fire the fine generator at checkin time to assess required fines without a "missing...
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 24 Aug 2009 15:23:49 +0000 (15:23 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 24 Aug 2009 15:23:49 +0000 (15:23 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@13923 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm

index 7fed4df..2cb9a9e 100644 (file)
@@ -1676,6 +1676,9 @@ sub do_checkin {
             " open circs for copy " .$self->copy->id."!!") if @$circs > 1;
     }
 
+    # run the fine generator against this circ, if this circ is there
+    $self->generate_fines if ($self->circ);
+
     # if the circ is marked as 'claims returned', add the event to the list
     $self->push_events(OpenILS::Event->new('CIRC_CLAIMS_RETURNED'))
         if ($self->circ and $self->circ->stop_fines 
@@ -2152,6 +2155,27 @@ sub process_received_transit {
 }
 
 
+sub generate_fines {
+   my $self = shift;
+   my $evt;
+   my $obt;
+
+   my $st = OpenSRF::AppSession->connect(
+      'open-ils.storage'
+   )->request(
+      'open-ils.storage.action.circulation.overdue.generate_fines',
+      undef,
+      $self->circ->id
+   )->wait_complete;
+
+   $st->disconnect;
+
+   # refresh the circ in case the fine generator set the stop_fines field
+   $self->circ($self->editor->retrieve_action_circulation($self->circ->id));
+
+   return undef;
+}
+
 sub checkin_handle_circ {
    my $self = shift;
    my $circ = $self->circ;