[open-ils-commits] r17546 - branches/rel_2_0/Open-ILS/src/perlmods/OpenILS/Application/Actor (miker)

svn at svn.open-ils.org svn at svn.open-ils.org
Thu Sep 9 12:30:41 EDT 2010


Author: miker
Date: 2010-09-09 12:30:38 -0400 (Thu, 09 Sep 2010)
New Revision: 17546

Modified:
   branches/rel_2_0/Open-ILS/src/perlmods/OpenILS/Application/Actor/UserGroups.pm
Log:
Backport from trunk: loop over users in a group, as the plan for usrgroup+mous is terrible

Modified: branches/rel_2_0/Open-ILS/src/perlmods/OpenILS/Application/Actor/UserGroups.pm
===================================================================
--- branches/rel_2_0/Open-ILS/src/perlmods/OpenILS/Application/Actor/UserGroups.pm	2010-09-09 16:30:01 UTC (rev 17545)
+++ branches/rel_2_0/Open-ILS/src/perlmods/OpenILS/Application/Actor/UserGroups.pm	2010-09-09 16:30:38 UTC (rev 17546)
@@ -24,21 +24,21 @@
 	my $e = new_editor(authtoken=>$auth);
 	return $e->event unless $e->checkauth;
 	return $e->event unless $e->allowed('VIEW_USER');
-    return $e->json_query(
-        {
-            select => {mous => ['usr', 'balance_owed']},
-            from => 'mous',
-            where => {
-                usr => {
-                    in => {
-                        select => {au => ['id']}, 
-                        from => 'au', 
-                        where => {usrgroup => $group_id}
-                    }
-                }
+
+	my $users = $e->search_actor_user({usrgroup => $group_id}, {idlist => 1});
+    my @mous;
+
+    for my $uid ( @$users ) {
+        push @mous, @{$e->json_query(
+            {
+                select => {mous => ['usr', 'balance_owed']},
+                from => 'mous',
+                where => { usr => $uid }
             }
-        }
-    );
+        )};
+    }
+
+    return \@mous;
 }
 
 



More information about the open-ils-commits mailing list