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.
---
misc/cronjobs/fines.pl | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/misc/cronjobs/fines.pl b/misc/cronjobs/fines.pl
index 0e28357..de9e8cf 100755
--- a/misc/cronjobs/fines.pl
+++ b/misc/cronjobs/fines.pl
@@ -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} :
--
1.5.5.GIT
_______________________________________________
Koha-patches mailing list
[email protected]
http://lists.koha.org/mailman/listinfo/koha-patches