Search in sources :

Example 26 with ClientCustActionForm

use of org.mifos.customers.client.struts.actionforms.ClientCustActionForm in project head by mifos.

the class PictureFormFile method prevEditPersonalInfo.

@TransactionDemarcate(joinToken = true)
public ActionForward prevEditPersonalInfo(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse httpservletresponse) throws Exception {
    ClientCustActionForm actionForm = (ClientCustActionForm) form;
    boolean isFamilyDetailsRequired = ClientRules.isFamilyDetailsRequired();
    SessionUtils.setAttribute(ClientConstants.ARE_FAMILY_DETAILS_REQUIRED, isFamilyDetailsRequired, request);
    if (isFamilyDetailsRequired) {
        SessionUtils.setAttribute(ClientConstants.ARE_FAMILY_DETAILS_MANDATORY, isFamilyDetailsMandatory(), request);
        SessionUtils.setAttribute(ClientConstants.ARE_FAMILY_DETAILS_HIDDEN, false, request);
    } else {
        SessionUtils.setAttribute(ClientConstants.ARE_FAMILY_DETAILS_MANDATORY, isSpouseFatherInformationMandatory(), request);
        SessionUtils.setAttribute(ClientConstants.ARE_FAMILY_DETAILS_HIDDEN, isSpouseFatherInformationHidden(), request);
    }
    actionForm.setAge(calculateAge(DateUtils.getDateAsSentFromBrowser(actionForm.getDateOfBirth())));
    return mapping.findForward(ActionForwards.prevEditPersonalInfo_success.toString());
}
Also used : ClientCustActionForm(org.mifos.customers.client.struts.actionforms.ClientCustActionForm) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Example 27 with ClientCustActionForm

use of org.mifos.customers.client.struts.actionforms.ClientCustActionForm in project head by mifos.

the class PictureFormFile method prevFamilyInfoNext.

@TransactionDemarcate(joinToken = true)
public ActionForward prevFamilyInfoNext(ActionMapping mapping, ActionForm form, @SuppressWarnings("unused") HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse httpservletresponse) throws Exception {
    ClientCustActionForm actionForm = (ClientCustActionForm) form;
    actionForm.setFamilyDateOfBirth();
    actionForm.constructFamilyDetails();
    return mapping.findForward(ActionForwards.prevFamilyInfoNext_success.toString());
}
Also used : ClientCustActionForm(org.mifos.customers.client.struts.actionforms.ClientCustActionForm) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Example 28 with ClientCustActionForm

use of org.mifos.customers.client.struts.actionforms.ClientCustActionForm in project head by mifos.

the class PictureFormFile method deleteFile.

@TransactionDemarcate(joinToken = true)
public ActionForward deleteFile(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
    ClientCustActionForm actionForm = (ClientCustActionForm) form;
    String fileName = request.getParameter("fileName");
    if (fileName != null) {
        int index = 0;
        for (FormFile formFile : actionForm.getFiles()) {
            if (formFile.getFileName().equals(fileName)) {
                index = actionForm.getFiles().indexOf(formFile);
                break;
            }
        }
        if (index >= 0) {
            actionForm.getFiles().remove(index);
            actionForm.getFilesMetadata().remove(index);
        }
    }
    return mapping.findForward(ActionForwards.load_success.toString());
}
Also used : ClientCustActionForm(org.mifos.customers.client.struts.actionforms.ClientCustActionForm) FormFile(org.apache.struts.upload.FormFile) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Example 29 with ClientCustActionForm

use of org.mifos.customers.client.struts.actionforms.ClientCustActionForm in project head by mifos.

the class ClientCustActionStrutsTest method testCreateSuccessWithoutGroup.

