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

svn at svn.open-ils.org svn at svn.open-ils.org
Mon Aug 9 10:35:18 EDT 2010


Author: erickson
Date: 2010-08-09 10:35:16 -0400 (Mon, 09 Aug 2010)
New Revision: 17137

Modified:
   trunk/Open-ILS/src/perlmods/OpenILS/SIP/Item.pm
Log:
combine circ and user fetch into 1 cstore call for SIP items.  minor cleanup

Modified: trunk/Open-ILS/src/perlmods/OpenILS/SIP/Item.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/SIP/Item.pm	2010-08-09 14:33:52 UTC (rev 17136)
+++ trunk/Open-ILS/src/perlmods/OpenILS/SIP/Item.pm	2010-08-09 14:35:16 UTC (rev 17137)
@@ -93,27 +93,32 @@
 				}
 			}
 		]
-    );
+    )->[0];
 
-
-    $copy = $copy->[0];
-
 	if(!$copy) {
 		syslog("LOG_DEBUG", "OILS: Item '%s' : not found", $item_id);
 		return undef;
 	}
 
-	my ($circ) = $U->fetch_open_circulation($copy->id);
-	if ($circ) {
-		# if i am checked out, set $self->{patron} to the user's barcode
-		my $user = $e->retrieve_actor_user(
-			[
-				$circ->usr,
-				{ flesh => 1, flesh_fields => { "au" => [ 'card' ] } }
-			]
-		);
+    my $circ = $e->search_action_circulation([
+        {
+            target_copy => $copy->id,
+            stop_fines_time => undef, 
+            checkin_time => undef
+        },
+        {
+            flesh => 2,
+            flesh_fields => {
+                circ => ['usr'],
+                au => ['card']
+            }
+        }
+    ])->[0];
 
-        my $bc = ($user) ? $user->card->barcode : "";
+    if($circ) {
+
+        my $user = $circ->usr;
+        my $bc = ($user->card) ? $user->card->barcode : '';
         $self->{patron} = $bc;
         $self->{patron_object} = $user;
 



More information about the open-ils-commits mailing list