[open-ils-commits] r12992 - trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ (erickson)

svn at svn.open-ils.org svn at svn.open-ils.org
Sun Apr 26 11:21:05 EDT 2009


Author: erickson
Date: 2009-04-26 11:21:03 -0400 (Sun, 26 Apr 2009)
New Revision: 12992

Modified:
   trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm
Log:
Patch from Doug Kyle which allows the caller to specify a user during renewal so that the system can verify the renewed item is checked out to the specified user.  Thanks

Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm	2009-04-26 15:20:08 UTC (rev 12991)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm	2009-04-26 15:21:03 UTC (rev 12992)
@@ -2332,17 +2332,25 @@
 
     # 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(
-            { target_copy => $self->copy->id, stop_fines => undef } )->[0];
+    my $usrid = $self->patron->id if $self->patron;
+    my $circ;
+    if ($usrid) {
+        # If we have a patron, match them to the circ
+        $circ = $self->editor->search_action_circulation(
+            {target_copy => $self->copy->id, usr => $usrid,  stop_fines => undef})->[0];
+    } else {
+        $circ = $self->editor->search_action_circulation(
+            {target_copy => $self->copy->id, stop_fines => undef})->[0];
+    }
 
     if(!$circ) {
-        $circ = $self->editor->search_action_circulation(
-            { 
-                target_copy => $self->copy->id, 
-                stop_fines => OILS_STOP_FINES_MAX_FINES,
-                checkin_time => undef
-            } 
-        )->[0];
+        if ($usrid) {
+            $circ = $self->editor->search_action_circulation(
+                {target_copy => $self->copy->id, usr => $usrid, stop_fines => OILS_STOP_FINES_MAX_FINES, checkin_time => undef})->[0];
+        } else {
+            $circ = $self->editor->search_action_circulation(
+                {target_copy => $self->copy->id, stop_fines => OILS_STOP_FINES_MAX_FINES, checkin_time => undef})->[0];
+        }
     }
 
     return $self->bail_on_events($self->editor->event) unless $circ;



More information about the open-ils-commits mailing list