xurror commented on a change in pull request #1843:
URL: https://github.com/apache/fineract/pull/1843#discussion_r707343612



##########
File path: 
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/Loan.java
##########
@@ -4509,30 +4511,77 @@ private LocalDate getMaxDateLimitForNewRepayment(final 
PeriodFrequencyType perio
                                                    // startDate
     }
 
-    public void applyHolidayToRepaymentScheduleDates(final Holiday holiday) {
+    public void applyHolidayToRepaymentScheduleDates(final Holiday holiday, 
final LoanUtilService loanUtilService) {
+        final DefaultScheduledDateGenerator scheduledDateGenerator = new 
DefaultScheduledDateGenerator();
+        ScheduleGeneratorDTO scheduleGeneratorDTO = 
loanUtilService.buildScheduleGeneratorDTO(this, holiday.getFromDateLocalDate());
+        final LoanApplicationTerms loanApplicationTerms = 
this.constructLoanApplicationTerms(scheduleGeneratorDTO);
+
+        // LocalDate rescheduleFromDate = holiday.getFromDateLocalDate();
+        LocalDate adjustedRescheduleToDate = null;
+
+        if (holiday.getReScheduleType().isResheduleToNextRepaymentDate()) {
+            final LocalDate rescheduleToDate = holiday.getToDateLocalDate();
+            for (final LoanRepaymentScheduleInstallment 
loanRepaymentScheduleInstallment : this.getRepaymentScheduleInstallments()) {
+                if 
(rescheduleToDate.isEqual(loanRepaymentScheduleInstallment.getDueDate())) {
+                    adjustedRescheduleToDate = rescheduleToDate;
+                    break;
+                } else {
+                    // Account for a Bimonthly Loan Product
+                    // if 
(loanApplicationTerms.getRepaymentPeriodFrequencyType().isSemiMonthly()) {
+                    // if 
(rescheduleToDate.isAfter(loanRepaymentScheduleInstallment.getDueDate())
+                    // && 
rescheduleToDate.isBefore(loanRepaymentScheduleInstallment.getDueDate().plusDays(15)))
 {

Review comment:
       The commented code is more for a future proof for an upcoming feature 
that I think is still WIP progress at Muellners around a bi-monthly product.
   The commented code is meant to retrofit the holiday rescheduling to new 
feature once it's rolled out.




-- 
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