[open-ils-commits] ***SPAM*** [GIT] Evergreen ILS branch master updated. b915d4bbf2cef462faa0df1bc6cfe324cdfba477

Evergreen Git git at git.evergreen-ils.org
Wed Nov 19 18:11:11 EST 2014


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".

The branch, master has been updated
       via  b915d4bbf2cef462faa0df1bc6cfe324cdfba477 (commit)
       via  ac6ba25fcc4c885060e22f57bfd662619a0e572b (commit)
      from  e38ec30abc3c14c92ddc89983f9dca19e7496415 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit b915d4bbf2cef462faa0df1bc6cfe324cdfba477
Author: Dan Wells <dbw2 at calvin.edu>
Date:   Wed Nov 19 18:08:31 2014 -0500

    Revert "LP#1198465 Allow fine generator to respect a stop_fines filter"
    
    This reverts commit e1fdcd3a6885baac3f86402e330aef3d8b36c681.
    
    The code failed in the case of restoring voided lost overdues together
    with generating new lost overdues on checkin.
    
    Signed-off-by: Dan Wells <dbw2 at calvin.edu>

diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/action.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/action.pm
index 62713bd..0452676 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/action.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/action.pm
@@ -1042,14 +1042,14 @@ sub generate_fines {
     my $self = shift;
     my $client = shift;
     my $circ = shift;
-    my $stop_fines_reasons = shift;
+    my $overbill = shift;
 
     local $OpenILS::Application::Storage::WRITE = 1;
 
     my @circs;
     if ($circ) {
         push @circs,
-            action::circulation->search_where( { id => $circ, stop_fines => $stop_fines_reasons } ),
+            action::circulation->search_where( { id => $circ, stop_fines => undef } ),
             booking::reservation->search_where( { id => $circ, return_time => undef, cancel_time => undef } );
     } else {
         push @circs, overdue_circs();
@@ -1132,6 +1132,10 @@ sub generate_fines {
 
             my $f_idx = 0;
             my $fine = $fines[$f_idx] if (@fines);
+            if ($overbill) {
+                $fine = $fines[++$f_idx] while ($fine and $fine->voided);
+            }
+
             my $current_fine_total = 0;
             $current_fine_total += int($_->amount * 100) for (grep { $_ and !$_->voided } @fines);
     

commit ac6ba25fcc4c885060e22f57bfd662619a0e572b
Author: Dan Wells <dbw2 at calvin.edu>
Date:   Wed Nov 19 18:06:18 2014 -0500

    Revert "LP#1198465 lost overdues generated in main xact"
    
    This reverts commit d2a521c0ff32e9921bfc93cb86b2c917e5eda92e.
    
    The code failed in the case of restoring voided lost overdues together
    with generating new lost overdues on checkin.
    
    Signed-off-by: Dan Wells <dbw2 at calvin.edu>

diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm
index ffb0d92..307d962 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm
@@ -347,6 +347,14 @@ sub run_method {
     } else {
 
         $circulator->editor->commit;
+
+        if ($circulator->generate_lost_overdue) {
+            # Generating additional overdue billings has to happen after the 
+            # main commit and before the final respond() so the caller can
+            # receive the latest transaction summary.
+            my $evt = $circulator->generate_lost_overdue_fines;
+            $circulator->bail_on_events($evt) if $evt;
+        }
     }
     
     $conn->respond_complete(circ_events($circulator));
@@ -528,6 +536,7 @@ my @AUTOLOAD_FIELDS = qw/
     skip_deposit_fee
     skip_rental_fee
     use_booking
+    generate_lost_overdue
     clear_expired
     retarget_mode
     hold_as_transit
@@ -2507,26 +2516,8 @@ sub do_checkin {
             " open circs for copy " .$self->copy->id."!!") if @$circs > 1;
     }
 
-    my $ignore_stop_fines = undef;
-    if ($self->circ) {
-
-        # if this circ is LOST and we are configured to generate overdue 
-        # fines for lost items on checkin (to fill the gap between mark 
-        # lost time and when the fines would have naturally stopped), tell 
-        # the fine generator to ignore the stop-fines value on this circ.
-        my $stat = $U->copy_status($self->copy->status)->id;
-        if ($stat == OILS_COPY_STATUS_LOST) {
-            $ignore_stop_fines = $self->circ->stop_fines if
-                $U->ou_ancestor_setting_value(
-                    $self->circ_lib, 
-                    OILS_SETTING_GENERATE_OVERDUE_ON_LOST_RETURN, 
-                    $self->editor
-                );
-        }
-
-        # run the fine generator against this circ
-        $self->generate_fines_start(undef, $ignore_stop_fines);
-    }
+    # run the fine generator against this circ, if this circ is there
+    $self->generate_fines_start if $self->circ;
 
     if( $self->checkin_check_holds_shelf() ) {
         $self->bail_on_events(OpenILS::Event->new('NO_CHANGE'));
@@ -3352,7 +3343,6 @@ sub generate_fines {
 sub generate_fines_start {
    my $self = shift;
    my $reservation = shift;
-   my $ignore_stop_fines = shift;
    my $dt_parser = DateTime::Format::ISO8601->new;
 
    my $obj = $reservation ? $self->reservation : $self->circ;
@@ -3371,7 +3361,7 @@ sub generate_fines_start {
       $self->{_gen_fines_req} = OpenSRF::AppSession->create('open-ils.storage') 
           ->request(
              'open-ils.storage.action.circulation.overdue.generate_fines',
-             $obj->id, $ignore_stop_fines
+             $obj->id
           );
    }
 
@@ -3593,6 +3583,16 @@ sub checkin_handle_lost_or_longoverdue {
         my $restore_od = $U->ou_ancestor_setting_value(
             $circ_lib, $args{ous_restore_overdue}, $self->editor) || 0;
 
+        # for reference: generate-overdues-on-long-overdue-checkin is not 
+        # supported because it doesn't make any sense that a circ would be 
+        # marked as long-overdue before it was done being regular-overdue
+        if (!$args{is_longoverdue}) {
+            $self->generate_lost_overdue(1) if 
+                $U->ou_ancestor_setting_value($circ_lib, 
+                    OILS_SETTING_GENERATE_OVERDUE_ON_LOST_RETURN, 
+                    $self->editor);
+        }
+
         $self->checkin_handle_lost_or_lo_now_found(
             $args{void_cost_btype}, $args{is_longoverdue}) if $void_cost;
         $self->checkin_handle_lost_or_lo_now_found(
@@ -4047,4 +4047,58 @@ sub checkin_handle_lost_or_lo_now_found_restore_od {
     }
 }
 
+# ------------------------------------------------------------------
+# Lost-then-found item checked in.  This sub generates new overdue
+# fines, beyond the point of any existing and possibly voided 
+# overdue fines, up to the point of final checkin time (or max fine
+# amount).  
+# ------------------------------------------------------------------
+sub generate_lost_overdue_fines {
+    my $self = shift;
+    my $circ = $self->circ;
+    my $e = $self->editor;
+
+    # Re-open the transaction so the fine generator can see it
+    if($circ->xact_finish or $circ->stop_fines) {
+        $e->xact_begin;
+        $circ->clear_xact_finish;
+        $circ->clear_stop_fines;
+        $circ->clear_stop_fines_time;
+        $e->update_action_circulation($circ) or return $e->die_event;
+        $e->xact_commit;
+    }
+
+    $e->xact_begin; # generate_fines expects an in-xact editor
+    $self->generate_fines;
+    $circ = $self->circ; # generate fines re-fetches the circ
+    
+    my $update = 0;
+
+    # Re-close the transaction if no money is owed
+    my ($obt) = $U->fetch_mbts($circ->id, $e);
+    if ($obt and $obt->balance_owed == 0) {
+        $circ->xact_finish('now');
+        $update = 1;
+    }
+
+    # Set stop fines if the fine generator didn't have to
+    unless($circ->stop_fines) {
+        $circ->stop_fines(OILS_STOP_FINES_CHECKIN);
+        $circ->stop_fines_time('now');
+        $update = 1;
+    }
+
+    # update the event data sent to the caller within the transaction
+    $self->checkin_flesh_events;
+
+    if ($update) {
+        $e->update_action_circulation($circ) or return $e->die_event;
+        $e->commit;
+    } else {
+        $e->rollback;
+    }
+
+    return undef;
+}
+
 1;

-----------------------------------------------------------------------

Summary of changes:
 .../lib/OpenILS/Application/Circ/Circulate.pm      |   98 +++++++++++++++-----
 .../Application/Storage/Publisher/action.pm        |    8 +-
 2 files changed, 82 insertions(+), 24 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list