Search in sources :

Example 1 with CreateAccountNote

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())));
}
Also used : AccountBO(org.mifos.accounts.business.AccountBO) CreateAccountNote(org.mifos.dto.domain.CreateAccountNote) AccountBusinessService(org.mifos.accounts.business.service.AccountBusinessService) UserContext(org.mifos.security.util.UserContext) NotesActionForm(org.mifos.accounts.struts.actionforms.NotesActionForm) CloseSession(org.mifos.framework.util.helpers.CloseSession) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Example 2 with CreateAccountNote

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());
}
Also used : CreateAccountNote(org.mifos.dto.domain.CreateAccountNote) UserContext(org.mifos.security.util.UserContext) NotesActionForm(org.mifos.accounts.struts.actionforms.NotesActionForm) LocalDate(org.joda.time.LocalDate) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Aggregations

NotesActionForm (org.mifos.accounts.struts.actionforms.NotesActionForm)2 CreateAccountNote (org.mifos.dto.domain.CreateAccountNote)2 TransactionDemarcate (org.mifos.framework.util.helpers.TransactionDemarcate)2 UserContext (org.mifos.security.util.UserContext)2 LocalDate (org.joda.time.LocalDate)1 AccountBO (org.mifos.accounts.business.AccountBO)1 AccountBusinessService (org.mifos.accounts.business.service.AccountBusinessService)1 CloseSession (org.mifos.framework.util.helpers.CloseSession)1