Search in sources :

Example 1 with ClientRulesDto

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

the class ClientServiceFacadeWebTier method retrieveFamilyInfoForEdit.

@Override
public ClientFamilyInfoDto retrieveFamilyInfoForEdit(String clientGlobalCustNum) {
    ClientBO client = this.customerDao.findClientBySystemId(clientGlobalCustNum);
    ClientDropdownsDto clientDropdowns = retrieveClientDropdownData();
    ClientRulesDto clientRules = retrieveClientRules();
    CustomerDetailDto customerDetail = client.toCustomerDetailDto();
    ClientDetailDto clientDetail = client.toClientDetailDto(clientRules.isFamilyDetailsRequired());
    List<ClientNameDetailDto> familyMembers = new ArrayList<ClientNameDetailDto>();
    Map<Integer, List<ClientFamilyDetailDto>> clientFamilyDetails = new HashMap<Integer, List<ClientFamilyDetailDto>>();
    int familyMemberCount = 0;
    for (ClientNameDetailEntity clientNameDetailEntity : client.getNameDetailSet()) {
        if (clientNameDetailEntity.isNotClientNameType()) {
            ClientNameDetailDto nameView1 = clientNameDetailEntity.toDto();
            familyMembers.add(nameView1);
            for (ClientFamilyDetailEntity clientFamilyDetailEntity : client.getFamilyDetailSet()) {
                if (clientNameDetailEntity.matchesCustomerId(clientFamilyDetailEntity.getClientName().getCustomerNameId())) {
                    ClientFamilyDetailDto clientFamilyDetail = clientFamilyDetailEntity.toDto();
                    addFamilyDetailsDtoToMap(clientFamilyDetails, familyMemberCount, clientFamilyDetail);
                }
            }
            familyMemberCount++;
        }
    }
    return new ClientFamilyInfoDto(clientDropdowns, customerDetail, clientDetail, familyMembers, clientFamilyDetails);
}
Also used : HashMap(java.util.HashMap) ClientBO(org.mifos.customers.client.business.ClientBO) ArrayList(java.util.ArrayList) ClientFamilyDetailDto(org.mifos.dto.screen.ClientFamilyDetailDto) ClientNameDetailDto(org.mifos.dto.screen.ClientNameDetailDto) ClientNameDetailEntity(org.mifos.customers.client.business.ClientNameDetailEntity) ClientRulesDto(org.mifos.dto.domain.ClientRulesDto) ClientDetailDto(org.mifos.dto.screen.ClientDetailDto) CustomerDetailDto(org.mifos.dto.domain.CustomerDetailDto) ArrayList(java.util.ArrayList) List(java.util.List) ClientDropdownsDto(org.mifos.dto.screen.ClientDropdownsDto) ClientFamilyDetailEntity(org.mifos.customers.client.business.ClientFamilyDetailEntity) ClientFamilyInfoDto(org.mifos.dto.screen.ClientFamilyInfoDto)

Example 2 with ClientRulesDto

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

the class ClientServiceFacadeWebTier method retrieveClientFormCreationData.

