Search in sources :

Example 1 with CustHistoricalDataActionForm

use of org.mifos.customers.struts.actionforms.CustHistoricalDataActionForm in project head by mifos.

the class CustHistoricalDataAction method getDetailAccountPage.

private String getDetailAccountPage(ActionForm form) {
    CustHistoricalDataActionForm actionForm = (CustHistoricalDataActionForm) form;
    String type = actionForm.getType();
    String forward = null;
    if (type.equals("Group")) {
        forward = ActionForwards.group_detail_page.toString();
    } else if (type.equals("Client")) {
        forward = ActionForwards.client_detail_page.toString();
    }
    return forward;
}
Also used : CustHistoricalDataActionForm(org.mifos.customers.struts.actionforms.CustHistoricalDataActionForm)

Example 2 with CustHistoricalDataActionForm

use of org.mifos.customers.struts.actionforms.CustHistoricalDataActionForm in project head by mifos.

the class CustHistoricalDataAction method getHistoricalData.

@TransactionDemarcate(saveToken = true)
public ActionForward getHistoricalData(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
    CustHistoricalDataActionForm actionForm = (CustHistoricalDataActionForm) form;
    String globalCustNum = request.getParameter(CustomerConstants.GLOBAL_CUST_NUM);
    CustomerHistoricalDataDto historicalData = this.groupServiceFacade.retrieveCustomerHistoricalData(globalCustNum);
    CustomerBO customer = this.customerDao.findCustomerBySystemId(globalCustNum);
    UserContext userContext = getUserContext(request);
    customer.updateDetails(userContext);
    if (historicalData.isClient()) {
        actionForm.setType("Client");
    } else if (historicalData.isGroup()) {
        actionForm.setType("Group");
    }
    CustomerHistoricalDataEntity customerHistoricalDataEntity = customer.getHistoricalData();
    if (customerHistoricalDataEntity == null) {
        customerHistoricalDataEntity = new CustomerHistoricalDataEntity(customer);
    }
    SessionUtils.removeAttribute(Constants.BUSINESS_KEY, request);
    SessionUtils.setAttribute(Constants.BUSINESS_KEY, customer, request);
    SessionUtils.setAttribute(CustomerConstants.MFIJOININGDATE, historicalData.getMfiJoiningDate(), request);
    SessionUtils.setAttribute(CustomerConstants.CUSTOMER_HISTORICAL_DATA, customerHistoricalDataEntity, request);
    return mapping.findForward(ActionForwards.getHistoricalData_success.toString());
}
Also used : CustomerHistoricalDataDto(org.mifos.dto.screen.CustomerHistoricalDataDto) UserContext(org.mifos.security.util.UserContext) CustomerHistoricalDataEntity(org.mifos.customers.business.CustomerHistoricalDataEntity) CustHistoricalDataActionForm(org.mifos.customers.struts.actionforms.CustHistoricalDataActionForm) CustomerBO(org.mifos.customers.business.CustomerBO) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Example 3 with CustHistoricalDataActionForm

use of org.mifos.customers.struts.actionforms.CustHistoricalDataActionForm in project head by mifos.

the class CustHistoricalDataAction method loadHistoricalData.

@TransactionDemarcate(joinToken = true)
public ActionForward loadHistoricalData(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
    CustHistoricalDataActionForm historicalActionForm = (CustHistoricalDataActionForm) form;
    UserContext userContext = getUserContext(request);
    CustomerHistoricalDataEntity customerHistoricalDataEntity = (CustomerHistoricalDataEntity) SessionUtils.getAttribute(CustomerConstants.CUSTOMER_HISTORICAL_DATA, request);
    historicalActionForm.setInterestPaid(getStringValue(customerHistoricalDataEntity.getInterestPaid()));
    historicalActionForm.setLoanAmount(getStringValue(customerHistoricalDataEntity.getLoanAmount()));
    historicalActionForm.setLoanCycleNumber(getStringValue(customerHistoricalDataEntity.getLoanCycleNumber()));
    historicalActionForm.setMissedPaymentsCount(getStringValue(customerHistoricalDataEntity.getMissedPaymentsCount()));
    historicalActionForm.setCommentNotes(customerHistoricalDataEntity.getNotes());
    historicalActionForm.setProductName(customerHistoricalDataEntity.getProductName());
    historicalActionForm.setTotalAmountPaid(getStringValue(customerHistoricalDataEntity.getTotalAmountPaid()));
    historicalActionForm.setTotalPaymentsCount(getStringValue(customerHistoricalDataEntity.getTotalPaymentsCount()));
    String mfiJoiningDate = SessionUtils.getAttribute(CustomerConstants.MFIJOININGDATE, request).toString();
    historicalActionForm.setMfiJoiningDate(DateUtils.getUserLocaleDate(userContext.getPreferredLocale(), mfiJoiningDate));
    return mapping.findForward(ActionForwards.loadHistoricalData_success.toString());
}
Also used : UserContext(org.mifos.security.util.UserContext) CustomerHistoricalDataEntity(org.mifos.customers.business.CustomerHistoricalDataEntity) CustHistoricalDataActionForm(org.mifos.customers.struts.actionforms.CustHistoricalDataActionForm) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Example 4 with CustHistoricalDataActionForm

use of org.mifos.customers.struts.actionforms.CustHistoricalDataActionForm in project head by mifos.

the class CustHistoricalDataAction method updateHistoricalData.

@CloseSession
@TransactionDemarcate(validateAndResetToken = true)
public ActionForward updateHistoricalData(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
    CustomerBO customerBOInSession = (CustomerBO) SessionUtils.getAttribute(Constants.BUSINESS_KEY, request);
    CustomerBO customerBO = this.customerDao.findCustomerById(customerBOInSession.getCustomerId());
    checkVersionMismatch(customerBOInSession.getVersionNo(), customerBO.getVersionNo());
    customerBO.setUserContext(getUserContext(request));
    CustHistoricalDataActionForm historicalActionForm = (CustHistoricalDataActionForm) form;
    CustomerHistoricalDataUpdateRequest historicalData = createHistoricalDataUpdateRequest(historicalActionForm, getUserContext(request));
    this.groupServiceFacade.updateCustomerHistoricalData(customerBO.getGlobalCustNum(), historicalData);
    return mapping.findForward(ActionForwards.updateHistoricalData_success.toString());
}
Also used : CustomerHistoricalDataUpdateRequest(org.mifos.dto.domain.CustomerHistoricalDataUpdateRequest) CustHistoricalDataActionForm(org.mifos.customers.struts.actionforms.CustHistoricalDataActionForm) CustomerBO(org.mifos.customers.business.CustomerBO) CloseSession(org.mifos.framework.util.helpers.CloseSession) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Aggregations

CustHistoricalDataActionForm (org.mifos.customers.struts.actionforms.CustHistoricalDataActionForm)4 TransactionDemarcate (org.mifos.framework.util.helpers.TransactionDemarcate)3 CustomerBO (org.mifos.customers.business.CustomerBO)2 CustomerHistoricalDataEntity (org.mifos.customers.business.CustomerHistoricalDataEntity)2 UserContext (org.mifos.security.util.UserContext)2 CustomerHistoricalDataUpdateRequest (org.mifos.dto.domain.CustomerHistoricalDataUpdateRequest)1 CustomerHistoricalDataDto (org.mifos.dto.screen.CustomerHistoricalDataDto)1 CloseSession (org.mifos.framework.util.helpers.CloseSession)1