[open-ils-commits] r15491 - trunk/Open-ILS/src/perlmods/OpenILS/Application/Acq (erickson)

svn at svn.open-ils.org svn at svn.open-ils.org
Tue Feb 9 21:41:10 EST 2010


Author: erickson
Date: 2010-02-09 21:41:09 -0500 (Tue, 09 Feb 2010)
New Revision: 15491

Modified:
   trunk/Open-ILS/src/perlmods/OpenILS/Application/Acq/Financials.pm
Log:
ML stub for fiscal rollover processing.

Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Acq/Financials.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Acq/Financials.pm	2010-02-10 01:58:42 UTC (rev 15490)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Acq/Financials.pm	2010-02-10 02:41:09 UTC (rev 15491)
@@ -1185,5 +1185,54 @@
 }
 
 
+__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;
 



More information about the open-ils-commits mailing list