koha-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Koha-cvs] koha admin/categorie.pl koha-tmpl/intranet-tmpl...


From: paul poulain
Subject: [Koha-cvs] koha admin/categorie.pl koha-tmpl/intranet-tmpl...
Date: Tue, 03 Jul 2007 08:48:14 +0000

CVSROOT:        /sources/koha
Module name:    koha
Changes by:     paul poulain <tipaul>   07/07/03 08:48:14

Modified files:
        admin          : categorie.pl 
        koha-tmpl/intranet-tmpl/prog/en/admin: categorie.tmpl 

Log message:
        do not use REPLACE in SQL statements : it is not standard SQL, and 
don't work with integrity contraints : it's a delete/insert, not an UPDATE if 
the row exist. fixes the problem for borrower categories

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/admin/categorie.pl?cvsroot=koha&r1=1.27&r2=1.28
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/intranet-tmpl/prog/en/admin/categorie.tmpl?cvsroot=koha&r1=1.6&r2=1.7

Patches:
Index: admin/categorie.pl
===================================================================
RCS file: /sources/koha/koha/admin/categorie.pl,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -b -r1.27 -r1.28
--- admin/categorie.pl  24 Apr 2007 13:54:28 -0000      1.27
+++ admin/categorie.pl  3 Jul 2007 08:48:14 -0000       1.28
@@ -111,10 +111,17 @@
 # called by add_form, used to insert/modify data in DB
 } elsif ($op eq 'add_validate') {
        $template->param(add_validate => 1);
+       my $is_a_modif = $input->param("is_a_modif");
        my $dbh = C4::Context->dbh;
-       my $sth=$dbh->prepare("replace categories 
(categorycode,description,enrolmentperiod,upperagelimit,dateofbirthrequired,enrolmentfee,reservefee,overduenoticerequired,category_type)
 values (?,?,?,?,?,?,?,?,?)");
+       if ($is_a_modif) {
+            my $sth=$dbh->prepare("UPDATE categories SET 
description=?,enrolmentperiod=?,upperagelimit=?,dateofbirthrequired=?,enrolmentfee=?,reservefee=?,overduenoticerequired=?,category_type=?
 WHERE categorycode=?");
+            $sth->execute(map { $input->param($_) } 
('description','enrolmentperiod','upperagelimit','dateofbirthrequired','enrolmentfee','reservefee','overduenoticerequired','category_type','categorycode'));
+            $sth->finish;
+        } else {
+            my $sth=$dbh->prepare("INSERT INTO categories  
(categorycode,description,enrolmentperiod,upperagelimit,dateofbirthrequired,enrolmentfee,reservefee,overduenoticerequired,category_type)
 values (?,?,?,?,?,?,?,?,?)");
        $sth->execute(map { $input->param($_) } 
('categorycode','description','enrolmentperiod','upperagelimit','dateofbirthrequired','enrolmentfee','reservefee','overduenoticerequired','category_type'));
        $sth->finish;
+        }
        print "Content-Type: text/html\n\n<META HTTP-EQUIV=Refresh CONTENT=\"0; 
URL=categorie.pl\"></html>";
        exit;
 
@@ -181,7 +188,6 @@
                                category_type => 
$results->[$i]{'category_type'},
                                "type_".$results->[$i]{'category_type'} => 1,
                                toggle => $toggle );
-                               warn "ICI".     $results->[$i]{'category_type'};
                push @loop, \%row;
                if ( $toggle eq 0 )
                {

Index: koha-tmpl/intranet-tmpl/prog/en/admin/categorie.tmpl
===================================================================
RCS file: 
/sources/koha/koha/koha-tmpl/intranet-tmpl/prog/en/admin/categorie.tmpl,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- koha-tmpl/intranet-tmpl/prog/en/admin/categorie.tmpl        11 Mar 2007 
21:08:12 -0000      1.6
+++ koha-tmpl/intranet-tmpl/prog/en/admin/categorie.tmpl        3 Jul 2007 
08:48:14 -0000       1.7
@@ -87,7 +87,7 @@
        <table>
        <!-- TMPL_IF NAME="categorycode" -->
        <tr><th>Category code</th><td><!-- TMPL_VAR NAME="categorycode" -->
-                               <input type="hidden" name="categorycode" 
value="<!-- TMPL_VAR NAME="categorycode" -->" /></td></tr>
+                               <input type="hidden" name="categorycode" 
value="<!-- TMPL_VAR NAME="categorycode" -->" /><input type="hidden" 
name="is_a_modif" value="1" /></td></tr>
        <!-- TMPL_ELSE -->
        <tr><th>Category code</th><td><input type="text" name="categorycode" 
size="10" maxlength="10" onblur="toUC(this)" /></td></tr>
        <!-- /TMPL_IF -->




reply via email to

[Prev in Thread] Current Thread [Next in Thread]