Search in sources :

Example 1 with InvalidDateException

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);
    }
}
Also used : AccountException(org.mifos.accounts.exceptions.AccountException) InvalidDateException(org.mifos.application.admin.servicefacade.InvalidDateException) PersistenceException(org.mifos.framework.exceptions.PersistenceException)

Example 2 with InvalidDateException

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);
}
Also used : InvalidDateException(org.mifos.application.admin.servicefacade.InvalidDateException) Date(java.sql.Date)

Example 3 with InvalidDateException

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);
}
Also used : InvalidDateException(org.mifos.application.admin.servicefacade.InvalidDateException) Date(java.sql.Date)

Example 4 with InvalidDateException

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);
    }
}
Also used : ClientFamilyDetailDto(org.mifos.dto.screen.ClientFamilyDetailDto) ClientNameDetailDto(org.mifos.dto.screen.ClientNameDetailDto) InvalidDateException(org.mifos.application.admin.servicefacade.InvalidDateException)

Example 5 with InvalidDateException

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;
}
Also used : InvalidDateException(org.mifos.application.admin.servicefacade.InvalidDateException) ActionMessage(org.apache.struts.action.ActionMessage) ActionErrors(org.apache.struts.action.ActionErrors) Date(java.sql.Date)

Aggregations

InvalidDateException (org.mifos.application.admin.servicefacade.InvalidDateException)46 ActionMessage (org.apache.struts.action.ActionMessage)22 ActionErrors (org.apache.struts.action.ActionErrors)20 Locale (java.util.Locale)12 Date (java.sql.Date)9 ResourceBundle (java.util.ResourceBundle)9 PersistenceException (org.mifos.framework.exceptions.PersistenceException)6 Date (java.util.Date)5 AccountException (org.mifos.accounts.exceptions.AccountException)5 DoubleConversionResult (org.mifos.framework.util.helpers.DoubleConversionResult)5 SimpleDateFormat (java.text.SimpleDateFormat)4 MifosRuntimeException (org.mifos.core.MifosRuntimeException)4 CustomerException (org.mifos.customers.exceptions.CustomerException)4 ParseException (java.text.ParseException)3 LocalDate (org.joda.time.LocalDate)3 PageExpiredException (org.mifos.framework.exceptions.PageExpiredException)3 BusinessRuleException (org.mifos.service.BusinessRuleException)3 ArrayList (java.util.ArrayList)2 DateMidnight (org.joda.time.DateMidnight)2 DateTime (org.joda.time.DateTime)2