[open-ils-commits] r8105 - branches/rel_1_2/Open-ILS/src/perlmods/OpenILS/Application/Circ

svn at svn.open-ils.org svn at svn.open-ils.org
Wed Nov 21 11:18:57 EST 2007


Author: erickson
Date: 2007-11-21 11:01:16 -0500 (Wed, 21 Nov 2007)
New Revision: 8105

Modified:
   branches/rel_1_2/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm
Log:
backporting the logic to delay hold retargeting until after the checkin is complete and responded.  also, repaired renew perm check

Modified: branches/rel_1_2/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm
===================================================================
--- branches/rel_1_2/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm	2007-11-21 15:58:54 UTC (rev 8104)
+++ branches/rel_1_2/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm	2007-11-21 16:01:16 UTC (rev 8105)
@@ -211,6 +211,7 @@
     unless($circulator->bail_out) {
         $circulator->do_hold_notify($circulator->notify_hold)
             if $circulator->notify_hold;
+        $circulator->retarget_holds if $circulator->retarget;
     }
 }
 
@@ -333,11 +334,11 @@
     dummy_author
     circ_lib
     barcode
-   duration_level
-   recurring_fines_level
-   duration_rule
-   recurring_fines_rule
-   max_fine_rule
+    duration_level
+    recurring_fines_level
+    duration_rule
+    recurring_fines_rule
+    max_fine_rule
     renewal_remaining
     due_date
     fulfilled_holds
@@ -351,6 +352,7 @@
     opac_renewal
     phone_renewal
     desk_renewal
+    retarget
 /;
 
 
@@ -1537,7 +1539,7 @@
     my $copy = $self->copy;
 
     # See if this copy can fulfill any holds
-    my ($hold) = $holdcode->find_nearest_permitted_hold( 
+    my ($hold, undef, $retarget) = $holdcode->find_nearest_permitted_hold( 
         $self->editor, $copy, $self->editor->requestor );
 
     if(!$hold) {
@@ -1546,6 +1548,7 @@
         return undef;
     }
 
+    $self->retarget($retarget);
 
     $logger->info("circulator: found permitted hold ".
         $hold->id . " for copy, capturing...");
@@ -1624,6 +1627,13 @@
     }
 }
 
+sub retarget_holds {
+    $logger->info("retargeting prev_check_time=null holds after opportunistic capture");
+    my $ses = OpenSRF::AppSession->create('open-ils.storage');
+    $ses->request('open-ils.storage.action.hold_request.copy_targeter');
+    # no reason to wait for the return value
+    return;
+}
 
 sub checkin_build_hold_transit {
     my $self = shift;
@@ -1932,11 +1942,6 @@
     $self->log_me("do_renew()");
     $self->is_renewal(1);
 
-    unless( $self->is_renewal ) {
-        return $self->bail_on_events($self->editor->events)
-            unless $self->editor->allowed('RENEW_CIRC');
-    }   
-
     # Make sure there is an open circ to renew that is not
     # marked as LOST, CLAIMSRETURNED, or LONGOVERDUE
     my $circ = $self->editor->search_action_circulation(
@@ -1954,6 +1959,12 @@
 
     return $self->bail_on_events($self->editor->event) unless $circ;
 
+    # A user is not allowed to renew another user's items without permission
+    unless( $circ->usr eq $self->editor->requestor->id ) {
+        return $self->bail_on_events($self->editor->events)
+            unless $self->editor->allowed('RENEW_CIRC', $circ->circ_lib);
+    }   
+
     $self->push_events(OpenILS::Event->new('MAX_RENEWALS_REACHED'))
         if $circ->renewal_remaining < 1;
 



More information about the open-ils-commits mailing list