[open-ils-commits] r8360 - branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Acq

svn at svn.open-ils.org svn at svn.open-ils.org
Wed Jan 9 10:04:20 EST 2008


Author: erickson
Date: 2008-01-09 09:39:47 -0500 (Wed, 09 Jan 2008)
New Revision: 8360

Modified:
   branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Acq/Financials.pm
Log:
added child fund fetching logic

Modified: branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Acq/Financials.pm
===================================================================
--- branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Acq/Financials.pm	2008-01-09 14:39:02 UTC (rev 8359)
+++ branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Acq/Financials.pm	2008-01-09 14:39:47 UTC (rev 8360)
@@ -68,9 +68,24 @@
     my $e = new_editor(authtoken=>$auth);
     return $e->event unless $e->checkauth;
     return $e->event unless $e->allowed('VIEW_FUND', $org_id);
-    my $fund = $e->retrieve_acq_fund($fund_id) or return $e->event;
-    # XXX add descendant logic
-    return $fund;
+
+    my $search = {owner => $org_id};
+
+    if($$options{children}) {
+        $org_list = $e->search_actor_org_unit([
+            {id => $org_id}, {
+                flesh => -1,
+                flesh_fields => {aou => ['children']}
+            }
+        ]);
+
+        my $org_ids = [];
+        push(@$org_ids, $_->id) for @$org_list;
+        $search = {owner => $org_ids};
+    }
+
+    my $funds = $e->search_acq_fund($search) or return $e->event;
+    return $funds; 
 }
 
 



More information about the open-ils-commits mailing list