[open-ils-commits] r13846 - trunk/Open-ILS/src/perlmods/OpenILS/Application/Acq (erickson)
svn at svn.open-ils.org
svn at svn.open-ils.org
Mon Aug 17 12:12:09 EDT 2009
Author: erickson
Date: 2009-08-17 12:12:06 -0400 (Mon, 17 Aug 2009)
New Revision: 13846
Modified:
trunk/Open-ILS/src/perlmods/OpenILS/Application/Acq/Financials.pm
Log:
added companion api call to fund list retrieval which returns unique set of fund years based on the provided query
Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Acq/Financials.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Acq/Financials.pm 2009-08-17 14:30:01 UTC (rev 13845)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Acq/Financials.pm 2009-08-17 16:12:06 UTC (rev 13846)
@@ -285,6 +285,11 @@
}
);
+__PACKAGE__->register_method(
+ method => 'retrieve_org_funds',
+ api_name => 'open-ils.acq.fund.org.years.retrieve');
+
+
sub retrieve_org_funds {
my($self, $conn, $auth, $filter, $options) = @_;
my $e = new_editor(authtoken=>$auth);
@@ -300,7 +305,6 @@
$U->user_has_work_perm_at($e, $limit_perm, {descendants =>1});
return undef unless @{$filter->{org}};
-
my $query = [
$filter,
{
@@ -310,6 +314,19 @@
}
];
+ if($self->api_name =~ /years/) {
+ # return the distinct set of fund years covered by the selected funds
+ my $data = $e->json_query({
+ select => {
+ acqf => [{column => 'year', transform => 'distinct'}]
+ },
+ from => 'acqf',
+ where => $filter}
+ );
+
+ return [map { $_->{year} } @$data];
+ }
+
my $funds = $e->search_acq_fund($query);
for my $fund (@$funds) {
More information about the open-ils-commits
mailing list