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());
}
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());
}
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());
}
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());
}
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;
}
Aggregations