Lines 97-106
sub Bug_17135_fix {
Link Here
|
97 |
## which does not require any correction |
97 |
## which does not require any correction |
98 |
next if ($fine->{description} =~ /$due_qr/); |
98 |
next if ($fine->{description} =~ /$due_qr/); |
99 |
|
99 |
|
100 |
{ |
100 |
if( !$old_date_pattern ) { |
101 |
## for extracting old due date from fine description |
101 |
## for extracting old due date from fine description |
102 |
## not used for fixing anything, logging/debug purposes only |
102 |
## not used for fixing anything, logging/debug purposes only |
103 |
last if $old_date_pattern; |
|
|
104 |
$old_date_pattern = $due; |
103 |
$old_date_pattern = $due; |
105 |
$old_date_pattern =~ s/[A-Za-z]/\[A-Za-z\]/g; |
104 |
$old_date_pattern =~ s/[A-Za-z]/\[A-Za-z\]/g; |
106 |
$old_date_pattern =~ s/[0-9]/\\d/g; |
105 |
$old_date_pattern =~ s/[0-9]/\\d/g; |
Lines 174-188
sub Bug_17135_fix {
Link Here
|
174 |
}; |
173 |
}; |
175 |
} |
174 |
} |
176 |
|
175 |
|
177 |
if ($verbose) { |
176 |
if( $verbose ) { |
178 |
Warn("Fine records with mismatched old vs current due dates: $different_dates_cnt"); |
177 |
Warn( "Fine records with mismatched old vs current due dates: $different_dates_cnt" ); |
179 |
Warn("Non-accruing accountlines FU records (item not due): ".$not_due_not_accruning_cnt); |
178 |
Warn( "Non-accruing accountlines FU records (item not due): ".$not_due_not_accruning_cnt ); |
180 |
Warn("Non-accruing accountlines FU records (item due): ".$due_not_accruning_cnt); |
179 |
Warn( "Non-accruing accountlines FU records (item due): ".$due_not_accruning_cnt ); |
181 |
} |
180 |
} |
182 |
|
181 |
|
183 |
if (@$forfixing > 0) { |
|
|
184 |
Warn("Dry run (test only mode), skipping ".scalar(@$forfixing)." database changes.") unless ($confirm); |
185 |
} |
186 |
my $updated_cnt = 0; |
182 |
my $updated_cnt = 0; |
187 |
my $update_sql = "UPDATE accountlines SET accounttype = 'F' WHERE accounttype = 'FU' AND accountlines_id = ? LIMIT 1"; |
183 |
my $update_sql = "UPDATE accountlines SET accounttype = 'F' WHERE accounttype = 'FU' AND accountlines_id = ? LIMIT 1"; |
188 |
for my $fine (@$forfixing) { |
184 |
for my $fine (@$forfixing) { |
Lines 197-204
sub Bug_17135_fix {
Link Here
|
197 |
$updated_cnt += $rows_affected; |
193 |
$updated_cnt += $rows_affected; |
198 |
logaction("FINES", "FU", $fine->{borrowernumber}, $logentry) if ($log); |
194 |
logaction("FINES", "FU", $fine->{borrowernumber}, $logentry) if ($log); |
199 |
} |
195 |
} |
200 |
if (@$forfixing > 0 && $confirm && $mode eq 'production') { |
196 |
|
201 |
Warn("Database update done, $updated_cnt".((@$forfixing == $updated_cnt)? "": "/".scalar(@$forfixing))." fine records closed successfully."); |
197 |
# Regardless of verbose, we report at least a number here |
|
|
198 |
if( @$forfixing > 0 ) { |
199 |
if( $confirm && $mode eq 'production') { |
200 |
Warn( "Database update done, $updated_cnt". |
201 |
( @$forfixing == $updated_cnt? "": ( "/". @$forfixing )). |
202 |
" fine records closed successfully." ); |
203 |
} else { |
204 |
Warn( "Dry run (test only mode), skipping ". @$forfixing. |
205 |
" fine records." ); |
206 |
} |
207 |
} else { |
208 |
Warn( "No fine records needed to be fixed" ); |
202 |
} |
209 |
} |
203 |
} |
210 |
} |
204 |
|
211 |
|
205 |
- |
|
|