Ejemplo n.º 1
0
  @CloseSession
  @TransactionDemarcate(validateAndResetToken = true)
  public ActionForward removeGroupMemberShip(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      @SuppressWarnings("unused") HttpServletResponse response)
      throws Exception {

    GroupTransferActionForm actionForm = (GroupTransferActionForm) form;
    CustomerBO customerBOInSession =
        (CustomerBO) SessionUtils.getAttribute(Constants.BUSINESS_KEY, request);
    ClientBO client = this.customerDao.findClientBySystemId(customerBOInSession.getGlobalCustNum());

    checkVersionMismatch(customerBOInSession.getVersionNo(), client.getVersionNo());

    Short loanOfficerId = null;
    if (StringUtils.isNotBlank(actionForm.getAssignedLoanOfficerId())) {
      loanOfficerId = Short.valueOf(actionForm.getAssignedLoanOfficerId());
    }

    this.clientServiceFacade.removeGroupMembership(
        customerBOInSession.getGlobalCustNum(), loanOfficerId, actionForm.getComment());

    return mapping.findForward(ActionForwards.view_client_details_page.toString());
  }
Ejemplo n.º 2
0
  @Override
  public CenterDto retrieveCenterDetailsForUpdate(Integer centerId) {

    MifosUser user =
        (MifosUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
    UserContext userContext = toUserContext(user);

    CustomerBO center = customerDao.findCustomerById(centerId);

    Short officeId = center.getOffice().getOfficeId();
    String searchId = center.getSearchId();
    Short loanOfficerId = extractLoanOfficerId(center);

    CenterCreation centerCreation =
        new CenterCreation(
            officeId,
            userContext.getId(),
            userContext.getLevelId(),
            userContext.getPreferredLocale());
    List<PersonnelDto> activeLoanOfficersForBranch =
        personnelDao.findActiveLoanOfficersForOffice(centerCreation);

    List<CustomerDto> customerList =
        customerDao.findClientsThatAreNotCancelledOrClosed(searchId, officeId);

    List<CustomerPositionDto> customerPositionDtos =
        generateCustomerPositionViews(center, userContext.getLocaleId());

    DateTime mfiJoiningDate = new DateTime();
    String mfiJoiningDateAsString = "";
    if (center.getMfiJoiningDate() != null) {
      mfiJoiningDate = new DateTime(center.getMfiJoiningDate());
      mfiJoiningDateAsString =
          DateUtils.getUserLocaleDate(
              userContext.getPreferredLocale(), center.getMfiJoiningDate().toString());
    }

    AddressDto address = null;
    if (center.getAddress() != null) {
      address = Address.toDto(center.getAddress());
    }
    return new CenterDto(
        loanOfficerId,
        center.getCustomerId(),
        center.getGlobalCustNum(),
        mfiJoiningDate,
        mfiJoiningDateAsString,
        center.getExternalId(),
        address,
        customerPositionDtos,
        customerList,
        activeLoanOfficersForBranch,
        true);
  }
Ejemplo n.º 3
0
 private CustomerView getCusomerView(final CustomerBO customer) {
   CustomerView customerView = new CustomerView();
   customerView.setCustomerId(customer.getCustomerId());
   customerView.setCustomerLevelId(customer.getCustomerLevel().getId());
   customerView.setCustomerSearchId(customer.getSearchId());
   customerView.setDisplayName(customer.getDisplayName());
   customerView.setGlobalCustNum(customer.getGlobalCustNum());
   customerView.setOfficeId(customer.getOffice().getOfficeId());
   if (null != customer.getParentCustomer()) {
     customerView.setParentCustomerId(customer.getParentCustomer().getCustomerId());
   }
   customerView.setPersonnelId(customer.getPersonnel().getPersonnelId());
   customerView.setStatusId(customer.getCustomerStatus().getId());
   return customerView;
 }
Ejemplo n.º 4
0
 private void setFormAttributes(UserContext userContext, ActionForm form, CustomerBO customerBO)
     throws ApplicationException, InvalidDateException {
   CustomerNotesActionForm notesActionForm = (CustomerNotesActionForm) form;
   notesActionForm.setLevelId(customerBO.getCustomerLevel().getId().toString());
   notesActionForm.setGlobalCustNum(customerBO.getGlobalCustNum());
   notesActionForm.setCustomerName(customerBO.getDisplayName());
   notesActionForm.setCommentDate(DateUtils.getCurrentDate(userContext.getPreferredLocale()));
   if (customerBO instanceof CenterBO) {
     notesActionForm.setInput("center");
   } else if (customerBO instanceof GroupBO) {
     notesActionForm.setInput("group");
   } else if (customerBO instanceof ClientBO) {
     notesActionForm.setInput("client");
   }
 }
Ejemplo n.º 5
0
  @Override
  public CustomerNoteFormDto retrieveCustomerNote(String globalCustNum) {

    MifosUser user =
        (MifosUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
    UserContext userContext = toUserContext(user);

    CustomerBO customer = this.customerDao.findCustomerBySystemId(globalCustNum);
    PersonnelBO loggedInUser = this.personnelDao.findPersonnelById(userContext.getId());

    Integer customerLevel = customer.getCustomerLevel().getId().intValue();
    String globalNum = customer.getGlobalCustNum();
    String displayName = customer.getDisplayName();
    LocalDate commentDate = new LocalDate();
    String commentUser = loggedInUser.getDisplayName();

    return new CustomerNoteFormDto(
        globalNum, displayName, customerLevel, commentDate, commentUser, "");
  }