diff --git a/NEWS.md b/NEWS.md index 408b4d84..2b402178 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,12 @@ ## 8.7.0 - Unreleased +## 8.6.1 - Released (Quesnelia R1 2024) +The primary focus of this release was to improve the flow of editing PO fund distribution where the re-encumber flag is disabled +[Full Changelog](https://github.com/folio-org/mod-finance-storage/compare/v8.6.0...v8.6.1) + +### Bug fixes +* [MODFISTO-477](https://folio-org.atlassian.net/browse/MODFISTO-477) A new encumbrance is needed during FYRO for orders with "Re-encumber" = false + ## 8.6.0 - Released (Quesnelia R1 2024) The primary focus of this release was to introduce Batch Transactions API [Full Changelog](https://github.com/folio-org/mod-finance-storage/compare/v8.5.0...v8.6.0) diff --git a/src/main/resources/templates/db_scripts/budget_encumbrances_rollover.sql b/src/main/resources/templates/db_scripts/budget_encumbrances_rollover.sql index c526b417..7fcd1b13 100644 --- a/src/main/resources/templates/db_scripts/budget_encumbrances_rollover.sql +++ b/src/main/resources/templates/db_scripts/budget_encumbrances_rollover.sql @@ -36,6 +36,12 @@ CREATE OR REPLACE FUNCTION ${myuniversity}_${mymodule}.calculate_planned_encumbr input_fromFiscalYearId uuid := (_rollover_record->>'fromFiscalYearId')::uuid; BEGIN + IF + NOT((_transaction->'encumbrance'->>'reEncumber')::boolean) + THEN + RETURN 0.0; + END IF; + SELECT sum((jsonb->'encumbrance'->>'initialAmountEncumbered')::decimal) INTO po_line_cost FROM ${myuniversity}_${mymodule}.transaction WHERE input_fromFiscalYearId=fiscalYearId AND ${myuniversity}_${mymodule}.to_btree_format(jsonb->'encumbrance'->>'sourcePoLineId')=_transaction->'encumbrance'->>'sourcePoLineId' @@ -131,7 +137,10 @@ CREATE OR REPLACE FUNCTION ${myuniversity}_${mymodule}.rollover_order(_order_id 'initialAmountEncumbered', ${myuniversity}_${mymodule}.calculate_planned_encumbrance_amount(tr.jsonb, _rollover_record, true), 'amountAwaitingPayment', 0, 'amountExpended', 0, - 'status', 'Unreleased' + 'status', CASE WHEN (tr.jsonb->'encumbrance'->>'reEncumber')::boolean + THEN 'Unreleased' + ELSE 'Released' + END ), 'metadata', _rollover_record->'metadata' || jsonb_build_object('createdDate', to_char(clock_timestamp(),'YYYY-MM-DD"T"HH24:MI:SS.MSTZHTZM')) @@ -140,7 +149,7 @@ CREATE OR REPLACE FUNCTION ${myuniversity}_${mymodule}.rollover_order(_order_id LEFT JOIN ${myuniversity}_${mymodule}.fund fund ON fund.id = tr.fromFundId WHERE ${myuniversity}_${mymodule}.to_btree_format(tr.jsonb->'encumbrance'->>'sourcePurchaseOrderId')=_order_id AND tr.fiscalYearId=input_fromFiscalYearId - AND (tr.jsonb->'encumbrance'->>'reEncumber')::boolean AND tr.jsonb->'encumbrance'->>'orderStatus'='Open' + AND tr.jsonb->'encumbrance'->>'orderStatus'='Open' AND (_rollover_record->>'rolloverType' <> 'Preview' OR (_rollover_record->>'rolloverType' = 'Preview' AND fund.ledgerId = input_ledgerId)); -- #9.1 calculate and add missing penny to appropriate temp transaction @@ -708,7 +717,6 @@ CREATE OR REPLACE FUNCTION ${myuniversity}_${mymodule}.budget_encumbrances_rollo WHERE tr.jsonb->>'transactionType' = 'Encumbrance' AND tr.fiscalYearId = input_fromFiscalYearId AND tr.jsonb->'encumbrance'->>'orderStatus' = 'Open' - AND (tr.jsonb->'encumbrance'->>'reEncumber')::boolean AND ledger.id=input_ledgerId GROUP BY order_id ORDER BY date diff --git a/src/main/resources/templates/db_scripts/schema.json b/src/main/resources/templates/db_scripts/schema.json index ad3f4773..69c77db2 100644 --- a/src/main/resources/templates/db_scripts/schema.json +++ b/src/main/resources/templates/db_scripts/schema.json @@ -74,7 +74,7 @@ { "run": "after", "snippetPath": "budget_encumbrances_rollover.sql", - "fromModuleVersion": "mod-finance-storage-8.6.0" + "fromModuleVersion": "mod-finance-storage-8.6.1" }, { "run": "after",