Bug 31157: Allow selection for overdue from address in the UI

This patch adds a new system preference to allow systems librarians the
option to pick wich address to use for overdues notices.

We default to 'cron' to allow existing uses of '--frombranch' on the
command line to continue to function but now allow end users to override
this option via the new OverdueNoticeFrom preference.

Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com>

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Martin Renvoize 2022-07-14 17:11:45 +01:00 committed by Tomas Cohen Arazi
parent e6947b7408
commit 19fc6220fa
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F
4 changed files with 25 additions and 0 deletions

View file

@ -0,0 +1,15 @@
use Modern::Perl;
return {
bug_number => "31157",
description => "Add OverdueNoticeFrom preference",
up => sub {
my ($args) = @_;
my ($dbh, $out) = @$args{qw(dbh out)};
$dbh->do(q{
INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES
('OverdueNoticeFrom', 'cron', 'cron|item-issuebranch|item-homebranch', 'Use the choice as the from address when generating overdue notices', 'Choice')
});
},
};

View file

@ -521,6 +521,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `
('OverDrivePasswordRequired','0',NULL,'Does the library require passwords for OverDrive SIP authentication','YesNo'),
('OverDriveUsername','cardnumber','cardnumber|userid','Which patron information should be passed as OverDrive username','Choice'),
('OverdueNoticeCalendar',0,NULL,'Take the calendar into consideration when generating overdue notices','YesNo'),
('OverdueNoticeFrom', 'cron', 'cron|item-issuebranch|item-homebranch', 'Use the choice as the from address when generating overdue notices', 'Choice'),
('OverduesBlockCirc','noblock','noblock|confirmation|block','When checking out an item should overdues block checkout, generate a confirmation dialogue, or allow checkout','Choice'),
('OverduesBlockRenewing','allow','allow|blockitem|block','If any of patron checked out documents is late, should renewal be allowed, blocked only on overdue items or blocked on whatever checked out document','Choice'),
('PassItemMarcToXSLT','0',NULL,'If enabled, item fields in the MARC record will be made avaiable to XSLT sheets. Otherwise they will be removed.','YesNo'),

View file

@ -407,6 +407,14 @@ Circulation:
1: "Use calendar"
0: "Ignore calendar"
- "when working out the period for overdue notices."
-
- "Use the"
- pref: OverdueNoticeFrom
choices:
cron: "system default"
item-issuebranch: "checkout library"
item-homebranch: "item home library"
- "as the from address when generating overdue notices."
-
- Include up to
- pref: PrintNoticesMaxLines

View file

@ -338,6 +338,7 @@ if ( defined $csvfilename && $csvfilename =~ /^-/ ) {
die "--frombranch takes item-homebranch or item-issuebranch only"
unless ( $frombranch eq 'item-issuebranch'
|| $frombranch eq 'item-homebranch' );
$frombranch = C4::Context->preference('OverdueNoticeFrom') ne 'cron' ? C4::Context->preference('OverdueNoticeFrom') : $frombranch;
my $owning_library = ( $frombranch eq 'item-homebranch' ) ? 1 : 0;
my @overduebranches = C4::Overdues::GetBranchcodesWithOverdueRules(); # Branches with overdue rules