Search in sources :

Example 6 with SavingsActionForm

use of org.mifos.accounts.savings.struts.actionforms.SavingsActionForm in project head by mifos.

the class SavingsAction method preview.

@TransactionDemarcate(joinToken = true)
public ActionForward preview(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
    SavingsActionForm savingActionForm = (SavingsActionForm) form;
    SessionUtils.setAttribute(SavingsConstants.IS_PENDING_APPROVAL, ProcessFlowRules.isSavingsPendingApprovalStateEnabled(), request.getSession());
    return createGroupQuestionnaire.fetchAppliedQuestions(mapping, savingActionForm, request, ActionForwards.preview_success);
}
Also used : SavingsActionForm(org.mifos.accounts.savings.struts.actionforms.SavingsActionForm) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Example 7 with SavingsActionForm

use of org.mifos.accounts.savings.struts.actionforms.SavingsActionForm in project head by mifos.

the class SavingsAction method update.

@CloseSession
@TransactionDemarcate(validateAndResetToken = true)
public ActionForward update(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
    logger.debug("In SavingsAction::update()");
    SavingsActionForm actionForm = (SavingsActionForm) form;
    SavingsBO savings = (SavingsBO) SessionUtils.getAttribute(Constants.BUSINESS_KEY, request);
    Long savingsId = savings.getAccountId().longValue();
    savings = this.savingsDao.findById(savingsId);
    Integer version = savings.getVersionNo();
    checkVersionMismatch(version, savings.getVersionNo());
    this.savingsServiceFacade.updateSavingsAccountDetails(savingsId, actionForm.getRecommendedAmount(), actionForm.getAccountCustomFieldSet());
    request.setAttribute(SavingsConstants.GLOBALACCOUNTNUM, savings.getGlobalAccountNum());
    logger.info("In SavingsAction::update(), Savings object updated successfully");
    doCleanUp(actionForm, request);
    return mapping.findForward("update_success");
}
Also used : SavingsActionForm(org.mifos.accounts.savings.struts.actionforms.SavingsActionForm) SavingsBO(org.mifos.accounts.savings.business.SavingsBO) CloseSession(org.mifos.framework.util.helpers.CloseSession) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Example 8 with SavingsActionForm

use of org.mifos.accounts.savings.struts.actionforms.SavingsActionForm in project head by mifos.

the class SavingsAction method get.

