Bug 20537: Added checks to remove warning from overdue_notices.pl

When executing overdue_notices.pl on borrowers that lack a surname, we
see this error:
Use of uninitialized value in concatenation (.) or string at
/usr/share/koha/bin/cronjobs/overdue_notices.pl line 575.

This patch fixes this issue by setting the $borr variable
based on the information that has been defined.

To test:
1) Create a borrower and set its surname to null
2) Checkout an item to the borrower and set it to be overdue
3) Navigate to kohaclone/misc/cronjobs and enter a koha-shell
4) Run the script: ./overdue_notices.pl
5) Observe the error appears
6) Apply the patch
7) Repeat steps 3-4
8) Observe the error is gone
9) Sign off!

Sponsored-by: Catalyst IT

Signed-off-by: Liz Rea <wizzyrea@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
This commit is contained in:
Hayley Mapley 2019-05-24 13:52:58 -05:00 committed by Nick Clemens
parent 0230563082
commit 7d42e29c8b
1 changed files with 5 additions and 4 deletions

View File

@ -574,10 +574,11 @@ END_SQL
next;
}
$borrowernumber = $data->{'borrowernumber'};
my $borr =
$data->{'firstname'} . ', '
. $data->{'surname'} . ' ('
. $borrowernumber . ')';
my $borr = sprintf( "%s%s%s (%s)",
$data->{'surname'} || '',
$data->{'firstname'} && $data->{'surname'} ? ', ' : '',
$data->{'firstname'} || '',
$borrowernumber );
$verbose
and warn "borrower $borr has items triggering level $i.";