From 2ae916618b40004d1118e44d7c71efaa2d3b4e6f Mon Sep 17 00:00:00 2001 From: Mohit Sinha Date: Thu, 11 Apr 2019 00:24:33 +0700 Subject: [PATCH] LocalDate check should be according to timezone of tenant. --- .../apache/fineract/portfolio/loanaccount/domain/Loan.java | 4 ++-- .../service/LoanWritePlatformServiceJpaRepositoryImpl.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/Loan.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/Loan.java index f880155b1..c7b6cc3ca 100755 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/Loan.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/Loan.java @@ -2929,7 +2929,7 @@ public class Loan extends AbstractPersistableCustom { validateRepaymentDateIsOnNonWorkingDay(paymentTransaction.getTransactionDate(), holidayDetailDTO.getWorkingDays(), holidayDetailDTO.isAllowTransactionsOnNonWorkingDay()); - if (paymentTransaction.getTransactionDate().isAfter(new LocalDate())) { + if (paymentTransaction.getTransactionDate().isAfter(DateUtils.getLocalDateOfTenant())) { final String errorMessage = "The date on which a loan charge paid cannot be in the future."; throw new InvalidLoanStateTransitionException("charge.payment", "cannot.be.a.future.date", errorMessage, paymentTransaction.getTransactionDate()); @@ -3767,7 +3767,7 @@ public class Loan extends AbstractPersistableCustom { rescheduledOnLocalDate, getDisbursementDate()); } - if (rescheduledOnLocalDate.isAfter(new LocalDate())) { + if (rescheduledOnLocalDate.isAfter(DateUtils.getLocalDateOfTenant())) { final String errorMessage = "The date on which a loan is rescheduled cannot be in the future."; throw new InvalidLoanStateTransitionException("close.reschedule", "cannot.be.a.future.date", errorMessage, rescheduledOnLocalDate); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanWritePlatformServiceJpaRepositoryImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanWritePlatformServiceJpaRepositoryImpl.java index 411974ee5..068265f77 100755 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanWritePlatformServiceJpaRepositoryImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanWritePlatformServiceJpaRepositoryImpl.java @@ -1794,7 +1794,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf .retrieveInstallmentLoanCharges(chargeData.getId(), true); PortfolioAccountData portfolioAccountData = null; for (final LoanInstallmentChargeData installmentChargeData : chargePerInstallments) { - if (!installmentChargeData.getDueDate().isAfter(new LocalDate())) { + if (!installmentChargeData.getDueDate().isAfter(DateUtils.getLocalDateOfTenant())) { if (portfolioAccountData == null) { portfolioAccountData = this.accountAssociationsReadPlatformService.retriveLoanLinkedAssociation(chargeData .getLoanId()); @@ -1810,7 +1810,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf transferFeeCharge(sb, accountTransferDTO); } } - } else if (chargeData.getDueDate() != null && !chargeData.getDueDate().isAfter(new LocalDate())) { + } else if (chargeData.getDueDate() != null && !chargeData.getDueDate().isAfter(DateUtils.getLocalDateOfTenant())) { final PortfolioAccountData portfolioAccountData = this.accountAssociationsReadPlatformService .retriveLoanLinkedAssociation(chargeData.getLoanId()); final SavingsAccount fromSavingsAccount = null;