[open-ils-commits] r8621 -
branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Acq
svn at svn.open-ils.org
svn at svn.open-ils.org
Mon Feb 4 19:22:49 EST 2008
Author: erickson
Date: 2008-02-04 18:54:35 -0500 (Mon, 04 Feb 2008)
New Revision: 8621
Modified:
branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Acq/Financials.pm
Log:
changed fund-source retrieval to return all viewable sources if no specific org is specified
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-02-04 23:41:43 UTC (rev 8620)
+++ branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Acq/Financials.pm 2008-02-04 23:54:35 UTC (rev 8621)
@@ -115,38 +115,27 @@
desc => 'Retrieves all the funding_sources associated with an org unit that the requestor has access to see',
params => [
{desc => 'Authentication token', type => 'string'},
- {desc => 'Org Unit ID', type => 'number'},
- {desc => 'Hash or options, including "descendants",
- includes funding_sources for descendant orgs in addition to the requested org;
- "ancestor", includes ancestor org funding_sources;
- "full_path", includes orgs for ancestors and descendants',
- type => 'hash'},
+ {desc => 'Org Unit ID. If no ID is provided, this method returns the
+ full set of funding sources this user has permission to view', type => 'number'},
],
return => {desc => 'The funding_source objects on success, Event on failure'}
}
);
sub retrieve_org_funding_sources {
- my($self, $conn, $auth, $org_id, $options) = @_;
+ my($self, $conn, $auth, $org_id) = @_;
my $e = new_editor(authtoken=>$auth);
return $e->event unless $e->checkauth;
- return $e->event unless $e->allowed('VIEW_FUNDING_SOURCE', $org_id);
- my $orglist = [$org_id];
- if($$options{full_path}) {
- $orglist = org_descendants($org_id);
- push(@$orglist, @{org_ancestors($org_id)});
- } else {
- $orglist = org_descendants($org_id) if $$options{descendants};
- $orglist = org_ancestors($org_id) if $$options{ancestors};
- }
+ my $org_ids = ($org_id) ? [$org_id] :
+ $U->find_highest_work_orgs($e, 'VIEW_FUNDING_SOURCE');
- my @search_orgs;
- for my $orgid (@$orglist) {
- push(@search_orgs, $orgid) if $e->allowed('VIEW_FUNDING_SOURCE', $orgid);
- }
+ return [] unless @$org_ids;
- my $search = {owner => \@search_orgs};
+ my @orglist;
+ push(@orglist, @{org_descendants($_)}) for @$org_ids;
+
+ my $search = {owner => \@orglist};
my $funding_sources = $e->search_acq_funding_source($search) or return $e->event;
return $funding_sources;
}
More information about the open-ils-commits
mailing list