Search in sources :

Example 16 with LoanAccountActionForm

use of org.mifos.accounts.loan.struts.actionforms.LoanAccountActionForm in project head by mifos.

the class LoanAccountAction method captureQuestionResponses.

@TransactionDemarcate(joinToken = true)
@Override
public ActionForward captureQuestionResponses(final ActionMapping mapping, final ActionForm form, final HttpServletRequest request, @SuppressWarnings("unused") final HttpServletResponse response) throws Exception {
    request.setAttribute(METHODCALLED, "captureQuestionResponses");
    LoanAccountActionForm actionForm = (LoanAccountActionForm) form;
    setPerspective(request, actionForm.getPerspective());
    ActionErrors errors = createLoanQuestionnaire.validateResponses(request, actionForm);
    if (errors != null && !errors.isEmpty()) {
        addErrors(request, errors);
        return mapping.findForward(ActionForwards.captureQuestionResponses.toString());
    }
    return createLoanQuestionnaire.rejoinFlow(mapping);
}
Also used : LoanAccountActionForm(org.mifos.accounts.loan.struts.actionforms.LoanAccountActionForm) ActionErrors(org.apache.struts.action.ActionErrors) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Example 17 with LoanAccountActionForm

use of org.mifos.accounts.loan.struts.actionforms.LoanAccountActionForm in project head by mifos.

the class LoanAccountAction method getGroupLoanRepaymentSchedule.

@TransactionDemarcate(joinToken = true)
public ActionForward getGroupLoanRepaymentSchedule(final ActionMapping mapping, final ActionForm form, final HttpServletRequest request, @SuppressWarnings("unused") final HttpServletResponse response) throws Exception {
    LoanAccountActionForm loanAccountActionForm = (LoanAccountActionForm) form;
    UserContext userContext = getUserContext(request);
    Integer grouploanId = Integer.valueOf(request.getParameter(ACCOUNT_ID));
    Locale locale = userContext.getPreferredLocale();
    Date viewDate = loanAccountActionForm.getScheduleViewDateValue(locale);
    LoanBO groupLoan = getLoan(grouploanId);
    LoanAccountAction.setSessionAtributeForGLIM(request, groupLoan);
    groupLoan.updateDetails(userContext);
    Errors errors = loanBusinessService.computeExtraInterest(groupLoan, viewDate);
    if (errors.hasErrors()) {
        loanAccountActionForm.resetScheduleViewDate();
    }
    List<LoanBO> membersAccount = this.loanDao.findIndividualLoans(grouploanId);
    List<Integer> membersAccountIds = getMembersAccountId(membersAccount);
    OriginalScheduleInfoDto generatedSchedule = OriginalScheduleInfoHelper.sumRepaymentSchedule(getMembersSchedule(membersAccountIds));
    SessionUtils.setAttribute(Constants.BUSINESS_KEY, groupLoan, request);
    SessionUtils.setAttribute(Constants.VIEW_DATE, viewDate, request);
    SessionUtils.setAttribute(Constants.ORIGINAL_SCHEDULE_AVAILABLE, generatedSchedule.hasOriginalInstallments(), request);
    SessionUtils.setAttribute("isNewGropLoan", Boolean.TRUE, request);
    String forward = errors.hasErrors() ? ActionForwards.getLoanRepaymentScheduleFailure.toString() : ActionForwards.getLoanRepaymentSchedule.toString();
    addErrors(request, getActionErrors(errors));
    return mapping.findForward(forward);
}
Also used : Locale(java.util.Locale) LoanAccountActionForm(org.mifos.accounts.loan.struts.actionforms.LoanAccountActionForm) ActionErrors(org.apache.struts.action.ActionErrors) Errors(org.mifos.platform.validations.Errors) UserContext(org.mifos.security.util.UserContext) OriginalScheduleInfoDto(org.mifos.accounts.loan.business.service.OriginalScheduleInfoDto) LoanBO(org.mifos.accounts.loan.business.LoanBO) Date(java.util.Date) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Aggregations

LoanAccountActionForm (org.mifos.accounts.loan.struts.actionforms.LoanAccountActionForm)17 TransactionDemarcate (org.mifos.framework.util.helpers.TransactionDemarcate)10 LoanBO (org.mifos.accounts.loan.business.LoanBO)9 ArrayList (java.util.ArrayList)6 Test (org.junit.Test)6 RepaymentScheduleInstallment (org.mifos.accounts.loan.util.helpers.RepaymentScheduleInstallment)6 LoanAccountDetailsDto (org.mifos.dto.domain.LoanAccountDetailsDto)6 UserContext (org.mifos.security.util.UserContext)6 Locale (java.util.Locale)4 CustomFieldDefinitionEntity (org.mifos.application.master.business.CustomFieldDefinitionEntity)4 Money (org.mifos.framework.util.helpers.Money)4 Date (java.util.Date)3 HashSet (java.util.HashSet)3 ActionErrors (org.apache.struts.action.ActionErrors)3 MessageLookup (org.mifos.application.master.MessageLookup)3 MifosRuntimeException (org.mifos.core.MifosRuntimeException)3 LoanActivityDto (org.mifos.dto.domain.LoanActivityDto)3 ValueListElement (org.mifos.dto.domain.ValueListElement)3 LoanInformationDto (org.mifos.dto.screen.LoanInformationDto)3 ApplicationException (org.mifos.framework.exceptions.ApplicationException)3