Adding release notes 3.0.6
[koha.git] / admin / biblio_framework.pl
index 97d364b..77dc797 100755 (executable)
@@ -95,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<META HTTP-EQUIV=Refresh CONTENT=\"0; URL=biblio_framework.pl\"></html>";
        exit;
                                                                                                        # END $OP eq ADD_VALIDATE
@@ -130,14 +138,17 @@ 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<META HTTP-EQUIV=Refresh CONTENT=\"0; URL=biblio_framework.pl\"></html>";
        exit;
                                                                                                        # END $OP eq DELETE_CONFIRMED
@@ -167,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: