Search in sources :

Example 91 with TransactionDemarcate

use of org.mifos.framework.util.helpers.TransactionDemarcate in project head by mifos.

the class FeeAction method editPreview.

@TransactionDemarcate(joinToken = true)
public ActionForward editPreview(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
    Short feeId = ((FeeActionForm) form).getFeeIdValue();
    FeeDto feeDto = this.feeDao.findDtoById(feeId);
    Short appliedFeeId = this.feeDao.findFeeAppliedToLoan(feeId);
    boolean isInProducts = appliedFeeId == null ? true : false;
    List<Short> feesAppliedLoanAccountList = this.feeDao.getAllUsedLoansWithAttachedFee();
    boolean isFeeAppliedToLoan = feesAppliedLoanAccountList.contains(feeId);
    Short feeInSchedule = this.feeDao.findFeeInSchedule(feeId);
    boolean isFeeInSchedule = feeInSchedule == null ? false : true;
    ActionMessages messages = new ActionMessages();
    if (!(((FeeActionForm) form).isToRemove() && feeDto.getFeeStatus().getId().equalsIgnoreCase("2"))) {
        form.reset(mapping, request);
    }
    if (((FeeActionForm) form).isToRemove()) {
        if (!isInProducts && !isFeeAppliedToLoan) {
            messages.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("Fees.feeRemoved"));
        } else if (isFeeAppliedToLoan) {
            if (!isFeeInSchedule) {
                messages.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("Fees.feeRemovedFromPrd"));
                ((FeeActionForm) form).setCantBeRemoved(true);
            } else {
                messages.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("Fees.feeRemovedFromPrdButNotDeleted"));
            }
        } else {
            messages.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("Fees.feeNotUsedRemove"));
        }
    } else {
        if (((FeeActionForm) form).getFeeStatusValue().getValue() == 2) {
            messages.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("Fees.feeRemovedFromPrdWhenInActive"));
        }
    }
    saveErrors(request, messages);
    request.getSession().setAttribute("feeModel", feeDto);
    return mapping.findForward(ActionForwards.editPreview_success.toString());
}
Also used : FeeActionForm(org.mifos.accounts.fees.struts.actionforms.FeeActionForm) ActionMessages(org.apache.struts.action.ActionMessages) FeeDto(org.mifos.dto.domain.FeeDto) ActionMessage(org.apache.struts.action.ActionMessage) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Example 92 with TransactionDemarcate

use of org.mifos.framework.util.helpers.TransactionDemarcate in project head by mifos.

the class FeeAction method get.

@TransactionDemarcate(saveToken = true)
public ActionForward get(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
    Short feeId = ((FeeActionForm) form).getFeeIdValue();
    FeeDto feeDto = this.feeDao.findDtoById(feeId);
    request.setAttribute("feeModel", feeDto);
    request.setAttribute("GlNamesMode", AccountingRules.getGlNamesMode());
    return mapping.findForward(ActionForwards.get_success.toString());
}
Also used : FeeActionForm(org.mifos.accounts.fees.struts.actionforms.FeeActionForm) FeeDto(org.mifos.dto.domain.FeeDto) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Example 93 with TransactionDemarcate

use of org.mifos.framework.util.helpers.TransactionDemarcate in project head by mifos.

the class FeeAction method editPrevious.

@TransactionDemarcate(joinToken = true)
public ActionForward editPrevious(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
    Short feeId = ((FeeActionForm) form).getFeeIdValue();
    FeeDto feeDto = this.feeDao.findDtoById(feeId);
    request.setAttribute("feeModel", feeDto);
    return mapping.findForward(ActionForwards.editprevious_success.toString());
}
Also used : FeeActionForm(org.mifos.accounts.fees.struts.actionforms.FeeActionForm) FeeDto(org.mifos.dto.domain.FeeDto) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Example 94 with TransactionDemarcate

use of org.mifos.framework.util.helpers.TransactionDemarcate in project head by mifos.

the class PersonAction method unLockUserAccount.

@SuppressWarnings("unused")
@TransactionDemarcate(validateAndResetToken = true)
public ActionForward unLockUserAccount(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
    PersonnelBO personnel = (PersonnelBO) SessionUtils.getAttribute(Constants.BUSINESS_KEY, request);
    UserContext userContext = getUserContext(request);
    this.personnelServiceFacade.unLockUserAccount(personnel.getGlobalPersonnelNum());
    return mapping.findForward(ActionForwards.unLockUserAccount_success.toString());
}
Also used : PersonnelBO(org.mifos.customers.personnel.business.PersonnelBO) UserContext(org.mifos.security.util.UserContext) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Example 95 with TransactionDemarcate

use of org.mifos.framework.util.helpers.TransactionDemarcate in project head by mifos.

the class PersonAction method search.

@Override
@TransactionDemarcate(saveToken = true)
public ActionForward search(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
    ActionForward actionForward = null;
    UserContext userContext = getUserContext(request);
    PersonnelBO personnel = this.personnelDao.findPersonnelById(userContext.getId());
    String searchString = ((PersonActionForm) form).getSearchString();
    addSeachValues(searchString, personnel.getOffice().getOfficeId().toString(), personnel.getOffice().getOfficeName(), request);
    searchString = org.mifos.framework.util.helpers.SearchUtils.normalizeSearchString(searchString);
    actionForward = super.search(mapping, form, request, response);
    SessionUtils.setQueryResultAttribute(Constants.SEARCH_RESULTS, legacyPersonnelDao.search(searchString, userContext.getId()), request);
    return actionForward;
}
Also used : PersonActionForm(org.mifos.customers.personnel.struts.actionforms.PersonActionForm) PersonnelBO(org.mifos.customers.personnel.business.PersonnelBO) UserContext(org.mifos.security.util.UserContext) ActionForward(org.apache.struts.action.ActionForward) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Aggregations

TransactionDemarcate (org.mifos.framework.util.helpers.TransactionDemarcate)259 UserContext (org.mifos.security.util.UserContext)72 ArrayList (java.util.ArrayList)41 CloseSession (org.mifos.framework.util.helpers.CloseSession)35 LoanBO (org.mifos.accounts.loan.business.LoanBO)26 ClientCustActionForm (org.mifos.customers.client.struts.actionforms.ClientCustActionForm)21 CustomerBO (org.mifos.customers.business.CustomerBO)20 SavingsBO (org.mifos.accounts.savings.business.SavingsBO)19 AccountBO (org.mifos.accounts.business.AccountBO)18 ApplicationException (org.mifos.framework.exceptions.ApplicationException)17 ActionErrors (org.apache.struts.action.ActionErrors)14 LocalDate (org.joda.time.LocalDate)14 AccountApplyPaymentActionForm (org.mifos.accounts.struts.actionforms.AccountApplyPaymentActionForm)14 ClientBO (org.mifos.customers.client.business.ClientBO)14 CustomFieldDto (org.mifos.dto.domain.CustomFieldDto)13 List (java.util.List)12 AccountPaymentEntity (org.mifos.accounts.business.AccountPaymentEntity)12 CustomFieldDefinitionEntity (org.mifos.application.master.business.CustomFieldDefinitionEntity)12 MeetingBO (org.mifos.application.meeting.business.MeetingBO)12 ActionForward (org.apache.struts.action.ActionForward)11