Prevent fines failure on NULL borrowernumber.
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> Signed-off-by: Henri-Damien LAURENT <henridamien.laurent@biblibre.com>
This commit is contained in:
parent
a93a847497
commit
4e3249091a
|
|
@ -89,6 +89,10 @@ for (my $i=0; $i<scalar(@$data); $i++) {
|
|||
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} :
|
||||
|
|
|
|||
Loading…
Reference in New Issue