Search in sources :

Example 11 with CustomFieldDto

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

the class CenterCustActionForm method clearActionFormFields.

public void clearActionFormFields() {
    setDefaultFees(new ArrayList<ApplicableAccountFeeDto>());
    setAdditionalFees(new ArrayList<ApplicableAccountFeeDto>());
    setCustomerPositions(new ArrayList<CustomerPositionDto>());
    setCustomFields(new ArrayList<CustomFieldDto>());
    setAddress(new Address());
    setDisplayName(null);
    setMfiJoiningDate(null);
    setGlobalCustNum(null);
    setCustomerId(null);
    setExternalId(null);
    setLoanOfficerId(null);
    setQuestionGroups(null);
}
Also used : Address(org.mifos.framework.business.util.Address) CustomFieldDto(org.mifos.dto.domain.CustomFieldDto) CustomerPositionDto(org.mifos.dto.domain.CustomerPositionDto) ApplicableAccountFeeDto(org.mifos.dto.domain.ApplicableAccountFeeDto)

Example 12 with CustomFieldDto

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

the class ClientCustActionForm method clearMostButNotAllFieldsOnActionForm.

public void clearMostButNotAllFieldsOnActionForm() {
    setDefaultFees(new ArrayList<ApplicableAccountFeeDto>());
    setAdditionalFees(new ArrayList<ApplicableAccountFeeDto>());
    setCustomFields(new ArrayList<CustomFieldDto>());
    setFamilyNames(new ArrayList<ClientNameDetailDto>());
    setFamilyDetails(new ArrayList<ClientFamilyDetailDto>());
    setFamilyRelationship(new ArrayList<Short>());
    setFamilyFirstName(new ArrayList<String>());
    setFamilyMiddleName(new ArrayList<String>());
    setFamilyLastName(new ArrayList<String>());
    setFamilySecondLastName(new ArrayList<String>());
    setFamilyDateOfBirthDD(new ArrayList<String>());
    setFamilyDateOfBirthMM(new ArrayList<String>());
    setFamilyDateOfBirthYY(new ArrayList<String>());
    setFamilyGender(new ArrayList<Short>());
    setFamilyLivingStatus(new ArrayList<Short>());
    initializeFamilyMember();
    addFamilyMember();
    setAddress(new Address());
    setDisplayName(null);
    setDateOfBirthDD(null);
    setDateOfBirthMM(null);
    setDateOfBirthYY(null);
    setGovernmentId(null);
    setMfiJoiningDate(null);
    setGlobalCustNum(null);
    setCustomerId(null);
    setExternalId(null);
    setLoanOfficerId(null);
    setLoanOfficerName("");
    setFormedByPersonnel(null);
    setTrained(null);
    setTrainedDate(null);
    setClientName(new ClientNameDetailDto());
    setSpouseName(new ClientNameDetailDto());
    setClientDetailView(new ClientPersonalDetailDto());
    setNextOrPreview("next");
    setQuestionGroups(null);
    for (int i = 0; i < getSelectedOfferings().size(); i++) {
        getSelectedOfferings().set(i, null);
    }
    setFiles(new ArrayList<FormFile>());
    setFilesMetadata(new ArrayList<UploadedFileDto>());
}
Also used : Address(org.mifos.framework.business.util.Address) CustomFieldDto(org.mifos.dto.domain.CustomFieldDto) ClientPersonalDetailDto(org.mifos.dto.screen.ClientPersonalDetailDto) ApplicableAccountFeeDto(org.mifos.dto.domain.ApplicableAccountFeeDto) FormFile(org.apache.struts.upload.FormFile) ClientFamilyDetailDto(org.mifos.dto.screen.ClientFamilyDetailDto) ClientNameDetailDto(org.mifos.dto.screen.ClientNameDetailDto) UploadedFileDto(org.mifos.dto.screen.UploadedFileDto)

Example 13 with CustomFieldDto

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

the class CenterCustAction method manage.

// NOTE edit center details
@TransactionDemarcate(joinToken = true)
public ActionForward manage(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
    CenterCustActionForm actionForm = (CenterCustActionForm) form;
    actionForm.clearActionFormFields();
    CenterBO center = (CenterBO) SessionUtils.getAttribute(Constants.BUSINESS_KEY, request);
    final Integer centerId = center.getCustomerId();
    center = this.customerDao.findCenterBySystemId(center.getGlobalCustNum());
    SessionUtils.setAttribute(Constants.BUSINESS_KEY, null, request);
    CenterDto centerDto = this.centerServiceFacade.retrieveCenterDetailsForUpdate(centerId);
    actionForm.setLoanOfficerId(centerDto.getLoanOfficerIdAsString());
    actionForm.setCustomerId(centerDto.getCustomerIdAsString());
    actionForm.setGlobalCustNum(centerDto.getGlobalCustNum());
    actionForm.setExternalId(centerDto.getExternalId());
    actionForm.setMfiJoiningDate(centerDto.getMfiJoiningDateAsString());
    actionForm.setMfiJoiningDate(centerDto.getMfiJoiningDate().getDayOfMonth(), centerDto.getMfiJoiningDate().getMonthOfYear(), centerDto.getMfiJoiningDate().getYear());
    actionForm.setAddress(center.getAddress());
    actionForm.setCustomerPositions(centerDto.getCustomerPositionViews());
    actionForm.setCustomFields(new ArrayList<CustomFieldDto>());
    SessionUtils.setAttribute(Constants.BUSINESS_KEY, center, request);
    SessionUtils.setCollectionAttribute(CustomerConstants.LOAN_OFFICER_LIST, centerDto.getActiveLoanOfficersForBranch(), request);
    SessionUtils.setCollectionAttribute(CustomerConstants.CUSTOM_FIELDS_LIST, new ArrayList<CustomFieldDto>(), request);
    SessionUtils.setCollectionAttribute(CustomerConstants.POSITIONS, centerDto.getCustomerPositionViews(), request);
    SessionUtils.setCollectionAttribute(CustomerConstants.CLIENT_LIST, centerDto.getClientList(), request);
    return mapping.findForward(ActionForwards.manage_success.toString());
}
Also used : CenterCustActionForm(org.mifos.customers.center.struts.actionforms.CenterCustActionForm) CustomFieldDto(org.mifos.dto.domain.CustomFieldDto) CenterBO(org.mifos.customers.center.business.CenterBO) CenterDto(org.mifos.dto.domain.CenterDto) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Example 14 with CustomFieldDto

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

