Bug 36128: Use of uninitialized value in string eq at /usr/share/koha/lib/C4/Overdues.pm

Fixes the following error message when running the overdues check cronjob on a
Koha system without defined overdue rules:

/etc/cron.daily/koha-common:
Use of uninitialized value in string eq at /usr/share/koha/lib/C4/Overdues.pm
line 686.

by checking if the variable is defined before comparing it.

Test plan:
1. Go to Tools - Overdue notice/status triggers and verify that for every single
   patron type for both Default and every individual library, you have no value
   set for Delay, so that you will never send anyone an overdue notice
2. Run the cron job which creates and sends overdue notices
3. Confirm the above mentioned error no longer appears

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Denys Konovalov 2024-06-23 14:13:35 +02:00 committed by Katrin Fischer
parent 5a32d5b059
commit 4c8586270a
Signed by: kfischer
GPG key ID: 0EF6E2C03357A834

View file

@ -683,7 +683,7 @@ sub GetBranchcodesWithOverdueRules {
WHERE delay1 IS NOT NULL
ORDER BY branchcode
|);
if ( $branchcodes->[0] eq '' ) {
if ( defined $branchcodes->[0] && $branchcodes->[0] eq '' ) {
# If a default rule exists, all branches should be returned
return Koha::Libraries->search({}, { order_by => 'branchname' })->get_column('branchcode');
}