the reason I wanted to pass in an editor here, so I could flesh the users for their...
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 29 Mar 2010 20:36:12 +0000 (20:36 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 29 Mar 2010 20:36:12 +0000 (20:36 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@16044 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/Application/Acq/Order.pm

index b5ab89b..a08dc09 100644 (file)
@@ -2717,8 +2717,15 @@ sub create_user_request_events {
     my $ses = OpenSRF::AppSession->create('open-ils.trigger');
     $ses->connect;
 
+    my %cached_usr_home_ou = ();
     for my $user_req (@$user_reqs) {
-        my $req = $ses->request('open-ils.trigger.event.autocreate', $hook, $user_req, $user_req->usr->home_ou);
+        my $home_ou = $cached_usr_home_ou{$user_req->usr};
+        if (! $home_ou) {
+            my $user = $e->retrieve_actor_user($user_req->usr) or return $e->die_event;
+            $home_ou = $user->home_ou;
+            $cached_usr_home_ou{$user_req->usr} = $home_ou;
+        }
+        my $req = $ses->request('open-ils.trigger.event.autocreate', $hook, $user_req, $home_ou);
         $req->recv;
     }