[open-ils-commits] r18402 - in trunk/Open-ILS/src/perlmods/OpenILS: . SIP/Transaction (erickson)

svn at svn.open-ils.org svn at svn.open-ils.org
Wed Oct 20 11:23:37 EDT 2010


Author: erickson
Date: 2010-10-20 11:23:35 -0400 (Wed, 20 Oct 2010)
New Revision: 18402

Modified:
   trunk/Open-ILS/src/perlmods/OpenILS/SIP.pm
   trunk/Open-ILS/src/perlmods/OpenILS/SIP/Transaction/Checkin.pm
Log:
during checkin, an item's hold may have a fleshed pickup_lib.  added code to detect and protect against treating a ref as an ID.  minor cleanup

Modified: trunk/Open-ILS/src/perlmods/OpenILS/SIP/Transaction/Checkin.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/SIP/Transaction/Checkin.pm	2010-10-20 14:47:32 UTC (rev 18401)
+++ trunk/Open-ILS/src/perlmods/OpenILS/SIP/Transaction/Checkin.pm	2010-10-20 15:23:35 UTC (rev 18402)
@@ -168,14 +168,24 @@
     }
 
     if ($self->item->hold) {
-        my $holder = OpenILS::SIP->find_patron('usr' => $self->item->hold->usr) or
-            syslog('LOG_WARNING', "OpenILS::SIP->find_patron cannot find hold usr => '" . $self->item->hold->usr . "'");
+        my ($pickup_lib_id, $pickup_lib_sn);
 
-        $self->item->hold_patron_bcode( $holder->id   );
-        $self->item->hold_patron_name(  $holder->name );     # Item already had the holder ID, we really just needed the name
-        $self->item->destination_loc( OpenILS::SIP::shortname_from_id($self->item->hold->pickup_lib) );   # must use pickup_lib as method
+        my $holder = OpenILS::SIP->find_patron('usr' => $self->item->hold->usr);
 
-        my $atype = ($self->item->hold->pickup_lib == $phys_location) ? '01' : '02';
+        if (ref $self->item->hold->pickup_lib) {
+            $pickup_lib_id = $self->item->hold->pickup_lib->id;
+            $pickup_lib_sn = $self->item->hold->pickup_lib->shortname;
+
+        } else {
+            $pickup_lib_id = $self->item->hold->pickup_lib;
+            $pickup_lib_sn = OpenILS::SIP::shortname_from_id($pickup_lib_id);
+        }
+
+        $self->item->hold_patron_bcode($holder->id);
+        $self->item->hold_patron_name($holder->name); 
+        $self->item->destination_loc($pickup_lib_sn); 
+
+        my $atype = ($pickup_lib_id == $phys_location) ? '01' : '02';
         $self->alert_type($atype);
     }
 

Modified: trunk/Open-ILS/src/perlmods/OpenILS/SIP.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/SIP.pm	2010-10-20 14:47:32 UTC (rev 18401)
+++ trunk/Open-ILS/src/perlmods/OpenILS/SIP.pm	2010-10-20 15:23:35 UTC (rev 18402)
@@ -151,7 +151,8 @@
 
 sub shortname_from_id {
     my $id = shift or return;
-    return editor()->search_actor_org_unit({id => $id})->[0]->shortname;
+    return $id->shortname if ref $id;
+    return editor()->retrieve_actor_org_unit($id)->shortname;
 }
 sub patron_barcode_from_id {
     my $id = shift or return;



More information about the open-ils-commits mailing list