updated loan officer unassign date validation error message
This commit is contained in:
+13
-3
@@ -2029,9 +2029,19 @@ public class Loan extends AbstractPersistable<Long> {
|
||||
final LocalDate today = DateUtils.getLocalDateOfTenant();
|
||||
|
||||
if (latestHistoryRecord.getStartDate().isAfter(unassignDate)) {
|
||||
throw new LoanOfficerUnassignmentDateException(this.getId(), this.getLoanOfficer().getId(), latestHistoryRecord.getStartDate(),
|
||||
unassignDate);
|
||||
} else if (unassignDate.isAfter(today)) { throw new LoanOfficerUnassignmentDateException(this.getId()); }
|
||||
|
||||
final String errorMessage = "The Loan officer Unassign date(" + unassignDate + ") cannot be before its assignment date ("
|
||||
+ latestHistoryRecord.getStartDate() + ").";
|
||||
|
||||
throw new LoanOfficerUnassignmentDateException("cannot.be.before.assignment.date", errorMessage, this.getId(), this
|
||||
.getLoanOfficer().getId(), latestHistoryRecord.getStartDate(), unassignDate);
|
||||
|
||||
} else if (unassignDate.isAfter(today)) {
|
||||
|
||||
final String errorMessage = "The Loan Officer Unassign date (" + unassignDate + ") cannot be in the future.";
|
||||
|
||||
throw new LoanOfficerUnassignmentDateException("cannot.be.a.future.date", errorMessage, unassignDate);
|
||||
}
|
||||
}
|
||||
|
||||
private LoanOfficerAssignmentHistory findLatestIncompleteHistoryRecord() {
|
||||
|
||||
+3
-11
@@ -5,20 +5,12 @@
|
||||
*/
|
||||
package org.mifosplatform.portfolio.loanaccount.exception;
|
||||
|
||||
import org.joda.time.LocalDate;
|
||||
import org.mifosplatform.infrastructure.core.exception.AbstractPlatformDomainRuleException;
|
||||
|
||||
public class LoanOfficerUnassignmentDateException extends AbstractPlatformDomainRuleException {
|
||||
|
||||
public LoanOfficerUnassignmentDateException(final Long loanId, final Long loanofficerId, final LocalDate assignedDate,
|
||||
final LocalDate unassignDate) {
|
||||
super("error.msg.loan.unassign.loanofficer.invalid.pastedate", "Loan officer Unassign date(" + unassignDate
|
||||
+ ") can not be less than assign date(" + assignedDate + ") for loan(" + loanId + ") with Loan Officer " + loanofficerId
|
||||
+ ").", loanId);
|
||||
public LoanOfficerUnassignmentDateException(String postFix, String defaultUserMessage,
|
||||
Object... defaultUserMessageArgs) {
|
||||
super("error.msg.loan.loanofficer.unassign.date." + postFix, defaultUserMessage, defaultUserMessageArgs);
|
||||
}
|
||||
|
||||
public LoanOfficerUnassignmentDateException(final Long loanId) {
|
||||
super("error.msg.loan.unassign.loanofficer.invalid.futuredate", "Unassign loan officer in future date is not supported.", loanId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user