View | Details | Raw Unified | Return to bug 14960
Collapse All | Expand All

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

Return to bug 14960