use of org.apache.struts.action.ActionErrors in project head by mifos.
the class SavingsClosureActionForm method validateDate.
private ActionErrors validateDate(String date, String fieldName) {
ActionErrors errors = new ActionErrors();
java.sql.Date sqlDate = null;
if (date != null && !date.equals("")) {
try {
sqlDate = DateUtils.getDateAsSentFromBrowser(date);
if (DateUtils.whichDirection(sqlDate) > 0) {
errors = new ActionErrors();
errors.add(AccountConstants.ERROR_FUTUREDATE, new ActionMessage(AccountConstants.ERROR_FUTUREDATE, fieldName));
}
} catch (InvalidDateException e) {
errors.add(AccountConstants.ERROR_INVALIDDATE, new ActionMessage(AccountConstants.ERROR_INVALIDDATE, fieldName));
}
} else {
errors = new ActionErrors();
errors.add(AccountConstants.ERROR_MANDATORY, new ActionMessage(AccountConstants.ERROR_MANDATORY, fieldName));
}
return errors;
}
use of org.apache.struts.action.ActionErrors in project head by mifos.
the class SavingsDepositWithdrawalActionForm method validateTrxnDate.
private ActionErrors validateTrxnDate(String date, String fieldName) {
ActionErrors errors = new ActionErrors();
try {
if (lastTrxnDate != null && dateFallsBeforeDate(getDateAsSentFromBrowser(date), lastTrxnDate)) {
errors = new ActionErrors();
errors.add(AccountConstants.ERROR_PAYMENT_DATE_BEFORE_LAST_PAYMENT, new ActionMessage(AccountConstants.ERROR_PAYMENT_DATE_BEFORE_LAST_PAYMENT, fieldName));
}
} catch (InvalidDateException e) {
//date format was already validated
}
return errors;
}
use of org.apache.struts.action.ActionErrors in project head by mifos.
the class RepayLoanActionForm method validateDate.
protected ActionErrors validateDate(String date, String fieldName) {
ActionErrors errors = null;
java.sql.Date sqlDate = null;
if (date != null && !date.equals("")) {
try {
sqlDate = getDateAsSentFromBrowser(date);
if (DateUtils.whichDirection(sqlDate) > 0) {
errors = new ActionErrors();
errors.add(AccountConstants.ERROR_FUTUREDATE, new ActionMessage(AccountConstants.ERROR_FUTUREDATE, fieldName));
}
} catch (InvalidDateException ide) {
errors = new ActionErrors();
errors.add(AccountConstants.ERROR_INVALIDDATE, new ActionMessage(AccountConstants.ERROR_INVALIDDATE, fieldName));
}
} else {
errors = new ActionErrors();
errors.add(AccountConstants.ERROR_MANDATORY, new ActionMessage(AccountConstants.ERROR_MANDATORY, fieldName));
}
return errors;
}
use of org.apache.struts.action.ActionErrors in project head by mifos.
the class RepayLoanActionForm method validatePaymentDate.
public ActionErrors validatePaymentDate(String transactionDate, String fieldName) {
ActionErrors errors = null;
if (transactionDate != null && !transactionDate.equals("")) {
try {
if (lastPaymentDate != null && dateFallsBeforeDate(getDateAsSentFromBrowser(transactionDate), lastPaymentDate)) {
errors = new ActionErrors();
errors.add(AccountConstants.ERROR_PAYMENT_DATE_BEFORE_LAST_PAYMENT, new ActionMessage(AccountConstants.ERROR_PAYMENT_DATE_BEFORE_LAST_PAYMENT, fieldName));
}
} catch (InvalidDateException ide) {
errors = new ActionErrors();
errors.add(AccountConstants.ERROR_INVALIDDATE, new ActionMessage(AccountConstants.ERROR_INVALIDDATE, fieldName));
}
}
return errors;
}
use of org.apache.struts.action.ActionErrors in project head by mifos.
the class RepayLoanActionForm method validateDateOfPayment.
private void validateDateOfPayment(ActionErrors errors) {
String fieldName = "accounts.date_of_trxn";
ActionErrors validationErrors = validateDate(getDateOfPayment(), getLocalizedMessage(fieldName));
if (null != validationErrors && !validationErrors.isEmpty()) {
errors.add(validationErrors);
}
validationErrors = validatePaymentDate(getDateOfPayment(), getLocalizedMessage(fieldName));
if (null != validationErrors && !validationErrors.isEmpty()) {
errors.add(validationErrors);
}
}
Aggregations