From b3ee627590d8b99d5919dd48c1960cdafd1c8bdf Mon Sep 17 00:00:00 2001 From: erickson Date: Fri, 15 Jul 2005 17:55:26 +0000 Subject: [PATCH] renew now accepts either a circ object or a circ id git-svn-id: svn://svn.open-ils.org/ILS/trunk@1211 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../src/perlmods/OpenILS/Application/Circ/Rules.pm | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Circ/Rules.pm b/Open-ILS/src/perlmods/OpenILS/Application/Circ/Rules.pm index aaa35f019a..df2d00cbc9 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Circ/Rules.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Circ/Rules.pm @@ -711,8 +711,19 @@ __PACKAGE__->register_method( sub renew { my($self, $client, $login_session, $circ) = @_; + + throw OpenSRF::EX::InvalidArg + ("open-ils.circ.renew no circ") unless defined($circ); + my $user = $apputils->check_user_session($login_session); + my $session = OpenSRF::AppSession->create("open-ils.storage"); + + if(!ref($circ)) { + $circ = $session->request( + "open-ils.storage.direct.action.circulation.retrieve", $circ )->gather(1); + } + if($user->id ne $circ->usr) { if($apputils->check_user_perms($user->id, $user->home_ou, "RENEW_CIRC")) { return OpenILS::Perm->new("RENEW_CIRC"); @@ -726,7 +737,6 @@ sub renew { # XXX XXX See if the copy this circ points to is needed to fulfill a hold! # XXX check overdue..? - my $session = OpenSRF::AppSession->create("open-ils.storage"); my $copy = _grab_copy_by_id($session, $circ->target_copy); my $checkin = $self->method_lookup("open-ils.circ.checkin.barcode"); my ($status) = $checkin->run($login_session, $copy->barcode, 1); -- 2.43.2