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