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());
}
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);
}
}
}
Aggregations