There is currently no use case for using the past fiscal year encumbrances in mod-orders. Retrieving them without using the fiscal year id causes the risk of unwanted modifications in past year budgets.
The following methods in EncumbranceService need to be changed to use the fiscal year id as a parameter:
- buildEncumbranceOrderQuery(String orderId)
- buildEncumbranceByPoLineQuery(String polineId)
- buildUnreleaseEncumbranceByPoLineQuery(String polineId)
Also, mod-orders' code should be checked again to make sure we are not forgetting other calls that are not using fiscal year ids.
Unfortunately getting the fiscal year id is not so simple. The only way is to use the order fund distributions to get the fund and from there the ledger id and its current fiscal year (see getCurrentFiscalYearByFundId). When an order is modified, it may only have a fund distribution in storage or in the new record, so it might be necessary to check both depending on the context.
Optimizations might be needed to avoid retrieving the fund several times in the same call.
- All the calls to retrieve transactions by query should use a fiscal year id.