From a7b27d6d363198c6017408a768d90015b047ef0c Mon Sep 17 00:00:00 2001 From: Lionel Raymundi - Poincenot Date: Sun, 19 Mar 2017 23:11:29 -0300 Subject: [PATCH] FINERACT-418 penalties should be applied until the day before running job --- .../service/LoanWritePlatformServiceJpaRepositoryImpl.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 4f02d2e3e..abb635391 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 @@ -2395,15 +2395,15 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf final Long penaltyPostingWaitPeriodValue = this.configurationDomainService.retrieveGraceOnPenaltyPostingPeriod(); final LocalDate dueDate = command.localDateValueOfParameterNamed("dueDate"); Long diff = penaltyWaitPeriodValue + 1 - penaltyPostingWaitPeriodValue; - if (diff < 0) { - diff = 0L; + if (diff < 1) { + diff = 1L; } LocalDate startDate = dueDate.plusDays(penaltyWaitPeriodValue.intValue() + 1); Integer frequencyNunber = 1; if (feeFrequency == null) { scheduleDates.put(frequencyNunber++, startDate.minusDays(diff.intValue())); } else { - while (DateUtils.getLocalDateOfTenant().isAfter(startDate)) { + while (!startDate.isAfter(DateUtils.getLocalDateOfTenant())) { scheduleDates.put(frequencyNunber++, startDate.minusDays(diff.intValue())); LocalDate scheduleDate = scheduledDateGenerator.getRepaymentPeriodDate(PeriodFrequencyType.fromInt(feeFrequency), chargeDefinition.feeInterval(), startDate, null, null);