From: erickson Date: Mon, 17 Aug 2009 16:12:06 +0000 (+0000) Subject: added companion api call to fund list retrieval which returns unique set of fund... X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=27fcd61093cb540c52e17ca7ad2d83a95b39a37d;p=evergreen%2Fbjwebb.git added companion api call to fund list retrieval which returns unique set of fund years based on the provided query git-svn-id: svn://svn.open-ils.org/ILS/trunk@13846 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Acq/Financials.pm b/Open-ILS/src/perlmods/OpenILS/Application/Acq/Financials.pm index 4c843f489..54e7a7216 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Acq/Financials.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Acq/Financials.pm @@ -285,6 +285,11 @@ __PACKAGE__->register_method( } ); +__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 @@ sub retrieve_org_funds { $U->user_has_work_perm_at($e, $limit_perm, {descendants =>1}); return undef unless @{$filter->{org}}; - my $query = [ $filter, { @@ -310,6 +314,19 @@ sub retrieve_org_funds { } ]; + 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) {