the class CenterUpdateUsingCustomerServiceIntegrationTest method canUpdateCenterWithDifferentLoanOfficer.

@Test
public void canUpdateCenterWithDifferentLoanOfficer() throws Exception {
    // setup
    String externalId = center.getExternalId();
    String mfiJoiningDate = new SimpleDateFormat("dd/MM/yyyy").format(center.getMfiJoiningDate());
    AddressDto address = null;
    if (center.getAddress() != null) {
        address = Address.toDto(center.getAddress());
    }
    List<CustomFieldDto> customFields = new ArrayList<CustomFieldDto>();
    List<CustomerPositionDto> customerPositions = new ArrayList<CustomerPositionDto>();
    UserContext userContext = TestUtils.makeUser();
    otherLoanOfficer.setPreferredLocale(userContext.getLocaleId());
    IntegrationTestObjectMother.createPersonnel(otherLoanOfficer);
    String updatedDisplayName = "Center " + RandomStringUtils.randomAlphanumeric(5);
    CenterUpdate centerUpdate = new CenterUpdate(center.getCustomerId(), updatedDisplayName, center.getVersionNo(), otherLoanOfficer.getPersonnelId(), externalId, mfiJoiningDate, address, customFields, customerPositions);
    // exercise test
    customerService.updateCenter(userContext, centerUpdate);
    // verification
    center = customerDao.findCenterBySystemId(center.getGlobalCustNum());
    assertThat(center.getPersonnel().getDisplayName(), is(otherLoanOfficer.getDisplayName()));
}
Also used : CenterUpdate(org.mifos.dto.domain.CenterUpdate) UserContext(org.mifos.security.util.UserContext) 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) Test(org.junit.Test)

Example 15 with CustomFieldDto

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

the class CenterUpdateUsingCustomerServiceIntegrationTest method canUpdateCenterWithNoLoanOfficerWhenCenterIsInactive.

@Test
public void canUpdateCenterWithNoLoanOfficerWhenCenterIsInactive() throws Exception {
    // setup
    CustomerStatusFlag centerStatusFlag = null;
    CustomerNoteEntity customerNote = null;
    customerService.updateCenterStatus(center, CustomerStatus.CENTER_INACTIVE, centerStatusFlag, customerNote);
    StaticHibernateUtil.flushAndClearSession();
    Short loanOfficerId = null;
    String externalId = center.getExternalId();
    String mfiJoiningDate = new SimpleDateFormat("dd/MM/yyyy").format(center.getMfiJoiningDate());
    AddressDto address = null;
    if (center.getAddress() != null) {
        address = Address.toDto(center.getAddress());
    }
    List<CustomFieldDto> customFields = new ArrayList<CustomFieldDto>();
    List<CustomerPositionDto> customerPositions = new ArrayList<CustomerPositionDto>();
    String updatedDisplayName = "Center " + RandomStringUtils.randomAlphanumeric(5);
    CenterUpdate centerUpdate = new CenterUpdate(center.getCustomerId(), updatedDisplayName, center.getVersionNo(), loanOfficerId, externalId, mfiJoiningDate, address, customFields, customerPositions);
    UserContext userContext = TestUtils.makeUser();
    // exercise test
    customerService.updateCenter(userContext, centerUpdate);
    // verification
    center = customerDao.findCenterBySystemId(center.getGlobalCustNum());
    assertThat(center.getPersonnel(), is(nullValue()));
}
Also used : CustomerNoteEntity(org.mifos.customers.business.CustomerNoteEntity) CustomerStatusFlag(org.mifos.customers.util.helpers.CustomerStatusFlag) UserContext(org.mifos.security.util.UserContext) CustomFieldDto(org.mifos.dto.domain.CustomFieldDto) ArrayList(java.util.ArrayList) AddressDto(org.mifos.dto.domain.AddressDto) CenterUpdate(org.mifos.dto.domain.CenterUpdate) CustomerPositionDto(org.mifos.dto.domain.CustomerPositionDto) SimpleDateFormat(java.text.SimpleDateFormat) Test(org.junit.Test)

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