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>
(cherry picked from commit 4c8586270a)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 319f954c21)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
Denys Konovalov 2024-06-23 14:13:35 +02:00 committed by Fridolin Somers
parent 9587c661ea
commit dc395bf063
1 changed files with 1 additions and 1 deletions

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');
}