From d8386daa67d48b5da602ad846f0038d586193090 Mon Sep 17 00:00:00 2001 From: erickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4> Date: Wed, 10 Feb 2010 02:41:09 +0000 Subject: [PATCH] ML stub for fiscal rollover processing. git-svn-id: svn://svn.open-ils.org/ILS/trunk@15491 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../perlmods/OpenILS/Application/Acq/Financials.pm | 49 ++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Acq/Financials.pm b/Open-ILS/src/perlmods/OpenILS/Application/Acq/Financials.pm index f96a1be63f..9f06966468 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Acq/Financials.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Acq/Financials.pm @@ -1185,5 +1185,54 @@ sub update_po_events { } +__PACKAGE__->register_method ( + method => 'process_fiscal_rollover', + api_name => 'open-ils.acq.fiscal_rollover.process', + stream => 1, +); + +__PACKAGE__->register_method ( + method => 'process_fiscal_rollover', + api_name => 'open-ils.acq.fiscal_rollover.process.dry_run', + stream => 1, +); + +sub process_fiscal_rollover { + my( $self, $conn, $auth, $org_id, $year, $descendants ) = @_; + + my $e = new_editor(xact=>1, authtoken=>$auth); + return $e->die_event unless $e->checkauth; + return $e->die_event unless $e->allowed('ADMIN_FUND', $org_id); + + # Create next year's funds + $e->json_query({ + from => [ + ($descendants) ? + 'acq.propagate_funds_by_org_tree' : + 'acq.propagate_funds_by_org_unit', + $year, $e->requestor->id, $org_id + ] + }); + + # Roll the uncumbrances over to the newly create funds + $e->json_query({ + from => [ + ($descendants) ? + 'acq.rollover_funds_by_org_tree' : + 'acq.rollover_funds_by_org_unit', + $year, $e->requestor->id, $org_id + ] + }); + + # TODO + # Loop over the newly created funds (funds for $year + 1 for + # selected org units) and stream back the new fund, including + # fund summary and total debits + + $self->api_name =~ /dry_run/ and $e->rollback or $e->commit; + return undef; +} + + 1; -- 2.11.0