Search in sources :

Example 26 with CustomFieldDto

use of org.mifos.dto.domain.CustomFieldDto in project head by mifos.

the class ClientCustActionStrutsTest method testSuccessfulEditPreview.

@Test
public void testSuccessfulEditPreview() throws Exception {
    createAndSetClientInSession();
    setRequestPathInfo("/clientCustAction.do");
    addRequestParameter("method", "editPersonalInfo");
    addRequestParameter("officeId", "3");
    addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
    actionPerform();
    List<CustomFieldDto> customFieldDefs = getCustomFieldFromSession();
    setRequestPathInfo("/clientCustAction.do");
    addRequestParameter("method", "previewEditPersonalInfo");
    addRequestParameter("clientName.firstName", "Client2");
    int i = 0;
    for (CustomFieldDto customFieldDef : customFieldDefs) {
        addRequestParameter("customField[" + i + "].fieldId", customFieldDef.getFieldId().toString());
        addRequestParameter("customField[" + i + "].fieldValue", "11");
        i++;
    }
    addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
    actionPerform();
    verifyForward(ActionForwards.previewEditPersonalInfo_success.toString());
    verifyNoActionErrors();
    verifyNoActionMessages();
}
Also used : CustomFieldDto(org.mifos.dto.domain.CustomFieldDto) Test(org.junit.Test)

Example 27 with CustomFieldDto

use of org.mifos.dto.domain.CustomFieldDto in project head by mifos.

the class ClientCustActionStrutsTest method testCreateSuccessUnderGroupInBranch.

@Test
public void testCreateSuccessUnderGroupInBranch() throws Exception {
    try {
        createParentGroup();
        setRequestPathInfo("/clientCustAction.do");
        addRequestParameter("method", "load");
        addRequestParameter("parentGroupId", group.getCustomerId().toString());
        addRequestParameter("groupFlag", "1");
        addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
        actionPerform();
        flowKey = request.getAttribute(Constants.CURRENTFLOWKEY).toString();
        verifyNoActionErrors();
        verifyNoActionMessages();
        verifyForward(ActionForwards.load_success.toString());
        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", "20/3/1987");
            i++;
        }
        addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
        actionPerform();
        verifyNoActionErrors();
        verifyNoActionMessages();
        verifyForward(ActionForwards.next_success.toString());
        setRequestPathInfo("/clientCustAction.do");
        addRequestParameter("method", "preview");
        addRequestParameter("input", "mfiInfo");
        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());
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : ClientCustActionForm(org.mifos.customers.client.struts.actionforms.ClientCustActionForm) BusinessActivityEntity(org.mifos.application.master.business.BusinessActivityEntity) CustomFieldDto(org.mifos.dto.domain.CustomFieldDto) List(java.util.List) ArrayList(java.util.ArrayList) IOException(java.io.IOException) PageExpiredException(org.mifos.framework.exceptions.PageExpiredException) Test(org.junit.Test)

Example 28 with CustomFieldDto

use of org.mifos.dto.domain.CustomFieldDto in project head by mifos.

the class CenterUpdateBuilder method build.

public CenterUpdate build() {
    int versionNum = 1;
    int customerId = -1;
    Short loanOfficerId = -1;
    String externalId = null;
    String updatedDisplayName = "Center " + RandomStringUtils.random(5);
    String mfiJoiningDate = new SimpleDateFormat("dd/MM/yyyy").format(new Date());
    AddressDto address = null;
    List<CustomFieldDto> customFields = new ArrayList<CustomFieldDto>();
    List<CustomerPositionDto> customerPositions = new ArrayList<CustomerPositionDto>();
    return new CenterUpdate(customerId, updatedDisplayName, versionNum, loanOfficerId, externalId, mfiJoiningDate, address, customFields, customerPositions);
}
Also used : CenterUpdate(org.mifos.dto.domain.CenterUpdate) CustomFieldDto(org.mifos.dto.domain.CustomFieldDto) ArrayList(java.util.ArrayList) CustomerPositionDto(org.mifos.dto.domain.CustomerPositionDto) AddressDto(org.mifos.dto.domain.AddressDto) SimpleDateFormat(java.text.SimpleDateFormat) Date(java.util.Date)

Example 29 with CustomFieldDto

use of org.mifos.dto.domain.CustomFieldDto in project head by mifos.

the class TestObjectFactory method getCustomFields.

public static List<CustomFieldDto> getCustomFields() {
    List<CustomFieldDto> customFields = new ArrayList<CustomFieldDto>();
    CustomFieldDto fee = new CustomFieldDto(Short.valueOf("4"), "Custom", CustomFieldType.NUMERIC.getValue());
    customFields.add(fee);
    return customFields;
}
Also used : CustomFieldDto(org.mifos.dto.domain.CustomFieldDto) ArrayList(java.util.ArrayList)

Example 30 with CustomFieldDto

use of org.mifos.dto.domain.CustomFieldDto in project head by mifos.

the class TestObjectFactory method getCustomFieldView.

private static List<CustomFieldDto> getCustomFieldView() {
    List<CustomFieldDto> customFields = new ArrayList<CustomFieldDto>();
    customFields.add(new CustomFieldDto(new Short("8"), "custom field value", null));
    return customFields;
}
Also used : CustomFieldDto(org.mifos.dto.domain.CustomFieldDto) ArrayList(java.util.ArrayList)

Aggregations

CustomFieldDto (org.mifos.dto.domain.CustomFieldDto)86 ArrayList (java.util.ArrayList)48 Test (org.junit.Test)36 UserContext (org.mifos.security.util.UserContext)16 Date (java.util.Date)14 Address (org.mifos.framework.business.util.Address)14 TransactionDemarcate (org.mifos.framework.util.helpers.TransactionDemarcate)13 AddressDto (org.mifos.dto.domain.AddressDto)12 List (java.util.List)10 PersonnelBO (org.mifos.customers.personnel.business.PersonnelBO)10 SimpleDateFormat (java.text.SimpleDateFormat)9 BusinessActivityEntity (org.mifos.application.master.business.BusinessActivityEntity)9 ClientCustActionForm (org.mifos.customers.client.struts.actionforms.ClientCustActionForm)8 ApplicableAccountFeeDto (org.mifos.dto.domain.ApplicableAccountFeeDto)8 CustomerPositionDto (org.mifos.dto.domain.CustomerPositionDto)8 CustomFieldDefinitionEntity (org.mifos.application.master.business.CustomFieldDefinitionEntity)7 MeetingBO (org.mifos.application.meeting.business.MeetingBO)7 MifosRuntimeException (org.mifos.core.MifosRuntimeException)6 GroupCustActionForm (org.mifos.customers.group.struts.actionforms.GroupCustActionForm)6 OfficeBO (org.mifos.customers.office.business.OfficeBO)6