Search in sources :

Example 6 with ConfigurationBusinessService

use of org.mifos.config.business.service.ConfigurationBusinessService in project head by mifos.

the class ViewOrganizationSettingsServiceFacadeWebTier method getMiscRules.

private Properties getMiscRules(HttpSession httpSession) {
    Properties misc = new Properties();
    Integer timeoutVal = httpSession.getMaxInactiveInterval() / 60;
    misc.setProperty("sessionTimeout", timeoutVal.toString());
    misc.setProperty("backDatedTransactions", booleanToYesNo(AccountingRules.isBackDatedTxnAllowed()));
    misc.setProperty("backDatedApprovals", booleanToYesNo(AccountingRules.isBackDatedApprovalAllowed()));
    ConfigurationBusinessService cbs = new ConfigurationBusinessService();
    misc.setProperty("glim", booleanToYesNo(cbs.isGlimEnabled()));
    misc.setProperty("lsim", booleanToYesNo(cbs.isRepaymentIndepOfMeetingEnabled()));
    MifosConfigurationManager configurationManager = MifosConfigurationManager.getInstance();
    misc.setProperty("backDatedLoanProductCreationAllowed", booleanToYesNo(configurationManager.getBoolean(LoanConstants.BACK_DATED_LOAN_PRODUCT_CREATION)));
    misc.setProperty("grouploanwithmembers", booleanToYesNo(AccountingRules.isGroupLoanWithMembers()));
    return misc;
}
Also used : ConfigurationBusinessService(org.mifos.config.business.service.ConfigurationBusinessService) Properties(java.util.Properties) MifosConfigurationManager(org.mifos.config.business.MifosConfigurationManager)

Example 7 with ConfigurationBusinessService

use of org.mifos.config.business.service.ConfigurationBusinessService in project head by mifos.

the class LoanAccountServiceFacadeWebTier method validateLoanDisbursementDate.

@Override
public Errors validateLoanDisbursementDate(LocalDate loanDisbursementDate, Integer customerId, Integer productId) {
    Errors errors = new Errors();
    if (loanDisbursementDate.isBefore(new LocalDate())) {
        String[] args = { "" };
        errors.addError("dibursementdate.cannot.be.before.todays.date", args);
    }
    CustomerBO customer = this.customerDao.findCustomerById(customerId);
    LocalDate customerActivationDate = new LocalDate(customer.getCustomerActivationDate());
    if (loanDisbursementDate.isBefore(customerActivationDate)) {
        String[] args = { customerActivationDate.toString("dd-MMM-yyyy") };
        errors.addError("dibursementdate.before.customer.activation.date", args);
    }
    LoanOfferingBO loanProduct = this.loanProductDao.findById(productId);
    LocalDate productStartDate = new LocalDate(loanProduct.getStartDate());
    if (loanDisbursementDate.isBefore(productStartDate)) {
        String[] args = { productStartDate.toString("dd-MMM-yyyy") };
        errors.addError("dibursementdate.before.product.startDate", args);
    }
    try {
        this.holidayServiceFacade.validateDisbursementDateForNewLoan(customer.getOfficeId(), loanDisbursementDate.toDateMidnight().toDateTime());
    } catch (BusinessRuleException e) {
        String[] args = { "" };
        errors.addError("dibursementdate.falls.on.holiday", args);
    }
    boolean isRepaymentIndependentOfMeetingEnabled = new ConfigurationBusinessService().isRepaymentIndepOfMeetingEnabled();
    LoanDisbursementDateFactory loanDisbursementDateFactory = new LoanDisbursmentDateFactoryImpl();
    LoanDisbursementDateValidator loanDisbursementDateFinder = loanDisbursementDateFactory.create(customer, loanProduct, isRepaymentIndependentOfMeetingEnabled, false);
    boolean isValid = loanDisbursementDateFinder.isDisbursementDateValidInRelationToSchedule(loanDisbursementDate);
    if (!isValid) {
        String[] args = { "" };
        errors.addError("dibursementdate.invalid.in.relation.to.meeting.schedule", args);
    }
    return errors;
}
Also used : Errors(org.mifos.platform.validations.Errors) BusinessRuleException(org.mifos.service.BusinessRuleException) LoanDisbursementDateValidator(org.mifos.clientportfolio.newloan.domain.LoanDisbursementDateValidator) LoanDisbursementDateFactory(org.mifos.clientportfolio.newloan.domain.LoanDisbursementDateFactory) LoanOfferingBO(org.mifos.accounts.productdefinition.business.LoanOfferingBO) ConfigurationBusinessService(org.mifos.config.business.service.ConfigurationBusinessService) CustomerBO(org.mifos.customers.business.CustomerBO) LocalDate(org.joda.time.LocalDate) LoanDisbursmentDateFactoryImpl(org.mifos.clientportfolio.newloan.domain.LoanDisbursmentDateFactoryImpl)

Aggregations

ConfigurationBusinessService (org.mifos.config.business.service.ConfigurationBusinessService)7 ArrayList (java.util.ArrayList)4 LocalDate (org.joda.time.LocalDate)3 Test (org.junit.Test)3 LoanOfferingBO (org.mifos.accounts.productdefinition.business.LoanOfferingBO)3 CustomerBO (org.mifos.customers.business.CustomerBO)3 ClientBO (org.mifos.customers.client.business.ClientBO)3 LoanAccountDetailsDto (org.mifos.dto.domain.LoanAccountDetailsDto)3 BigDecimal (java.math.BigDecimal)2 Locale (java.util.Locale)2 AmountFeeBO (org.mifos.accounts.fees.business.AmountFeeBO)2 FeeBO (org.mifos.accounts.fees.business.FeeBO)2 LoanBO (org.mifos.accounts.loan.business.LoanBO)2 LoanBusinessService (org.mifos.accounts.loan.business.service.LoanBusinessService)2 LoanAccountActionForm (org.mifos.accounts.loan.struts.actionforms.LoanAccountActionForm)2 MeetingBO (org.mifos.application.meeting.business.MeetingBO)2 RankOfDay (org.mifos.application.meeting.util.helpers.RankOfDay)2 WeekDay (org.mifos.application.meeting.util.helpers.WeekDay)2 CreateAccountFeeDto (org.mifos.dto.domain.CreateAccountFeeDto)2 CreateAccountPenaltyDto (org.mifos.dto.domain.CreateAccountPenaltyDto)2