[open-ils-commits] r17401 - trunk/Open-ILS/src/perlmods/OpenILS/SIP/Transaction (erickson)

svn at svn.open-ils.org svn at svn.open-ils.org
Tue Aug 31 08:48:34 EDT 2010


Author: erickson
Date: 2010-08-31 08:48:32 -0400 (Tue, 31 Aug 2010)
New Revision: 17401

Modified:
   trunk/Open-ILS/src/perlmods/OpenILS/SIP/Transaction/Checkin.pm
Log:
use current_loc as the circ_lib for checkin if provided and formatted as a valid org shortname

Modified: trunk/Open-ILS/src/perlmods/OpenILS/SIP/Transaction/Checkin.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/SIP/Transaction/Checkin.pm	2010-08-31 12:48:31 UTC (rev 17400)
+++ trunk/Open-ILS/src/perlmods/OpenILS/SIP/Transaction/Checkin.pm	2010-08-31 12:48:32 UTC (rev 17401)
@@ -53,6 +53,7 @@
     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 @@
 
     $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) {



More information about the open-ils-commits mailing list