use of org.mifos.dto.domain.CreateAccountNote in project head by mifos.
the class NotesAction method create.
@CloseSession
@TransactionDemarcate(validateAndResetToken = true)
public ActionForward create(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
NotesActionForm notesActionForm = (NotesActionForm) form;
UserContext uc = getUserContext(request);
CreateAccountNote accountNote = (CreateAccountNote) SessionUtils.getAttribute("model.accountNote", request);
AccountBO accountBO = new AccountBusinessService().getAccount(accountNote.getAccountId());
if (accountBO.getPersonnel() != null) {
checkPermissionForAddingNotes(accountBO.getType(), null, uc, accountBO.getOffice().getOfficeId(), accountBO.getPersonnel().getPersonnelId());
} else {
checkPermissionForAddingNotes(accountBO.getType(), null, uc, accountBO.getOffice().getOfficeId(), uc.getId());
}
if (accountBO.isSavingsAccount()) {
this.savingsServiceFacade.addNote(accountNote);
} else {
this.loanAccountServiceFacade.addNote(accountNote);
}
return mapping.findForward(chooseForward(Short.valueOf(notesActionForm.getAccountTypeId())));
}
use of org.mifos.dto.domain.CreateAccountNote in project head by mifos.
the class NotesAction method preview.
@TransactionDemarcate(joinToken = true)
public ActionForward preview(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
NotesActionForm notesActionForm = (NotesActionForm) form;
UserContext uc = getUserContext(request);
LocalDate commentDate = new LocalDate();
String comment = notesActionForm.getComment();
Integer createdById = uc.getId().intValue();
Integer accountId = Integer.valueOf(notesActionForm.getAccountId());
CreateAccountNote accountNote = new CreateAccountNote(commentDate, comment, createdById, accountId);
SessionUtils.setAttribute("model.accountNote", accountNote, request);
return mapping.findForward(ActionForwards.preview_success.toString());
}
Aggregations