[open-ils-commits] r15366 - branches/rel_1_6_0/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher (miker)
svn at svn.open-ils.org
svn at svn.open-ils.org
Fri Jan 22 15:04:00 EST 2010
Author: miker
Date: 2010-01-22 15:03:56 -0500 (Fri, 22 Jan 2010)
New Revision: 15366
Modified:
branches/rel_1_6_0/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/action.pm
Log:
correct billing timestamp and count calculation issues introduced by 1.6.0.0 "push day-granular circs to end of calendar day" trigger
Modified: branches/rel_1_6_0/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/action.pm
===================================================================
--- branches/rel_1_6_0/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/action.pm 2010-01-22 15:40:55 UTC (rev 15365)
+++ branches/rel_1_6_0/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/action.pm 2010-01-22 20:03:56 UTC (rev 15366)
@@ -625,7 +625,7 @@
$fine_interval =~ s/(\d{2}):(\d{2}):(\d{2})/$1 h $2 m $3 s/o;
$fine_interval = interval_to_seconds( $fine_interval );
- if ( $fine_interval >= interval_to_seconds('1d') ) {
+ if ( 0 and $fine_interval >= interval_to_seconds('1d') ) {
my $tz_offset_s = 0;
if ($due_dt->strftime('%z') =~ /(-|\+)(\d{2}):?(\d{2})/) {
$tz_offset_s = $1 . interval_to_seconds( "${2}h ${3}m");
@@ -699,21 +699,25 @@
}
}
+ next if ($last_fine > $now);
+ my $pending_fine_count = int( ($now - $last_fine) / $fine_interval );
- my $pending_fine_count = int( ($now - $last_fine) / $fine_interval );
- if ($pending_fine_count < 1 + $grace) {
- $client->respond( "\tNo fines to create. " );
- if ($grace && $now < $due + $fine_interval * $grace) {
- $client->respond( "Still inside grace period of: ". seconds_to_interval( $fine_interval * $grace)."\n" );
- $log->info( "Circ ".$c->id." is still inside grace period of: $grace [". seconds_to_interval( $fine_interval * $grace).']' );
- } else {
- $client->respond( "Last fine generated for: ".localtime($last_fine)."\n" );
- }
- next;
- }
-
- $client->respond( "\t$pending_fine_count pending fine(s)\n" );
+ # Generate fines for the interval we are currently inside, when the fine interval is some multiple of 1d
+ $pending_fine_count++ if ($fine_interval && ($fine_interval % 86400 == 0));
+ if ( $last_fine == $due # we have no fines yet
+ && $grace # and we have a grace period
+ && $pending_fine_count <= $grace # and we seem to be inside that period
+ && $now < $due + $fine_interval * $grace # and some date math bares that out, then
+ ) {
+ $client->respond( "Still inside grace period of: ". seconds_to_interval( $fine_interval * $grace)."\n" );
+ $log->info( "Circ ".$c->id." is still inside grace period of: $grace [". seconds_to_interval( $fine_interval * $grace).']' );
+ next;
+ }
+
+ $client->respond( "\t$pending_fine_count pending fine(s)\n" );
+ next unless ($pending_fine_count);
+
my $recuring_fine = int($c->recuring_fine * 100);
my $max_fine = int($c->max_fine * 100);
More information about the open-ils-commits
mailing list