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;
}
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;
}
Aggregations