diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/prequalification/service/PrequalificationWritePlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/prequalification/service/PrequalificationWritePlatformServiceImpl.java index b3fc8040620..8a889999b3a 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/organisation/prequalification/service/PrequalificationWritePlatformServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/prequalification/service/PrequalificationWritePlatformServiceImpl.java @@ -37,6 +37,7 @@ import java.util.concurrent.atomic.AtomicReference; import javax.transaction.Transactional; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.StringUtils; import org.apache.fineract.infrastructure.codes.service.CodeValueReadPlatformService; import org.apache.fineract.infrastructure.core.api.JsonCommand; @@ -106,7 +107,6 @@ import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.RowMapper; import org.springframework.stereotype.Service; -import org.springframework.util.ObjectUtils; @Service @Slf4j @@ -855,7 +855,11 @@ public CommandProcessingResult processAnalysisRequest(Long entityId, JsonCommand } } - if (prequalificationGroup.isPrequalificationTypeIndividual() && action.equals("approveanalysis")) { + final Long productId = prequalificationGroup.getLoanProduct().getId(); + final LoanProduct loanProduct = this.loanProductRepository.findById(productId) + .orElseThrow(() -> new LoanProductNotFoundException(productId)); + final Boolean requireCommitteeApproval = ObjectUtils.defaultIfNull(loanProduct.getRequireCommitteeApproval(), Boolean.FALSE); + if (prequalificationGroup.isPrequalificationTypeIndividual() && action.equals("approveanalysis") && requireCommitteeApproval) { PrequalificationStatusRange statusRange = resolveIndividualStatusRange(prequalificationGroup, action); prequalificationStatus = PrequalificationStatus.fromInt(statusRange.getStatus()); 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 cdc5f3daea4..080db551b8e 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 @@ -21,6 +21,18 @@ import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonObject; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.temporal.ChronoField; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import javax.persistence.PersistenceException; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.exception.ExceptionUtils; import org.apache.fineract.accounting.journalentry.data.LumaBitacoraTransactionTypeEnum; @@ -164,19 +176,6 @@ import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; -import javax.persistence.PersistenceException; -import java.math.BigDecimal; -import java.time.LocalDate; -import java.time.LocalDateTime; -import java.time.temporal.ChronoField; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; - @Service public class LoanApplicationWritePlatformServiceJpaRepositoryImpl implements LoanApplicationWritePlatformService { diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/LoanProduct.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/LoanProduct.java index e8fa01a692f..3aab23f43e5 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/LoanProduct.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/LoanProduct.java @@ -1698,4 +1698,12 @@ public BigDecimal getPaymentToleranceLimit() { public void setPaymentToleranceLimit(BigDecimal paymentToleranceLimit) { this.paymentToleranceLimit = paymentToleranceLimit; } + + public Boolean getRequireCommitteeApproval() { + return requireCommitteeApproval; + } + + public void setRequireCommitteeApproval(Boolean requireCommitteeApproval) { + this.requireCommitteeApproval = requireCommitteeApproval; + } }