From 9123905d5de5bca064d07d57b608ccabc3a76f46 Mon Sep 17 00:00:00 2001 From: tipaul Date: Tue, 10 Dec 2002 13:29:32 +0000 Subject: [PATCH] many bugfixes from Dombes Abbey tests --- admin/authorised_values.pl | 13 +++++++------ admin/marc_subfields_structure.pl | 2 +- admin/thesaurus.pl | 12 +++++------- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/admin/authorised_values.pl b/admin/authorised_values.pl index 528c92fee0..baaa41ad85 100755 --- a/admin/authorised_values.pl +++ b/admin/authorised_values.pl @@ -32,7 +32,7 @@ sub StringSearch { $searchstring=~ s/\'/\\\'/g; my @data=split(' ',$searchstring); my $count=@data; - my $query="Select id,category,authorised_value from authorised_values where (category like \"$data[0]%\") order by category,authorised_value"; + my $query="Select id,category,authorised_value,lib from authorised_values where (category like \"$data[0]%\") order by category,authorised_value"; my $sth=$dbh->prepare($query); $sth->execute; my @results; @@ -49,7 +49,7 @@ my $input = new CGI; my $searchfield=$input->param('searchfield'); $searchfield=~ s/\,//g; my $id = $input->param('id'); -my $reqsel="select category,authorised_value from authorised_values where id='$id'"; +my $reqsel="select category,authorised_value,lib from authorised_values where id='$id'"; my $reqdel="delete from authorised_values where id='$id'"; my $offset=$input->param('offset'); my $script_name="/cgi-bin/koha/admin/authorised_values.pl"; @@ -72,7 +72,7 @@ if ($op eq 'add_form') { my $data; if ($id) { my $dbh = C4::Context->dbh; - my $sth=$dbh->prepare("select id,category,authorised_value from authorised_values where id='$id'"); + my $sth=$dbh->prepare("select id,category,authorised_value,lib from authorised_values where id='$id'"); $sth->execute; $data=$sth->fetchrow_hashref; $sth->finish; @@ -86,6 +86,7 @@ if ($op eq 'add_form') { } $template->param(category => $data->{'category'}, authorised_value => $data->{'authorised_value'}, + lib => $data->{'lib'}, id => $data->{'id'} ); if ($data->{'category'}) { @@ -97,9 +98,8 @@ if ($op eq 'add_form') { # called by add_form, used to insert/modify data in DB } elsif ($op eq 'add_validate') { my $dbh = C4::Context->dbh; - my $sth=$dbh->prepare("replace authorised_values (id,category,authorised_value) values (?,?,?)"); - warn "TOTO : ".$input->param('id'), $input->param('category'), $input->param('authorised_value'); - $sth->execute($input->param('id'), $input->param('category'), $input->param('authorised_value')); + my $sth=$dbh->prepare("replace authorised_values (id,category,authorised_value,lib) values (?,?,?,?)"); + $sth->execute($input->param('id'), $input->param('category'), $input->param('authorised_value'),$input->param('lib')); $sth->finish; print "Content-Type: text/html\n\nparam('category')."\">"; exit; @@ -161,6 +161,7 @@ if ($op eq 'add_form') { my %row_data; # get a fresh hash for the row data $row_data{category} = $results->[$i]{'category'}; $row_data{authorised_value} = $results->[$i]{'authorised_value'}; + $row_data{lib} = $results->[$i]{'lib'}; $row_data{edit} = "$script_name?op=add_form&id=".$results->[$i]{'id'}; $row_data{delete} = "$script_name?op=delete_confirm&searchfield=$searchfield&id=".$results->[$i]{'id'}; push(@loop_data, \%row_data); diff --git a/admin/marc_subfields_structure.pl b/admin/marc_subfields_structure.pl index 59970a4f1b..39c412921e 100755 --- a/admin/marc_subfields_structure.pl +++ b/admin/marc_subfields_structure.pl @@ -166,7 +166,7 @@ if ($op eq 'add_form') { ); $row_data{value_builder} = CGI::scrolling_list(-name=>'value_builder', -values=> \@value_builder, - -default=>$data->{'thesaurus_category'}, + -default=>$data->{'value_builder'}, -size=>1, -multiple=>0, ); diff --git a/admin/thesaurus.pl b/admin/thesaurus.pl index 0bfbef9235..c16ad144b5 100755 --- a/admin/thesaurus.pl +++ b/admin/thesaurus.pl @@ -73,9 +73,9 @@ if ($op eq 'add_form') { $data->{'stdlib'} = $input->param('stdlib'); } if ($search_category) { - $template->param(action => "Modify authorised value"); + $template->param(action => "Modify thesaurus"); } else { - $template->param(action => "Add authorised value"); + $template->param(action => "Add thesaurus"); } $template->param(category => $data->{'category'}, stdlib => $data->{'stdlib'}, @@ -97,7 +97,9 @@ if ($op eq 'add_form') { # called by add_form, used to insert/modify data in DB } elsif ($op eq 'add_validate') { my $dbh = C4::Context->dbh; - newauthority($dbh,$input->param('category'),$input->param('stdlib'), $input->param('freelib'),'',1,''); + my $freelib = $input->param('freelib'); + $freelib = $input->param('stdlib') unless ($input->param('freelib')); + newauthority($dbh,$input->param('category'),$input->param('father')." ".$input->param('stdlib'), $freelib,'',1,''); print "Content-Type: text/html\n\n"; exit; ################## DELETE_CONFIRM ################################## @@ -117,10 +119,6 @@ if ($op eq 'add_form') { ################## DELETE_CONFIRMED ################################## # called by delete_confirm, used to effectively confirm deletion of data in DB } elsif ($op eq 'delete_confirmed') { -# my $dbh = C4::Context->dbh; -# my $sth=$dbh->prepare($reqdel); -# $sth->execute; -# $sth->finish; &delauthority($id); print "Content-Type: text/html\n\n"; exit; -- 2.39.5