@Override
public ClientFormCreationDto retrieveClientFormCreationData(Short groupFlag, Short officeId, String parentGroupId) {
    MifosUser user = (MifosUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
    UserContext userContext = toUserContext(user);
    List<PersonnelDto> personnelList = new ArrayList<PersonnelDto>();
    MeetingBO parentCustomerMeeting = null;
    Short formedByPersonnelId = null;
    String formedByPersonnelName = "";
    String centerDisplayName = "";
    String groupDisplayName = "";
    String officeName = "";
    List<FeeBO> fees = new ArrayList<FeeBO>();
    Short applicableOfficeId = officeId;
    if (YesNoFlag.YES.getValue().equals(groupFlag)) {
        Integer parentCustomerId = Integer.valueOf(parentGroupId);
        CustomerBO parentCustomer = this.customerDao.findCustomerById(parentCustomerId);
        groupDisplayName = parentCustomer.getDisplayName();
        if (parentCustomer.getPersonnel() != null) {
            formedByPersonnelId = parentCustomer.getPersonnel().getPersonnelId();
            formedByPersonnelName = parentCustomer.getPersonnel().getDisplayName();
        }
        if (parentCustomer.getParentCustomer() != null) {
            centerDisplayName = parentCustomer.getParentCustomer().getDisplayName();
        }
        applicableOfficeId = parentCustomer.getOffice().getOfficeId();
        officeName = parentCustomer.getOffice().getOfficeName();
        if (parentCustomer.getCustomerMeeting() != null) {
            parentCustomerMeeting = parentCustomer.getCustomerMeetingValue();
            fees = this.customerDao.retrieveFeesApplicableToClientsRefinedBy(parentCustomer.getCustomerMeetingValue());
        } else {
            fees = this.customerDao.retrieveFeesApplicableToClients();
        }
    } else if (YesNoFlag.NO.getValue().equals(groupFlag)) {
        CenterCreation centerCreation = new CenterCreation(applicableOfficeId, userContext.getId(), userContext.getLevelId(), userContext.getPreferredLocale());
        personnelList = this.personnelDao.findActiveLoanOfficersForOffice(centerCreation);
        fees = this.customerDao.retrieveFeesApplicableToClients();
    }
    CustomerApplicableFeesDto applicableFees = CustomerApplicableFeesDto.toDto(fees, userContext);
    List<ApplicableAccountFeeDto> defaultFees = new ArrayList<ApplicableAccountFeeDto>();
    for (FeeDto fee : applicableFees.getDefaultFees()) {
        defaultFees.add(new ApplicableAccountFeeDto(fee.getFeeIdValue().intValue(), fee.getFeeName(), fee.getAmount(), fee.isRemoved(), fee.isWeekly(), fee.isMonthly(), fee.isPeriodic(), fee.getFeeSchedule()));
    }
    List<ApplicableAccountFeeDto> additionalFees = new ArrayList<ApplicableAccountFeeDto>();
    for (FeeDto fee : applicableFees.getAdditionalFees()) {
        additionalFees.add(new ApplicableAccountFeeDto(fee.getFeeIdValue().intValue(), fee.getFeeName(), fee.getAmount(), fee.isRemoved(), fee.isWeekly(), fee.isMonthly(), fee.isPeriodic(), fee.getFeeSchedule()));
    }
    List<SavingsDetailDto> savingsOfferings = this.customerDao.retrieveSavingOfferingsApplicableToClient();
    ClientRulesDto clientRules = retrieveClientRules();
    ClientDropdownsDto clientDropdowns = retrieveClientDropdownData();
    List<PersonnelDto> formedByPersonnel = this.customerDao.findLoanOfficerThatFormedOffice(applicableOfficeId);
    MeetingDto parentMeeting = null;
    if (parentCustomerMeeting != null) {
        parentMeeting = parentCustomerMeeting.toDto();
    }
    return new ClientFormCreationDto(clientDropdowns, clientRules, applicableOfficeId, officeName, formedByPersonnelId, formedByPersonnelName, personnelList, formedByPersonnel, savingsOfferings, parentMeeting, centerDisplayName, groupDisplayName, additionalFees, defaultFees);
}
Also used : SavingsDetailDto(org.mifos.dto.domain.SavingsDetailDto) UserContext(org.mifos.security.util.UserContext) MeetingBO(org.mifos.application.meeting.business.MeetingBO) ArrayList(java.util.ArrayList) ApplicableAccountFeeDto(org.mifos.dto.domain.ApplicableAccountFeeDto) FeeDto(org.mifos.accounts.fees.business.FeeDto) PersonnelDto(org.mifos.dto.domain.PersonnelDto) MifosUser(org.mifos.security.MifosUser) ApplicableAccountFeeDto(org.mifos.dto.domain.ApplicableAccountFeeDto) CustomerMeetingDto(org.mifos.dto.domain.CustomerMeetingDto) MeetingDto(org.mifos.dto.domain.MeetingDto) CenterCreation(org.mifos.dto.domain.CenterCreation) ClientRulesDto(org.mifos.dto.domain.ClientRulesDto) CustomerBO(org.mifos.customers.business.CustomerBO) FeeBO(org.mifos.accounts.fees.business.FeeBO) ClientFormCreationDto(org.mifos.dto.screen.ClientFormCreationDto) ClientDropdownsDto(org.mifos.dto.screen.ClientDropdownsDto)

Example 3 with ClientRulesDto

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

the class ClientServiceFacadeWebTier method retrieveClientRules.

private ClientRulesDto retrieveClientRules() {
    boolean centerHierarchyExists = ClientRules.getCenterHierarchyExists();
    int maxNumberOfFamilyMembers = ClientRules.getMaximumNumberOfFamilyMembers();
    boolean familyDetailsRequired = ClientRules.isFamilyDetailsRequired();
    ClientRulesDto clientRules = new ClientRulesDto(centerHierarchyExists, maxNumberOfFamilyMembers, familyDetailsRequired);
    return clientRules;
}
Also used : ClientRulesDto(org.mifos.dto.domain.ClientRulesDto)

Example 4 with ClientRulesDto

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

the class ClientServiceFacadeWebTier method retrieveClientPersonalInfoForUpdate.

@Override
public ClientPersonalInfoDto retrieveClientPersonalInfoForUpdate(String clientSystemId, String clientStatus, short loanOfficerId) {
    ClientDropdownsDto clientDropdowns = retrieveClientDropdownData();
    ClientRulesDto clientRules = retrieveClientRules();
    ClientBO client = this.customerDao.findClientBySystemId(clientSystemId);
    CustomerDetailDto customerDetailDto = client.toCustomerDetailDto();
    ClientDetailDto clientDetailDto = client.toClientDetailDto(clientRules.isFamilyDetailsRequired());
    return new ClientPersonalInfoDto(clientDropdowns, clientRules, customerDetailDto, clientDetailDto);
}
Also used : ClientRulesDto(org.mifos.dto.domain.ClientRulesDto) ClientBO(org.mifos.customers.client.business.ClientBO) ClientDetailDto(org.mifos.dto.screen.ClientDetailDto) CustomerDetailDto(org.mifos.dto.domain.CustomerDetailDto) ClientPersonalInfoDto(org.mifos.dto.screen.ClientPersonalInfoDto) ClientDropdownsDto(org.mifos.dto.screen.ClientDropdownsDto)

Example 5 with ClientRulesDto

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

the class PictureFormFile method previewEditPersonalInfo.

@TransactionDemarcate(joinToken = true)
public ActionForward previewEditPersonalInfo(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse httpservletresponse) throws Exception {
    ClientCustActionForm actionForm = (ClientCustActionForm) form;
    String dateOfBirth = actionForm.getDateOfBirth();
    actionForm.setAge(calculateAge(DateUtils.getDateAsSentFromBrowser(dateOfBirth)));
    ClientRulesDto clientRules = this.clientServiceFacade.retrieveClientDetailsForPreviewingEditOfPersonalInfo();
    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);
    }
    ClientNameDetailDto clientName = actionForm.getClientName();
    clientName.setNames(ClientRules.getNameSequence());
    actionForm.setClientName(clientName);
    ClientNameDetailDto spouseName = actionForm.getSpouseName();
    if (spouseName != null) {
        spouseName.setNames(ClientRules.getNameSequence());
        actionForm.setSpouseName(spouseName);
    }
    return mapping.findForward(ActionForwards.previewEditPersonalInfo_success.toString());
}
Also used : ClientCustActionForm(org.mifos.customers.client.struts.actionforms.ClientCustActionForm) ClientNameDetailDto(org.mifos.dto.screen.ClientNameDetailDto) ClientRulesDto(org.mifos.dto.domain.ClientRulesDto) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Aggregations

