[open-ils-commits] r15164 - in trunk/Open-ILS/src/perlmods/OpenILS/Application: Circ Storage/Publisher (miker)

svn at svn.open-ils.org svn at svn.open-ils.org
Mon Dec 14 17:11:12 EST 2009


Author: miker
Date: 2009-12-14 17:11:06 -0500 (Mon, 14 Dec 2009)
New Revision: 15164

Modified:
   trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm
   trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/action.pm
Log:
generate fines at reservation checkin; do not stomp the circ list with reservations when gathering overdue circs

Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm	2009-12-14 22:04:13 UTC (rev 15163)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm	2009-12-14 22:11:06 UTC (rev 15164)
@@ -229,9 +229,15 @@
         $circulator->do_checkout();
 
     } elsif( $circulator->is_res_checkin ) {
-        $circulator->do_reservation_return();
-        $circulator->do_checkin();
-
+        my ($reservation, $evt) = $U->fetch_booking_reservation($self->reservation);
+        if ($evt) {
+            $self->bail_on_events($evt);
+        } else {
+            $self->reservation( $reservation );
+            $self->generate_fines(1)
+            $circulator->do_reservation_return();
+            $circulator->do_checkin();
+        }
     } elsif( $api =~ /checkin/ ) {
         $circulator->do_checkin();
 
@@ -1639,10 +1645,6 @@
 
     $self->log_me("do_reservation_pickup()");
 
-    my ($reservation, $evt) = $U->fetch_booking_reservation($self->reservation);
-    return $self->bail_on_events($evt) if $evt;
-
-    $self->reservation( $reservation );
     $self->reservation->pickup_time('now');
 
     if (
@@ -2497,21 +2499,25 @@
 
 sub generate_fines {
    my $self = shift;
+   my $reservation = shift;
    my $evt;
    my $obt;
 
+   my $id = $reservation ? $self->reservation->id : $self->circ->id;
+
    my $st = OpenSRF::AppSession->connect('open-ils.storage');
 
    $st->request(
       'open-ils.storage.action.circulation.overdue.generate_fines',
       undef,
-      $self->circ->id
+      $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));
+   $self->reservation($self->editor->retrieve_booking_reservation($id)) if $reservation;
+   $self->circ($self->editor->retrieve_action_circulation($id)) if !$reservation;
 
    return undef;
 }

Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/action.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/action.pm	2009-12-14 22:04:13 UTC (rev 15163)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/action.pm	2009-12-14 22:11:06 UTC (rev 15164)
@@ -126,10 +126,10 @@
             AND cancel_time IS NULL
 	SQL
 
-	my $sth = action::circulation->db_Main->prepare_cached($sql);
+	$sth = action::circulation->db_Main->prepare_cached($sql);
 	$sth->execute($upper_interval);
 
-	my @circs = map { booking::reservation->construct($_) } $sth->fetchall_hash;
+	@circs = map { booking::reservation->construct($_) } $sth->fetchall_hash;
 
 }
 



More information about the open-ils-commits mailing list