From 288c1a768db4f578900de904ce39bc9a2f64378f Mon Sep 17 00:00:00 2001 From: Chris Cormack Date: Wed, 2 Nov 2011 14:43:45 +1300 Subject: [PATCH] Bug 7139 : Log addition and deletion of circulation messages Signed-off-by: Marcel de Rooy Changed the two action names into caps no-spaces. Signed-off-by: Paul Poulain --- C4/Members.pm | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/C4/Members.pm b/C4/Members.pm index 8bd7b47ed8..1d7bc42920 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) -- 2.39.5