ClientRulesDto (org.mifos.dto.domain.ClientRulesDto)5 ClientDropdownsDto (org.mifos.dto.screen.ClientDropdownsDto)3 ArrayList (java.util.ArrayList)2 ClientBO (org.mifos.customers.client.business.ClientBO)2 CustomerDetailDto (org.mifos.dto.domain.CustomerDetailDto)2 ClientDetailDto (org.mifos.dto.screen.ClientDetailDto)2 ClientNameDetailDto (org.mifos.dto.screen.ClientNameDetailDto)2 HashMap (java.util.HashMap)1 List (java.util.List)1 FeeBO (org.mifos.accounts.fees.business.FeeBO)1 FeeDto (org.mifos.accounts.fees.business.FeeDto)1 MeetingBO (org.mifos.application.meeting.business.MeetingBO)1 CustomerBO (org.mifos.customers.business.CustomerBO)1 ClientFamilyDetailEntity (org.mifos.customers.client.business.ClientFamilyDetailEntity)1 ClientNameDetailEntity (org.mifos.customers.client.business.ClientNameDetailEntity)1 ClientCustActionForm (org.mifos.customers.client.struts.actionforms.ClientCustActionForm)1 ApplicableAccountFeeDto (org.mifos.dto.domain.ApplicableAccountFeeDto)1 CenterCreation (org.mifos.dto.domain.CenterCreation)1 CustomerMeetingDto (org.mifos.dto.domain.CustomerMeetingDto)1 MeetingDto (org.mifos.dto.domain.MeetingDto)1