use current_loc as the circ_lib for checkin if provided and formatted as a valid...
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 31 Aug 2010 12:48:32 +0000 (12:48 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 31 Aug 2010 12:48:32 +0000 (12:48 +0000)
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

index a4ee853..20fe8cf 100644 (file)
@@ -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) {