Effective date not calculated correctly for invoices including purged amounts
Description
The user is receiving an error during import saying the system could not calculate encumbrances correctly during the EncumbranceLedgerJob.
This problem comes from an invoice in the system that has a payment date matching the following two criteria:
The payment was in an earlier posting period than the invoice date (the user back-dated the check in classic)
The system was purged as of a date that is between the invoice date and the payment date
The result of this happening is an invoice that is still on file with a missing disbursement (it was purged because its date is before the cutoff date). Later, when the system tries to calculate an effective date for the disbursement impact on encumbrance, it can't find a disbursement for the invoice that indicates it was paid and returns null for the effective date.
To fix this problem we need to do the following:
Update the PurchaseOrderImportImpl to import the datePaid field as PurchaseOrderCharge.legacyPaidDate. It is currently being imported as the cancelled date if the item/charged was cancelled. Otherwise, it is ignored.
Update the code that calculates the payment date to look at the newly-imported standard custom field if the expected disbursement is missing.
In the case where we fall back to in imported paid date, we need to log a warning message notifying the user that we expected to find a disbursement in the database but we couldn't so we had to fall back to an imported date.
I decided to give it one more try before the night was over and finally got passed the issue I was having. Now I only have a data problem in the images I created. When the qa database got anonymized the historical data was truncated causing an error in a call to getModifiable in one of our rules. This is a known bug with anonymized data sets. I'm not sure how we're going to fix this since this dataset has to go in the public repository. I need to talk with Dave and Jodi about this.
The user is receiving an error during import saying the system could not calculate encumbrances correctly during the EncumbranceLedgerJob.
This problem comes from an invoice in the system that has a payment date matching the following two criteria:
The payment was in an earlier posting period than the invoice date (the user back-dated the check in classic)
The system was purged as of a date that is between the invoice date and the payment date
The result of this happening is an invoice that is still on file with a missing disbursement (it was purged because its date is before the cutoff date). Later, when the system tries to calculate an effective date for the disbursement impact on encumbrance, it can't find a disbursement for the invoice that indicates it was paid and returns null for the effective date.
To fix this problem we need to do the following:
Update the PurchaseOrderImportImpl to import the datePaid field as PurchaseOrderCharge.legacyPaidDate. It is currently being imported as the cancelled date if the item/charged was cancelled. Otherwise, it is ignored.
Update the code that calculates the payment date to look at the newly-imported standard custom field if the expected disbursement is missing.
In the case where we fall back to in imported paid date, we need to log a warning message notifying the user that we expected to find a disbursement in the database but we couldn't so we had to fall back to an imported date.