From a309ecbfa82dc8e81e1818d3895f160ed8ecce1b Mon Sep 17 00:00:00 2001 From: erickson Date: Tue, 31 Aug 2010 12:48:32 +0000 Subject: [PATCH] use current_loc as the circ_lib for checkin if provided and formatted as a valid org shortname git-svn-id: svn://svn.open-ils.org/ILS/trunk@17401 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/src/perlmods/OpenILS/SIP/Transaction/Checkin.pm | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Open-ILS/src/perlmods/OpenILS/SIP/Transaction/Checkin.pm b/Open-ILS/src/perlmods/OpenILS/SIP/Transaction/Checkin.pm index a4ee85371..20fe8cf98 100644 --- a/Open-ILS/src/perlmods/OpenILS/SIP/Transaction/Checkin.pm +++ b/Open-ILS/src/perlmods/OpenILS/SIP/Transaction/Checkin.pm @@ -53,6 +53,7 @@ sub resensitize { return !$self->{item}->magnetic; } +my %org_sn_cache; sub do_checkin { my $self = shift; my ($inst_id, $trans_date, $return_date, $current_loc, $item_props) = @_; # most unused @@ -64,11 +65,19 @@ sub do_checkin { $inst_id ||= ''; + my $args = {barcode => $self->{item}->id}; + if($current_loc) { + my $org_id = (defined $org_sn_cache{$current_loc}) ? + $org_sn_cache{$current_loc} : + OpenILS::SIP->editor()->search_actor_org_unit({shortname => $current_loc}, {idlist => 1})->[0]; + $org_sn_cache{$current_loc} = $org_id; + $args->{circ_lib} = $org_id if defined $org_id; + } + my $resp = $U->simplereq( 'open-ils.circ', 'open-ils.circ.checkin', - $self->{authtoken}, - { barcode => $self->{item}->id } + $self->{authtoken}, $args ); if ($debug) { -- 2.11.0