Search in sources :

Example 1 with CustomerNotesActionForm

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

the class CustomerNotesAction method getDetailCustomerPage.

private String getDetailCustomerPage(ActionForm form) {
    CustomerNotesActionForm notesActionForm = (CustomerNotesActionForm) form;
    String input = notesActionForm.getInput();
    String forward = null;
    if (input.equals("center")) {
        forward = ActionForwards.center_detail_page.toString();
    }
    if (input.equals("group")) {
        forward = ActionForwards.group_detail_page.toString();
    }
    if (input.equals("client")) {
        forward = ActionForwards.client_detail_page.toString();
    }
    return forward;
}
Also used : CustomerNotesActionForm(org.mifos.customers.struts.actionforms.CustomerNotesActionForm)

Example 2 with CustomerNotesActionForm

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

the class CustomerNotesAction method load.

@TransactionDemarcate(joinToken = true)
public ActionForward load(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
    logger.debug("In CustomerNotesAction::load()");
    CustomerNotesActionForm notesActionForm = (CustomerNotesActionForm) form;
    notesActionForm.setComment("");
    notesActionForm.setCommentDate("");
    UserContext userContext = getUserContext(request);
    Integer customerId = Integer.valueOf(((CustomerNotesActionForm) form).getCustomerId());
    CustomerBO customerBO = this.customerDao.findCustomerById(customerId);
    customerBO.setUserContext(userContext);
    CustomerNoteFormDto noteDto = this.centerServiceFacade.retrieveCustomerNote(customerBO.getGlobalCustNum());
    notesActionForm.setLevelId(noteDto.getCustomerLevel().toString());
    notesActionForm.setGlobalCustNum(noteDto.getGlobalNum());
    notesActionForm.setCustomerName(noteDto.getDisplayName());
    notesActionForm.setCommentDate(DateUtils.getCurrentDate(userContext.getPreferredLocale()));
    if (customerBO.isCenter()) {
        notesActionForm.setInput("center");
    } else if (customerBO.isGroup()) {
        notesActionForm.setInput("group");
    } else if (customerBO.isClient()) {
        notesActionForm.setInput("client");
    }
    SessionUtils.removeAttribute(Constants.BUSINESS_KEY, request);
    SessionUtils.setAttribute(Constants.BUSINESS_KEY, customerBO, request);
    SessionUtils.setAttribute(CustomerConstants.PERSONNEL_NAME, noteDto.getCommentUser(), request);
    return mapping.findForward(ActionForwards.load_success.toString());
}
Also used : CustomerNotesActionForm(org.mifos.customers.struts.actionforms.CustomerNotesActionForm) UserContext(org.mifos.security.util.UserContext) CustomerBO(org.mifos.customers.business.CustomerBO) CustomerNoteFormDto(org.mifos.dto.screen.CustomerNoteFormDto) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Example 3 with CustomerNotesActionForm

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

the class CustomerNotesAction method create.

@CloseSession
@TransactionDemarcate(validateAndResetToken = true)
public ActionForward create(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
    logger.debug("In CustomerNotesAction::create()");
    ActionForward forward = null;
    CustomerNotesActionForm notesActionForm = (CustomerNotesActionForm) form;
    Integer customerId = Integer.valueOf(((CustomerNotesActionForm) form).getCustomerId());
    CustomerBO customerBO = this.customerDao.findCustomerById(customerId);
    UserContext uc = getUserContext(request);
    if (customerBO.getPersonnel() != null) {
        checkPermissionForAddingNotes(AccountTypes.CUSTOMER_ACCOUNT, customerBO.getLevel(), uc, customerBO.getOffice().getOfficeId(), customerBO.getPersonnel().getPersonnelId());
    } else {
        checkPermissionForAddingNotes(AccountTypes.CUSTOMER_ACCOUNT, customerBO.getLevel(), uc, customerBO.getOffice().getOfficeId(), uc.getId());
    }
    CustomerNoteFormDto customerNoteForm = new CustomerNoteFormDto(customerBO.getGlobalCustNum(), customerBO.getDisplayName(), customerBO.getCustomerLevel().getId().intValue(), new LocalDate(), "", notesActionForm.getComment());
    this.centerServiceFacade.createCustomerNote(customerNoteForm);
    forward = mapping.findForward(getDetailCustomerPage(notesActionForm));
    return forward;
}
Also used : CustomerNotesActionForm(org.mifos.customers.struts.actionforms.CustomerNotesActionForm) UserContext(org.mifos.security.util.UserContext) CustomerBO(org.mifos.customers.business.CustomerBO) CustomerNoteFormDto(org.mifos.dto.screen.CustomerNoteFormDto) LocalDate(org.joda.time.LocalDate) ActionForward(org.apache.struts.action.ActionForward) CloseSession(org.mifos.framework.util.helpers.CloseSession) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Aggregations

CustomerNotesActionForm (org.mifos.customers.struts.actionforms.CustomerNotesActionForm)3 CustomerBO (org.mifos.customers.business.CustomerBO)2 CustomerNoteFormDto (org.mifos.dto.screen.CustomerNoteFormDto)2 TransactionDemarcate (org.mifos.framework.util.helpers.TransactionDemarcate)2 UserContext (org.mifos.security.util.UserContext)2 ActionForward (org.apache.struts.action.ActionForward)1 LocalDate (org.joda.time.LocalDate)1 CloseSession (org.mifos.framework.util.helpers.CloseSession)1