Uploaded image for project: 'mod-finance-storage'
  1. mod-finance-storage
  2. MODFISTO-326

Create a script to fix Lotus encumbrance issues



    • ACQ Sprint 144, ACQ Sprint 145, ACQ Sprint 146, ACQ Sprint 147
    • 2
    • Thunderjet
    • Not For Release
    • TBD


      An external script needs to be created to fix issues with encumbrances in Lotus.

      The related fixes in Morning Glory cannot safely be added to a hotfix because they are complex. Also, because finding encumbrances of closed orders without using the encumbrance's orderStatus property cannot be done in a database migration, some issues cannot be fixed in the migration to Morning Glory (although they should be fixed after a rollover in Morning Glory).

      Issues to resolve :

      Lotus environments, before rollover, might have:

      1. closed orders with encumbrances having orderStatus=Open and status=Released (MODORDERS-712)

      Lotus environments, after rollover, might have:

      1. closed orders with encumbrances having orderStatus=Open and status=Released (MODORDERS-712)
      2. open orders with encumbrances having orderStatus=Open and status=Released when they should be Unreleased (MODFISTO-325)
      3. wrong budgets because something was done to these orders (such as changing the fund distribution) (MODFISTO-325)

      Logic :

      1. Fix encumbrances orderStatus for closed orders. In order to do this, the relevant encumbrances have to be unreleased first and released afterwards because it is not possible to change orderStatus of released encumbrances.
      2. Change encumbrance status to Unreleased for all open orders' encumbrances with non-zero amounts
      3. Recalculate the encumbered property for all the budgets related to these encumbrances
      4. Release all unreleased encumbrances for closed orders

      Additional specifications :

      • The script needs to be able to handle tens of thousands of orders. This could be a problem with Postman because it runs out of memory for a large number of requests; python can be used instead.
      • Running the script twice should not change the result.

      Running the script :

      The script should not be used before a rollover in Lotus (because if it was, encumbrances would not be created for closed orders, and they could not be reopened - see MODORDERS-706). It can be used after a rollover for all ledgers, or just before migration to Morning Glory. If necessary it could also be used in Morning Glory.

      Operations affecting order encumbrances or budgets should be avoided while the script is running. It could take a long time with a large number of orders.

      Script arguments :

      • Fiscal year code
      • Okapi URL
      • Tenant
      • Username
      • User password is required as a command-line input.

      Execution example :
          ./fix_lotus_encumbrances.py 'FY2022' 'http://localhost:9130/' 'diku' 'diku_admin'

      Required permissions for the user :

      • finance.budgets.collection.get
      • finance.encumbrances.item.put
      • finance.fiscal-years.collection.get
      • finance.order-transaction-summaries.item.put
      • finance.transactions.collection.get
      • finance.transactions.item.get
      • finance-storage.budgets.item.put
      • orders.collection.get

      TestRail: Results


          Issue Links



                dennisbridges Dennis Bridges
                damieng Damien Guillaume
                0 Vote for this issue
                8 Start watching this issue



                  TestRail: Runs

                    TestRail: Cases