Bugzilla – Attachment 149647 Details for
Bug 33360
SendQueuedMessages: Improve limit behavior and add domain limits
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 33360: Incorporate Koha::Notice::Util in Letters:SendQueuedMessages
Bug-33360-Incorporate-KohaNoticeUtil-in-LettersSen.patch (text/plain), 2.35 KB, created by
Martin Renvoize (ashimema)
on 2023-04-14 09:05:53 UTC
(
hide
)
Description:
Bug 33360: Incorporate Koha::Notice::Util in Letters:SendQueuedMessages
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2023-04-14 09:05:53 UTC
Size:
2.35 KB
patch
obsolete
>From 1c90e20f3dad175106460daad0a328631173b8fb Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Thu, 30 Mar 2023 08:58:10 +0200 >Subject: [PATCH] Bug 33360: Incorporate Koha::Notice::Util in > Letters:SendQueuedMessages > >Minimal adjustment to get the feature working. >Will still be improved in follow-up. > >Test plan: >[1] Add a domain limit to your koha-conf: > <message_domain_limits> > <domain><name>gmail.com</name><limit>1</limit> <unit>1h</unit></domain> > </message_domain_limits> > Replace gmail.com by the domain you want to send to. > Restart all. >[2] Disable cron job for message queue. >[3] Generate two pending notices in the queue. >[4] Run process_message_queue.pl >[5] Check that one is sent, one is still pending. >[6] Run again. >[7] Check: nothing is sent, last one still pending. > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > C4/Letters.pm | 7 +++++++ > 1 file changed, 7 insertions(+) > >diff --git a/C4/Letters.pm b/C4/Letters.pm >index 36d3f5d77e..f45771c932 100644 >--- a/C4/Letters.pm >+++ b/C4/Letters.pm >@@ -34,6 +34,7 @@ use Koha::SMS::Providers; > use Koha::Email; > use Koha::Notice::Messages; > use Koha::Notice::Templates; >+use Koha::Notice::Util; > use Koha::DateUtils qw( dt_from_string output_pref ); > use Koha::Auth::TwoFactorAuth; > use Koha::Patrons; >@@ -65,6 +66,8 @@ BEGIN { > ); > } > >+our $domain_limits = {}; >+ > =head1 NAME > > C4::Letters - Give functions for Letters management >@@ -984,6 +987,7 @@ sub SendQueuedMessages { > 'where' => $params->{'where'} // q{}, > }; > my $unsent_messages = _get_unsent_messages( $which_unsent_messages ); >+ $domain_limits = Koha::Notice::Util->load_domain_limits; # (re)initialize per run > MESSAGE: foreach my $message ( @$unsent_messages ) { > my $message_object = Koha::Notice::Messages->find( $message->{message_id} ); > # If this fails the database is unwritable and we won't manage to send a message that continues to be marked 'pending' >@@ -1332,6 +1336,9 @@ sub _send_message_by_email { > } > } > >+ # Skip this message if we exceed domain limits in this run >+ return if Koha::Notice::Util->exceeds_limit({ to => $to_address, limits => $domain_limits }); >+ > my $subject = $message->{'subject'}; > > my $content = $message->{'content'}; >-- >2.40.0
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 33360
:
149256
|
149257
|
149258
|
149546
|
149547
|
149548
|
149549
|
149550
|
149551
|
149552
|
149645
|
149646
|
149647
|
149648
|
149649
|
149650
|
149651
|
149662
|
149663
|
149664
|
149665
|
149666
|
149667
|
149668