The problem is that we do not ensure that the issues table has valid
borrowernumber in each line. This is exacerbated by Getoverdues()
returning data sorted BY borrowernumber. So one NULL borrowernumber
in issues prevented ALL fines from being assessed. The actual error
from fines.pl cron log is:
No branchcode argument to new. Should be C4::Calendar->new(branchcode => $branchcode)
at /home/user/kohaclone/misc/cronjobs/fines.pl line 98
This patch deals only with getting fines to avoid crashing. It does
not fix the underlying data integrity problem.
Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
my $datedue = C4::Dates->new($data->[$i]->{'date_due'},'iso');
my $datedue_days = Date_to_Days(split(/-/,$datedue->output('iso')));
my $due_str = $datedue->output();
+ unless (defined $data->[$i]->{'borrowernumber'}) {
+ print STDERR "ERROR in Getoverdues line $i: issues.borrowernumber IS NULL. Repair 'issues' table now! Skipping record.\n";
+ next; # Note: this doesn't solve everything. After NULL borrowernumber, multiple issues w/ real borrowernumbers can pile up.
+ }
my $borrower = BorType($data->[$i]->{'borrowernumber'});
my $branchcode = ($control eq 'ItemHomeLibrary') ? $data->[$i]->{homebranch} :
($control eq 'PatronLibrary' ) ? $borrower->{branchcode} :