################## ADD_VALIDATE ##################################
# called by add_form, used to insert/modify data in DB
} elsif ($op eq 'add_validate') {
- $sth=$dbh->prepare("replace auth_tag_structure (tagfield,liblibrarian,libopac,repeatable,mandatory,authorised_value,authtypecode) 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,
- $authtypecode
- );
- }
- $sth->finish;
+ if ($input->param('modif')) {
+ $sth=$dbh->prepare("UPDATE auth_tag_structure SET tagfield=?, liblibrarian=?, libopac=?, repeatable=?, mandatory=?, authorised_value=? WHERE authtypecode=? AND tagfield=?");
+ 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(
+ $liblibrarian,
+ $libopac,
+ $repeatable?1:0,
+ $mandatory?1:0,
+ $authorised_value,
+ $authtypecode,
+ $tagfield,
+ );
+ }
+ $sth->finish;
+ } else {
+ $sth=$dbh->prepare("INSERT INTO auth_tag_structure (tagfield,liblibrarian,libopac,repeatable,mandatory,authorised_value,authtypecode) 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,
+ $authtypecode
+ );
+ }
+ $sth->finish;
+ }
print "Content-Type: text/html\n\n<META HTTP-EQUIV=Refresh CONTENT=\"0; URL=auth_tag_structure.pl?searchfield=$tagfield&authtypecode=$authtypecode\">";
exit;
# END $OP eq ADD_VALIDATE
# 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 biblio_framework (frameworkcode,frameworktext) values (?,?)");
- $sth->execute($input->param('frameworkcode'),$input->param('frameworktext'));
- $sth->finish;
+ if ($input->param('modif')) {
+ my $sth=$dbh->prepare("UPDATE biblio_framework SET frameworktext=? WHERE frameworkcode=?");
+ $sth->execute($input->param('frameworktext'),$input->param('frameworkcode'));
+ $sth->finish;
+ } else {
+ my $sth=$dbh->prepare("INSERT into biblio_framework (frameworkcode,frameworktext) values (?,?)");
+ $sth->execute($input->param('frameworkcode'),$input->param('frameworktext'));
+ $sth->finish;
+ }
print "Content-Type: text/html\n\n<META HTTP-EQUIV=Refresh CONTENT=\"0; URL=biblio_framework.pl\"></html>";
exit;
# END $OP eq ADD_VALIDATE
################## 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=?");
+ 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( $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 (?,?,?,?,?,?,?)");
+ 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
+ );
+ }
+ $sth->finish;
}
- $sth->finish;
print "Content-Type: text/html\n\n<META HTTP-EQUIV=Refresh CONTENT=\"0; URL=marctagstructure.pl?searchfield=$tagfield&frameworkcode=$frameworkcode\"></html>";
exit;
# END $OP eq ADD_VALIDATE
</h2>
<form action="<!-- TMPL_VAR NAME="script_name" -->" name="Aform" method="post">
<input type="hidden" name="op" value="add_validate" />
+ <!-- TMPL_IF NAME="heading-modify-tag-p" --><input type="hidden" name="modif" value="1" /><!-- /TMPL_IF -->
<input type="hidden" name="authtypecode" value="<!-- TMPL_VAR NAME="authtypecode" -->" />
<fieldset class="rows"><ol>
<li><span class="label">Tag</span><!-- TMPL_VAR NAME="searchfield" --></li>
<!-- /TMPL_IF -->
<!-- TMPL_IF NAME="authtypecode" -->
<tr><td><label for="authtypecode">Authority type<label></td><td><input type="hidden" name="op" value="add_validate" />
- <input type="hidden" name="checked" value="0" /><input type="hidden" name="authtypecode" value="<!-- TMPL_VAR NAME="authtypecode" -->" /><!-- TMPL_VAR NAME="authtypecode" --></td></tr>
+ <input type="hidden" name="modif" value="1" /><input type="hidden" name="authtypecode" value="<!-- TMPL_VAR NAME="authtypecode" -->" /><!-- TMPL_VAR NAME="authtypecode" --></td></tr>
<!-- TMPL_ELSE -->
<tr><td><label for="authtypecode">Authority type</label></td><td><input id="authtypecode" type="text" name="authtypecode" size="10" maxlength="10" onblur="toUC(this)" /></td></tr>
<!-- /TMPL_IF -->
<h1><!-- TMPL_IF NAME="frameworkcode" -->Modify framework text<!-- TMPL_ELSE -->Add framework<!-- /TMPL_IF --></h1>
<form action="<!-- TMPL_VAR NAME="script_name" -->" name="Aform" method="post">
<input type="hidden" name="op" value="add_validate" />
- <input type="hidden" name="checked" value="0" />
<fieldset class="rows"> <ol><!-- TMPL_IF NAME="frameworkcode" -->
<li><span class="label">Framework Code</span><input type="hidden" id="frameworkcode" name="frameworkcode" value="<!-- TMPL_VAR NAME="frameworkcode" -->" /><!-- TMPL_VAR NAME="frameworkcode" --></li>
+ <input type="hidden" name="modif" value=1" />
<!-- TMPL_ELSE -->
<li><label for="frameworkcode">Framework Code</label><input type="text" id="frameworkcode" name="frameworkcode" size="4" maxlength="4" onblur="toUC(this)" /></li>
<!-- /TMPL_IF -->
<form action="<!-- TMPL_VAR NAME="script_name" -->" name="Aform" method="post">
- <fieldset class="rows"><legend><!-- TMPL_IF NAME="use-heading-flags-p" --><!-- TMPL_IF NAME="heading-modify-tag-p" -->Modify tag <!-- TMPL_VAR NAME="searchfield" --><!-- /TMPL_IF --><!-- TMPL_IF NAME="heading-add-tag-p" -->Add tag<!-- /TMPL_IF --><!-- TMPL_ELSE --><!-- TMPL_VAR NAME="action" --><!-- /TMPL_IF --></legend> <input type="hidden" name="op" value="add_validate" />
+ <fieldset class="rows"><legend><!-- TMPL_IF NAME="use-heading-flags-p" --><!-- TMPL_IF NAME="heading-modify-tag-p" -->Modify tag <input type="hidden" name="modif" value="1" /><!-- TMPL_VAR NAME="searchfield" --><!-- /TMPL_IF --><!-- TMPL_IF NAME="heading-add-tag-p" -->Add tag<!-- /TMPL_IF --><!-- TMPL_ELSE --><!-- TMPL_VAR NAME="action" --><!-- /TMPL_IF --></legend> <input type="hidden" name="op" value="add_validate" />
<input type="hidden" name="frameworkcode" value="<!-- TMPL_VAR NAME="frameworkcode" -->" />
<ol> <li><label for="tagfield">Tag</label><input id="tagfield" type="text" name="tagfield" value="<!-- TMPL_VAR NAME="searchfield" -->" maxlength="3" size="3" /></li>