use of org.mifos.customers.business.CustomerBO in project head by mifos.
the class LoanAccountAction method manage.
@TransactionDemarcate(joinToken = true)
public ActionForward manage(final ActionMapping mapping, final ActionForm form, final HttpServletRequest request, @SuppressWarnings("unused") final HttpServletResponse response) throws Exception {
LoanAccountActionForm loanActionForm = (LoanAccountActionForm) form;
String globalAccountNum = request.getParameter(GLOBAL_ACCOUNT_NUM);
CustomerBO customer = getCustomerFromRequest(request);
if (isGlimEnabled() || isNewGlimEnabled()) {
populateGlimAttributes(request, loanActionForm, globalAccountNum, customer);
}
String recurMonth = customer.getCustomerMeeting().getMeeting().getMeetingDetails().getRecurAfter().toString();
handleRepaymentsIndependentOfMeetingIfConfigured(request, loanActionForm, recurMonth);
LoanBO loanBO = new LoanDaoHibernate(new GenericDaoHibernate()).findByGlobalAccountNum(globalAccountNum);
UserContext userContext = getUserContext(request);
loanBO.setUserContext(userContext);
SessionUtils.setAttribute(PROPOSED_DISBURSAL_DATE, loanBO.getDisbursementDate(), request);
SessionUtils.removeAttribute(LOANOFFERING, request);
LoanOfferingBO loanOffering = getLoanOffering(loanBO.getLoanOffering().getPrdOfferingId(), userContext.getLocaleId());
loanActionForm.setInstallmentRange(loanBO.getMaxMinNoOfInstall());
loanActionForm.setLoanAmountRange(loanBO.getMaxMinLoanAmount());
MaxMinInterestRate interestRateRange = loanBO.getMaxMinInterestRate();
loanActionForm.setMaxInterestRate(interestRateRange.getMaxLoanAmount());
loanActionForm.setMinInterestRate(interestRateRange.getMinLoanAmount());
loanActionForm.setExternalId(loanBO.getExternalId());
if (null != loanBO.getFund()) {
loanActionForm.setLoanOfferingFund(loanBO.getFund().getFundId().toString());
}
if (configService.isRepaymentIndepOfMeetingEnabled()) {
MeetingDetailsEntity meetingDetail = loanBO.getLoanMeeting().getMeetingDetails();
loanActionForm.setMonthDay("");
loanActionForm.setMonthWeek("0");
loanActionForm.setMonthRank("0");
if (meetingDetail.getRecurrenceTypeEnum() == RecurrenceType.MONTHLY) {
setMonthlySchedule(loanActionForm, meetingDetail);
} else {
setWeeklySchedule(loanActionForm, meetingDetail);
}
}
setSessionAtributeForGLIM(request, loanBO);
SessionUtils.setAttribute(LOANOFFERING, loanOffering, request);
// Retrieve and set into the session all collateral types from the
// lookup_value_locale table associated with the current user context
// locale
SessionUtils.setCollectionAttribute(MasterConstants.COLLATERAL_TYPES, legacyMasterDao.getLookUpEntity(MasterConstants.COLLATERAL_TYPES).getCustomValueListElements(), request);
SessionUtils.setCollectionAttribute(MasterConstants.BUSINESS_ACTIVITIES, legacyMasterDao.findValueListElements(MasterConstants.LOAN_PURPOSES), request);
SessionUtils.setCollectionAttribute(CUSTOM_FIELDS, new ArrayList<CustomFieldDefinitionEntity>(), request);
SessionUtils.setAttribute(RECURRENCEID, loanBO.getLoanMeeting().getMeetingDetails().getRecurrenceTypeEnum().getValue(), request);
SessionUtils.setAttribute(RECURRENCENAME, loanBO.getLoanMeeting().getMeetingDetails().getRecurrenceType().getRecurrenceName(), request);
SessionUtils.setCollectionAttribute(LOANFUNDS, getFunds(loanOffering), request);
setRequestAttributesForEditPage(request, loanBO);
InformationOrderServiceFacade informationOrderServiceFacade = ApplicationContextProvider.getBean(InformationOrderServiceFacade.class);
SessionUtils.setCollectionAttribute("detailsInformationOrder", informationOrderServiceFacade.getInformationOrder("CreateLoan"), request);
setFormAttributes(loanBO, form, request);
return mapping.findForward(ActionForwards.manage_success.toString());
}
use of org.mifos.customers.business.CustomerBO in project head by mifos.
the class LoanAccountAction method performGlimSpecificOnManagePreview.
private void performGlimSpecificOnManagePreview(final HttpServletRequest request, final LoanAccountActionForm loanAccountForm) throws PageExpiredException {
CustomerBO customer = getCustomer(loanAccountForm.getCustomerIdValue());
setGlimEnabledSessionAttributes(request, customer.isGroup());
if (customer.isGroup()) {
List<LoanAccountDetailsDto> loanAccountDetailsView = populateDetailsForSelectedClients(loanAccountForm.getClientDetails(), loanAccountForm.getClients());
SessionUtils.setCollectionAttribute("loanAccountDetailsView", loanAccountDetailsView, request);
}
}
use of org.mifos.customers.business.CustomerBO in project head by mifos.
the class CustomerApplyAdjustmentAction method applyAdjustment.
@TransactionDemarcate(validateAndResetToken = true)
@CloseSession
public ActionForward applyAdjustment(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
String forward = null;
request.setAttribute(CustomerConstants.METHOD, CustomerConstants.METHOD_APPLY_ADJUSTMENT);
CustomerApplyAdjustmentActionForm applyAdjustmentActionForm = (CustomerApplyAdjustmentActionForm) form;
String globalCustNum = applyAdjustmentActionForm.getGlobalCustNum();
CustomerBO customerBO = this.customerDao.findCustomerBySystemId(globalCustNum);
SessionUtils.removeAttribute(Constants.BUSINESS_KEY, request);
SessionUtils.setAttribute(Constants.BUSINESS_KEY, customerBO, request);
if (null == customerBO.getCustomerAccount().findMostRecentNonzeroPaymentByPaymentDate()) {
request.setAttribute(CustomerConstants.METHOD, CustomerConstants.METHOD_PREVIEW_ADJUSTMENT);
throw new ApplicationException(AccountExceptionConstants.ZEROAMNTADJUSTMENT);
}
try {
this.centerServiceFacade.revertLastChargesPayment(globalCustNum, applyAdjustmentActionForm.getAdjustmentNote());
} catch (BusinessRuleException e) {
request.setAttribute(CustomerConstants.METHOD, CustomerConstants.METHOD_PREVIEW_ADJUSTMENT);
throw e;
}
String inputPage = applyAdjustmentActionForm.getInput();
resetActionFormFields(applyAdjustmentActionForm);
if (inputPage != null) {
if (inputPage.equals(CustomerConstants.VIEW_GROUP_CHARGES)) {
forward = CustomerConstants.APPLY_ADJUSTMENT_GROUP_SUCCESS;
} else if (inputPage.equals(CustomerConstants.VIEW_CENTER_CHARGES)) {
forward = CustomerConstants.APPLY_ADJUSTMENT_CENTER_SUCCESS;
} else if (inputPage.equals(CustomerConstants.VIEW_CLIENT_CHARGES)) {
forward = CustomerConstants.APPLY_ADJUSTMENT_CLIENT_SUCCESS;
}
}
return mapping.findForward(forward);
}
use of org.mifos.customers.business.CustomerBO in project head by mifos.
the class CustomerApplyAdjustmentAction method loadAdjustment.
@TransactionDemarcate(joinToken = true)
public ActionForward loadAdjustment(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
CustomerApplyAdjustmentActionForm applyAdjustmentActionForm = (CustomerApplyAdjustmentActionForm) form;
resetActionFormFields(applyAdjustmentActionForm);
String globalCustNum = applyAdjustmentActionForm.getGlobalCustNum();
CustomerBO customerBO = this.customerDao.findCustomerBySystemId(globalCustNum);
SessionUtils.removeAttribute(Constants.BUSINESS_KEY, request);
SessionUtils.setAttribute(Constants.BUSINESS_KEY, customerBO, request);
request.setAttribute(CustomerConstants.METHOD, CustomerConstants.METHOD_LOAD_ADJUSTMENT);
if (null == customerBO.getCustomerAccount().findMostRecentNonzeroPaymentByPaymentDate()) {
request.setAttribute("isDisabled", "true");
throw new ApplicationException(AccountExceptionConstants.ZEROAMNTADJUSTMENT);
}
return mapping.findForward(CustomerConstants.METHOD_LOAD_ADJUSTMENT_SUCCESS);
}
use of org.mifos.customers.business.CustomerBO in project head by mifos.
the class EditCustomerStatusAction method loadStatus.
@TransactionDemarcate(joinToken = true)
public ActionForward loadStatus(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
logger.debug("In EditCustomerStatusAction:load()");
EditCustomerStatusActionForm editCustomerStatusActionForm = (EditCustomerStatusActionForm) form;
editCustomerStatusActionForm.clear();
UserContext userContext = getUserContext(request);
Integer customerId = editCustomerStatusActionForm.getCustomerIdValue();
CustomerBO customer = this.customerDao.findCustomerById(customerId);
customer.setUserContext(userContext);
SessionUtils.removeAttribute(Constants.BUSINESS_KEY, request);
SessionUtils.setAttribute(Constants.BUSINESS_KEY, customer, request);
List<CustomerStatusEntity> statusList = new ArrayList<CustomerStatusEntity>();
switch(customer.getLevel()) {
case CENTER:
this.centerServiceFacade.initializeCenterStates(customer.getGlobalCustNum());
statusList = AccountStateMachines.getInstance().getCenterStatusList(customer.getCustomerStatus());
editCustomerStatusActionForm.setInput("center");
break;
case GROUP:
this.centerServiceFacade.initializeGroupStates(customer.getGlobalCustNum());
statusList = AccountStateMachines.getInstance().getGroupStatusList(customer.getCustomerStatus());
editCustomerStatusActionForm.setInput("group");
break;
case CLIENT:
this.centerServiceFacade.initializeClientStates(customer.getGlobalCustNum());
statusList = AccountStateMachines.getInstance().getClientStatusList(customer.getCustomerStatus());
editCustomerStatusActionForm.setInput("client");
break;
default:
break;
}
;
for (CustomerStatusEntity customerStatusEntity : statusList) {
for (CustomerStatusFlagEntity flag : customerStatusEntity.getFlagSet()) {
String statusMessageText = ApplicationContextProvider.getBean(MessageLookup.class).lookup(flag.getLookUpValue().getPropertiesKey());
flag.setStatusFlagMessageText(statusMessageText);
}
}
editCustomerStatusActionForm.setLevelId(customer.getCustomerLevel().getId().toString());
editCustomerStatusActionForm.setCurrentStatusId(customer.getCustomerStatus().getId().toString());
editCustomerStatusActionForm.setGlobalAccountNum(customer.getGlobalCustNum());
editCustomerStatusActionForm.setCustomerName(customer.getDisplayName());
SessionUtils.setCollectionAttribute(SavingsConstants.STATUS_LIST, statusList, request);
return mapping.findForward(ActionForwards.loadStatus_success.toString());
}
Aggregations