From d8020adf51c4dc0fcb45d0d24a5d4c7b86379cc2 Mon Sep 17 00:00:00 2001 From: erickson Date: Sun, 26 Apr 2009 15:20:08 +0000 Subject: [PATCH] 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 git-svn-id: svn://svn.open-ils.org/ILS/branches/rel_1_4@12991 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../perlmods/OpenILS/Application/Circ/Circulate.pm | 26 ++++++++++++++-------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm b/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm index d7fb112f36..cfbb0beef9 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm @@ -2307,17 +2307,25 @@ sub do_renew { # 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; -- 2.11.0