Lines 103-109
foreach (@pcategories) {
Link Here
|
103 |
} |
103 |
} |
104 |
|
104 |
|
105 |
use vars qw(@borrower_fields @item_fields @other_fields); |
105 |
use vars qw(@borrower_fields @item_fields @other_fields); |
106 |
use vars qw($fldir $libname $control $mode $delim $dbname $today $today_iso $today_days); |
106 |
use vars qw($fldir $libname $control $mode $delim $dbname $today_iso $today_days); |
107 |
use vars qw($filename); |
107 |
use vars qw($filename); |
108 |
|
108 |
|
109 |
CHECK { |
109 |
CHECK { |
Lines 135-142
if (defined $borrowernumberlimit) {
Link Here
|
135 |
} |
135 |
} |
136 |
my $overdueItemsCounted = 0; |
136 |
my $overdueItemsCounted = 0; |
137 |
my %calendars = (); |
137 |
my %calendars = (); |
138 |
$today = C4::Dates->new(); |
138 |
$today_iso = output_pref( { dt => dt_from_string, dateonly => 1, dateformat => 'iso' } ); |
139 |
$today_iso = $today->output('iso'); |
|
|
140 |
my ($tyear, $tmonth, $tday) = split( /-/, $today_iso ); |
139 |
my ($tyear, $tmonth, $tday) = split( /-/, $today_iso ); |
141 |
$today_days = Date_to_Days( $tyear, $tmonth, $tday ); |
140 |
$today_days = Date_to_Days( $tyear, $tmonth, $tday ); |
142 |
|
141 |
|
Lines 145-158
for ( my $i = 0 ; $i < scalar(@$data) ; $i++ ) {
Link Here
|
145 |
my $datedue; |
144 |
my $datedue; |
146 |
my $datedue_days; |
145 |
my $datedue_days; |
147 |
eval { |
146 |
eval { |
148 |
$datedue = C4::Dates->new( $data->[$i]->{'date_due'}, 'iso' ); |
147 |
$datedue = eval { output_pref( { dt => dt_from_string( $data->[$i]->{'date_due'} ), dateonly => 1, dateformat => 'iso' } ); }; |
149 |
$datedue_days = Date_to_Days( split( /-/, $datedue->output('iso') ) ); |
148 |
$datedue_days = Date_to_Days( split( /-/, $datedue ) ); |
150 |
}; |
149 |
}; |
151 |
if ($@) { |
150 |
if ($@) { |
152 |
warn "Error on date for borrower " . $data->[$i]->{'borrowernumber'} . ": $@date_due: " . $data->[$i]->{'date_due'} . "\ndatedue_days: " . $datedue_days . "\nSkipping"; |
151 |
warn "Error on date for borrower " . $data->[$i]->{'borrowernumber'} . ": $@date_due: " . $data->[$i]->{'date_due'} . "\ndatedue_days: " . $datedue_days . "\nSkipping"; |
153 |
next; |
152 |
next; |
154 |
} |
153 |
} |
155 |
my $due_str = $datedue->output(); |
154 |
my $due_str = eval { output_pref( { dt => dt_from_string( $datedue ), dateonly => 1 } ); }; |
156 |
unless ( defined $data->[$i]->{'borrowernumber'} ) { |
155 |
unless ( defined $data->[$i]->{'borrowernumber'} ) { |
157 |
print STDERR "ERROR in Getoverdues line $i: issues.borrowernumber IS NULL. Repair 'issues' table now! Skipping record.\n"; |
156 |
print STDERR "ERROR in Getoverdues line $i: issues.borrowernumber IS NULL. Repair 'issues' table now! Skipping record.\n"; |
158 |
next; # Note: this doesn't solve everything. After NULL borrowernumber, multiple issues w/ real borrowernumbers can pile up. |
157 |
next; # Note: this doesn't solve everything. After NULL borrowernumber, multiple issues w/ real borrowernumbers can pile up. |
Lines 192-199
for ( my $i = 0 ; $i < scalar(@$data) ; $i++ ) {
Link Here
|
192 |
$data->[$i], |
191 |
$data->[$i], |
193 |
$borrower->{'categorycode'}, |
192 |
$borrower->{'categorycode'}, |
194 |
$branchcode, |
193 |
$branchcode, |
195 |
dt_from_string($datedue->output('iso')), |
194 |
dt_from_string( $datedue ), |
196 |
dt_from_string($today->output('iso')), |
195 |
dt_from_string( $today_iso ), |
197 |
); |
196 |
); |
198 |
|
197 |
|
199 |
# Reassign fine's amount if specified in command-line |
198 |
# Reassign fine's amount if specified in command-line |