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

Antoine Farnault antoine at koha-fr.org
Wed Nov 15 19:01:23 CET 2006


CVSROOT:	/sources/koha
Module name:	koha
Branch:		rel_3_0
Changes by:	Antoine Farnault <toins>	06/11/15 18:01:23

Modified files:
	C4/Circulation : Circ2.pm 

Log message:
	New function AnonymiseIssueHitory.

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.13&r2=1.114.2.14

Patches:
Index: Circ2.pm
===================================================================
RCS file: /sources/koha/koha/C4/Circulation/Circ2.pm,v
retrieving revision 1.114.2.13
retrieving revision 1.114.2.14
diff -u -b -r1.114.2.13 -r1.114.2.14
--- Circ2.pm	13 Nov 2006 11:07:26 -0000	1.114.2.13
+++ Circ2.pm	15 Nov 2006 18:01:22 -0000	1.114.2.14
@@ -3,7 +3,7 @@
 
 package C4::Circulation::Circ2;
 
-# $Id: Circ2.pm,v 1.114.2.13 2006/11/13 11:07:26 toins Exp $
+# $Id: Circ2.pm,v 1.114.2.14 2006/11/15 18:01:22 toins Exp $
 
 #package to deal with Returns
 #written 3/11/99 by olwen at katipo.co.nz
@@ -45,7 +45,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.13 $' =~ /\d+/g; shift(@v) . "." . join( "_", map { sprintf "%03d", $_ } @v ); };
+$VERSION = do { my @v = '$Revision: 1.114.2.14 $' =~ /\d+/g; shift(@v) . "." . join( "_", map { sprintf "%03d", $_ } @v ); };
 
 =head1 NAME
 
@@ -97,6 +97,7 @@
         &AddNotifyLine
         &RemoveNotifyLine
         &GetIssuesFromBiblio
+        &AnonymiseIssueHistory
         );
 # &GetBranches &getprinters &getbranch &getprinter => moved to C4::Koha.pm
 
@@ -2312,7 +2313,9 @@
 }
 
 =head2 RemoveNotifyLine
+
 Cancel a notification
+
 =cut
 
 sub RemoveNotifyLine {
@@ -2328,7 +2331,37 @@
         return 1;
 }
 
+=head 2 AnonymiseIssueHistory
+
+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>.
+
+return undef if there is no error.
+return the error message from DB if there is one.
+
+=cut
+
+sub AnonymiseIssueHistory {
+    my $borrowernumber = shift;
+    my $date = shift;
+    my $dbh = C4::Context->dbh;
+    my $query = "
+        UPDATE issues
+        SET    borrowernumber = NULL
+        WHERE  borrowernumber = ?
+    ";
+    $query .= " AND timestamp < '".$date."'" if $date;
+    my $sth = $dbh->prepare($query);
+    $sth->execute;
+    warn "query is=".$query;
+    return $sth->errstr if $sth->errstr;
+    return undef;
+}
+
 1;
+
 __END__
 
 =back





More information about the Koha-cvs mailing list