From 595ad7ea19a51a5c4c23d7cf375508b4efdc02db Mon Sep 17 00:00:00 2001 From: Alex Buckley Date: Mon, 9 Dec 2019 23:06:06 +0000 Subject: [PATCH] Bug 24197: Added new local use syspref which sets the email address that failed overdue notices are set to. Test plan: 1. Set an email in KohaAdminEmailAddress and notice there is no syspref named RedirectAddressForFailedOverdueNotices 2. Set some invalid email addresses in patron records then checkout items to those patrons making the due date in the past 3. Manually run overdue_notices.pl 4. Check the message_queue database table and notice the patrons with invalid email addresses are in an email starting with the content: 'These messages were not sent directly to the patrons.' 5. Apply patch 6. Run database update: cd installer/data/mysql sudo koha-shell ./updatedb.pl 7. Confirm there is a new system preference named: RedirectAddressForFailedOverdueNotices Give it a different email address to that in the KohaAdminEmailAddress syspref. 7. Repeat steps 2-4 and notice that the failed overdue notices have been sent to the email defined in RedirectAddressForFailedOverdueNotices Sponsored-By: Catalyst IT --- .../bug_24197-new_RedirectAddressForFailedOverdueNotices_syspref.sql | 1 + installer/data/mysql/sysprefs.sql | 1 + koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/admin.pref | 5 +++++ misc/cronjobs/overdue_notices.pl | 2 ++ 4 files changed, 9 insertions(+) create mode 100644 installer/data/mysql/atomicupdate/bug_24197-new_RedirectAddressForFailedOverdueNotices_syspref.sql diff --git a/installer/data/mysql/atomicupdate/bug_24197-new_RedirectAddressForFailedOverdueNotices_syspref.sql b/installer/data/mysql/atomicupdate/bug_24197-new_RedirectAddressForFailedOverdueNotices_syspref.sql new file mode 100644 index 0000000000..9985656a64 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_24197-new_RedirectAddressForFailedOverdueNotices_syspref.sql @@ -0,0 +1 @@ +INSERT INGORE INTO systempreferences (variable, value, options, explanation, type) VALUES ('RedirectAddressForFailedOverdueNotices', '', NULL, 'Destination email for failed overdue notices. If left empty then the branch email or KohaAdminEmailAddress syspref will be the email address that failed overdue notices are sent to', 'free'); diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index 71c7fe76a1..c49bfab66f 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -496,6 +496,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('RecallsLog','1',NULL,'If ON, log create/cancel/expire/fulfill actions on recalls','YesNo'), ('RecallsMaxPickUpDelay','7','','Define the maximum time a recall can be waiting for pickup','Integer'), ('RecordLocalUseOnReturn','0',NULL,'If ON, statistically record returns of unissued items as local use, instead of return','YesNo'), +('RedirectAddressForFailedOverdueNotices', '', NULL, 'Destination email for failed overdue notices. If left empty then the branch email or KohaAdminEmailAddress syspref will be the email address that failed overdue notices are sent to', 'free'), ('RefundLostOnReturnControl','CheckinLibrary','CheckinLibrary|ItemHomeBranch|ItemHoldingBranch','If a lost item is returned, choose which branch to pick rules for refunding.','Choice'), ('RenewalLog','0','','If ON, log information about renewals','YesNo'), ('RenewalPeriodBase','date_due','date_due|now','Set whether the renewal date should be counted from the date_due or from the moment the Patron asks for renewal ','Choice'), diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/admin.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/admin.pref index 5bf920ba25..c5e8d6e61a 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/admin.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/admin.pref @@ -21,6 +21,11 @@ Administration: class: email - "(Leave this field empty to send messages to their normal recipient)" - + - "Email address failed overdue notices are sent to: " + - pref: RedirectAddressForFailedOverdueNotices + class: email + - "If left empty then the branch email or KohaAdminEmailAddress will be set as the destination address for failed overdue notices" + - - "How much debugging information to show in the browser when an internal error occurs: " - pref: DebugLevel default: 0 diff --git a/misc/cronjobs/overdue_notices.pl b/misc/cronjobs/overdue_notices.pl index 9f616d0a43..3303a286a7 100755 --- a/misc/cronjobs/overdue_notices.pl +++ b/misc/cronjobs/overdue_notices.pl @@ -819,6 +819,8 @@ END_SQL title => 'Overdue Notices', content => 'These messages were not sent directly to the patrons.', }; + + $admin_email_address = C4::Context->preference('RedirectAddressForFailedOverdueNotices') if C4::Context->preference('RedirectAddressForFailedOverdueNotices') ne ''; C4::Letters::EnqueueLetter( { letter => $letter, borrowernumber => undef, -- 2.11.0