loop over users in a group, as the plan for usrgroup+mous is terrible
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 9 Sep 2010 16:30:01 +0000 (16:30 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 9 Sep 2010 16:30:01 +0000 (16:30 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@17545 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/Application/Actor/UserGroups.pm

index 0d2305d..7691fe5 100644 (file)
@@ -24,21 +24,21 @@ sub group_money_summary {
        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;
 }