X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=admin%2Fmarctagstructure.pl;h=5a24794d9cb2a4bb73b353c8286c733102209a3d;hb=5d4613fde0be8e391c33eed549c3e8405ddf6644;hp=78cc6eb6b6130af449333a9426ef0b60bfbdc6ab;hpb=8b7085a8abd9226f5dbb3cb5b295e4bc9e4b9cba;p=koha.git diff --git a/admin/marctagstructure.pl b/admin/marctagstructure.pl index 78cc6eb6b6..5a24794d9c 100755 --- a/admin/marctagstructure.pl +++ b/admin/marctagstructure.pl @@ -123,9 +123,9 @@ if ($op eq 'add_form') { -default => $data->{'authorised_value'}, ); + $template->param(searchfield => $searchfield) if ($searchfield); if ($searchfield) { - $template->param(action => "Modify tag", - searchfield => $searchfield); + $template->param(action => "Modify tag"); $template->param('heading-modify-tag-p' => 1); } else { $template->param(action => "Add tag"); @@ -153,24 +153,39 @@ if ($op eq 'add_form') { ################## ADD_VALIDATE ################################## # called by add_form, used to insert/modify data in DB } elsif ($op eq 'add_validate') { - $sth=$dbh->prepare("replace marc_tag_structure (tagfield,liblibrarian,libopac,repeatable,mandatory,authorised_value,frameworkcode) values (?,?,?,?,?,?,?)"); my $tagfield =$input->param('tagfield'); my $liblibrarian = $input->param('liblibrarian'); my $libopac =$input->param('libopac'); my $repeatable =$input->param('repeatable'); my $mandatory =$input->param('mandatory'); my $authorised_value =$input->param('authorised_value'); - unless (C4::Context->config('demo') eq 1) { - $sth->execute($tagfield, - $liblibrarian, - $libopac, - $repeatable?1:0, - $mandatory?1:0, - $authorised_value, - $frameworkcode - ); + if ($input->param('modif')) { + $sth=$dbh->prepare("UPDATE marc_tag_structure SET liblibrarian=? ,libopac=? ,repeatable=? ,mandatory=? ,authorised_value=? WHERE frameworkcode=? AND tagfield=?"); + unless (C4::Context->config('demo') eq 1) { + $sth->execute( $liblibrarian, + $libopac, + $repeatable?1:0, + $mandatory?1:0, + $authorised_value, + $frameworkcode, + $tagfield + ); + } + $sth->finish; + } else { + $sth=$dbh->prepare("INSERT INTO marc_tag_structure (tagfield,liblibrarian,libopac,repeatable,mandatory,authorised_value,frameworkcode) values (?,?,?,?,?,?,?)"); + unless (C4::Context->config('demo') eq 1) { + $sth->execute($tagfield, + $liblibrarian, + $libopac, + $repeatable?1:0, + $mandatory?1:0, + $authorised_value, + $frameworkcode + ); + } + $sth->finish; } - $sth->finish; print "Content-Type: text/html\n\n"; exit; # END $OP eq ADD_VALIDATE