Search in sources :

Example 1 with ClientAttendanceDto

use of org.mifos.customers.client.business.service.ClientAttendanceDto in project head by mifos.

the class BulkEntryActionStrutsTest method testSuccessfulCreate.

@Test
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());
    StaticHibernateUtil.flushAndClearSession();
    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());
}
Also used : HashMap(java.util.HashMap) GregorianCalendar(java.util.GregorianCalendar) Calendar(java.util.Calendar) LoanBO(org.mifos.accounts.loan.business.LoanBO) GregorianCalendar(java.util.GregorianCalendar) SavingsBO(org.mifos.accounts.savings.business.SavingsBO) Date(java.util.Date) ClientAttendanceDto(org.mifos.customers.client.business.service.ClientAttendanceDto) CollectionSheetEntryGridDto(org.mifos.application.collectionsheet.business.CollectionSheetEntryGridDto) Test(org.junit.Test)

Example 2 with ClientAttendanceDto

use of org.mifos.customers.client.business.service.ClientAttendanceDto in project head by mifos.

the class CollectionSheetEntryDto method populateClientAttendance.

public void populateClientAttendance(final Integer customerId, final List<ClientAttendanceDto> collectionSheetEntryClientAttendanceViews) {
    if (customerDetail.isCustomerCenter()) {
        return;
    }
    for (ClientAttendanceDto clientAttendanceView : collectionSheetEntryClientAttendanceViews) {
        logger.debug("populateClientAttendance");
        logger.debug("clientAttendanceView.getCustomerId() " + clientAttendanceView.getClientId());
        logger.debug("customerId " + customerId);
        logger.debug("customerDetail.getCustomerId() " + customerDetail.getCustomerId());
        if (clientAttendanceView.getClientId().compareTo(customerId) == 0) {
            Short attendanceId = clientAttendanceView.getAttendanceId();
            setAttendence(attendanceId);
        }
    }
}
Also used : ClientAttendanceDto(org.mifos.customers.client.business.service.ClientAttendanceDto)

Aggregations

ClientAttendanceDto (org.mifos.customers.client.business.service.ClientAttendanceDto)2 Calendar (java.util.Calendar)1 Date (java.util.Date)1 GregorianCalendar (java.util.GregorianCalendar)1 HashMap (java.util.HashMap)1 Test (org.junit.Test)1 LoanBO (org.mifos.accounts.loan.business.LoanBO)1 SavingsBO (org.mifos.accounts.savings.business.SavingsBO)1 CollectionSheetEntryGridDto (org.mifos.application.collectionsheet.business.CollectionSheetEntryGridDto)1