@TransactionDemarcate(saveToken = true)
public ActionForward get(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
    UserContext uc = (UserContext) SessionUtils.getAttribute(Constants.USER_CONTEXT_KEY, request.getSession());
    SavingsActionForm actionForm = (SavingsActionForm) form;
    actionForm.setInput(null);
    String globalAccountNum = actionForm.getGlobalAccountNum();
    if (StringUtils.isBlank(actionForm.getGlobalAccountNum())) {
        SavingsBO savings = (SavingsBO) SessionUtils.getAttribute(Constants.BUSINESS_KEY, request);
        globalAccountNum = savings.getGlobalAccountNum();
    }
    logger.debug(" Retrieving for globalAccountNum: " + globalAccountNum);
    SavingsBO savings = this.savingsDao.findBySystemId(globalAccountNum);
    savings.setUserContext(uc);
    SavingsAccountDetailDto savingsAccountDto;
    try {
        savingsAccountDto = this.savingsServiceFacade.retrieveSavingsAccountDetails(savings.getAccountId().longValue());
    } catch (MifosRuntimeException e) {
        if (e.getCause() instanceof ApplicationException) {
            throw (ApplicationException) e.getCause();
        }
        throw e;
    }
    List<AdminDocumentBO> allAdminDocuments = legacyAdminDocumentDao.getAllActiveAdminDocuments();
    List<AdminDocumentBO> savingsAdminDocuments = new ArrayList();
    for (AdminDocumentBO adminDocumentBO : allAdminDocuments) {
        List<AdminDocAccStateMixBO> admindoclist = legacyAdminDocAccStateMixDao.getMixByAdminDocuments(adminDocumentBO.getAdmindocId());
        if (!savingsAdminDocuments.contains(adminDocumentBO) && admindoclist.size() > 0 && admindoclist.get(0).getAccountStateID().getPrdType().getProductTypeID().equals(Short.valueOf("2"))) {
            savingsAdminDocuments.add(adminDocumentBO);
        }
    }
    SessionUtils.setCollectionAttribute("administrativeDocumentsList", savingsAdminDocuments, request);
    SessionUtils.setAttribute(Constants.BUSINESS_KEY, savings, request);
    SessionUtils.setCollectionAttribute(MasterConstants.SAVINGS_TYPE, legacyMasterDao.findMasterDataEntitiesWithLocale(SavingsTypeEntity.class), request);
    SessionUtils.setCollectionAttribute(MasterConstants.RECOMMENDED_AMOUNT_UNIT, legacyMasterDao.findMasterDataEntitiesWithLocale(RecommendedAmntUnitEntity.class), request);
    List<CustomFieldDefinitionEntity> customFieldDefinitions = new ArrayList<CustomFieldDefinitionEntity>();
    SessionUtils.setCollectionAttribute(SavingsConstants.CUSTOM_FIELDS, customFieldDefinitions, request);
    SessionUtils.setAttribute(SavingsConstants.PRDOFFERING, savings.getSavingsOffering(), request);
    actionForm.setRecommendedAmount(savingsAccountDto.getRecommendedOrMandatoryAmount());
    actionForm.clear();
    SessionUtils.setCollectionAttribute(SavingsConstants.RECENTY_ACTIVITY_DETAIL_PAGE, savingsAccountDto.getRecentActivity(), request);
    SessionUtils.setCollectionAttribute(SavingsConstants.NOTES, savings.getRecentAccountNotes(), request);
    logger.info(" Savings object retrieved successfully");
    setCurrentPageUrl(request, savings);
    setQuestionGroupInstances(request, savings);
    request.getSession().setAttribute("backPageUrl", request.getAttribute("currentPageUrl"));
    return mapping.findForward("get_success");
}
Also used : UserContext(org.mifos.security.util.UserContext) ArrayList(java.util.ArrayList) SavingsBO(org.mifos.accounts.savings.business.SavingsBO) AdminDocAccStateMixBO(org.mifos.reports.admindocuments.business.AdminDocAccStateMixBO) RecommendedAmntUnitEntity(org.mifos.accounts.productdefinition.business.RecommendedAmntUnitEntity) CustomFieldDefinitionEntity(org.mifos.application.master.business.CustomFieldDefinitionEntity) SavingsActionForm(org.mifos.accounts.savings.struts.actionforms.SavingsActionForm) ApplicationException(org.mifos.framework.exceptions.ApplicationException) SavingsTypeEntity(org.mifos.accounts.productdefinition.business.SavingsTypeEntity) AdminDocumentBO(org.mifos.reports.admindocuments.business.AdminDocumentBO) SavingsAccountDetailDto(org.mifos.dto.domain.SavingsAccountDetailDto) MifosRuntimeException(org.mifos.core.MifosRuntimeException) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Example 9 with SavingsActionForm

use of org.mifos.accounts.savings.struts.actionforms.SavingsActionForm in project head by mifos.

the class SavingsAction method create.

@TransactionDemarcate(validateAndResetToken = true)
public ActionForward create(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
    SavingsActionForm savingsActionForm = ((SavingsActionForm) form);
    logger.debug("In SavingsAction::create(), accountStateId: " + savingsActionForm.getStateSelected());
    UserContext uc = (UserContext) SessionUtils.getAttribute(Constants.USER_CONTEXT_KEY, request.getSession());
    CustomerBO customer = (CustomerBO) SessionUtils.getAttribute(SavingsConstants.CLIENT, request);
    Integer customerId = customer.getCustomerId();
    Integer productId = Integer.valueOf(savingsActionForm.getSelectedPrdOfferingId());
    String recommendedOrMandatoryAmount = savingsActionForm.getRecommendedAmount();
    Short accountState = Short.valueOf(savingsActionForm.getStateSelected());
    customer = this.customerDao.findCustomerById(customerId);
    checkPermissionForCreate(accountState, uc, customer.getOffice().getOfficeId(), customer.getPersonnel().getPersonnelId());
    SavingsAccountCreationDto savingsAccountCreation = new SavingsAccountCreationDto(productId, customerId, accountState, recommendedOrMandatoryAmount);
    Long savingsId = this.savingsServiceFacade.createSavingsAccount(savingsAccountCreation);
    SavingsBO saving = this.savingsDao.findById(savingsId);
    createGroupQuestionnaire.saveResponses(request, savingsActionForm, saving.getAccountId());
    request.setAttribute(SavingsConstants.GLOBALACCOUNTNUM, saving.getGlobalAccountNum());
    request.setAttribute(SavingsConstants.RECORD_OFFICE_ID, saving.getOffice().getOfficeId());
    request.setAttribute(SavingsConstants.CLIENT_NAME, customer.getDisplayName());
    request.setAttribute(SavingsConstants.CLIENT_ID, customer.getCustomerId());
    request.setAttribute(SavingsConstants.CLIENT_LEVEL, customer.getCustomerLevel().getId());
    logger.info("In SavingsAction::create(), Savings object saved successfully ");
    return mapping.findForward("create_success");
}
Also used : SavingsActionForm(org.mifos.accounts.savings.struts.actionforms.SavingsActionForm) UserContext(org.mifos.security.util.UserContext) CustomerBO(org.mifos.customers.business.CustomerBO) SavingsAccountCreationDto(org.mifos.dto.domain.SavingsAccountCreationDto) SavingsBO(org.mifos.accounts.savings.business.SavingsBO) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Example 10 with SavingsActionForm

use of org.mifos.accounts.savings.struts.actionforms.SavingsActionForm in project head by mifos.

the class SavingsAction method waiveAmountDue.

@TransactionDemarcate(joinToken = true)
public ActionForward waiveAmountDue(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
    logger.debug("In SavingsAction::waiveAmountDue()");
    UserContext uc = (UserContext) SessionUtils.getAttribute(Constants.USER_CONTEXT_KEY, request.getSession());
    SavingsBO savings = (SavingsBO) SessionUtils.getAttribute(Constants.BUSINESS_KEY, request);
    Integer versionNum = savings.getVersionNo();
    savings = this.savingsDao.findBySystemId(((SavingsActionForm) form).getGlobalAccountNum());
    checkVersionMismatch(versionNum, savings.getVersionNo());
    savings.setUserContext(uc);
    Long savingsId = savings.getAccountId().longValue();
    this.savingsServiceFacade.waiveNextDepositAmountDue(savingsId);
    return mapping.findForward("waiveAmount_success");
}
Also used : SavingsActionForm(org.mifos.accounts.savings.struts.actionforms.SavingsActionForm) UserContext(org.mifos.security.util.UserContext) SavingsBO(org.mifos.accounts.savings.business.SavingsBO) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Aggregations

SavingsActionForm (org.mifos.accounts.savings.struts.actionforms.SavingsActionForm)12 TransactionDemarcate (org.mifos.framework.util.helpers.TransactionDemarcate)11 SavingsBO (org.mifos.accounts.savings.business.SavingsBO)7 UserContext (org.mifos.security.util.UserContext)6 ArrayList (java.util.ArrayList)3 CustomFieldDefinitionEntity (org.mifos.application.master.business.CustomFieldDefinitionEntity)3 RecommendedAmntUnitEntity (org.mifos.accounts.productdefinition.business.RecommendedAmntUnitEntity)2 SavingsOfferingBO (org.mifos.accounts.productdefinition.business.SavingsOfferingBO)2 SavingsTypeEntity (org.mifos.accounts.productdefinition.business.SavingsTypeEntity)2 CustomerBO (org.mifos.customers.business.CustomerBO)2 CustomFieldDto (org.mifos.dto.domain.CustomFieldDto)2 Test (org.junit.Test)1 AccountActionDateEntity (org.mifos.accounts.business.AccountActionDateEntity)1 AccountFlagMapping (org.mifos.accounts.business.AccountFlagMapping)1 InterestCalcTypeEntity (org.mifos.accounts.productdefinition.business.InterestCalcTypeEntity)1 MifosRuntimeException (org.mifos.core.MifosRuntimeException)1 PrdOfferingDto (org.mifos.dto.domain.PrdOfferingDto)1 SavingsAccountCreationDto (org.mifos.dto.domain.SavingsAccountCreationDto)1 SavingsAccountDetailDto (org.mifos.dto.domain.SavingsAccountDetailDto)1 SavingsAccountDepositDueDto (org.mifos.dto.screen.SavingsAccountDepositDueDto)1