From 5074d1199ba5050fb806c67b61ff1e4128f430f3 Mon Sep 17 00:00:00 2001 From: Henri-Damien LAURENT Date: Tue, 6 May 2008 17:27:32 +0200 Subject: [PATCH] bug Fixing 2081 Editing authorisedvalue now checks if OTHER value has the same authorised_value before storing id is now passed to the form so that it is used when editing authorised_value when imageurl it is passed as '' not empty parameter Signed-off-by: Joshua Ferraro --- admin/authorised_values.pl | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/admin/authorised_values.pl b/admin/authorised_values.pl index 42291b8e80..0a672a66fd 100755 --- a/admin/authorised_values.pl +++ b/admin/authorised_values.pl @@ -109,6 +109,7 @@ if ($op eq 'add_form') { my $dbh = C4::Context->dbh; my $new_category = $input->param('category'); my $new_authorised_value = $input->param('authorised_value'); + my $imageurl=$input->param( 'imageurl' )|''; my $duplicate_entry = 0; if ( $id ) { # Update @@ -118,7 +119,7 @@ if ($op eq 'add_form') { $sth->finish; if ( $authorised_value ne $new_authorised_value ) { my $sth = $dbh->prepare_cached( "SELECT COUNT(*) FROM authorised_values " . - "WHERE category = '$new_category' AND authorised_value = '$new_authorised_value' "); + "WHERE category = '$new_category' AND authorised_value = '$new_authorised_value' and id<>$id"); $sth->execute(); ($duplicate_entry) = $sth->fetchrow_array(); warn "**** duplicate_entry = $duplicate_entry"; @@ -132,7 +133,7 @@ if ($op eq 'add_form') { WHERE id=?' ); my $lib = $input->param('lib'); undef $lib if ($lib eq ""); # to insert NULL instead of a blank string - $sth->execute($new_category, $new_authorised_value, $lib, $input->param( 'imageurl' ), $id); + $sth->execute($new_category, $new_authorised_value, $lib, $imageurl, $id); print "Content-Type: text/html\n\n"; exit; } @@ -149,7 +150,7 @@ if ($op eq 'add_form') { values (?, ?, ?, ?, ?)' ); my $lib = $input->param('lib'); undef $lib if ($lib eq ""); # to insert NULL instead of a blank string - $sth->execute($id, $new_category, $new_authorised_value, $lib, $input->param( 'imageurl' ) ); + $sth->execute($id, $new_category, $new_authorised_value, $lib, $imageurl ); $sth->finish; print "Content-Type: text/html\n\nparam('category')."\">"; exit; -- 2.39.5