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

Antoine Farnault antoine at koha-fr.org
Tue Nov 14 15:49:59 CET 2006


CVSROOT:	/sources/koha
Module name:	koha
Branch:		rel_3_0
Changes by:	Antoine Farnault <toins>	06/11/14 14:49:59

Modified files:
	C4             : Suggestions.pm 

Log message:
	* upate sql query to work with the new attribute 'reason'.
	* fix some POD error.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Suggestions.pm?cvsroot=koha&only_with_tag=rel_3_0&r1=1.12&r2=1.12.2.1

Patches:
Index: Suggestions.pm
===================================================================
RCS file: /sources/koha/koha/C4/Suggestions.pm,v
retrieving revision 1.12
retrieving revision 1.12.2.1
diff -u -b -r1.12 -r1.12.2.1
--- Suggestions.pm	12 Jul 2006 08:15:46 -0000	1.12
+++ Suggestions.pm	14 Nov 2006 14:49:59 -0000	1.12.2.1
@@ -17,7 +17,7 @@
 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
 # Suite 330, Boston, MA  02111-1307 USA
 
-# $Id: Suggestions.pm,v 1.12 2006/07/12 08:15:46 toins Exp $
+# $Id: Suggestions.pm,v 1.12.2.1 2006/11/14 14:49:59 toins Exp $
 
 use strict;
 require Exporter;
@@ -28,7 +28,7 @@
 use vars qw($VERSION @ISA @EXPORT);
 
 # set the version for version checking
