use of org.mifos.application.admin.servicefacade.InvalidDateException in project head by mifos.
the class LoanAccountActionForm method validateRedoLoanPayments.
private void validateRedoLoanPayments(HttpServletRequest request, ActionErrors errors, MifosCurrency currency) {
Locale locale = getUserContext(request).getPreferredLocale();
try {
CustomerBO customer = getCustomer(request);
List<PaymentDataHtmlBean> validPaymentBeans = getValidatablePaymentBeans();
for (PaymentDataHtmlBean bean : validPaymentBeans) {
validatePaymentDataHtmlBean(errors, currency, locale, customer, bean);
}
validatePaymentDatesOrdering(validPaymentBeans, errors);
validateMaxPayableAmount(request, errors);
} catch (InvalidDateException invalidDate) {
errors.add(LoanExceptionConstants.INVALIDTRANSACTIONDATE, new ActionMessage(LoanExceptionConstants.INVALIDTRANSACTIONDATE));
} catch (FrameworkRuntimeException invalidDate) {
errors.add(LoanExceptionConstants.INVALIDTRANSACTIONDATE, new ActionMessage(LoanExceptionConstants.INVALIDTRANSACTIONDATE));
} catch (MeetingException e) {
errors.add(ExceptionConstants.FRAMEWORKRUNTIMEEXCEPTION, new ActionMessage(ExceptionConstants.FRAMEWORKRUNTIMEEXCEPTION));
} catch (PageExpiredException e) {
errors.add(ExceptionConstants.PAGEEXPIREDEXCEPTION, new ActionMessage(ExceptionConstants.PAGEEXPIREDEXCEPTION));
} catch (PersistenceException e) {
errors.add(ExceptionConstants.FRAMEWORKRUNTIMEEXCEPTION, new ActionMessage(ExceptionConstants.FRAMEWORKRUNTIMEEXCEPTION));
}
}
use of org.mifos.application.admin.servicefacade.InvalidDateException 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.mifos.application.admin.servicefacade.InvalidDateException 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.mifos.application.admin.servicefacade.InvalidDateException in project head by mifos.
the class ClientCustActionForm method validateTrained.
@Override
protected void validateTrained(HttpServletRequest request, ActionErrors errors) {
super.validateTrained(request, errors);
try {
Locale locale = getUserContext(request).getPreferredLocale();
Date trainedDate = getTrainedDateValue(locale);
Date dob = getDateFromString(getDateOfBirth(), locale);
if (trainedDate != null && dob != null && DateUtils.dateFallsBeforeDate(trainedDate, dob)) {
errors.add(CustomerConstants.TRAINED_DATE_BEFORE_DOB, new ActionMessage(CustomerConstants.TRAINED_DATE_BEFORE_DOB, getDateOfBirth()));
}
} catch (InvalidDateException ex) {
//already validated in super
}
}
use of org.mifos.application.admin.servicefacade.InvalidDateException in project head by mifos.
the class PictureFormFile method updateMfiInfo.
@CloseSession
@TransactionDemarcate(validateAndResetToken = true)
public ActionForward updateMfiInfo(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
ClientCustActionForm actionForm = (ClientCustActionForm) form;
ClientBO clientInSession = getClientFromSession(request);
Integer clientId = clientInSession.getCustomerId();
Integer oldVersionNumber = clientInSession.getVersionNo();
boolean trained = false;
if (trainedValue(actionForm) != null && trainedValue(actionForm).equals(YesNoFlag.YES.getValue())) {
trained = true;
}
DateTime trainedDate = null;
try {
java.sql.Date inputDate = trainedDate(actionForm);
if (inputDate != null) {
trainedDate = new DateTime(trainedDate(actionForm));
}
} catch (InvalidDateException e) {
throw new CustomerException(ClientConstants.TRAINED_DATE_MANDATORY);
}
Short personnelId = Short.valueOf("-1");
if (groupFlagValue(actionForm).equals(YesNoFlag.NO.getValue())) {
if (actionForm.getLoanOfficerIdValue() != null) {
personnelId = actionForm.getLoanOfficerIdValue();
}
} else if (groupFlagValue(actionForm).equals(YesNoFlag.YES.getValue())) {
// TODO for an urgent fix this reads client to get personnelId.
// Client is read again in updateClientMfiInfo. Refactor to only read in
// updateClientMfiInfo.
ClientBO client = (ClientBO) this.customerDao.findCustomerById(clientId);
personnelId = client.getPersonnel().getPersonnelId();
}
ClientMfiInfoUpdate clientMfiInfoUpdate = new ClientMfiInfoUpdate(clientId, oldVersionNumber, personnelId, externalId(actionForm), trained, trainedDate);
this.clientServiceFacade.updateClientMfiInfo(clientMfiInfoUpdate);
return mapping.findForward(ActionForwards.updateMfiInfo_success.toString());
}
Aggregations