Exemplo n.º 1
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;
 }
Exemplo n.º 2
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");
   }
 }
Exemplo n.º 3
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, "");
  }
Exemplo n.º 4
0
  @SuppressWarnings("unchecked")
  public void testSuccessfulGet() throws Exception {

    MeetingBO meeting =
        TestObjectFactory.createMeeting(
            TestObjectFactory.getNewMeetingForToday(WEEKLY, EVERY_WEEK, CUSTOMER_MEETING));
    center = TestObjectFactory.createWeeklyFeeCenter("Center", meeting);
    group =
        TestObjectFactory.createWeeklyFeeGroupUnderCenter(
            "Group", CustomerStatus.GROUP_ACTIVE, center);
    client = TestObjectFactory.createClient("Client", CustomerStatus.CLIENT_ACTIVE, group);
    account = getLoanAccount(group, meeting);

    // Using utility method that uses builder pattern to create savings accounts - TestObjectFactory
    // was creating
    // installments for all savings accounts (which is wrong)
    TestCollectionSheetRetrieveSavingsAccountsUtils collectionSheetRetrieveSavingsAccountsUtils =
        new TestCollectionSheetRetrieveSavingsAccountsUtils();
    centerSavingsAccount =
        collectionSheetRetrieveSavingsAccountsUtils.createSavingsAccount(
            center, "cemi", "120.00", false, false);
    groupSavingsAccount =
        collectionSheetRetrieveSavingsAccountsUtils.createSavingsAccount(
            group, "gvcg", "180.00", true, false);
    clientSavingsAccount =
        collectionSheetRetrieveSavingsAccountsUtils.createSavingsAccount(
            client, "clm", "222.00", false, false);

    request.setAttribute(Constants.CURRENTFLOWKEY, flowKey);
    CustomerView customerView = new CustomerView();
    customerView.setCustomerId(center.getCustomerId());
    customerView.setCustomerSearchId(center.getSearchId());
    customerView.setCustomerLevelId(center.getCustomerLevel().getId());

    final OfficeView officeView =
        new OfficeView(
            Short.valueOf("3"), "", OfficeLevel.BRANCHOFFICE, "levelNameKey", Integer.valueOf(-1));
    final PersonnelView personnelView = new PersonnelView(Short.valueOf("3"), "");

    SessionUtils.setAttribute(
        CollectionSheetEntryConstants.COLLECTION_SHEET_ENTRY_FORM_DTO,
        createCollectionSheetDto(customerView, officeView, personnelView),
        request);

    SessionUtils.setCollectionAttribute(
        CollectionSheetEntryConstants.PAYMENT_TYPES_LIST,
        Arrays.asList(getPaymentTypeView()),
        request);
    SessionUtils.setAttribute(
        CollectionSheetEntryConstants.ISCENTERHIERARCHYEXISTS, Constants.YES, request);

    setMasterListInSession(center.getCustomerId());
    setRequestPathInfo("/collectionsheetaction.do");
    addRequestParameter("method", "get");
    addRequestParameter("officeId", "3");
    addRequestParameter("loanOfficerId", "3");
    addRequestParameter("paymentId", "1");
    addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);

    Calendar meetinDateCalendar = new GregorianCalendar();
    meetinDateCalendar.setTime(getMeetingDates(meeting));
    int year = meetinDateCalendar.get(Calendar.YEAR);
    int month = meetinDateCalendar.get(Calendar.MONTH);
    int day = meetinDateCalendar.get(Calendar.DAY_OF_MONTH);
    meetinDateCalendar = new GregorianCalendar(year, month, day);
    SessionUtils.setAttribute(
        "LastMeetingDate", new java.sql.Date(meetinDateCalendar.getTimeInMillis()), request);
    addRequestDateParameter("transactionDate", day + "/" + (month + 1) + "/" + year);
    addRequestParameter("receiptId", "1");
    addRequestDateParameter("receiptDate", "20/03/2006");
    addRequestParameter("customerId", String.valueOf(center.getCustomerId().intValue()));
    actionPerform();
    verifyNoActionErrors();
    verifyNoActionMessages();
    verifyForward("get_success");
  }