From 60403419ed1acf76af87eecb274b9beb7490ada7 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 22 Apr 2015 13:45:44 +0200 Subject: [PATCH] Bug 10947: Fix editing the default authority type MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The default authority type cannot be defined. The authtypecode is en empty string and the tests should be done on "defined", not "exist". Test plan: Edit the default authority type, save it. Note: There is no way to create an authority with an empty string, with you deleted you won't be able to recreate it. Followed test plan, works as expected. Signed-off-by: Marc Véron Signed-off-by: Katrin Fischer Signed-off-by: Tomas Cohen Arazi --- admin/authtypes.pl | 6 ++---- .../intranet-tmpl/prog/en/modules/admin/authtypes.tt | 10 +++++----- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/admin/authtypes.pl b/admin/authtypes.pl index f22ad7cc92..23e9d29568 100755 --- a/admin/authtypes.pl +++ b/admin/authtypes.pl @@ -1,7 +1,6 @@ #!/usr/bin/perl # written 20/02/2002 by paul.poulain@free.fr -# This software is placed under the gnu General Public License, v2 (http://www.gnu.org/licenses/gpl.html) # Copyright 2000-2002 Katipo Communications # @@ -20,8 +19,7 @@ # You should have received a copy of the GNU General Public License # along with Koha; if not, see . -use strict; -use warnings; +use Modern::Perl; use CGI qw ( -utf8 ); use C4::Context; use C4::Auth; @@ -61,7 +59,7 @@ my $dbh = C4::Context->dbh; # called by default. Used to create form to add or modify a record if ($op eq 'add_form') { #---- if primkey exists, it's a modify action, so read values to modify... - if ($authtypecode) { + if ( defined $authtypecode) { my $sth = $dbh->prepare("SELECT * FROM auth_types WHERE authtypecode=?"); $sth->execute($authtypecode); my $data = $sth->fetchrow_hashref(); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authtypes.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authtypes.tt index 9c62d48313..3fbc439686 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authtypes.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authtypes.tt @@ -1,7 +1,7 @@ [% INCLUDE 'doc-head-open.inc' %] Koha › Administration › Authority types [% IF ( add_form ) %] -› [% IF ( authtypecode ) %]Modify authority type[% ELSE %]New authority type[% END %] +› [% IF authtypecode.defined %]Modify authority type[% ELSE %]New authority type[% END %] [% ELSIF ( delete_confirm ) %] › Confirm deletion of authority type [% END %] @@ -32,7 +32,7 @@ › <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> › <a href="[% script_name %]">Authority types</a> [% IF ( add_form ) %] -› [% IF ( authtypecode ) %]Modify[% ELSE %]New[% END %] Authority type +› [% IF authtypecode.defined %]Modify[% ELSE %]New[% END %] Authority type [% ELSIF ( delete_confirm ) %] › Confirm deletion of authority type [% END %] @@ -48,7 +48,7 @@ <form action="[% script_name %]" name="Aform" method="post" class="validated"> <fieldset class="rows"> <legend> - [% IF ( authtypecode ) %] + [% IF authtypecode.defined %] Modify authority type [% ELSE %] New authority type @@ -56,7 +56,7 @@ </legend> <ol> <li> - [% IF ( authtypecode ) %] + [% IF authtypecode.defined %] <span class="label">Authority type</span> <input type="hidden" name="op" value="add_validate" /> <input type="hidden" name="checked" value="0" /> @@ -76,7 +76,7 @@ <p class="tip">Note: for 'Authority field to copy', enter the authority field that should be copied from the authority record to the bibliographic record. E.g., in MARC21, field 100 in the authority record should be copied to field 100 in the bibliographic record</p> <label for="auth_tag_to_report">Authority field to copy: </label><input type="text" id="auth_tag_to_report" name="auth_tag_to_report" size="5" maxlength="3" value="[% auth_tag_to_report %]" /> <input type="hidden" name="op" value="add_validate" /> - [% IF ( authtypecode ) %] + [% IF authtypecode.defined %] <input type="hidden" name="modif" value="1" /> [% END %] </li> -- 2.39.5