Bugzilla – Attachment 27827 Details for
Bug 11209
Multi transport types: same messages are sent for a patron
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 11209: Don't sent the same message for the same user the same day
Bug-11209-Dont-sent-the-same-message-for-the-same-.patch (text/plain), 2.50 KB, created by
Chris Cormack
on 2014-05-01 03:39:08 UTC
(
hide
)
Description:
Bug 11209: Don't sent the same message for the same user the same day
Filename:
MIME Type:
Creator:
Chris Cormack
Created:
2014-05-01 03:39:08 UTC
Size:
2.50 KB
patch
obsolete
>From 980cdd1fa7d2aae5c4a90d5afd25920e145cfd38 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Wed, 6 Nov 2013 14:56:35 +0100 >Subject: [PATCH] Bug 11209: Don't sent the same message for the same user the > same day > >For PREDUE messages, one message is sent to the message_queue table for >each items in advanced. >So the patron will receive the same message. > >The sms part for DUE and PREDUE should not contain dynamic parts, only a >standard message. > >Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz> >--- > C4/Letters.pm | 23 ++++++++++++++++++++++- > 1 file changed, 22 insertions(+), 1 deletion(-) > >diff --git a/C4/Letters.pm b/C4/Letters.pm >index 5025c10..a6c6640 100644 >--- a/C4/Letters.pm >+++ b/C4/Letters.pm >@@ -893,7 +893,7 @@ sub _get_unsent_messages { > > my $dbh = C4::Context->dbh(); > my $statement = << 'ENDSQL'; >-SELECT mq.message_id, mq.borrowernumber, mq.subject, mq.content, mq.message_transport_type, mq.status, mq.time_queued, mq.from_address, mq.to_address, mq.content_type, b.branchcode >+SELECT mq.message_id, mq.borrowernumber, mq.subject, mq.content, mq.message_transport_type, mq.status, mq.time_queued, mq.from_address, mq.to_address, mq.content_type, b.branchcode, mq.letter_code > FROM message_queue mq > LEFT JOIN borrowers b ON b.borrowernumber = mq.borrowernumber > WHERE status = ? >@@ -1001,6 +1001,21 @@ $content > EOS > } > >+sub _is_duplicate { >+ my ( $message ) = @_; >+ my $dbh = C4::Context->dbh; >+ my $count = $dbh->selectrow_array(q| >+ SELECT COUNT(*) >+ FROM message_queue >+ WHERE message_transport_type = ? >+ AND borrowernumber = ? >+ AND letter_code = ? >+ AND CAST(time_queued AS date) = CAST(? AS date) >+ AND status="sent" >+ |, {}, $message->{message_transport_type}, $message->{borrowernumber}, $message->{letter_code}, $message->{time_queued} ); >+ return $count; >+} >+ > sub _send_message_by_sms { > my $message = shift or return; > my $member = C4::Members::GetMember( 'borrowernumber' => $message->{'borrowernumber'} ); >@@ -1011,6 +1026,12 @@ sub _send_message_by_sms { > return; > } > >+ if ( _is_duplicate( $message ) ) { >+ _set_message_status( { message_id => $message->{'message_id'}, >+ status => 'failed' } ); >+ return; >+ } >+ > my $success = C4::SMS->send_sms( { destination => $member->{'smsalertnumber'}, > message => $message->{'content'}, > } ); >-- >1.8.3.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 11209
:
22752
|
22762
|
23255
|
27827
|
27828
|
27919
|
27937
|
27938
|
27939