Search in sources :

Example 1 with ClientMfiInfoDto

use of org.mifos.dto.screen.ClientMfiInfoDto in project head by mifos.

the class ClientServiceFacadeWebTier method retrieveMfiInfoForEdit.

@Override
public ClientMfiInfoDto retrieveMfiInfoForEdit(String clientSystemId) {
    MifosUser user = (MifosUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
    UserContext userContext = toUserContext(user);
    ClientBO client = this.customerDao.findClientBySystemId(clientSystemId);
    String groupDisplayName = "";
    String centerDisplayName = "";
    if (client.getParentCustomer() != null) {
        groupDisplayName = client.getParentCustomer().getDisplayName();
        if (client.getParentCustomer().getParentCustomer() != null) {
            centerDisplayName = client.getParentCustomer().getParentCustomer().getDisplayName();
        }
    }
    List<PersonnelDto> loanOfficersList = new ArrayList<PersonnelDto>();
    if (!client.isClientUnderGroup()) {
        CenterCreation centerCreation = new CenterCreation(client.getOffice().getOfficeId(), userContext.getId(), userContext.getLevelId(), userContext.getPreferredLocale());
        loanOfficersList = this.personnelDao.findActiveLoanOfficersForOffice(centerCreation);
    }
    CustomerDetailDto customerDetail = client.toCustomerDetailDto();
    ClientDetailDto clientDetail = client.toClientDetailDto(ClientRules.isFamilyDetailsRequired());
    return new ClientMfiInfoDto(groupDisplayName, centerDisplayName, loanOfficersList, customerDetail, clientDetail);
}
Also used : UserContext(org.mifos.security.util.UserContext) CenterCreation(org.mifos.dto.domain.CenterCreation) ClientBO(org.mifos.customers.client.business.ClientBO) ClientDetailDto(org.mifos.dto.screen.ClientDetailDto) ArrayList(java.util.ArrayList) CustomerDetailDto(org.mifos.dto.domain.CustomerDetailDto) PersonnelDto(org.mifos.dto.domain.PersonnelDto) MifosUser(org.mifos.security.MifosUser) ClientMfiInfoDto(org.mifos.dto.screen.ClientMfiInfoDto)

Example 2 with ClientMfiInfoDto

use of org.mifos.dto.screen.ClientMfiInfoDto in project head by mifos.

the class PictureFormFile method editMfiInfo.

@TransactionDemarcate(joinToken = true)
public ActionForward editMfiInfo(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
    ClientCustActionForm actionForm = (ClientCustActionForm) form;
    actionForm.clearMostButNotAllFieldsOnActionForm();
    ClientBO clientFromSession = getClientFromSession(request);
    String clientSystemId = clientFromSession.getGlobalCustNum();
    ClientMfiInfoDto mfiInfoDto = this.clientServiceFacade.retrieveMfiInfoForEdit(clientSystemId);
    SessionUtils.setAttribute(GroupConstants.CENTER_HIERARCHY_EXIST, ClientRules.getCenterHierarchyExists(), request);
    SessionUtils.setCollectionAttribute(CustomerConstants.LOAN_OFFICER_LIST, mfiInfoDto.getLoanOfficersList(), request);
    actionForm.setGroupDisplayName(mfiInfoDto.getGroupDisplayName());
    actionForm.setCenterDisplayName(mfiInfoDto.getCenterDisplayName());
    actionForm.setLoanOfficerId(mfiInfoDto.getCustomerDetail().getLoanOfficerIdAsString());
    actionForm.setCustomerId(mfiInfoDto.getCustomerDetail().getCustomerId().toString());
    actionForm.setGlobalCustNum(mfiInfoDto.getCustomerDetail().getGlobalCustNum());
    actionForm.setExternalId(mfiInfoDto.getCustomerDetail().getExternalId());
    actionForm.setGroupFlag(mfiInfoDto.getClientDetail().getGroupFlagAsString());
    actionForm.setParentGroupId(mfiInfoDto.getClientDetail().getParentGroupId().toString());
    actionForm.setTrained(mfiInfoDto.getClientDetail().getTrainedAsString());
    actionForm.setTrainedDate(mfiInfoDto.getClientDetail().getTrainedDate());
    actionForm.setDateOfBirth(clientFromSession.getDateOfBirth());
    ClientBO client = this.customerDao.findClientBySystemId(clientSystemId);
    SessionUtils.removeThenSetAttribute(Constants.BUSINESS_KEY, client, request);
    return mapping.findForward(ActionForwards.editMfiInfo_success.toString());
}
Also used : ClientCustActionForm(org.mifos.customers.client.struts.actionforms.ClientCustActionForm) ClientBO(org.mifos.customers.client.business.ClientBO) ClientMfiInfoDto(org.mifos.dto.screen.ClientMfiInfoDto) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Aggregations

ClientBO (org.mifos.customers.client.business.ClientBO)2 ClientMfiInfoDto (org.mifos.dto.screen.ClientMfiInfoDto)2 ArrayList (java.util.ArrayList)1 ClientCustActionForm (org.mifos.customers.client.struts.actionforms.ClientCustActionForm)1 CenterCreation (org.mifos.dto.domain.CenterCreation)1 CustomerDetailDto (org.mifos.dto.domain.CustomerDetailDto)1 PersonnelDto (org.mifos.dto.domain.PersonnelDto)1 ClientDetailDto (org.mifos.dto.screen.ClientDetailDto)1 TransactionDemarcate (org.mifos.framework.util.helpers.TransactionDemarcate)1 MifosUser (org.mifos.security.MifosUser)1 UserContext (org.mifos.security.util.UserContext)1