diff --git a/fineract-core/src/main/java/org/apache/fineract/portfolio/PortfolioProductType.java b/fineract-core/src/main/java/org/apache/fineract/portfolio/PortfolioProductType.java index fc6f313f3..2f4895e09 100644 --- a/fineract-core/src/main/java/org/apache/fineract/portfolio/PortfolioProductType.java +++ b/fineract-core/src/main/java/org/apache/fineract/portfolio/PortfolioProductType.java @@ -55,17 +55,25 @@ public enum PortfolioProductType { return null; } + // Matched against each constant's own declared value above, not its declaration position -- + // those two orderings diverge (CLIENT is declared 3rd but its value is 5), so a switch written + // by position silently mapped every id past SAVING to the wrong type: 3 (really PROVISIONING) + // returned CLIENT, 4 (really SHARES) returned PROVISIONING, 5 (really CLIENT) returned SHARES, + // and 6 (CURRENT) fell through to null -- a live NPE the moment a Current-product GL entry + // (entity_type_enum=6) reached this on the Journal Entries screen. switch (v) { case 1: return LOAN; case 2: return SAVING; case 3: - return CLIENT; - case 4: return PROVISIONING; - case 5: + case 4: return SHARES; + case 5: + return CLIENT; + case 6: + return CURRENT; default: return null; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/clerkdisbursement/api/ClerkDisbursementRequestApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/clerkdisbursement/api/ClerkDisbursementRequestApiResource.java index 56f55e3ba..00e292a9a 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/clerkdisbursement/api/ClerkDisbursementRequestApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/clerkdisbursement/api/ClerkDisbursementRequestApiResource.java @@ -631,7 +631,15 @@ public class ClerkDisbursementRequestApiResource { return ps; }, btLogKh); final long btLogId = Objects.requireNonNull(btLogKh.getKey()).longValue(); - final String btVoucherNo = generateBtVoucherNo(btLogId, currentUser, finalBtTotal); + // submit() already raised this request's voucher (every request type does, so it + // shows in My Vouchers the moment a clerk submits it, before any checker acts) -- + // minting a second one here for Bank Transfer specifically double-counted the same + // transfer under two different names, "Entered by" whoever raised it AND whoever + // approved it. Reuse that voucher; only fall back to raising a fresh one if this + // request somehow reached approval without it (defensive, not the normal path). + final Object existingVoucherNo = record.get("voucher_no"); + final String btVoucherNo = existingVoucherNo != null ? (String) existingVoucherNo + : generateBtVoucherNo(btLogId, currentUser, finalBtTotal); jdbcTemplate.update("UPDATE m_bank_transfer_log SET voucher_no = ? WHERE id = ?", btVoucherNo, btLogId); } diff --git a/fineract-provider/src/main/resources/db/changelog/tenant/final-changelog-tenant.xml b/fineract-provider/src/main/resources/db/changelog/tenant/final-changelog-tenant.xml index 56a28f9a0..bbb450357 100644 --- a/fineract-provider/src/main/resources/db/changelog/tenant/final-changelog-tenant.xml +++ b/fineract-provider/src/main/resources/db/changelog/tenant/final-changelog-tenant.xml @@ -136,4 +136,5 @@ + diff --git a/fineract-provider/src/main/resources/db/changelog/tenant/parts/0585_fix_current_product_od_scheme_pending_columns.xml b/fineract-provider/src/main/resources/db/changelog/tenant/parts/0585_fix_current_product_od_scheme_pending_columns.xml new file mode 100644 index 000000000..071cc2974 --- /dev/null +++ b/fineract-provider/src/main/resources/db/changelog/tenant/parts/0585_fix_current_product_od_scheme_pending_columns.xml @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +