Search in sources :

Example 26 with CloseSession

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());
}
Also used : GroupTransferActionForm(org.mifos.customers.group.struts.actionforms.GroupTransferActionForm) CustomerDetailDto(org.mifos.dto.domain.CustomerDetailDto) GroupBO(org.mifos.customers.group.business.GroupBO) CloseSession(org.mifos.framework.util.helpers.CloseSession) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Example 27 with CloseSession

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());
}
Also used : GroupTransferActionForm(org.mifos.customers.group.struts.actionforms.GroupTransferActionForm) ClientBO(org.mifos.customers.client.business.ClientBO) CustomerBO(org.mifos.customers.business.CustomerBO) CloseSession(org.mifos.framework.util.helpers.CloseSession) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Example 28 with CloseSession

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;
}
Also used : CustomerNotesActionForm(org.mifos.customers.struts.actionforms.CustomerNotesActionForm) UserContext(org.mifos.security.util.UserContext) CustomerBO(org.mifos.customers.business.CustomerBO) CustomerNoteFormDto(org.mifos.dto.screen.CustomerNoteFormDto) LocalDate(org.joda.time.LocalDate) ActionForward(org.apache.struts.action.ActionForward) CloseSession(org.mifos.framework.util.helpers.CloseSession) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Example 29 with CloseSession

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());
}
Also used : PersonnelNoteActionForm(org.mifos.customers.personnel.struts.actionforms.PersonnelNoteActionForm) CloseSession(org.mifos.framework.util.helpers.CloseSession) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Example 30 with CloseSession

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;
}
Also used : UserReferenceDto(org.mifos.dto.domain.UserReferenceDto) UserContext(org.mifos.security.util.UserContext) AccountReferenceDto(org.mifos.dto.domain.AccountReferenceDto) PaymentTypeDto(org.mifos.dto.domain.PaymentTypeDto) AccountPaymentParametersDto(org.mifos.dto.domain.AccountPaymentParametersDto) AccountPaymentDto(org.mifos.accounts.servicefacade.AccountPaymentDto) AccountApplyPaymentActionForm(org.mifos.accounts.struts.actionforms.AccountApplyPaymentActionForm) BigDecimal(java.math.BigDecimal) ActionForward(org.apache.struts.action.ActionForward) CloseSession(org.mifos.framework.util.helpers.CloseSession) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Aggregations

CloseSession (org.mifos.framework.util.helpers.CloseSession)35 TransactionDemarcate (org.mifos.framework.util.helpers.TransactionDemarcate)35 UserContext (org.mifos.security.util.UserContext)13 ClientBO (org.mifos.customers.client.business.ClientBO)7 BusinessRuleException (org.mifos.service.BusinessRuleException)7 CustomerBO (org.mifos.customers.business.CustomerBO)6 BigDecimal (java.math.BigDecimal)5 ActionForward (org.apache.struts.action.ActionForward)5 LocalDate (org.joda.time.LocalDate)5 AccountBO (org.mifos.accounts.business.AccountBO)5 AccountPaymentParametersDto (org.mifos.dto.domain.AccountPaymentParametersDto)4 AccountReferenceDto (org.mifos.dto.domain.AccountReferenceDto)4 PaymentTypeDto (org.mifos.dto.domain.PaymentTypeDto)4 UserReferenceDto (org.mifos.dto.domain.UserReferenceDto)4 ArrayList (java.util.ArrayList)3 Date (java.util.Date)3 Locale (java.util.Locale)3 AccountBusinessService (org.mifos.accounts.business.service.AccountBusinessService)3 LoanBO (org.mifos.accounts.loan.business.LoanBO)3 SavingsBO (org.mifos.accounts.savings.business.SavingsBO)3