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..957645a72e --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_24197-new_RedirectAddressForFailedOverdueNotices_syspref.sql @@ -0,0 +1 @@ +INSERT IGNORE 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 271cb3108a..a05c3638eb 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -529,6 +529,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('QuoteOfTheDay','','intranet,opac','Enable or disable display of Quote of the Day on the OPAC and staff interface home page','multiple'), ('RandomizeHoldsQueueWeight','0',NULL,'if ON, the holds queue in circulation will be randomized, either based on all location codes, or by the location codes specified in StaticHoldsQueueWeight','YesNo'), ('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'), ('RenewAccruingItemWhenPaid','0','','If enabled, when the fines on an item accruing is paid off, attempt to renew that item. If the syspref "RenewalPeriodBase" is set to "due date", renewed items may still be overdue','YesNo'), ('RenewAccruingItemInOpac','0','','If enabled, when the fines on an item accruing is paid off in the OPAC via a payment plugin, attempt to renew that item. If the syspref "RenewalPeriodBase" is set to "due date", renewed items may still be overdue','YesNo'), 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 d1a6fd98fd..ebd42acec1 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,12 @@ 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 d8fa4eef7d..fd2ab40a6a 100755 --- a/misc/cronjobs/overdue_notices.pl +++ b/misc/cronjobs/overdue_notices.pl @@ -455,7 +455,8 @@ foreach my $branchcode (@branches) { my $library = Koha::Libraries->find($branchcode); my $admin_email_address = $library->branchemail || C4::Context->preference('KohaAdminEmailAddress'); - my $branch_email_address = $library->inbound_email_address; + my $branch_email_address = C4::Context->preference('RedirectAddressForFailedOverdueNotices') + || $library->inbound_email_address; my @output_chunks; # may be sent to mail or stdout or csv file. $verbose and warn sprintf "branchcode : '%s' using %s\n", $branchcode, $branch_email_address; @@ -817,6 +818,7 @@ END_SQL title => 'Overdue Notices', content => 'These messages were not sent directly to the patrons.', }; + C4::Letters::EnqueueLetter( { letter => $letter, borrowernumber => undef,