oleksii-novikov-onix commented on code in PR #6205:
URL: https://github.com/apache/fineract/pull/6205#discussion_r3759700366


##########
fineract-working-capital-loan/src/main/java/org/apache/fineract/portfolio/workingcapitalloan/repository/WorkingCapitalLoanBreachScheduleRepository.java:
##########
@@ -41,4 +43,22 @@ Optional<WorkingCapitalLoanBreachSchedule> 
findByLoanIdAndFromDateLessThanEqualA
             LocalDate transactionDate, LocalDate transactionDate1);
 
     Optional<WorkingCapitalLoanBreachSchedule> 
findTopByLoanIdAndBreachTrueOrderByFromDateAsc(Long loanId);
+
+    @Query("""
+            SELECT s FROM WorkingCapitalLoanBreachSchedule s
+            WHERE s.loan.id = :loanId
+              AND s.breach IS NULL
+              AND s.fromDate <= :businessDate
+              AND s.toDate >= :businessDate
+            ORDER BY s.periodNumber DESC""")
+    List<WorkingCapitalLoanBreachSchedule> 
findCurrentOpenPeriodsOrderByPeriodNumberDesc(@Param("loanId") Long loanId,

Review Comment:
   Fixed



##########
fineract-working-capital-loan/src/main/java/org/apache/fineract/portfolio/workingcapitalloan/validator/WorkingCapitalLoanDelinquencyActionParseAndValidator.java:
##########
@@ -250,6 +252,24 @@ private void validateReschedule(final 
WorkingCapitalLoanDelinquencyAction action
         }
         if (hasFrequencyGroup) {
             validateFrequencyGroupProvided(action, dataValidator);
+            if (action.getFrequency() != null && action.getFrequency() > 0 && 
action.getFrequencyType() != null) {
+                validateFrequencyDoesNotEndBeforeBusinessDate(action, 
workingCapitalLoan, dataValidator);
+            }
+        }
+    }
+
+    /**
+     * Rejects a frequency change whose resulting period end date falls before 
the current business date. The candidate
+     * end date comes from the range schedule service, so it is the very date 
the re-date would persist.
+     */
+    private void validateFrequencyDoesNotEndBeforeBusinessDate(final 
WorkingCapitalLoanDelinquencyAction action,

Review Comment:
   Fixed



##########
fineract-working-capital-loan/src/main/java/org/apache/fineract/portfolio/workingcapitalloan/domain/WorkingCapitalLoanDelinquencyPauseUtils.java:
##########
@@ -58,6 +58,27 @@ public static LocalDate resolveEffectivePauseEnd(final 
WorkingCapitalLoanDelinqu
                 
.map(WorkingCapitalLoanDelinquencyAction::getStartDate).min(Comparator.naturalOrder()).orElse(pauseEnd);
     }
 
+    /**
+     * Extends an inclusive period end date by every recorded pause 
overlapping the period, mirroring the pause replay
+     * performed by the schedule rebuild.
+     */
+    public static LocalDate extendToDateByRecordedPauses(final LocalDate 
fromDate, final LocalDate baseToDate,

Review Comment:
   Fixed



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to