X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=admin%2Fbiblio_framework.pl;h=77dc7971af963365bd711c935b372c830e1c916f;hb=e1bc643436b64abde9f89fc2bb41a371826364b0;hp=4542a86fbb3a899750863914685dae4dd1254bcc;hpb=f8e9fb6445dadbdef91e13a253c9c6bcb75e0eec;p=koha.git diff --git a/admin/biblio_framework.pl b/admin/biblio_framework.pl index 4542a86fbb..77dc7971af 100755 --- a/admin/biblio_framework.pl +++ b/admin/biblio_framework.pl @@ -24,13 +24,12 @@ use strict; use CGI; use C4::Context; -use C4::Output; use C4::Auth; -use C4::Interface::CGI::Output; +use C4::Output; sub StringSearch { - my ($env,$searchstring,$type)=@_; + my ($searchstring,$type)=@_; my $dbh = C4::Context->dbh; $searchstring=~ s/\'/\\\'/g; my @data=split(' ',$searchstring); @@ -96,9 +95,17 @@ 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 biblio_framework (frameworkcode,frameworktext) values (?,?)"); - $sth->execute($input->param('frameworkcode'),$input->param('frameworktext')); - $sth->finish; + if($input->param('frameworktext') and $input->param('frameworkcode')){ + 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"; exit; # END $OP eq ADD_VALIDATE @@ -131,21 +138,23 @@ if ($op eq 'add_form') { } elsif ($op eq 'delete_confirmed') { #start the page and read in includes my $dbh = C4::Context->dbh; - my $frameworkcode=uc($input->param('frameworkcode')); - my $sth=$dbh->prepare("delete from marc_tag_structure where frameworkcode=?"); - $sth->execute($frameworkcode); - $sth=$dbh->prepare("delete from marc_subfield_structure where frameworkcode=?"); - $sth->execute($frameworkcode); - $sth=$dbh->prepare("delete from biblio_framework where frameworkcode=?"); - $sth->execute($frameworkcode); - $sth->finish; +# my $frameworkcode=uc($input->param('frameworkcode')); +# + if($frameworkcode) { + my $sth=$dbh->prepare("delete from marc_tag_structure where frameworkcode=?"); + $sth->execute($frameworkcode); + $sth=$dbh->prepare("delete from marc_subfield_structure where frameworkcode=?"); + $sth->execute($frameworkcode); + $sth=$dbh->prepare("delete from biblio_framework where frameworkcode=?"); + $sth->execute($frameworkcode); + $sth->finish; + } print "Content-Type: text/html\n\n"; exit; # END $OP eq DELETE_CONFIRMED ################## DEFAULT ################################## } else { # DEFAULT - my $env; - my ($count,$results)=StringSearch($env,$searchfield,'web'); + my ($count,$results)=StringSearch($searchfield,'web'); my $toggle="white"; my @loop_data; for (my $i=$offset; $i < ($offset+$pagesize<$count?$offset+$pagesize:$count); $i++){ @@ -169,10 +178,6 @@ if ($op eq 'add_form') { $template->param(next => "$script_name?offset=".$nextpage); } } #---- END $OP eq DEFAULT -$template->param(intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"), - intranetstylesheet => C4::Context->preference("intranetstylesheet"), - IntranetNav => C4::Context->preference("IntranetNav"), - ); output_html_with_http_headers $input, $cookie, $template->output; # Local Variables: