[Koha-cvs] koha/C4 Letters.pm [rel_3_0]

Antoine Farnault antoine at koha-fr.org
Fri Oct 20 16:59:17 CEST 2006


CVSROOT:	/sources/koha
Module name:	koha
Branch:		rel_3_0
Changes by:	Antoine Farnault <toins>	06/10/20 14:59:17

Modified files:
	C4             : Letters.pm 

Log message:
	fix an error in GetLetters parameter.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Letters.pm?cvsroot=koha&only_with_tag=rel_3_0&r1=1.4.2.2&r2=1.4.2.3

Patches:
Index: Letters.pm
===================================================================
RCS file: /sources/koha/koha/C4/Letters.pm,v
retrieving revision 1.4.2.2
retrieving revision 1.4.2.3
diff -u -b -r1.4.2.2 -r1.4.2.3
--- Letters.pm	28 Sep 2006 16:34:15 -0000	1.4.2.2
+++ Letters.pm	20 Oct 2006 14:59:17 -0000	1.4.2.3
@@ -84,20 +84,31 @@
 
 sub GetLetters {
 # returns a reference to a hash of references to ALL letters...
-    my $cat =@_;
+    my $cat = shift;
     my %letters;
     my $dbh = C4::Context->dbh;
+    $dbh->quote($cat);
     my $sth;
        if ($cat ne ""){
-        $sth = $dbh->prepare("Select * from letter where module = \'".$cat."\' order by name");
+        my $query = qq/
+            SELECT   *
+            FROM     letter
+            WHERE    module = ?
+            ORDER BY name
+        /;
+        $sth = $dbh->prepare($query);
+        $sth->execute($cat);
     } else {
-        $sth = $dbh->prepare("Select * from letter order by name");
-    }
+        my $query = qq/
+            SELECT   *
+            FROM     letter
+            ORDER BY name
+        /;
+        $sth = $dbh->prepare($query);
     $sth->execute;
-    my $count;
-    while (my $letter=$sth->fetchrow_hashref) {
+    }
+    while (my $letter=$sth->fetchrow_hashref){
             $letters{$letter->{'code'}}=$letter->{'name'};
-            $count++;
     }
     return \%letters;
 }





More information about the Koha-cvs mailing list