bugs fixed 458,310,453,158,166
This commit is contained in:
+5
-1
@@ -365,7 +365,7 @@ public class ClientWritePlatformServiceJpaRepositoryImpl implements ClientWriteP
|
|||||||
{
|
{
|
||||||
final JsonElement clientNonPersonElement = this.fromApiJsonHelper.parse(command.jsonFragment(ClientApiConstants.clientNonPersonDetailsParamName));
|
final JsonElement clientNonPersonElement = this.fromApiJsonHelper.parse(command.jsonFragment(ClientApiConstants.clientNonPersonDetailsParamName));
|
||||||
|
|
||||||
if(clientNonPersonElement != null)
|
if(clientNonPersonElement != null && !isEmpty(clientNonPersonElement))
|
||||||
{
|
{
|
||||||
final String incorpNumber = this.fromApiJsonHelper.extractStringNamed(ClientApiConstants.incorpNumberParamName, clientNonPersonElement);
|
final String incorpNumber = this.fromApiJsonHelper.extractStringNamed(ClientApiConstants.incorpNumberParamName, clientNonPersonElement);
|
||||||
final String remarks = this.fromApiJsonHelper.extractStringNamed(ClientApiConstants.remarksParamName, clientNonPersonElement);
|
final String remarks = this.fromApiJsonHelper.extractStringNamed(ClientApiConstants.remarksParamName, clientNonPersonElement);
|
||||||
@@ -391,6 +391,10 @@ public class ClientWritePlatformServiceJpaRepositoryImpl implements ClientWriteP
|
|||||||
this.clientNonPersonRepository.save(newClientNonPerson);
|
this.clientNonPersonRepository.save(newClientNonPerson);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isEmpty(final JsonElement element){
|
||||||
|
return element.toString().trim().length()<4;
|
||||||
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+2
-3
@@ -20,7 +20,6 @@ package org.apache.fineract.portfolio.loanaccount.domain;
|
|||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
import javax.persistence.CascadeType;
|
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.JoinColumn;
|
import javax.persistence.JoinColumn;
|
||||||
@@ -39,8 +38,8 @@ public class LoanInstallmentCharge extends AbstractPersistableCustom<Long> imple
|
|||||||
@JoinColumn(name = "loan_charge_id", referencedColumnName = "id", nullable = false)
|
@JoinColumn(name = "loan_charge_id", referencedColumnName = "id", nullable = false)
|
||||||
private LoanCharge loancharge;
|
private LoanCharge loancharge;
|
||||||
|
|
||||||
@ManyToOne(optional = false, cascade = CascadeType.ALL)
|
@ManyToOne
|
||||||
@JoinColumn(name = "loan_schedule_id", referencedColumnName = "id", nullable = false)
|
@JoinColumn(name = "loan_schedule_id", nullable = false)
|
||||||
private LoanRepaymentScheduleInstallment installment;
|
private LoanRepaymentScheduleInstallment installment;
|
||||||
|
|
||||||
@Column(name = "amount", scale = 6, precision = 19, nullable = false)
|
@Column(name = "amount", scale = 6, precision = 19, nullable = false)
|
||||||
|
|||||||
+1
-1
@@ -824,7 +824,7 @@ public class LoanApplicationWritePlatformServiceJpaRepositoryImpl implements Loa
|
|||||||
final CalendarInstance calendarInstance = ciList.get(0);
|
final CalendarInstance calendarInstance = ciList.get(0);
|
||||||
final boolean isCalendarAssociatedWithEntity = this.calendarReadPlatformService.isCalendarAssociatedWithEntity(calendarInstance
|
final boolean isCalendarAssociatedWithEntity = this.calendarReadPlatformService.isCalendarAssociatedWithEntity(calendarInstance
|
||||||
.getEntityId(), calendarInstance.getCalendar().getId(), CalendarEntityType.LOANS.getValue().longValue());
|
.getEntityId(), calendarInstance.getCalendar().getId(), CalendarEntityType.LOANS.getValue().longValue());
|
||||||
if (isCalendarAssociatedWithEntity) {
|
if (isCalendarAssociatedWithEntity && calendarId == null) {
|
||||||
this.calendarRepository.delete(calendarInstance.getCalendar());
|
this.calendarRepository.delete(calendarInstance.getCalendar());
|
||||||
}
|
}
|
||||||
if (calendarInstance.getCalendar().getId() != calendar.getId()) {
|
if (calendarInstance.getCalendar().getId() != calendar.getId()) {
|
||||||
|
|||||||
+25
-2
@@ -60,6 +60,7 @@ import org.apache.fineract.portfolio.calendar.data.CalendarData;
|
|||||||
import org.apache.fineract.portfolio.calendar.domain.CalendarEntityType;
|
import org.apache.fineract.portfolio.calendar.domain.CalendarEntityType;
|
||||||
import org.apache.fineract.portfolio.calendar.service.CalendarReadPlatformService;
|
import org.apache.fineract.portfolio.calendar.service.CalendarReadPlatformService;
|
||||||
import org.apache.fineract.portfolio.charge.data.ChargeData;
|
import org.apache.fineract.portfolio.charge.data.ChargeData;
|
||||||
|
import org.apache.fineract.portfolio.charge.domain.ChargeCalculationType;
|
||||||
import org.apache.fineract.portfolio.charge.domain.ChargeTimeType;
|
import org.apache.fineract.portfolio.charge.domain.ChargeTimeType;
|
||||||
import org.apache.fineract.portfolio.charge.service.ChargeReadPlatformService;
|
import org.apache.fineract.portfolio.charge.service.ChargeReadPlatformService;
|
||||||
import org.apache.fineract.portfolio.client.data.ClientData;
|
import org.apache.fineract.portfolio.client.data.ClientData;
|
||||||
@@ -90,6 +91,8 @@ import org.apache.fineract.portfolio.loanaccount.data.PaidInAdvanceData;
|
|||||||
import org.apache.fineract.portfolio.loanaccount.data.RepaymentScheduleRelatedLoanData;
|
import org.apache.fineract.portfolio.loanaccount.data.RepaymentScheduleRelatedLoanData;
|
||||||
import org.apache.fineract.portfolio.loanaccount.data.ScheduleGeneratorDTO;
|
import org.apache.fineract.portfolio.loanaccount.data.ScheduleGeneratorDTO;
|
||||||
import org.apache.fineract.portfolio.loanaccount.domain.Loan;
|
import org.apache.fineract.portfolio.loanaccount.domain.Loan;
|
||||||
|
import org.apache.fineract.portfolio.loanaccount.domain.LoanCharge;
|
||||||
|
import org.apache.fineract.portfolio.loanaccount.domain.LoanInstallmentCharge;
|
||||||
import org.apache.fineract.portfolio.loanaccount.domain.LoanRepaymentScheduleInstallment;
|
import org.apache.fineract.portfolio.loanaccount.domain.LoanRepaymentScheduleInstallment;
|
||||||
import org.apache.fineract.portfolio.loanaccount.domain.LoanRepaymentScheduleTransactionProcessorFactory;
|
import org.apache.fineract.portfolio.loanaccount.domain.LoanRepaymentScheduleTransactionProcessorFactory;
|
||||||
import org.apache.fineract.portfolio.loanaccount.domain.LoanRepositoryWrapper;
|
import org.apache.fineract.portfolio.loanaccount.domain.LoanRepositoryWrapper;
|
||||||
@@ -416,14 +419,34 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
|
|||||||
final Collection<PaymentTypeData> paymentOptions = this.paymentTypeReadPlatformService.retrieveAllPaymentTypes();
|
final Collection<PaymentTypeData> paymentOptions = this.paymentTypeReadPlatformService.retrieveAllPaymentTypes();
|
||||||
final BigDecimal outstandingLoanBalance = loanRepaymentScheduleInstallment.getPrincipalOutstanding(currency).getAmount();
|
final BigDecimal outstandingLoanBalance = loanRepaymentScheduleInstallment.getPrincipalOutstanding(currency).getAmount();
|
||||||
final BigDecimal unrecognizedIncomePortion = null;
|
final BigDecimal unrecognizedIncomePortion = null;
|
||||||
|
BigDecimal adjustedChargeAmount = adjustPrepayInstallmentCharge(loan, onDate);
|
||||||
return new LoanTransactionData(null, null, null, transactionType, null, currencyData, earliestUnpaidInstallmentDate,
|
return new LoanTransactionData(null, null, null, transactionType, null, currencyData, earliestUnpaidInstallmentDate,
|
||||||
loanRepaymentScheduleInstallment.getTotalOutstanding(currency).getAmount(), loanRepaymentScheduleInstallment
|
loanRepaymentScheduleInstallment.getTotalOutstanding(currency).getAmount().subtract(adjustedChargeAmount), loanRepaymentScheduleInstallment
|
||||||
.getPrincipalOutstanding(currency).getAmount(), loanRepaymentScheduleInstallment.getInterestOutstanding(currency)
|
.getPrincipalOutstanding(currency).getAmount(), loanRepaymentScheduleInstallment.getInterestOutstanding(currency)
|
||||||
.getAmount(), loanRepaymentScheduleInstallment.getFeeChargesOutstanding(currency).getAmount(),
|
.getAmount(), loanRepaymentScheduleInstallment.getFeeChargesOutstanding(currency).getAmount().subtract(adjustedChargeAmount),
|
||||||
loanRepaymentScheduleInstallment.getPenaltyChargesOutstanding(currency).getAmount(), null, unrecognizedIncomePortion,
|
loanRepaymentScheduleInstallment.getPenaltyChargesOutstanding(currency).getAmount(), null, unrecognizedIncomePortion,
|
||||||
paymentOptions, null, null, null, outstandingLoanBalance, false);
|
paymentOptions, null, null, null, outstandingLoanBalance, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private BigDecimal adjustPrepayInstallmentCharge(Loan loan, final LocalDate onDate) {
|
||||||
|
BigDecimal chargeAmount = BigDecimal.ZERO;
|
||||||
|
for(LoanCharge loanCharge: loan.charges()){
|
||||||
|
if(loanCharge.isInstalmentFee() && loanCharge.getCharge().getChargeCalculation()==ChargeCalculationType.FLAT.getValue()){
|
||||||
|
for (LoanRepaymentScheduleInstallment installment : loan.getRepaymentScheduleInstallments()) {
|
||||||
|
if(onDate.isBefore(installment.getDueDate())){
|
||||||
|
LoanInstallmentCharge loanInstallmentCharge = loanCharge.getInstallmentLoanCharge(installment.getInstallmentNumber());
|
||||||
|
if(loanInstallmentCharge != null){
|
||||||
|
chargeAmount = chargeAmount.add(loanInstallmentCharge.getAmountOutstanding());
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return chargeAmount;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LoanTransactionData retrieveWaiveInterestDetails(final Long loanId) {
|
public LoanTransactionData retrieveWaiveInterestDetails(final Long loanId) {
|
||||||
|
|
||||||
|
|||||||
+3
-1
@@ -279,7 +279,9 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
|||||||
checkForProductMixRestrictions(loan);
|
checkForProductMixRestrictions(loan);
|
||||||
|
|
||||||
LocalDate recalculateFrom = null;
|
LocalDate recalculateFrom = null;
|
||||||
loan.setActualDisbursementDate(actualDisbursementDate.toDate());
|
if(!loan.isMultiDisburmentLoan()){
|
||||||
|
loan.setActualDisbursementDate(actualDisbursementDate.toDate());
|
||||||
|
}
|
||||||
ScheduleGeneratorDTO scheduleGeneratorDTO = this.loanUtilService.buildScheduleGeneratorDTO(loan, recalculateFrom);
|
ScheduleGeneratorDTO scheduleGeneratorDTO = this.loanUtilService.buildScheduleGeneratorDTO(loan, recalculateFrom);
|
||||||
|
|
||||||
// validate actual disbursement date against meeting date
|
// validate actual disbursement date against meeting date
|
||||||
|
|||||||
+3
-3
@@ -477,16 +477,16 @@ public class LoanProductReadPlatformServiceImpl implements LoanProductReadPlatfo
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String productMixSchema() {
|
public String productMixSchema() {
|
||||||
return "lp.id as id, lp.name as name FROM m_product_loan lp left join m_product_mix pm on pm.product_id=lp.id where lp.id not IN("
|
return "lp.id as id, lp.name as name, lp.allow_multiple_disbursals as multiDisburseLoan FROM m_product_loan lp left join m_product_mix pm on pm.product_id=lp.id where lp.id not IN("
|
||||||
+ "select lp.id from m_product_loan lp inner join m_product_mix pm on pm.product_id=lp.id)";
|
+ "select lp.id from m_product_loan lp inner join m_product_mix pm on pm.product_id=lp.id)";
|
||||||
}
|
}
|
||||||
|
|
||||||
public String restrictedProductsSchema() {
|
public String restrictedProductsSchema() {
|
||||||
return "pm.restricted_product_id as id, rp.name as name from m_product_mix pm join m_product_loan rp on rp.id = pm.restricted_product_id ";
|
return "pm.restricted_product_id as id, rp.name as name, rp.allow_multiple_disbursals as multiDisburseLoan from m_product_mix pm join m_product_loan rp on rp.id = pm.restricted_product_id ";
|
||||||
}
|
}
|
||||||
|
|
||||||
public String derivedRestrictedProductsSchema() {
|
public String derivedRestrictedProductsSchema() {
|
||||||
return "pm.product_id as id, lp.name as name from m_product_mix pm join m_product_loan lp on lp.id=pm.product_id";
|
return "pm.product_id as id, lp.name as name, lp.allow_multiple_disbursals as multiDisburseLoan from m_product_mix pm join m_product_loan lp on lp.id=pm.product_id";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user