[Patches] [PATCH] Bug 7139 : Log addition and deletion of circulation messages

koha-patchbot at kohaaloha.com koha-patchbot at kohaaloha.com
Tue Dec 13 22:05:33 NZDT 2011


From: Chris Cormack <chrisc at catalyst.net.nz>
Date: Wed, 2 Nov 2011 14:43:45 +1300
Subject: [PATCH] Bug 7139 : Log addition and deletion of circulation messages
Content-Type: text/plain; charset="utf-8"

Signed-off-by: Marcel de Rooy <m.de.rooy at rijksmuseum.nl>
Changed the two action names into caps no-spaces.
---
 C4/Members.pm |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/C4/Members.pm b/C4/Members.pm
index 8bd7b47..1d7bc42 100644
--- a/C4/Members.pm
+++ b/C4/Members.pm
@@ -2126,7 +2126,7 @@ sub AddMessage {
     my $query = "INSERT INTO messages ( borrowernumber, branchcode, message_type, message ) VALUES ( ?, ?, ?, ? )";
     my $sth = $dbh->prepare($query);
     $sth->execute( $borrowernumber, $branchcode, $message_type, $message );
-
+    logaction("MEMBERS", "ADDCIRCMESSAGE", $borrowernumber, $message) if C4::Context->preference("BorrowersLog");
     return 1;
 }
 
@@ -2216,11 +2216,15 @@ sub DeleteMessage {
     my ( $message_id ) = @_;
 
     my $dbh = C4::Context->dbh;
-
-    my $query = "DELETE FROM messages WHERE message_id = ?";
+    my $query = "SELECT * FROM messages WHERE message_id = ?";
     my $sth = $dbh->prepare($query);
     $sth->execute( $message_id );
+    my $message = $sth->fetchrow_hashref();
 
+    $query = "DELETE FROM messages WHERE message_id = ?";
+    $sth = $dbh->prepare($query);
+    $sth->execute( $message_id );
+    logaction("MEMBERS", "DELCIRCMESSAGE", $message->{'borrowernumber'}, $message->{'message'}) if C4::Context->preference("BorrowersLog");
 }
 
 END { }    # module clean-up code here (global destructor)
-- 
1.6.0.6




More information about the Patches mailing list