[Koha-cvs] koha/C4/Circulation Circ2.pm [rel_3_0]

Antoine Farnault antoine at koha-fr.org
Mon Nov 27 15:53:30 CET 2006


CVSROOT:	/sources/koha
Module name:	koha
Branch:		rel_3_0
Changes by:	Antoine Farnault <toins>	06/11/27 14:53:30

Modified files:
	C4/Circulation : Circ2.pm 

Log message:
	some change on AnonymiseIssueHistory function.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Circulation/Circ2.pm?cvsroot=koha&only_with_tag=rel_3_0&r1=1.114.2.17&r2=1.114.2.18

Patches:
Index: Circ2.pm
===================================================================
RCS file: /sources/koha/koha/C4/Circulation/Circ2.pm,v
retrieving revision 1.114.2.17
retrieving revision 1.114.2.18
diff -u -b -r1.114.2.17 -r1.114.2.18
--- Circ2.pm	27 Nov 2006 10:25:52 -0000	1.114.2.17
+++ Circ2.pm	27 Nov 2006 14:53:29 -0000	1.114.2.18
@@ -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: Circ2.pm,v 1.114.2.17 2006/11/27 10:25:52 toins Exp $
+# $Id: Circ2.pm,v 1.114.2.18 2006/11/27 14:53:29 toins Exp $
 
 use strict;
 require Exporter;
@@ -38,7 +38,7 @@
 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
 
 # set the version for version checking
-$VERSION = do { my @v = '$Revision: 1.114.2.17 $' =~ /\d+/g; shift(@v).".".join( "_", map { sprintf "%03d", $_ } @v ); };
+$VERSION = do { my @v = '$Revision: 1.114.2.18 $' =~ /\d+/g; shift(@v).".".join( "_", map { sprintf "%03d", $_ } @v ); };
 
 =head1 NAME
 
@@ -2894,30 +2894,28 @@
 
 =head2 AnonymiseIssueHistory
 
-AnonymiseIssueHistory($borrowernumber,$date)
+$rows = AnonymiseIssueHistory($borrowernumber,$date)
 
 This function write NULL instead of C<$borrowernumber> given on input arg into the table issues.
-if C<$date> is not set, the it will delete all the issue history for C<$borrowernumber>.
+if C<$borrowernumber> is not set, it will delete the issue history for all borrower older than C<$date>.
 
-return undef if there is no error.
-return the error message from DB if there is one.
+return the number of affected rows.
 
 =cut
 
 sub AnonymiseIssueHistory {
-    my $borrowernumber = shift;
     my $date           = shift;
+    my $borrowernumber = shift;
     my $dbh            = C4::Context->dbh;
     my $query          = "
         UPDATE issues
         SET    borrowernumber = NULL
-        WHERE  borrowernumber = ?
+        WHERE  returndate < '".$date."'
+          AND borrowernumber IS NOT NULL
     ";
-    $query .= " AND timestamp < '".$date."'" if $date;
-    my $sth = $dbh->prepare($query);
-    $sth->execute($borrowernumber);
-    return $sth->errstr if $sth->errstr;
-    return undef;
+    $query .= " AND borrowernumber = '".$borrowernumber."'" if defined $borrowernumber;
+    my $rows_affected = $dbh->do($query);
+    return $rows_affected;
 }
 
 1;





More information about the Koha-cvs mailing list