From e6bd28682e284ab9a6ff3b00afeaa1113112af15 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 20 Jan 2016 17:57:55 +0000 Subject: [PATCH] Bug 15632: Koha::Patron::Messages - Remove DeleteMessage MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The DeleteMessage just deleted and logged if needed. This is now be done by Koha::Patron::Message->delete. Test plan: 1/ Go on the "check out" page of a patron 2/ Delete some messages Signed-off-by: Marc Véron Signed-off-by: Brendan A Gallagher --- C4/Members.pm | 24 ------------------------ circ/del_message.pl | 14 ++++---------- 2 files changed, 4 insertions(+), 34 deletions(-) diff --git a/C4/Members.pm b/C4/Members.pm index 6d23a4c643..49baae35c2 100644 --- a/C4/Members.pm +++ b/C4/Members.pm @@ -96,7 +96,6 @@ BEGIN { &GetExpiryDate &GetUpcomingMembershipExpires - &DeleteMessage &GetMessages &GetMessagesCount @@ -2206,29 +2205,6 @@ sub GetMessagesCount { return $count; } - - -=head2 DeleteMessage - - DeleteMessage( $message_id ); - -=cut - -sub DeleteMessage { - my ( $message_id ) = @_; - - my $dbh = C4::Context->dbh; - 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"); -} - =head2 IssueSlip IssueSlip($branchcode, $borrowernumber, $quickslip) diff --git a/circ/del_message.pl b/circ/del_message.pl index 6b8d560eb7..ccce6613b3 100755 --- a/circ/del_message.pl +++ b/circ/del_message.pl @@ -17,20 +17,13 @@ # You should have received a copy of the GNU General Public License # along with Koha; if not, see . -use strict; -use warnings; +use Modern::Perl; use CGI qw ( -utf8 ); -use C4::Context; use C4::Auth; use C4::Output; -use C4::Members; -use C4::Accounts; -use C4::Stats; -use C4::Koha; -use C4::Overdues; -use C4::Branch; # GetBranches +use Koha::Patron::Messages; my $input = new CGI; @@ -47,7 +40,8 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( my $borrowernumber = $input->param('borrowernumber'); my $message_id = $input->param('message_id'); -DeleteMessage($message_id); +my $message = Koha::Patron::Messages->find($message_id); +$message->delete if $message; print $input->redirect( "/cgi-bin/koha/circ/circulation.pl?borrowernumber=$borrowernumber"); -- 2.39.5