add validation for repayment strategy for loan application flows, add data update patch for heavensfamily data.

This commit is contained in:
Keith Woodlock
2012-09-12 11:40:56 +01:00
parent ae2279fce0
commit 99b53995ea
2 changed files with 15 additions and 0 deletions
@@ -0,0 +1,9 @@
UPDATE `mifostenant-heavensfamily`.`m_loan`
SET
`loan_transaction_strategy_id` = 2
WHERE id > 0;
UPDATE `mifostenant-heavensfamily`.`m_loan`
SET
`term_frequency` = `repay_every` * `number_of_repayments`
WHERE `term_frequency` = 0;
@@ -3,6 +3,7 @@ package org.mifosng.platform.loan.service;
import java.util.ArrayList;
import java.util.List;
import org.mifosng.platform.DataValidatorBuilder;
import org.mifosng.platform.api.commands.CalculateLoanScheduleCommand;
import org.mifosng.platform.api.commands.LoanChargeCommand;
import org.mifosng.platform.api.commands.LoanApplicationCommand;
@@ -39,6 +40,11 @@ public class LoanApplicationCommandValidator {
}
}
if (command.getTransactionProcessingStrategyId() == null) {
DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("loan");
baseDataValidator.reset().parameter("transactionProcessingStrategyId").value(command.getTransactionProcessingStrategyId()).notNull().inMinMaxRange(2, 2);
}
try {
// reuse calculate loan schedule validator for now
CalculateLoanScheduleCommand calculateLoanScheduleCommand = this.command.toCalculateLoanScheduleCommand();