Bug 10190: fix three regressions in overdue_notices.pl

- Store patron name/address fields in \$borrower_overdues so
  prepare_letter_for_printing has data for printed/CSV/text notices
- Fix email->print fallback: look up items under original MTT key,
  not the effective (fallback) key
- Set \$admin_email_address from \$library unconditionally in
  _enact_trigger; previously undef in non-patron_homelibrary mode,
  stripping the from_address on all queued notices

Signed-off-by: Michaela <michaela.sieber@kit.edu>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
This commit is contained in:
Martin Renvoize 2026-02-25 11:57:53 +00:00 committed by Pedro Amorim
parent d539637c5e
commit 6640e3e58a
No known key found for this signature in database
GPG Key ID: 06B75BA7F3894D55
1 changed files with 11 additions and 2 deletions

View File

@ -752,6 +752,14 @@ END_SQL
$borrower_overdues->{'B_email'} = $data->{'B_email'};
$borrower_overdues->{'smsalertnumber'} = $data->{'smsalertnumber'};
$borrower_overdues->{'phone'} = $data->{'phone'};
$borrower_overdues->{'firstname'} = $data->{'firstname'};
$borrower_overdues->{'surname'} = $data->{'surname'};
$borrower_overdues->{'address'} = $data->{'address'};
$borrower_overdues->{'address2'} = $data->{'address2'};
$borrower_overdues->{'city'} = $data->{'city'};
$borrower_overdues->{'zipcode'} = $data->{'zipcode'};
$borrower_overdues->{'country'} = $data->{'country'};
$borrower_overdues->{'cardnumber'} = $data->{'cardnumber'};
}
}
$sth->finish;
@ -847,7 +855,8 @@ sub _enact_trigger {
my $branchcode = $borrower_overdues->{branchcode};
my $patron = Koha::Patrons->find($borrowernumber);
my ( $library, $admin_email_address, $branch_email_address );
$library = Koha::Libraries->find($branchcode);
$library = Koha::Libraries->find($branchcode);
$admin_email_address = $library->from_email_address;
if ($patron_homelibrary) {
$branchcode = $patron->branchcode;
@ -889,7 +898,7 @@ sub _enact_trigger {
my $itemcount = 0;
my $titles = "";
my @items = ();
for my $item_info ( @{ $borrower_overdues->{triggers}->{$trigger}->{$notice}->{$effective_mtt} } ) {
for my $item_info ( @{ $borrower_overdues->{triggers}->{$trigger}->{$notice}->{$mtt} } ) {
if ( ( scalar(@emails_to_use) == 0 || $nomail )
&& $PrintNoticesMaxLines
&& $j >= $PrintNoticesMaxLines )