adding grace after a closed day
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 15 Sep 2006 14:50:25 +0000 (14:50 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 15 Sep 2006 14:50:25 +0000 (14:50 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@6116 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/action.pm

index b0dbb87..7ae1a19 100644 (file)
@@ -559,7 +559,7 @@ sub generate_fines {
                        my $recuring_fine = int($c->recuring_fine * 100);
                        my $max_fine = int($c->max_fine * 100);
 
-                       my ($latest_billing_ts, $latest_amount) = ('',0);;
+                       my ($latest_billing_ts, $latest_amount) = ('',0);
                        for (my $bill = 1; $bill <= $pending_fine_count; $bill++) {
        
                                if ($current_fine_total >= $max_fine) {
@@ -581,6 +581,16 @@ sub generate_fines {
                                        next if ( $h->$dow_open eq '00:00:00' and $h->$dow_close eq '00:00:00');
                                }
 
+                               if ($last_fine eq $due) { # first time we've billed for this
+                                       $dow = $billing_ts->subtract( days => 1 )->day_of_week_0();
+                                       $dow_open = "dow_${dow}_open";
+                                       $dow_close = "dow_${dow}_close";
+
+                                       if (my $h = $hoo{$c->circ_lib}) { # if the day before now was a closed day, skip today (adding grace)
+                                               next if ( $h->$dow_open eq '00:00:00' and $h->$dow_close eq '00:00:00');
+                                       }
+                               }
+
                                my $timestamptz = $billing_ts->strftime('%FT%T%z');
                                my @cl = actor::org_unit::closed_date->search_where(
                                                { close_start   => { '<=' => $timestamptz },