use of org.mifos.application.admin.servicefacade.InvalidDateException in project head by mifos.
the class SavingsBO method getSavingPerformanceHistory.
public void getSavingPerformanceHistory() throws AccountException {
try {
String systemDate = DateUtils.getCurrentDate();
java.sql.Date currentDate = DateUtils.getLocaleDate(systemDate);
getSavingsPerformance().addMissedDeposits(getSavingsPersistence().getMissedDeposits(getAccountId(), currentDate));
getSavingsPerformance().addMissedDeposits(getSavingsPersistence().getMissedDepositsPaidAfterDueDate(getAccountId()));
} catch (InvalidDateException ide) {
throw new AccountException(ide);
} catch (PersistenceException e) {
throw new AccountException(e);
}
}
use of org.mifos.application.admin.servicefacade.InvalidDateException in project head by mifos.
the class LoanPrdActionForm method validateEndDate.
private void validateEndDate(HttpServletRequest request, ActionErrors errors) {
logger.debug("start validateEndDate method of Loan Product Action form method :" + startDate + "---" + endDate);
Date startingDate = null;
Date endingDate = null;
try {
startingDate = getStartDateValue(getUserContext(request).getPreferredLocale());
} catch (InvalidDateException ide) {
addError(errors, "startDate", ProductDefinitionConstants.INVALIDSTARTDATE);
}
try {
endingDate = getEndDateValue(getUserContext(request).getPreferredLocale());
} catch (InvalidDateException ide) {
addError(errors, "endDate", ProductDefinitionConstants.INVALIDENDDATE);
}
if (startingDate != null && endingDate != null && startingDate.compareTo(endingDate) >= 0) {
addError(errors, "endDate", ProductDefinitionConstants.INVALIDENDDATE);
}
logger.debug("validateEndDate method of Loan Product Action form method called :" + startDate + "---" + endDate);
}
use of org.mifos.application.admin.servicefacade.InvalidDateException in project head by mifos.
the class LoanPrdActionForm method validateStartDate.
private void validateStartDate(HttpServletRequest request, ActionErrors errors) {
logger.debug("start validateStartDate method of Loan Product Action form method :" + startDate);
Date startingDate = null;
try {
startingDate = getStartDateValue(getUserContext(request).getPreferredLocale());
} catch (InvalidDateException ide) {
if (LoanOfferingBO.isBackDatedLoanProductCreationAllowed()) {
addError(errors, "startDate", ProductDefinitionConstants.INVALIDSTARTDATEWITHBACKDATE);
} else {
addError(errors, "startDate", ProductDefinitionConstants.INVALIDSTARTDATE);
}
}
if (LoanOfferingBO.isBackDatedLoanProductCreationAllowed() && (startingDate != null && (DateUtils.getDateWithoutTimeStamp(startingDate.getTime()).compareTo(DateUtils.getCurrentDateOfNextYearWithOutTimeStamp()) > 0))) {
addError(errors, "startDate", ProductDefinitionConstants.INVALIDSTARTDATEWITHBACKDATE);
} else if (!LoanOfferingBO.isBackDatedLoanProductCreationAllowed() && (startingDate != null && ((DateUtils.getDateWithoutTimeStamp(startingDate.getTime()).compareTo(DateUtils.getCurrentDateWithoutTimeStamp()) < 0) || (DateUtils.getDateWithoutTimeStamp(startingDate.getTime()).compareTo(DateUtils.getCurrentDateOfNextYearWithOutTimeStamp()) > 0)))) {
addError(errors, "startDate", ProductDefinitionConstants.INVALIDSTARTDATE);
}
logger.debug("validateStartDate method of Loan Product Action form method called :" + startDate);
}
use of org.mifos.application.admin.servicefacade.InvalidDateException in project head by mifos.
the class ClientCustActionForm method constructFamilyDetails.
/*
* This is used to construct Name detail view and family detail view for each family member, Please note i have
* added display name into family detail view so that i can iterate over only one collection when i do preview of
* this page.
*/
public void constructFamilyDetails() {
this.familyDetails = new ArrayList<ClientFamilyDetailDto>();
this.familyNames = new ArrayList<ClientNameDetailDto>();
for (int row = 0; row < familyFirstName.size(); row++) {
ClientNameDetailDto familyNames = new ClientNameDetailDto();
familyNames.setFirstName(getFamilyFirstName(row));
familyNames.setMiddleName(getFamilyMiddleName(row));
familyNames.setLastName(getFamilyLastName(row));
familyNames.setSecondLastName(getFamilySecondLastName(row));
familyNames.setNameType(getFamilyRelationship(row));
familyNames.setDisplayName(new StringBuilder(getFamilyFirstName(row) + getFamilyLastName(row)));
familyNames.setNames(ClientRules.getNameSequence());
ClientFamilyDetailDto familyDetails = null;
try {
if (getFamilyDateOfBirth(row) != null) {
familyDetails = new ClientFamilyDetailDto(getFamilyRelationship(row), getFamilyGender(row), getFamilyLivingStatus(row), DateUtils.getDateAsSentFromBrowser(getFamilyDateOfBirth(row)));
familyDetails.setDisplayName(familyNames.getDisplayName());
familyDetails.setDateOfBirthForBrowser(getFamilyDateOfBirth(row));
} else {
familyDetails = new ClientFamilyDetailDto(getFamilyRelationship(row), getFamilyGender(row), getFamilyLivingStatus(row), null);
familyDetails.setDisplayName(familyNames.getDisplayName());
}
} catch (InvalidDateException e) {
}
this.familyNames.add(familyNames);
this.familyDetails.add(familyDetails);
}
}
use of org.mifos.application.admin.servicefacade.InvalidDateException in project head by mifos.
the class BulkEntryActionForm method mandatoryCheck.
private ActionErrors mandatoryCheck(Date meetingDate, UserContext userContext, short isCenterHierarchyExists) {
String loanOfficer = getLocalizedMessage(CollectionSheetEntryConstants.LOANOFFICERS);
String modeOfPayment = getLocalizedMessage(CollectionSheetEntryConstants.MODE_OF_PAYMENT);
String dateOfTransaction = getLocalizedMessage(CollectionSheetEntryConstants.DATEOFTRXN);
ActionErrors errors = receiptDateValidate(new ActionErrors());
java.sql.Date currentDate = null;
try {
currentDate = DateUtils.getLocaleDate(userContext.getPreferredLocale(), DateUtils.getCurrentDate(userContext.getPreferredLocale()));
} catch (InvalidDateException ide) {
errors.add(CollectionSheetEntryConstants.INVALIDDATE, new ActionMessage(CollectionSheetEntryConstants.INVALIDDATE));
}
java.sql.Date trxnDate = null;
String customerLabel = isCenterHierarchyExists == Constants.YES ? ConfigurationConstants.CENTER : ConfigurationConstants.GROUP;
if (officeId == null || "".equals(officeId.trim())) {
errors.add(CollectionSheetEntryConstants.MANDATORYFIELDS, new ActionMessage(CollectionSheetEntryConstants.MANDATORYFIELDS, getMessageText(ConfigurationConstants.BRANCHOFFICE)));
}
if (loanOfficerId == null || "".equals(loanOfficerId.trim())) {
errors.add(CollectionSheetEntryConstants.MANDATORYFIELDS, new ActionMessage(CollectionSheetEntryConstants.MANDATORYFIELDS, loanOfficer));
}
if (customerId == null || "".equals(customerId.trim())) {
errors.add(CollectionSheetEntryConstants.MANDATORYFIELDS, new ActionMessage(CollectionSheetEntryConstants.MANDATORYFIELDS, getLabel(customerLabel)));
}
if (getTransactionDate() != null && !getTransactionDate().equals("")) {
try {
trxnDate = DateUtils.getDateAsSentFromBrowser(getTransactionDate());
} catch (InvalidDateException ide) {
errors.add(CollectionSheetEntryConstants.MANDATORYFIELDS, new ActionMessage(AccountConstants.ERROR_INVALID_TRXN));
}
} else {
errors.add(CollectionSheetEntryConstants.MANDATORYFIELDS, new ActionMessage(CollectionSheetEntryConstants.MANDATORYENTER, dateOfTransaction));
}
if (currentDate != null && meetingDate != null && trxnDate != null && (meetingDate.compareTo(trxnDate) > 0 || trxnDate.compareTo(currentDate) > 0)) {
errors.add(CollectionSheetEntryConstants.MANDATORYFIELDS, new ActionMessage(CollectionSheetEntryConstants.INVALIDENDDATE, dateOfTransaction));
} else if (meetingDate == null && trxnDate != null && trxnDate.compareTo(currentDate) != 0) {
errors.add(CollectionSheetEntryConstants.MANDATORYFIELDS, new ActionMessage(CollectionSheetEntryConstants.MEETINGDATEEXCEPTION, dateOfTransaction));
}
if (paymentId == null || "".equals(paymentId.trim())) {
errors.add(CollectionSheetEntryConstants.MANDATORYFIELDS, new ActionMessage(CollectionSheetEntryConstants.MANDATORYFIELDS, modeOfPayment));
}
return errors;
}
Aggregations