Bug 10190: three minor issues

- overdue_notices.pl: fix verbose sprintf - remove spurious \$triggered
  argument (CLI 0/1 flag had replaced delay value in output) and use
  the \$borr string that was computed but never included in the message
- overdue_notices.pl: remove %already_queued hash which was populated
  in _enact_trigger but never read; dead code since the refactor
- C4/Overdues.pm GetBranchcodesWithOverdueRules: guard the global-rule
  expansion with @branchcodes check so an empty result (no rules at all)
  correctly returns an empty list instead of all branches

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 12:17:37 +00:00 committed by Pedro Amorim
parent 8659f4e016
commit 591263d5ef
No known key found for this signature in database
GPG Key ID: 06B75BA7F3894D55
2 changed files with 4 additions and 6 deletions

View File

@ -727,7 +727,7 @@ sub GetBranchcodesWithOverdueRules {
distinct => 1,
}
)->get_column('branchcode');
if ( !$branchcodes[0] ) {
if ( @branchcodes && !defined $branchcodes[0] ) {
@branchcodes = Koha::Libraries->search( {}, { order_by => 'branchname' } )->get_column('branchcode');
}

View File

@ -514,7 +514,6 @@ if (@myitemtypes) {
@itemtypes = Koha::ItemTypes->search()->get_column('itemtype');
}
my %already_queued;
my %seen = map { $_ => 1 } @branches;
# Work through branches
@ -732,9 +731,9 @@ END_SQL
$data->{'firstname'} || '',
$data->{borrowernumber}
);
warn sprintf "Overdue matched trigger %s with delay of %s days and overdue due date of %s\n",
$i,
$triggered, $overdue_rules->{ "overdue_$i" . '_delay' }, $data->{date_due};
warn sprintf "Overdue matched trigger %s for %s with delay of %s days and overdue due date of %s\n",
$i, $borr,
$overdue_rules->{ "overdue_$i" . '_delay' }, $data->{date_due};
warn sprintf "Using letter code '%s'\n",
$overdue_rules->{ "overdue_$i" . '_notice' };
}
@ -1047,7 +1046,6 @@ sub _enact_trigger {
}
}
$already_queued{"$borrowernumber$trigger"} = 1;
}
}