From 804375df3ad969def6d2d265cb33f19980101879 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Fri, 25 Apr 2025 10:26:13 -0400 Subject: [PATCH] Bug 39749: RestrictPatronsWithFailedNotices should not trigger for DUPLICATE_MESSAGE failures Koha is built to prevent sending duplicate notices. Notices with static language ( e.g. "You have one or more holds ready to pick up" ) will easily trigger this filter. RestrictPatronsWithFailedNotices should ignore these notices because they do not indicate any problem with contacting the patron. Test Plan: 1) Enable RestrictPatronsWithFailedNotices 2) Enqueue to identical notices for a patron 3) Run process message queue to send one and fail the other as a duplicate ( alternately, just modify them in the database ) 4) Run restrict_patrons_with_failed_notices.pl 5) Note the restriction 6) Remove the restriction 7) Apply this patch 8) Run restrict_patrons_with_failed_notices.pl 9) Note that no restriction was created! --- misc/cronjobs/restrict_patrons_with_failed_notices.pl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/misc/cronjobs/restrict_patrons_with_failed_notices.pl b/misc/cronjobs/restrict_patrons_with_failed_notices.pl index 86178e1b02a..e86ed6a07a0 100755 --- a/misc/cronjobs/restrict_patrons_with_failed_notices.pl +++ b/misc/cronjobs/restrict_patrons_with_failed_notices.pl @@ -64,6 +64,9 @@ if ( C4::Context->preference('RestrictPatronsWithFailedNotices') ) { unless ( $failed_notice->message_transport_type eq 'sms' || $failed_notice->message_transport_type eq 'email' ); + # Messages failed for being duplicates do not indicate an issue with contacting the patron + next if $failed_notice->failure_code eq 'DUPLICATE_MESSAGE'; + # If failed sms or email notice has no recipient patron then skip to next failed # notice next unless $failed_notice->borrowernumber; -- 2.39.5 (Apple Git-154)