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

koha-patchbot at kohaaloha.com koha-patchbot at kohaaloha.com
Fri Nov 4 21:00:03 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

Signed-off-by: Brendan <brendan at bywatersolutions.com>
---
 C4/Members.pm |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/C4/Members.pm b/C4/Members.pm
index 56718f0..09cf47b 100644
--- a/C4/Members.pm
+++ b/C4/Members.pm
@@ -2146,7 +2146,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", "Add Circulation Message", $borrowernumber, $message) if C4::Context->preference("BorrowersLog");
     return 1;
 }
 
@@ -2236,11 +2236,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", "Remove Circulation Message", $message->{'borrowernumber'}, $message->{'message'}) if C4::Context->preference("BorrowersLog");
 }
 
 END { }    # module clean-up code here (global destructor)
-- 
1.7.2.5




More information about the Patches mailing list