LP#1198465 Recombine generate_fines()
authorDan Wells <dbw2@calvin.edu>
Fri, 5 Dec 2014 17:33:09 +0000 (12:33 -0500)
committerBill Erickson <berickxx@gmail.com>
Fri, 20 Feb 2015 21:20:43 +0000 (16:20 -0500)
The generate_fines() method was split back in 2010.  There is some
concern about the speed of checkin (e.g. via SIP for a sorter, where we
don't care about fines), and this may have been the reason for the
split.  It might also have been the fact that waiting for the storage
xact to finish was causing the circ xact to timeout.

In any case, since we are bringing them into the same xact now, reason
number 2 is invalid, and reason number 1 won't be helped by the split
anymore (since there is no longer any parallel action).  Let's bring it
back together.

Ultimately, as suggested by Mike, we will probably want to refactor a
bit and return a streaming response for sorting location, then a final
response once we have the fine generation figured out.

Signed-off-by: Dan Wells <dbw2@calvin.edu>
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm

index 7dee90c..9f57779 100644 (file)
@@ -2524,7 +2524,7 @@ sub do_checkin {
         }
 
         # run the fine generator against this circ
-        $self->generate_fines_start(undef, $ignore_stop_fines);
+        $self->generate_fines(undef, $ignore_stop_fines);
     }
 
     if( $self->checkin_check_holds_shelf() ) {
@@ -2565,7 +2565,6 @@ sub do_checkin {
     }
 
     if( $self->circ ) {
-        $self->generate_fines_finish;
         $self->checkin_handle_circ;
         return if $self->bail_out;
         $self->checkin_changed(1);
@@ -2790,9 +2789,6 @@ sub finish_fines_and_voiding {
     my $self = shift;
     return unless $self->circ;
 
-    # gather any updates to the circ after fine generation, if there was a circ
-    $self->generate_fines_finish;
-
     return unless $self->backdate or $self->void_overdues;
 
     # void overdues after fine generation to prevent concurrent DB access to overdue billings
@@ -3341,16 +3337,6 @@ sub put_hold_on_shelf {
 sub generate_fines {
    my $self = shift;
    my $reservation = shift;
-
-   $self->generate_fines_start($reservation);
-   $self->generate_fines_finish($reservation);
-
-   return undef;
-}
-
-sub generate_fines_start {
-   my $self = shift;
-   my $reservation = shift;
    my $ignore_stop_fines = shift;
    my $dt_parser = DateTime::Format::ISO8601->new;
 
@@ -3373,18 +3359,6 @@ sub generate_fines_start {
              $obj->id, $ignore_stop_fines
           );
    }
-
-   return undef;
-}
-
-sub generate_fines_finish {
-   my $self = shift;
-   my $reservation = shift;
-
-   return undef unless $self->{_gen_fines_req};
-
-   my $id = $reservation ? $self->reservation->id : $self->circ->id;
-
    $self->{_gen_fines_req}->wait_complete;
    delete($self->{_gen_fines_req});
 
@@ -3840,7 +3814,7 @@ sub do_renew {
     }
 
     # Run the fine generator against the old circ
-    $self->generate_fines_start;
+    $self->generate_fines;
 
     $self->run_renew_permit;