use of org.mifos.dto.screen.CustomerNoteFormDto in project head by mifos.
the class CenterServiceFacadeWebTier method retrieveCustomerNote.
@Override
public CustomerNoteFormDto retrieveCustomerNote(String globalCustNum) {
MifosUser user = (MifosUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
UserContext userContext = toUserContext(user);
CustomerBO customer = this.customerDao.findCustomerBySystemId(globalCustNum);
PersonnelBO loggedInUser = this.personnelDao.findPersonnelById(userContext.getId());
Integer customerLevel = customer.getCustomerLevel().getId().intValue();
String globalNum = customer.getGlobalCustNum();
String displayName = customer.getDisplayName();
LocalDate commentDate = new LocalDate();
String commentUser = loggedInUser.getDisplayName();
return new CustomerNoteFormDto(globalNum, displayName, customerLevel, commentDate, commentUser, "");
}
use of org.mifos.dto.screen.CustomerNoteFormDto 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.dto.screen.CustomerNoteFormDto 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