use of org.mifos.accounts.fees.struts.actionforms.FeeActionForm in project head by mifos.
the class FeeAction method load.
@TransactionDemarcate(saveToken = true)
public ActionForward load(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
form.reset(mapping, request);
((FeeActionForm) form).clear();
FeeDetailsForLoadDto feeDetailsForLoad = this.feeServiceFacade.retrieveDetailsForFeeLoad();
request.getSession().setAttribute("isMultiCurrencyEnabled", feeDetailsForLoad.isMultiCurrencyEnabled());
request.getSession().setAttribute(FeeParameters.class.getSimpleName(), feeDetailsForLoad.getFeeParameters());
request.getSession().setAttribute("currencies", AccountingRules.getCurrencies());
request.getSession().setAttribute("GlNamesMode", AccountingRules.getGlNamesMode());
return mapping.findForward(ActionForwards.load_success.toString());
}
use of org.mifos.accounts.fees.struts.actionforms.FeeActionForm in project head by mifos.
the class FeeAction method preview.
@TransactionDemarcate(joinToken = true)
public ActionForward preview(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
FeeActionForm feeActionForm = (FeeActionForm) form;
Short currencyId = feeActionForm.getCurrencyId();
FeeDetailsForPreviewDto feeDetailsForPreview = this.feeServiceFacade.retrieveDetailsforFeePreview(currencyId);
SessionUtils.setAttribute("isMultiCurrencyEnabled", feeDetailsForPreview.isMultiCurrencyEnabled(), request);
if (feeDetailsForPreview.isMultiCurrencyEnabled()) {
request.getSession().setAttribute("currencyCode", feeDetailsForPreview.getCurrencyCode());
}
return mapping.findForward(ActionForwards.preview_success.toString());
}
use of org.mifos.accounts.fees.struts.actionforms.FeeActionForm in project head by mifos.
the class FeeAction method create.
@TransactionDemarcate(validateAndResetToken = true)
public ActionForward create(ActionMapping mapping, ActionForm form, @SuppressWarnings("unused") HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
FeeActionForm actionForm = (FeeActionForm) form;
Short feeCategory = null;
if (actionForm.getCategoryTypeValue() != null) {
feeCategory = actionForm.getCategoryTypeValue().getValue();
}
Short feeFrequency = null;
if (actionForm.getFeeFrequencyTypeValue() != null) {
feeFrequency = actionForm.getFeeFrequencyTypeValue().getValue();
}
Short feePayment = null;
if (actionForm.getFeePaymentTypeValue() != null) {
feePayment = actionForm.getFeePaymentTypeValue().getValue();
}
Short feeFormula = null;
if (actionForm.getFeeFormulaValue() != null) {
feeFormula = actionForm.getFeeFormulaValue().getValue();
}
Short feeRecurrence = null;
if (actionForm.getFeeRecurrenceTypeValue() != null) {
feeRecurrence = actionForm.getFeeRecurrenceTypeValue().getValue();
}
FeeCreateDto feeCreateRequest = new FeeCreateDto(feeCategory, feeFrequency, actionForm.getGlCodeValue(), feePayment, feeFormula, actionForm.getFeeName(), actionForm.isRateFee(), actionForm.isCustomerDefaultFee(), actionForm.getRateValue(), actionForm.getCurrencyId(), actionForm.getAmount(), feeRecurrence, actionForm.getMonthRecurAfterValue(), actionForm.getWeekRecurAfterValue());
String feeId = this.feeServiceFacade.createFee(feeCreateRequest);
actionForm.setFeeId(feeId);
return mapping.findForward(ActionForwards.create_success.toString());
}
use of org.mifos.accounts.fees.struts.actionforms.FeeActionForm in project head by mifos.
the class FeeAction method update.
@TransactionDemarcate(validateAndResetToken = true)
public ActionForward update(ActionMapping mapping, ActionForm form, @SuppressWarnings("unused") HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
FeeActionForm feeActionForm = (FeeActionForm) form;
FeeStatus feeStatus = feeActionForm.getFeeStatusValue();
String forward = "";
Short feeStatusValue = null;
String whereToForward = "";
if (feeStatus != null) {
feeStatusValue = feeStatus.getValue();
}
FeeUpdateRequest feeUpdateRequest = new FeeUpdateRequest(Short.valueOf(feeActionForm.getFeeId()), feeActionForm.getCurrencyId(), feeActionForm.getAmount(), feeStatusValue, feeActionForm.getRateValue());
if (feeUpdateRequest.getFeeStatusValue() == 2) {
this.feeServiceFacade.updateFee(feeUpdateRequest);
try {
boolean remove = feeActionForm.isToRemove();
this.feeServiceFacade.removeFee(feeUpdateRequest, remove);
whereToForward = REMOVE_SUCCESS;
} catch (MifosRuntimeException e) {
ActionMessages messages = new ActionMessages();
messages.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("Fees.feeCannotBeRemoved"));
saveMessages(request, messages);
whereToForward = UPDATE_SUCCESS;
}
} else if (feeActionForm.isToRemove() && feeUpdateRequest.getFeeStatusValue() == 1) {
ActionMessages errors = new ActionMessages();
errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("Fees.feeCantBeRemove"));
saveErrors(request, errors);
whereToForward = UPDATE_FAILURE;
} else {
this.feeServiceFacade.updateFee(feeUpdateRequest);
whereToForward = UPDATE_SUCCESS;
}
if (whereToForward.equals(UPDATE_SUCCESS)) {
forward = ActionForwards.update_success.toString();
} else if (whereToForward.equals(UPDATE_FAILURE)) {
forward = ActionForwards.update_failure.toString();
} else if (whereToForward.equals(REMOVE_SUCCESS)) {
forward = ActionForwards.remove_fee_success.toString();
}
return mapping.findForward(forward);
}
use of org.mifos.accounts.fees.struts.actionforms.FeeActionForm in project head by mifos.
the class FeeAction method manage.
@TransactionDemarcate(joinToken = true)
public ActionForward manage(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
form.reset(mapping, request);
FeeActionForm feeActionForm = (FeeActionForm) form;
Short feeId = Short.valueOf(feeActionForm.getFeeId());
FeeDto fee = this.feeDao.findDtoById(feeId);
List<FeeStatusEntity> feeStatuses = this.feeDao.retrieveFeeStatuses();
SessionUtils.setCollectionAttribute(FeeConstants.STATUSLIST, feeStatuses, request);
feeActionForm.updateWithFee(fee);
request.getSession().setAttribute("feeModel", fee);
return mapping.findForward(ActionForwards.manage_success.toString());
}
Aggregations