From 9ca7060a872e972ccf77e589c28bf4ce6b72470a Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Mon, 24 Nov 2014 07:48:02 -0500 Subject: [PATCH] Bug 10363 [QA Followup] --- Koha/AuthorisedValues.pm | 2 +- admin/authorised_values.pl | 8 +++++--- installer/data/mysql/updatedatabase.pl | 1 - 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Koha/AuthorisedValues.pm b/Koha/AuthorisedValues.pm index ec201c3..55c7266 100644 --- a/Koha/AuthorisedValues.pm +++ b/Koha/AuthorisedValues.pm @@ -63,7 +63,7 @@ sub search { ->search( { %$params, %$or, }, $join ); my $class = ref($self); - return wantarray ? $self->_wrap( $rs->all() ) : $class->new_from_dbic($rs); + return wantarray ? $self->_wrap( $rs->all() ) : $class->_new_from_dbic($rs); } sub categories { diff --git a/admin/authorised_values.pl b/admin/authorised_values.pl index 4fc66c9..d7c03bc 100755 --- a/admin/authorised_values.pl +++ b/admin/authorised_values.pl @@ -101,7 +101,7 @@ if ($op eq 'add_form') { my $imageurl = $input->param( 'imageurl' ) || ''; $imageurl = '' if $imageurl =~ /removeImage/; my $duplicate_entry = 0; - my @branches = $input->param('branches'); + my @branches = grep { $_ ne q{} } $input->param('branches'); if ( $id ) { # Update my $av = Koha::AuthorisedValues->new->find( $id ); @@ -113,7 +113,7 @@ if ($op eq 'add_form') { $av->imageurl( $imageurl ); eval{ $av->store; - $av->branch_limitations( \@branches ); + $av->replace_branch_limitations( \@branches ); }; if ( $@ ) { push @messages, {type => 'error', code => 'error_on_update' }; @@ -129,10 +129,12 @@ if ($op eq 'add_form') { lib_opac => $input->param('lib_opac') || undef, imageurl => $imageurl, } ); + eval { $av->store; - $av->branch_limitations( \@branches ); + $av->replace_branch_limitations( \@branches ); }; + if ( $@ ) { push @messages, {type => 'error', code => 'error_on_insert' }; } else { diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index afeb32f..14b22ff 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -9543,7 +9543,6 @@ if ( CheckVersion($DBversion) ) { }); print "Upgrade to $DBversion done ( Bug 10363 - There is no package for authorised values. )\n"; SetVersion($DBversion); - SetVersion ($DBversion); } =head1 FUNCTIONS -- 1.7.2.5