use of org.mifos.application.admin.servicefacade.InvalidDateException in project head by mifos.
the class EditStatusActionForm 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 AccountApplyPaymentActionForm 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 ApplyAdjustmentActionForm 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));
} else if (previousPaymentDate != null && sqlDate.compareTo(previousPaymentDate) < 0) {
errors = new ActionErrors();
errors.add(AccountConstants.ERROR_ADJUSTMENT_PREVIOUS_DATE, new ActionMessage(AccountConstants.ERROR_ADJUSTMENT_PREVIOUS_DATE, fieldName));
} else if (nextPaymentDate != null && sqlDate.compareTo(nextPaymentDate) > 0) {
errors = new ActionErrors();
errors.add(AccountConstants.ERROR_ADJUSTMENT_NEXT_DATE, new ActionMessage(AccountConstants.ERROR_ADJUSTMENT_NEXT_DATE, 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 LoanPrdActionForm method validateStartDateForEditPreview.
private void validateStartDateForEditPreview(HttpServletRequest request, ActionErrors errors) {
logger.debug("start validateStartDateForEditPreview method of Loan Product Action form method :" + startDate);
request.setAttribute(Constants.CURRENTFLOWKEY, request.getParameter(Constants.CURRENTFLOWKEY));
java.util.Date oldStartDate = null;
Date changedStartDate = null;
try {
oldStartDate = (java.util.Date) SessionUtils.getAttribute(ProductDefinitionConstants.LOANPRDSTARTDATE, request);
} catch (PageExpiredException e) {
}
try {
changedStartDate = getStartDateValue(getUserContext(request).getPreferredLocale());
} catch (InvalidDateException ide) {
addError(errors, "startdate", ProductDefinitionConstants.STARTDATEUPDATEEXCEPTION);
}
if (oldStartDate != null && changedStartDate != null) {
if (LoanOfferingBO.isBackDatedLoanProductCreationAllowed() && DateUtils.getDateWithoutTimeStamp(oldStartDate.getTime()).compareTo(DateUtils.getDateWithoutTimeStamp(changedStartDate.getTime())) != 0) {
addError(errors, "startDate", ProductDefinitionConstants.STARTDATEUPDATEEXCEPTION);
} else if (!LoanOfferingBO.isBackDatedLoanProductCreationAllowed() && DateUtils.getDateWithoutTimeStamp(oldStartDate.getTime()).compareTo(DateUtils.getCurrentDateWithoutTimeStamp()) <= 0 && (DateUtils.getDateWithoutTimeStamp(oldStartDate.getTime()).compareTo(DateUtils.getDateWithoutTimeStamp(changedStartDate.getTime())) != 0)) {
addError(errors, "startDate", ProductDefinitionConstants.STARTDATEUPDATEEXCEPTION);
}
} else if (changedStartDate != null && DateUtils.getDateWithoutTimeStamp(changedStartDate.getTime()).compareTo(DateUtils.getCurrentDateWithoutTimeStamp()) > 0) {
validateStartDate(request, errors);
}
logger.debug("validateStartDateForEditPreview method of Loan Product Action form method called :" + startDate + "---" + oldStartDate);
}
use of org.mifos.application.admin.servicefacade.InvalidDateException in project head by mifos.
the class LoanPrdActionForm method reset.
@Override
public void reset(ActionMapping mapping, HttpServletRequest request) {
super.reset(mapping, request);
String method = request.getParameter(ProductDefinitionConstants.METHOD);
logger.debug("start reset method of Savings Product Action form method :" + method);
if (method != null && method.equals(Methods.load.toString())) {
try {
startDate = DateUtils.getCurrentDate(getUserContext(request).getPreferredLocale());
} catch (InvalidDateException ide) {
throw new MifosRuntimeException(ide);
}
recurAfter = "1";
minNoInstallments = "1";
minimumGapBetweenInstallments = 1;
}
if ((method != null) && method.equals(Methods.manage.toString())) {
cashFlowValidation = null;
cashFlowThreshold = null;
cashFlowThresholdValue = null;
repaymentCapacity = null;
repaymentCapacityValue = null;
indebtednessRatio = null;
indebtednessRatioValue = null;
}
if (method != null && (method.equals(Methods.preview.toString()) || method.equals(Methods.editPreview.toString()))) {
intDedDisbursementFlag = null;
prinDueLastInstFlag = null;
loanCounter = null;
waiverInterest = null;
prdOfferinFees = null;
prdOfferinPenalties = null;
loanOfferingFunds = null;
gracePeriodType = null;
gracePeriodDuration = null;
loanOfferingQGs = null;
canConfigureVariableInstallments = null;
isFixedRepaymentSchedule = null;
isRoundingDifferenceInFirstPayment = null;
cashFlowValidation = null;
cashFlowThreshold = null;
cashFlowThresholdValue = null;
repaymentCapacity = null;
repaymentCapacityValue = null;
indebtednessRatio = null;
indebtednessRatioValue = null;
}
logger.debug("reset method of Savings Product Action form method called ");
}
Aggregations