Bugzilla – Attachment 68379 Details for
Bug 12802
Send notices using several email addresses
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 12802: Update all circulation alerts, not only the first one
Bug-12802-Update-all-circulation-alerts-not-only-t.patch (text/plain), 3.30 KB, created by
Biblibre Sandboxes
on 2017-10-23 09:20:50 UTC
(
hide
)
Description:
Bug 12802: Update all circulation alerts, not only the first one
Filename:
MIME Type:
Creator:
Biblibre Sandboxes
Created:
2017-10-23 09:20:50 UTC
Size:
3.30 KB
patch
obsolete
>From ad910aef1fd7412f970ea2016a2dc1699c6863f1 Mon Sep 17 00:00:00 2001 >From: Julian Maurice <julian.maurice@biblibre.com> >Date: Thu, 12 Oct 2017 13:35:56 +0000 >Subject: [PATCH] Bug 12802: Update all circulation alerts, not only the first > one > >Since SendCirculationAlert can generate multiple entries in >message_queue, it should update them all if pending messages already >exist > >Signed-off-by: Axelle Clarisse <axelle.clarisse@univ-amu.fr> >--- > C4/Circulation.pm | 10 ++++++---- > C4/Message.pm | 19 ++++++++----------- > 2 files changed, 14 insertions(+), 15 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index 9773f69..d6f77fd 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -3366,13 +3366,15 @@ sub SendCirculationAlert { > $schema->storage->txn_begin; > C4::Context->dbh->do(q|LOCK TABLE message_queue READ|) unless $do_not_lock; > C4::Context->dbh->do(q|LOCK TABLE message_queue WRITE|) unless $do_not_lock; >- my $message = C4::Message->find_last_message($borrower, $type, $mtt); >- unless ( $message ) { >+ my @messages = C4::Message->find_last_messages($borrower, $type, $mtt); >+ unless ( @messages ) { > C4::Context->dbh->do(q|UNLOCK TABLES|) unless $do_not_lock; > C4::Message->enqueue($letter, $borrower, $mtt); > } else { >- $message->append($letter); >- $message->update; >+ foreach my $message (@messages) { >+ $message->append($letter); >+ $message->update; >+ } > } > C4::Context->dbh->do(q|UNLOCK TABLES|) unless $do_not_lock; > $schema->storage->txn_commit; >diff --git a/C4/Message.pm b/C4/Message.pm >index 800b82f..29a190b 100644 >--- a/C4/Message.pm >+++ b/C4/Message.pm >@@ -53,7 +53,7 @@ How to update a borrower's last checkout message: > > use C4::Message; > my $borrower = { borrowernumber => 1 }; >- my $message = C4::Message->find_last_message($borrower, 'CHECKOUT', 'email'); >+ my $message = C4::Message->find_last_messages($borrower, 'CHECKOUT', 'email'); > $message->append("you also checked out some other book...."); > $message->update; > >@@ -110,17 +110,17 @@ sub find { > } > } > >-=head3 C4::Message->find_last_message($borrower, $letter_code, $transport) >+=head3 C4::Message->find_last_messages($borrower, $letter_code, $transport) > > This method is used to get the borrower's most recent, pending, check-in or >-checkout message. (This makes it possible to add more information to the >+checkout messages. (This makes it possible to add more information to the > message before it gets sent out.) > > =cut > >-# C4::Message->find_last_message($borrower, $letter_code, $transport) >-# -- get the borrower's most recent pending checkin or checkout notification >-sub find_last_message { >+# C4::Message->find_last_messages($borrower, $letter_code, $transport) >+# -- get the borrower's most recent pending checkin or checkout notifications >+sub find_last_messages { > my ($class, $borrower, $letter_code, $transport) = @_; > # $type is the message_transport_type > $transport ||= 'email'; >@@ -139,11 +139,8 @@ sub find_last_message { > $letter_code, > $transport, > ); >- if (@$msgs) { >- return $class->new($msgs->[0]); >- } else { >- return; >- } >+ >+ return map { $class->new($_) } @$msgs; > } > > >-- >2.7.4
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 12802
:
31058
|
31059
|
31132
|
31382
|
31383
|
31384
|
31833
|
33864
|
33865
|
33866
|
33867
|
35890
|
35891
|
35892
|
35893
|
35926
|
35927
|
35928
|
35929
|
35930
|
36055
|
36056
|
36057
|
36058
|
36059
|
39762
|
39770
|
40167
|
45476
|
45477
|
45478
|
45479
|
45480
|
45481
|
45482
|
57296
|
61878
|
61879
|
61880
|
61881
|
61882
|
61883
|
61884
|
66934
|
66935
|
66936
|
66937
|
66938
|
66939
|
66940
|
68002
|
68003
|
68004
|
68005
|
68006
|
68007
|
68008
|
68009
|
68010
|
68011
|
68012
|
68013
|
68375
|
68376
|
68377
|
68378
|
68379
|
68380
|
119016
|
149232
|
153540
|
154076
|
159780
|
159857
|
160051
|
160052
|
160090
|
160091
|
160092
|
160103
|
160104
|
160105
|
160106
|
165494
|
165495
|
165496
|
165497