until it can be tested thoroughly, continue offloading the penalty calc to the penalt...
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 13 Jan 2009 18:02:05 +0000 (18:02 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 13 Jan 2009 18:02:05 +0000 (18:02 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@11816 dcc99617-32d9-48b4-a31d-7c20da2025e4

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

index 2e0119c..99ee1bf 100644 (file)
@@ -602,6 +602,7 @@ sub generate_fines {
 
        my %hoo = map { ( $_->id => $_ ) } actor::org_unit::hours_of_operation->retrieve_all;
 
+       my $penalty = OpenSRF::AppSession->create('open-ils.penalty');
        for my $c (@circs) {
        
                try {
@@ -765,7 +766,20 @@ sub generate_fines {
 
                        $self->method_lookup('open-ils.storage.transaction.commit')->run;
 
-            OpenILS::Utils::Penalty->calculate_penalties(undef, $c->usr, $c->circ_lib);
+            if(0) { # caluclate penalties inline.  Needs to be tested.
+                OpenILS::Utils::Penalty->calculate_penalties(
+                    undef, $c->usr->to_fieldmapper->id.'', $c->circ_lib->to_fieldmapper->id.'');
+
+            } else {
+
+                           $penalty->request(
+                                   'open-ils.penalty.patron_penalty.calculate',
+                                   { patron    => $c->usr->to_fieldmapper,
+                                   update      => 1,
+                                   background  => 1,
+                                   }
+                           )->gather(1);
+            }
 
                } catch Error with {
                        my $e = shift;