From 7add27a4ea85427a853c23c40d93edb7e8751619 Mon Sep 17 00:00:00 2001 From: Muhimbura Brian Mart Date: Wed, 3 Jul 2024 17:19:48 +0300 Subject: [PATCH 1/6] Fic 689 --- .../PrequalificationChecklistWritePlatformServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/prequalification/service/PrequalificationChecklistWritePlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/prequalification/service/PrequalificationChecklistWritePlatformServiceImpl.java index a30a4d3dfd1..6b1b5cc0375 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/organisation/prequalification/service/PrequalificationChecklistWritePlatformServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/prequalification/service/PrequalificationChecklistWritePlatformServiceImpl.java @@ -542,7 +542,7 @@ private CheckValidationColor runCheck6(final GroupData groupData) { reportParams.put("${loanProductId}", productId); reportParams.put("${clientCategorization}", clientCategorization); reportParams.put("${clientArea}", clientArea); - reportParams.put("${categorization}", groupData.getTopupMembers().size() > 0 ? "RECREDITO" : "NUEVO"); + reportParams.put("${categorization}", recreditPercent.compareTo(BigDecimal.valueOf(50L)) >= 0 ? "RECREDITO" : "NUEVO"); reportParams.put("${numberOfMembers}", numberOfMembers); reportParams.put("${numberOfRecurringMembers}", numberOfRecurringMembers); reportParams.put("${recreditPercent}", recreditPercent.toPlainString()); From 2c24e852d8431a739d139e933578328db37cf99b Mon Sep 17 00:00:00 2001 From: Brian Muhimbura Date: Thu, 4 Jul 2024 16:12:22 +0300 Subject: [PATCH 2/6] Fic 705 (#887) --- .../PrequalificationChecklistReadPlatformServiceImpl.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/prequalification/service/PrequalificationChecklistReadPlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/prequalification/service/PrequalificationChecklistReadPlatformServiceImpl.java index b49277af21b..242005818ad 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/organisation/prequalification/service/PrequalificationChecklistReadPlatformServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/prequalification/service/PrequalificationChecklistReadPlatformServiceImpl.java @@ -92,15 +92,14 @@ public PrequalificationChecklistData retrieveHardPolicyValidationResults(final L PrequalificationType.INDIVIDUAL.name()); final List memberColumnHeaders = new ArrayList<>( List.of("label.heading.clientid", "label.heading.clientname", "label.heading.dpi")); -// individualPolicies.forEach(policy -> memberColumnHeaders.add(policy.getDescription())); final List> memberRows = new ArrayList<>(); for (PrequalificationGroupMember member : prequalificationGroup.getMembers()) { final List memberRow = new ArrayList<>(); String memberId = null; String clientName; String dpi; - for (ChecklistValidationResult validationResult : validationResults) { - for (PolicyData policy : individualPolicies) { + for (PolicyData policy : individualPolicies) { + for (ChecklistValidationResult validationResult : validationResults) { if (policy.getId().equals(validationResult.getPolicyId()) && PrequalificationType.INDIVIDUAL.getValue().equals(validationResult.getPrequalificationTypeEnum()) && member.getId().equals(validationResult.getMemberId().longValue())) { @@ -115,7 +114,6 @@ public PrequalificationChecklistData retrieveHardPolicyValidationResults(final L memberColumnHeaders.add(policy.getDescription()); } memberRow.add(validationColor); - break; } From ee257bb2fff1efbeb1254d538001b43d15438368 Mon Sep 17 00:00:00 2001 From: Brian Muhimbura Date: Thu, 4 Jul 2024 20:06:57 +0300 Subject: [PATCH 3/6] Fix/fbr 707 (#890) * Fic 705 * Fic 707 --- .../loanaccount/domain/GroupLoanAdditionals.java | 10 +++++----- ...plicationWritePlatformServiceJpaRepositoryImpl.java | 1 - .../parts/0112_FBR_417_additional_group_loan_data.xml | 4 ++++ 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/GroupLoanAdditionals.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/GroupLoanAdditionals.java index 72a976168f8..95fb4f22853 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/GroupLoanAdditionals.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/GroupLoanAdditionals.java @@ -157,7 +157,7 @@ public class GroupLoanAdditionals extends AbstractPersistableCustom { private BigDecimal totalExternalLoanAmount; @Column(name = "total_installments") - private Integer totalInstallments; + private BigDecimal totalInstallments; @Column(name = "client_type") private Long clientType; @@ -258,7 +258,7 @@ public class GroupLoanAdditionals extends AbstractPersistableCustom { protected GroupLoanAdditionals() {} public GroupLoanAdditionals(Integer loanCycleCompleted, BigDecimal rentFee, BigDecimal mortgageFee, BigDecimal monthlyIncome, - BigDecimal familyExpenses, BigDecimal totalExternalLoanAmount, Integer totalInstallments, Long clientType, + BigDecimal familyExpenses, BigDecimal totalExternalLoanAmount, BigDecimal totalInstallments, Long clientType, String houseHoldGoods, String businessActivities, Long businessLocation, Integer businessExperience, BigDecimal salesValue, BigDecimal businessPurchases, BigDecimal businessProfit, BigDecimal clientProfit, BigDecimal inventories, Long visitBusiness, Long familySupport, Long businessEvolution, Integer numberOfApprovals, String recommenderName, @@ -352,7 +352,7 @@ public static GroupLoanAdditionals assembleFromJson(JsonCommand command, Loan lo BigDecimal monthlyIncome = command.bigDecimalValueOfParameterNamed("monthlyIncome"); BigDecimal familyExpenses = command.bigDecimalValueOfParameterNamed("familyExpenses"); BigDecimal totalExternalLoanAmount = command.bigDecimalValueOfParameterNamed("totalExternalLoanAmount"); - Integer totalInstallments = command.integerValueOfParameterNamed("totalInstallments"); + BigDecimal totalInstallments = command.bigDecimalValueOfParameterNamed("totalInstallments"); Long clientType = command.longValueOfParameterNamed("clientType"); String houseHoldGoods = command.stringValueOfParameterNamed("houseHoldGoods"); String businessActivities = command.stringValueOfParameterNamed("businessActivities"); @@ -468,8 +468,8 @@ public Map update(final JsonCommand command) { actualChanges.put("totalExternalLoanAmount", newValue); this.totalExternalLoanAmount = newValue; } - if (command.isChangeInIntegerParameterNamed("totalInstallments", this.totalInstallments)) { - final Integer newValue = command.integerValueOfParameterNamed("totalInstallments"); + if (command.isChangeInBigDecimalParameterNamed("totalInstallments", this.totalInstallments)) { + final BigDecimal newValue = command.bigDecimalValueOfParameterNamed("totalInstallments"); actualChanges.put("totalInstallments", newValue); this.totalInstallments = newValue; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanApplicationWritePlatformServiceJpaRepositoryImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanApplicationWritePlatformServiceJpaRepositoryImpl.java index 6b82b4ebfbd..9ea6d5e4eb8 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanApplicationWritePlatformServiceJpaRepositoryImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanApplicationWritePlatformServiceJpaRepositoryImpl.java @@ -990,7 +990,6 @@ private void createCalendar(final Loan loan, LocalDate calendarStartDate, Intege public CommandProcessingResult modifyApplication(final Long loanId, final JsonCommand command) { try { - AppUser currentUser = getAppUserIfPresent(); final Loan existingLoanApplication = retrieveLoanBy(loanId); if (!existingLoanApplication.isSubmittedAndPendingApproval()) { throw new LoanApplicationNotInSubmittedAndPendingApprovalStateCannotBeModified(loanId); diff --git a/fineract-provider/src/main/resources/db/changelog/tenant/parts/0112_FBR_417_additional_group_loan_data.xml b/fineract-provider/src/main/resources/db/changelog/tenant/parts/0112_FBR_417_additional_group_loan_data.xml index 4f4a3070046..23820f2f5ec 100644 --- a/fineract-provider/src/main/resources/db/changelog/tenant/parts/0112_FBR_417_additional_group_loan_data.xml +++ b/fineract-provider/src/main/resources/db/changelog/tenant/parts/0112_FBR_417_additional_group_loan_data.xml @@ -264,4 +264,8 @@ + + + + From 42fc9922eb3d1187928d798f1aae2e170743b327 Mon Sep 17 00:00:00 2001 From: Brian Muhimbura Date: Mon, 8 Jul 2024 17:39:32 +0300 Subject: [PATCH 4/6] Fix/fbr 690 (#896) * Fic 690 * fix/FBR-690 * Recredit Categorization fix * Recredit Categorization fix --- ...tionChecklistWritePlatformServiceImpl.java | 11 ++- .../db/changelog/tenant/changelog-tenant.xml | 1 + .../tenant/parts/0134_HardPolicyFixes.xml | 98 +++++++++++++++++++ 3 files changed, 108 insertions(+), 2 deletions(-) create mode 100644 fineract-provider/src/main/resources/db/changelog/tenant/parts/0134_HardPolicyFixes.xml diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/prequalification/service/PrequalificationChecklistWritePlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/prequalification/service/PrequalificationChecklistWritePlatformServiceImpl.java index 6b1b5cc0375..79ba047beac 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/organisation/prequalification/service/PrequalificationChecklistWritePlatformServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/prequalification/service/PrequalificationChecklistWritePlatformServiceImpl.java @@ -260,7 +260,7 @@ public String schema() { SELECT mc.id AS clientId,mc.loan_cycle as loanCycle, mpgm.id AS prequalificationMemberId, IFNULL(mc.display_name,mpgm.name) AS name, mpg.id AS prequalificationId,\s mpgm.requested_amount AS requestedAmount, IFNULL(mc.date_of_birth, mpgm.dob) AS dateOfBirth, IFNULL(mc.dpi, mpgm.dpi) AS dpi, mpgm.work_with_puente AS workWithPuente, mcv.code_value As gender, mpgm.is_president AS president, mpgm.buro_check_status as buroCheckStatus, mpgm.agency_bureau_status as agencyBuroStatus, - ml.is_topup AS isTopup, ml.id AS loanId, + ml.is_topup AS isTopup, ml.id AS loanId, mcv.code_value as loanCycleCompleted, CASE WHEN (? NOT IN (3,7,4,5)) AND (COALESCE(mc.loan_cycle, 0) >= 3) THEN 'RECURRING' WHEN (? IN (4,5)) AND (COALESCE(mc.loan_cycle, 0) >= 1) THEN 'RECURRING' ELSE 'NEW' END as clientCategorization, @@ -276,6 +276,8 @@ CASE WHEN (? NOT IN (3,7,4,5)) AND (COALESCE(mc.loan_cycle, 0) >= 3) THEN 'RECUR LEFT JOIN m_code_value areacv ON areacv.id = cinf.area LEFT JOIN m_prequalification_group mpg ON mpg.id = mpgm.group_id LEFT JOIN m_loan ml ON ml.client_id = mc.id AND ml.loan_status_id = 100 AND ml.prequalification_id = mpg.id + LEFT JOIN m_loan_additionals_group mlad ON mlad.loan_id = ml.id + LEFT JOIN m_code_value mcv ON mcv.id = mlad.loan_cycle_completed WHERE mpg.id = ? GROUP BY mc.id """; } @@ -298,7 +300,12 @@ public ClientData mapRow(@NotNull ResultSet rs, int rowNum) throws SQLException final String gender = rs.getString("gender"); final String clientArea = rs.getString("clientArea"); final String clientCategorization = rs.getString("clientCategorization"); - final String recreditCategorization = isTopup?"RECREDITO" : "NUEVO"; + String recreditCategorization = isTopup?"RECREDITO" : "NUEVO"; + final String loanCycleCompleted = rs.getString("loanCycleCompleted"); + if (!StringUtils.isBlank(loanCycleCompleted)){ + recreditCategorization = StringUtils.equalsIgnoreCase(loanCycleCompleted, "fromAnotherGroup") ? "RECREDITO" : "NUEVO"; + } + return ClientData.builder().clientId(clientId).prequalificationId(prequalificationId).clientArea(clientArea) .clientCategorization(clientCategorization).recreditCategorization(recreditCategorization).prequalificationMemberId(prequalificationMemberId).name(name) .dateOfBirth(dateOfBirth).dpi(dpi).requestedAmount(requestedAmount).gender(gender).workWithPuente(workWithPuente) diff --git a/fineract-provider/src/main/resources/db/changelog/tenant/changelog-tenant.xml b/fineract-provider/src/main/resources/db/changelog/tenant/changelog-tenant.xml index fa3fdc6e292..ee0b7047449 100644 --- a/fineract-provider/src/main/resources/db/changelog/tenant/changelog-tenant.xml +++ b/fineract-provider/src/main/resources/db/changelog/tenant/changelog-tenant.xml @@ -153,4 +153,5 @@ + diff --git a/fineract-provider/src/main/resources/db/changelog/tenant/parts/0134_HardPolicyFixes.xml b/fineract-provider/src/main/resources/db/changelog/tenant/parts/0134_HardPolicyFixes.xml new file mode 100644 index 00000000000..86ee33e2894 --- /dev/null +++ b/fineract-provider/src/main/resources/db/changelog/tenant/parts/0134_HardPolicyFixes.xml @@ -0,0 +1,98 @@ + + + + + + + + + + + + + = 3) THEN 'GREEN' + WHEN (${loanProductId} = 6) AND ('${recreditCategorization}' = 'NUEVO') AND (client_details.years_of_residence < 3) THEN 'YELLOW' + WHEN (${loanProductId} = 6) AND ('${recreditCategorization}' = 'RECREDITO') AND (client_details.years_of_residence >= 3) THEN 'GREEN' + WHEN (${loanProductId} = 6) AND ('${recreditCategorization}' = 'RECREDITO') AND (client_details.years_of_residence < 3) THEN 'YELLOW' + ELSE 'RED' + END AS color + FROM m_client mc + INNER JOIN ( + SELECT + mct.id AS client_id, + COALESCE(mcci.years_of_residence, 0) AS years_of_residence + FROM m_client mct + LEFT JOIN m_client_contact_info mcci ON mcci.client_id = mct.id + LEFT JOIN m_code_value housing_type ON housing_type.id = mcci.housing_type + ) client_details ON client_details.client_id = mc.id + WHERE mc.id = ${clientId}" + WHERE report_name = "Rental Age Policy Check"; + ]]> + + + + + + + + + + + + From 4c23aaef59230f7737b07c510ccff5ef01594d6d Mon Sep 17 00:00:00 2001 From: Brian Muhimbura Date: Mon, 8 Jul 2024 18:40:18 +0300 Subject: [PATCH 5/6] Fix/fbr 690 (#897) * Fic 690 * fix/FBR-690 * Recredit Categorization fix * Recredit Categorization fix * Recredit Categorization fix --- .../PrequalificationChecklistWritePlatformServiceImpl.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/prequalification/service/PrequalificationChecklistWritePlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/prequalification/service/PrequalificationChecklistWritePlatformServiceImpl.java index 79ba047beac..5f2046a9432 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/organisation/prequalification/service/PrequalificationChecklistWritePlatformServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/prequalification/service/PrequalificationChecklistWritePlatformServiceImpl.java @@ -260,7 +260,11 @@ public String schema() { SELECT mc.id AS clientId,mc.loan_cycle as loanCycle, mpgm.id AS prequalificationMemberId, IFNULL(mc.display_name,mpgm.name) AS name, mpg.id AS prequalificationId,\s mpgm.requested_amount AS requestedAmount, IFNULL(mc.date_of_birth, mpgm.dob) AS dateOfBirth, IFNULL(mc.dpi, mpgm.dpi) AS dpi, mpgm.work_with_puente AS workWithPuente, mcv.code_value As gender, mpgm.is_president AS president, mpgm.buro_check_status as buroCheckStatus, mpgm.agency_bureau_status as agencyBuroStatus, +<<<<<<< HEAD + ml.is_topup AS isTopup, ml.id AS loanId, mcvl.code_value as loanCycleCompleted, +======= ml.is_topup AS isTopup, ml.id AS loanId, mcv.code_value as loanCycleCompleted, +>>>>>>> 42fc9922eb3d1187928d798f1aae2e170743b327 CASE WHEN (? NOT IN (3,7,4,5)) AND (COALESCE(mc.loan_cycle, 0) >= 3) THEN 'RECURRING' WHEN (? IN (4,5)) AND (COALESCE(mc.loan_cycle, 0) >= 1) THEN 'RECURRING' ELSE 'NEW' END as clientCategorization, @@ -277,7 +281,7 @@ CASE WHEN (? NOT IN (3,7,4,5)) AND (COALESCE(mc.loan_cycle, 0) >= 3) THEN 'RECUR LEFT JOIN m_prequalification_group mpg ON mpg.id = mpgm.group_id LEFT JOIN m_loan ml ON ml.client_id = mc.id AND ml.loan_status_id = 100 AND ml.prequalification_id = mpg.id LEFT JOIN m_loan_additionals_group mlad ON mlad.loan_id = ml.id - LEFT JOIN m_code_value mcv ON mcv.id = mlad.loan_cycle_completed + LEFT JOIN m_code_value mcvl ON mcv.id = mlad.loan_cycle_completed WHERE mpg.id = ? GROUP BY mc.id """; } From c5683e9fbb6f56e38ae67dced69b28a8e910704a Mon Sep 17 00:00:00 2001 From: Brian Muhimbura Date: Mon, 8 Jul 2024 19:26:11 +0300 Subject: [PATCH 6/6] Fix/fbr 690 (#898) * Fic 690 * fix/FBR-690 * Recredit Categorization fix * Recredit Categorization fix * Recredit Categorization fix * Recredit Categorization fix --- .../PrequalificationChecklistWritePlatformServiceImpl.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/prequalification/service/PrequalificationChecklistWritePlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/prequalification/service/PrequalificationChecklistWritePlatformServiceImpl.java index 5f2046a9432..f3c92149c8e 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/organisation/prequalification/service/PrequalificationChecklistWritePlatformServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/prequalification/service/PrequalificationChecklistWritePlatformServiceImpl.java @@ -260,11 +260,8 @@ public String schema() { SELECT mc.id AS clientId,mc.loan_cycle as loanCycle, mpgm.id AS prequalificationMemberId, IFNULL(mc.display_name,mpgm.name) AS name, mpg.id AS prequalificationId,\s mpgm.requested_amount AS requestedAmount, IFNULL(mc.date_of_birth, mpgm.dob) AS dateOfBirth, IFNULL(mc.dpi, mpgm.dpi) AS dpi, mpgm.work_with_puente AS workWithPuente, mcv.code_value As gender, mpgm.is_president AS president, mpgm.buro_check_status as buroCheckStatus, mpgm.agency_bureau_status as agencyBuroStatus, -<<<<<<< HEAD ml.is_topup AS isTopup, ml.id AS loanId, mcvl.code_value as loanCycleCompleted, -======= - ml.is_topup AS isTopup, ml.id AS loanId, mcv.code_value as loanCycleCompleted, ->>>>>>> 42fc9922eb3d1187928d798f1aae2e170743b327 + ml.is_topup AS isTopup, ml.id AS loanId, mcvl.code_value as loanCycleCompleted, CASE WHEN (? NOT IN (3,7,4,5)) AND (COALESCE(mc.loan_cycle, 0) >= 3) THEN 'RECURRING' WHEN (? IN (4,5)) AND (COALESCE(mc.loan_cycle, 0) >= 1) THEN 'RECURRING' ELSE 'NEW' END as clientCategorization,