use of org.mifos.framework.util.helpers.CloseSession in project head by mifos.
the class GroupTransferAction method transferToBranch.
@TransactionDemarcate(validateAndResetToken = true)
@CloseSession
public ActionForward transferToBranch(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
GroupTransferActionForm actionForm = (GroupTransferActionForm) form;
GroupBO groupInSession = (GroupBO) SessionUtils.getAttribute(Constants.BUSINESS_KEY, request);
CustomerDetailDto groupDetail = this.groupServiceFacade.transferGroupToBranch(groupInSession.getGlobalCustNum(), actionForm.getOfficeIdValue(), groupInSession.getVersionNo());
GroupBO group = this.customerDao.findGroupBySystemId(groupDetail.getGlobalCustNum());
SessionUtils.setAttribute(Constants.BUSINESS_KEY, group, request);
return mapping.findForward(ActionForwards.update_success.toString());
}
use of org.mifos.framework.util.helpers.CloseSession in project head by mifos.
the class GroupTransferAction method removeGroupMemberShip.
@CloseSession
@TransactionDemarcate(validateAndResetToken = true)
public ActionForward removeGroupMemberShip(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
GroupTransferActionForm actionForm = (GroupTransferActionForm) form;
CustomerBO customerBOInSession = (CustomerBO) SessionUtils.getAttribute(Constants.BUSINESS_KEY, request);
ClientBO client = this.customerDao.findClientBySystemId(customerBOInSession.getGlobalCustNum());
checkVersionMismatch(customerBOInSession.getVersionNo(), client.getVersionNo());
Short loanOfficerId = null;
if (StringUtils.isNotBlank(actionForm.getAssignedLoanOfficerId())) {
loanOfficerId = Short.valueOf(actionForm.getAssignedLoanOfficerId());
}
this.clientServiceFacade.removeGroupMembership(customerBOInSession.getGlobalCustNum(), loanOfficerId, actionForm.getComment());
return mapping.findForward(ActionForwards.view_client_details_page.toString());
}
use of org.mifos.framework.util.helpers.CloseSession 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;
}
use of org.mifos.framework.util.helpers.CloseSession in project head by mifos.
the class PersonnelNoteAction method create.
@CloseSession
@TransactionDemarcate(validateAndResetToken = true)
public ActionForward create(ActionMapping mapping, ActionForm form, @SuppressWarnings("unused") HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
PersonnelNoteActionForm actionForm = (PersonnelNoteActionForm) form;
Short personnelId = getShortValue(actionForm.getPersonnelId());
this.centerServiceFacade.addNoteToPersonnel(personnelId, actionForm.getComment());
return mapping.findForward(ActionForwards.create_success.toString());
}
use of org.mifos.framework.util.helpers.CloseSession in project head by mifos.
the class AccountApplyPaymentAction method applyPayment.
@TransactionDemarcate(validateAndResetToken = true)
@CloseSession
public ActionForward applyPayment(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
UserContext userContext = (UserContext) SessionUtils.getAttribute(Constants.USER_CONTEXT_KEY, request.getSession());
AccountApplyPaymentActionForm actionForm = (AccountApplyPaymentActionForm) form;
Integer accountId = Integer.valueOf(actionForm.getAccountId());
String paymentType = request.getParameter(Constants.INPUT);
UserReferenceDto userReferenceDto = new UserReferenceDto(userContext.getId());
AccountPaymentDto accountPaymentDto = accountServiceFacade.getAccountPaymentInformation(accountId, paymentType, userContext.getLocaleId(), userReferenceDto, actionForm.getTrxnDate());
validateAccountPayment(accountPaymentDto, accountId, request);
validateAmount(accountPaymentDto, actionForm.getAmount());
PaymentTypeDto paymentTypeDto;
String amount = actionForm.getAmount();
if (accountPaymentDto.getAccountType().equals(AccountTypeDto.LOAN_ACCOUNT)) {
paymentTypeDto = getLoanPaymentTypeDtoForId(Short.valueOf(actionForm.getPaymentTypeId()));
} else {
paymentTypeDto = getFeePaymentTypeDtoForId(Short.valueOf(actionForm.getPaymentTypeId()));
}
AccountPaymentParametersDto accountPaymentParametersDto = new AccountPaymentParametersDto(userReferenceDto, new AccountReferenceDto(accountId), new BigDecimal(amount), actionForm.getTrxnDateAsLocalDate(), paymentTypeDto, AccountConstants.NO_COMMENT, actionForm.getReceiptDateAsLocalDate(), actionForm.getReceiptId(), accountPaymentDto.getCustomerDto());
if (paymentTypeDto.getValue().equals(this.legacyAcceptedPaymentTypeDao.getSavingsTransferId())) {
this.accountServiceFacade.makePaymentFromSavingsAcc(accountPaymentParametersDto, actionForm.getAccountForTransfer());
} else {
this.accountServiceFacade.makePayment(accountPaymentParametersDto);
}
request.getSession().setAttribute("globalAccountNum", ((AccountApplyPaymentActionForm) form).getGlobalAccountNum());
ActionForward findForward;
if (actionForm.getPrintReceipt()) {
if (accountPaymentDto.getAccountType().equals(AccountTypeDto.LOAN_ACCOUNT)) {
findForward = mapping.findForward(getForward("PRINT"));
} else {
request.getSession().setAttribute("clientSystemId", accountPaymentDto.getCustomerDto().getGlobalCustNum());
findForward = mapping.findForward(getForward("PRINT_CLIENT"));
}
} else {
findForward = mapping.findForward(getForward(((AccountApplyPaymentActionForm) form).getInput()));
}
return findForward;
}
Aggregations