@Test
public void testCreateSuccessWithoutGroup() throws Exception {
    SecurityContext securityContext = new SecurityContextImpl();
    MifosUser principal = new MifosUserBuilder().nonLoanOfficer().withAdminRole().build();
    Authentication authentication = new TestingAuthenticationToken(principal, principal);
    securityContext.setAuthentication(authentication);
    SecurityContextHolder.setContext(securityContext);
    //        List<FeeDto> feesToRemove = getFees(RecurrenceType.WEEKLY);
    setRequestPathInfo("/clientCustAction.do");
    addRequestParameter("method", "load");
    addRequestParameter("officeId", "3");
    addRequestParameter("groupFlag", "0");
    addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
    actionPerform();
    flowKey = (String) request.getAttribute(Constants.CURRENTFLOWKEY);
    List<BusinessActivityEntity> povertyStatus = (List<BusinessActivityEntity>) SessionUtils.getAttribute(ClientConstants.POVERTY_STATUS, request);
    List<CustomFieldDto> customFieldDefs = getCustomFieldFromSession();
    setRequestPathInfo("/clientCustAction.do");
    addRequestParameter("method", "next");
    addRequestParameter("officeId", "3");
    addRequestParameter("clientName.salutation", "1");
    addRequestParameter("clientName.firstName", "Client");
    addRequestParameter("clientName.lastName", "LastName");
    addRequestParameter("spouseName.firstName", "Spouse");
    addRequestParameter("spouseName.lastName", "LastName");
    addRequestParameter("spouseName.nameType", "1");
    addRequestDateParameter("dateOfBirth", "20/3/1987");
    addRequestParameter("clientDetailView.gender", "1");
    addRequestParameter("input", "personalInfo");
    addRequestParameter("customerDetail.povertyStatus", povertyStatus.get(0).getId().toString());
    int i = 0;
    for (CustomFieldDto customFieldDef : customFieldDefs) {
        addRequestParameter("customField[" + i + "].fieldId", customFieldDef.getFieldId().toString());
        addRequestParameter("customField[" + i + "].fieldValue", "Req");
        i++;
    }
    addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
    actionPerform();
    MeetingBO weeklyMeeting = new MeetingBuilder().weekly().every(1).occuringOnA(WeekDay.WEDNESDAY).build();
    SessionUtils.setAttribute(CustomerConstants.CUSTOMER_MEETING, weeklyMeeting, request);
    setRequestPathInfo("/clientCustAction.do");
    addRequestParameter("method", "preview");
    addRequestParameter("input", "mfiInfo");
    addRequestParameter("loanOfficerId", "1");
    addRequestParameter("formedByPersonnel", "1");
    addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
    actionPerform();
    verifyNoActionErrors();
    verifyNoActionMessages();
    verifyForward(ActionForwards.preview_success.toString());
    setRequestPathInfo("/clientCustAction.do");
    addRequestParameter("method", "create");
    addRequestParameter("input", "create");
    addRequestParameter("status", "1");
    addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
    actionPerform();
    verifyNoActionErrors();
    verifyNoActionMessages();
    verifyForward(ActionForwards.create_success.toString());
    ClientCustActionForm actionForm = (ClientCustActionForm) request.getSession().getAttribute("clientCustActionForm");
    client = TestObjectFactory.getClient(actionForm.getCustomerIdAsInt());
//        removeFees(feesToRemove);
}
Also used : ClientCustActionForm(org.mifos.customers.client.struts.actionforms.ClientCustActionForm) BusinessActivityEntity(org.mifos.application.master.business.BusinessActivityEntity) SecurityContextImpl(org.springframework.security.core.context.SecurityContextImpl) MeetingBO(org.mifos.application.meeting.business.MeetingBO) CustomFieldDto(org.mifos.dto.domain.CustomFieldDto) MifosUser(org.mifos.security.MifosUser) MifosUserBuilder(org.mifos.builders.MifosUserBuilder) TestingAuthenticationToken(org.springframework.security.authentication.TestingAuthenticationToken) Authentication(org.springframework.security.core.Authentication) SecurityContext(org.springframework.security.core.context.SecurityContext) List(java.util.List) ArrayList(java.util.ArrayList) MeetingBuilder(org.mifos.domain.builders.MeetingBuilder) Test(org.junit.Test)

Aggregations

ClientCustActionForm (org.mifos.customers.client.struts.actionforms.ClientCustActionForm)29 TransactionDemarcate (org.mifos.framework.util.helpers.TransactionDemarcate)21 ArrayList (java.util.ArrayList)10 List (java.util.List)8 CustomFieldDto (org.mifos.dto.domain.CustomFieldDto)8 Test (org.junit.Test)7 ClientBO (org.mifos.customers.client.business.ClientBO)7 ClientNameDetailDto (org.mifos.dto.screen.ClientNameDetailDto)7 BusinessActivityEntity (org.mifos.application.master.business.BusinessActivityEntity)5 MeetingBO (org.mifos.application.meeting.business.MeetingBO)5 UserContext (org.mifos.security.util.UserContext)5 FormFile (org.apache.struts.upload.FormFile)4 ApplicableAccountFeeDto (org.mifos.dto.domain.ApplicableAccountFeeDto)4 InformationOrderServiceFacade (org.mifos.platform.questionnaire.service.InformationOrderServiceFacade)4 ByteArrayInputStream (java.io.ByteArrayInputStream)3 InputStream (java.io.InputStream)3 DateTime (org.joda.time.DateTime)3 FeeDto (org.mifos.accounts.fees.business.FeeDto)3 SpouseFatherLookupEntity (org.mifos.application.master.business.SpouseFatherLookupEntity)3 SavingsDetailDto (org.mifos.dto.domain.SavingsDetailDto)3