コード例 #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;
 }
コード例 #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");
   }
 }
コード例 #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, "");
  }
コード例 #4
0
  public void testSuccessfulCreate() throws Exception {
    CollectionSheetEntryGridDto bulkEntry = getSuccessfulBulkEntry();
    Calendar meetingDateCalendar = new GregorianCalendar();
    int year = meetingDateCalendar.get(Calendar.YEAR);
    int month = meetingDateCalendar.get(Calendar.MONTH);
    int day = meetingDateCalendar.get(Calendar.DAY_OF_MONTH);
    meetingDateCalendar = new GregorianCalendar(year, month, day);

    Date meetingDate = new Date(meetingDateCalendar.getTimeInMillis());
    HashMap<Integer, ClientAttendanceDto> clientAttendance =
        new HashMap<Integer, ClientAttendanceDto>();
    clientAttendance.put(1, getClientAttendanceDto(1, meetingDate));
    clientAttendance.put(2, getClientAttendanceDto(2, meetingDate));
    clientAttendance.put(3, getClientAttendanceDto(3, meetingDate));

    request.setAttribute(Constants.CURRENTFLOWKEY, flowKey);
    addRequestParameter("attendanceSelected[0]", "2");

    request.setAttribute(Constants.CURRENTFLOWKEY, flowKey);
    SessionUtils.setAttribute(CollectionSheetEntryConstants.BULKENTRY, bulkEntry, request);
    setRequestPathInfo("/collectionsheetaction.do");
    addRequestParameter("method", "preview");
    addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
    addRequestDateParameter("transactionDate", day + "/" + (month + 1) + "/" + year);

    if (SUPPLY_ENTERED_AMOUNT_PARAMETERS) {
      addParametersForEnteredAmount();
      addParametersForDisbursalEnteredAmount();
    }

    performNoErrors();

    request.setAttribute(Constants.CURRENTFLOWKEY, flowKey);
    setRequestPathInfo("/collectionsheetaction.do");
    addRequestParameter("method", "create");
    addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
    addRequestParameter("attendanceSelected[0]", "2");
    addRequestDateParameter("transactionDate", day + "/" + (month + 1) + "/" + year);
    addRequestParameter("customerId", "1");

    performNoErrors();
    verifyForward("create_success");
    Assert.assertNotNull(request.getAttribute(CollectionSheetEntryConstants.CENTER));
    Assert.assertEquals(
        request.getAttribute(CollectionSheetEntryConstants.CENTER), center.getDisplayName());

    groupAccount = TestObjectFactory.getObject(LoanBO.class, groupAccount.getAccountId());
    clientAccount = TestObjectFactory.getObject(LoanBO.class, clientAccount.getAccountId());
    centerSavingsAccount =
        TestObjectFactory.getObject(SavingsBO.class, centerSavingsAccount.getAccountId());
    clientSavingsAccount =
        TestObjectFactory.getObject(SavingsBO.class, clientSavingsAccount.getAccountId());
    groupSavingsAccount =
        TestObjectFactory.getObject(SavingsBO.class, groupSavingsAccount.getAccountId());
    center = TestObjectFactory.getCustomer(center.getCustomerId());
    group = TestObjectFactory.getCustomer(group.getCustomerId());
    client = TestObjectFactory.getClient(client.getCustomerId());

    Assert.assertEquals(1, client.getClientAttendances().size());
    Assert.assertEquals(
        AttendanceType.ABSENT,
        client
            .getClientAttendanceForMeeting(new java.sql.Date(meetingDateCalendar.getTimeInMillis()))
            .getAttendanceAsEnum());
  }