-$VERSION = do { my @v = '$Revision: 1.12 $' =~ /\d+/g;
+$VERSION = do { my @v = '$Revision: 1.12.2.1 $' =~ /\d+/g;
   shift(@v) . "." . join("_", map {sprintf "%03d", $_ } @v); };
 
 =head1 NAME
@@ -172,6 +172,7 @@
 =back
 
 =cut
+
 sub GetSuggestion {
     my ($suggestionid) = @_;
     my $dbh = C4::Context->dbh;
@@ -199,6 +200,7 @@
 =back
 
 =cut
+
 sub GetSuggestionFromBiblionumber {
     my ($dbh,$biblionumber) = @_;
     my $query = qq|
@@ -244,6 +246,7 @@
 =back
 
 =cut
+
 sub CountSuggestion {
     my ($status) = @_;
     my $dbh = C4::Context->dbh;
@@ -296,17 +299,18 @@
 =back
 
 =cut
+
 sub NewSuggestion {
-    my ($borrowernumber,$title,$author,$publishercode,$note,$copyrightdate,$volumedesc,$publicationyear,$place,$isbn,$biblionumber) = @_;
+    my ($borrowernumber,$title,$author,$publishercode,$note,$copyrightdate,$volumedesc,$publicationyear,$place,$isbn,$biblionumber,$reason) = @_;
     my $dbh = C4::Context->dbh;
     my $query = qq |
         INSERT INTO suggestions
             (status,suggestedby,title,author,publishercode,note,copyrightdate,
-            volumedesc,publicationyear,place,isbn,biblionumber)
-        VALUES ('ASKED',?,?,?,?,?,?,?,?,?,?,?)
+            volumedesc,publicationyear,place,isbn,biblionumber,reason)
+        VALUES ('ASKED',?,?,?,?,?,?,?,?,?,?,?,?)
     |;
     my $sth = $dbh->prepare($query);
-    $sth->execute($borrowernumber,$title,$author,$publishercode,$note,$copyrightdate,$volumedesc,$publicationyear,$place,$isbn,$biblionumber);
+    $sth->execute($borrowernumber,$title,$author,$publishercode,$note,$copyrightdate,$volumedesc,$publicationyear,$place,$isbn,$biblionumber,$reason);
 }
 
 =head2 ModStatus
@@ -323,50 +327,51 @@
 =back
 
 =cut
+
 sub ModStatus {
-    my ($suggestionid,$status,$managedby,$biblionumber) = @_;
+    my ($suggestionid,$status,$managedby,$biblionumber,$reason) = @_;
     my $dbh = C4::Context->dbh;
     my $sth;
     if ($managedby>0) {
         if ($biblionumber) {
         my $query = qq|
             UPDATE suggestions
-            SET    status=?,managedby=?,biblionumber=?
+            SET    status=?,managedby=?,biblionumber=?,reason=?
             WHERE  suggestionid=?
         |;
         $sth = $dbh->prepare($query);
-        $sth->execute($status,$managedby,$biblionumber,$suggestionid);
+        $sth->execute($status,$managedby,$biblionumber,$reason,$suggestionid);
         } else {
             my $query = qq|
                 UPDATE suggestions
-                SET    status=?,managedby=?
+                SET    status=?,managedby=?,reason=?
                 WHERE  suggestionid=?
             |;
             $sth = $dbh->prepare($query);
-            $sth->execute($status,$managedby,$suggestionid);
+            $sth->execute($status,$managedby,$reason,$suggestionid);
         }
    } else {
         if ($biblionumber) {
             my $query = qq|
                 UPDATE suggestions
-                SET    status=?,biblionumber=?
+                SET    status=?,biblionumber=?,reason=?
                 WHERE  suggestionid=?
             |;
             $sth = $dbh->prepare($query);
-            $sth->execute($status,$biblionumber,$suggestionid);
+            $sth->execute($status,$biblionumber,$reason,$suggestionid);
         }
         else {
             my $query = qq|
                 UPDATE suggestions
-                SET    status=?
+                SET    status=?,reason=?
                 WHERE  suggestionid=?
             |;
             $sth = $dbh->prepare($query);
-            $sth->execute($status,$suggestionid);
+            $sth->execute($status,$reason,$suggestionid);
         }
     }
     # check mail sending.
-    my $queryMail = qq|
+    my $queryMail = "
         SELECT suggestions.*,
             boby.surname AS bysurname,
             boby.firstname AS byfirstname,
@@ -378,7 +383,7 @@
             LEFT JOIN borrowers AS boby ON boby.borrowernumber=suggestedby
             LEFT JOIN borrowers AS lib ON lib.borrowernumber=managedby
         WHERE suggestionid=?
-    |;
+    ";
     $sth = $dbh->prepare($queryMail);
     $sth->execute($suggestionid);
     my $emailinfo = $sth->fetchrow_hashref;
@@ -394,6 +399,7 @@
         libfirstname => $emailinfo->{libfirstname},
         byfirstname => $emailinfo->{byfirstname},
         bysurname => $emailinfo->{bysurname},
+        reason => $emailinfo->{reason}
     );
     my %mail = (
         To => $emailinfo->{byemail},
@@ -407,6 +413,7 @@
 =head2 ConnectSuggestionAndBiblio
 
 =over 4
+
 &ConnectSuggestionAndBiblio($suggestionid,$biblionumber)
 
 connect a suggestion to an existing biblio
@@ -414,14 +421,15 @@
 =back
 
 =cut
+
 sub ConnectSuggestionAndBiblio {
     my ($suggestionid,$biblionumber) = @_;
     my $dbh=C4::Context->dbh;
-    my $query = qq |
+    my $query = "
         UPDATE suggestions
         SET    biblionumber=?
         WHERE  suggestionid=?
-    |;
+    ";
     my $sth = $dbh->prepare($query);
     $sth->execute($biblionumber,$suggestionid);
 }
@@ -442,20 +450,32 @@
     my ($borrowernumber,$suggestionid) = @_;
     my $dbh = C4::Context->dbh;
     # check that the suggestion comes from the suggestor
-    my $query = qq |
+    my $query = "
         SELECT suggestedby
         FROM   suggestions
         WHERE  suggestionid=?
-    |;
+    ";
     my $sth = $dbh->prepare($query);
     $sth->execute($suggestionid);
     my ($suggestedby) = $sth->fetchrow;
     if ($suggestedby eq $borrowernumber) {
-        my $queryDelete = qq|
+        my $queryDelete = "
             DELETE FROM suggestions
             WHERE suggestionid=?
-        |;
+        ";
         $sth = $dbh->prepare($queryDelete);
         $sth->execute($suggestionid);
     }
 }
\ No newline at end of file
+
+1;
+__END__
+
+=back
+
+=head1 AUTHOR
+
+Koha Developement team <info at koha.org>
+
+=cut
+





More information about the Koha-cvs mailing list