From 76fcf07de8583717c3dee17a501d47321ab760ce Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 27 Sep 2016 09:24:57 +0100 Subject: [PATCH] Bug 17216: Internal AV should be correctly handled when creating a new category --- admin/authorised_values.pl | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/admin/authorised_values.pl b/admin/authorised_values.pl index 5aecc3c..bb94e23 100755 --- a/admin/authorised_values.pl +++ b/admin/authorised_values.pl @@ -167,7 +167,11 @@ if ($op eq 'add_form') { ); if ( $already_exists ) { - push @messages, {type => 'error', code => 'cat_already_exists' }; + if ( $new_category eq 'branches' or $new_category eq 'itemtypes' or $new_category eq 'cn_source' ) { + push @messages, {type => 'error', code => 'invalid_category_name' }; + } else { + push @messages, {type => 'error', code => 'cat_already_exists' }; + } } else { # Insert my $av = Koha::AuthorisedValueCategory->new( { @@ -182,11 +186,11 @@ if ($op eq 'add_form') { push @messages, {type => 'error', code => 'error_on_insert_cat' }; } else { push @messages, { type => 'message', code => 'success_on_insert_cat' }; + $searchfield = $new_category; } } $op = 'list'; - $searchfield = $new_category; } elsif ($op eq 'delete') { my $av = Koha::AuthorisedValues->new->find( $input->param('id') ); my $deleted = eval {$av->delete}; -- 2.8.1