use of org.mifos.dto.domain.CustomFieldDto in project head by mifos.
the class ClientCustActionStrutsTest method testSuccessfulPreviewWithSavingsOfferingsSelected.
@Test
public void testSuccessfulPreviewWithSavingsOfferingsSelected() throws Exception {
savingsOffering1 = TestObjectFactory.createSavingsProduct("savingsPrd1", "s1", SavingsType.MANDATORY, ApplicableTo.CLIENTS, new Date(System.currentTimeMillis()));
setRequestPathInfo("/clientCustAction.do");
addRequestParameter("method", "load");
addRequestParameter("officeId", "3");
addRequestParameter("groupFlag", "0");
addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
actionPerform();
flowKey = (String) request.getAttribute(Constants.CURRENTFLOWKEY);
List<CustomFieldDto> customFieldDefs = getCustomFieldFromSession();
List<BusinessActivityEntity> povertyStatus = (List<BusinessActivityEntity>) SessionUtils.getAttribute(ClientConstants.POVERTY_STATUS, request);
setRequestPathInfo("/clientCustAction.do");
addRequestParameter("method", "next");
addRequestParameter("officeId", "3");
addRequestParameter("clientName.salutation", "1");
addRequestParameter("clientName.firstName", "Client");
addRequestParameter("clientName.lastName", "LastName");
addRequestParameter("spouseName.firstName", "Spouse");
addRequestParameter("spouseName.lastName", "LastName");
addRequestParameter("spouseName.nameType", "1");
addRequestDateParameter("dateOfBirth", "20/3/1987");
addRequestParameter("clientDetailView.gender", "1");
addRequestParameter("input", "personalInfo");
addRequestParameter("customerDetail.povertyStatus", povertyStatus.get(0).getId().toString());
int i = 0;
for (CustomFieldDto customFieldDef : customFieldDefs) {
addRequestParameter("customField[" + i + "].fieldId", customFieldDef.getFieldId().toString());
addRequestParameter("customField[" + i + "].fieldValue", "11");
i++;
}
addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
actionPerform();
List<SavingsDetailDto> savingsOfferingList = getSavingsOfferingsFromSession();
SavingsDetailDto savingsOffering = savingsOfferingList.get(0);
setRequestPathInfo("/clientCustAction.do");
addRequestParameter("method", "preview");
addRequestParameter("input", "mfiInfo");
addRequestParameter("formedByPersonnel", "1");
addRequestParameter("savingsOffering[0]", savingsOffering.getPrdOfferingId().toString());
request.setAttribute(Constants.CURRENTFLOWKEY, flowKey);
SessionUtils.setAttribute(CustomerConstants.CUSTOMER_MEETING, new MeetingBO(RecurrenceType.MONTHLY, Short.valueOf("2"), new Date(), MeetingType.CUSTOMER_MEETING), request);
addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
actionPerform();
verifyForward(ActionForwards.preview_success.toString());
}
use of org.mifos.dto.domain.CustomFieldDto in project head by mifos.
the class ClientCustActionStrutsTest method testFailurePreview_FeeFrequencyMismatch.
@Test
public void testFailurePreview_FeeFrequencyMismatch() throws Exception {
List<FeeDto> feesToRemove = getFees(RecurrenceType.MONTHLY);
StaticHibernateUtil.flushAndClearSession();
setRequestPathInfo("/clientCustAction.do");
addRequestParameter("method", "load");
addRequestParameter("officeId", "3");
addRequestParameter("groupFlag", "0");
addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
actionPerform();
flowKey = (String) request.getAttribute(Constants.CURRENTFLOWKEY);
List<CustomFieldDto> customFieldDefs = getCustomFieldFromSession();
List<BusinessActivityEntity> povertyStatus = (List<BusinessActivityEntity>) SessionUtils.getAttribute(ClientConstants.POVERTY_STATUS, request);
List<ApplicableAccountFeeDto> feeList = (List<ApplicableAccountFeeDto>) SessionUtils.getAttribute(CustomerConstants.ADDITIONAL_FEES_LIST, request);
Assert.assertEquals(1, feeList.size());
ApplicableAccountFeeDto fee = feeList.get(0);
setRequestPathInfo("/clientCustAction.do");
addRequestParameter("method", "next");
addRequestParameter("officeId", "3");
addRequestParameter("clientName.salutation", "1");
addRequestParameter("clientName.firstName", "Client");
addRequestParameter("clientName.lastName", "LastName");
addRequestParameter("spouseName.firstName", "Spouse");
addRequestParameter("spouseName.lastName", "LastName");
addRequestParameter("spouseName.nameType", "1");
addRequestDateParameter("dateOfBirth", "20/3/1987");
addRequestParameter("clientDetailView.gender", "1");
addRequestParameter("input", "personalInfo");
addRequestParameter("customerDetail.povertyStatus", povertyStatus.get(0).getId().toString());
int i = 0;
for (CustomFieldDto customFieldDef : customFieldDefs) {
addRequestParameter("customField[" + i + "].fieldId", customFieldDef.getFieldId().toString());
addRequestParameter("customField[" + i + "].fieldValue", "Req");
i++;
}
addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
actionPerform();
setRequestPathInfo("/clientCustAction.do");
addRequestParameter("method", "preview");
addRequestParameter("input", "mfiInfo");
addRequestParameter("formedByPersonnel", "1");
addRequestParameter("selectedFee[0].feeId", fee.getFeeId().toString());
addRequestParameter("selectedFee[0].amount", fee.getAmount());
request.setAttribute(Constants.CURRENTFLOWKEY, flowKey);
SessionUtils.setAttribute(CustomerConstants.CUSTOMER_MEETING, new MeetingBO(RecurrenceType.WEEKLY, (short) 2, new Date(), MeetingType.CUSTOMER_MEETING), request);
addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
actionPerform();
Assert.assertEquals("Fee", 1, getErrorSize(CustomerConstants.ERRORS_FEE_FREQUENCY_MISMATCH));
removeFees(feesToRemove);
}
use of org.mifos.dto.domain.CustomFieldDto in project head by mifos.
the class ClientCustActionStrutsTest method testNextSuccess.
@Test
public void testNextSuccess() throws Exception {
setRequestPathInfo("/clientCustAction.do");
addRequestParameter("method", "load");
addRequestParameter("officeId", "3");
addRequestParameter("groupFlag", "0");
addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
actionPerform();
flowKey = request.getAttribute(Constants.CURRENTFLOWKEY).toString();
List<CustomFieldDto> customFieldDefs = getCustomFieldFromSession();
setRequestPathInfo("/clientCustAction.do");
addRequestParameter("method", "next");
addRequestParameter("officeId", "3");
addRequestParameter("clientName.salutation", "1");
addRequestParameter("clientName.firstName", "Client");
addRequestParameter("clientName.lastName", "LastName");
addRequestParameter("spouseName.firstName", "Spouse");
addRequestParameter("spouseName.lastName", "LastName");
addRequestParameter("spouseName.nameType", "1");
addRequestDateParameter("dateOfBirth", "20/3/1987");
addRequestParameter("clientDetailView.gender", "1");
addRequestParameter("input", "personalInfo");
addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
int i = 0;
for (CustomFieldDto customFieldDef : customFieldDefs) {
addRequestParameter("customField[" + i + "].fieldId", customFieldDef.getFieldId().toString());
addRequestParameter("customField[" + i + "].fieldValue", "20/3/1987");
i++;
}
actionPerform();
verifyNoActionErrors();
verifyNoActionMessages();
verifyForward(ActionForwards.next_success.toString());
}
use of org.mifos.dto.domain.CustomFieldDto in project head by mifos.
the class ClientCustActionStrutsTest method testSuccessfulUpdatePersonalInfo_AuditLog.
@Test
public void testSuccessfulUpdatePersonalInfo_AuditLog() throws Exception {
createClientForAuditLog();
setRequestPathInfo("/clientCustAction.do");
addRequestParameter("method", "editPersonalInfo");
addRequestParameter("officeId", "3");
addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
actionPerform();
List<CustomFieldDto> customFieldDefs = getCustomFieldFromSession();
List<BusinessActivityEntity> povertyStatusList = (List<BusinessActivityEntity>) SessionUtils.getAttribute(ClientConstants.POVERTY_STATUS, request);
setRequestPathInfo("/clientCustAction.do");
addRequestParameter("method", "previewEditPersonalInfo");
addRequestParameter("clientName.salutation", Integer.valueOf("48").toString());
addRequestParameter("clientName.firstName", "Diti");
addRequestParameter("clientName.middleName", "S");
addRequestParameter("clientName.secondLastName", "S");
addRequestParameter("clientName.lastName", "Sharma");
addRequestParameter("spouseName.firstName", "Abc");
addRequestParameter("spouseName.middleName", "A");
addRequestParameter("spouseName.secondLastName", "A");
addRequestParameter("spouseName.lastName", "Sharma");
addRequestParameter("spouseName.nameType", "2");
addRequestParameter("clientDetailView.povertyStatus", povertyStatusList.get(1).getId().toString());
addRequestParameter("clientDetailView.gender", Integer.valueOf("50").toString());
addRequestParameter("clientDetailView.citizenship", Integer.valueOf("131").toString());
addRequestParameter("clientDetailView.ethnicity", Integer.valueOf("219").toString());
addRequestParameter("clientDetailView.handicapped", Integer.valueOf("139").toString());
addRequestParameter("clientDetailView.businessActivities", "");
addRequestParameter("clientDetailView.maritalStatus", Integer.valueOf("67").toString());
addRequestParameter("clientDetailView.educationLevel", Integer.valueOf("227").toString());
addRequestParameter("clientDetailView.numChildren", Integer.valueOf("2").toString());
int i = 0;
for (CustomFieldDto customFieldDef : customFieldDefs) {
addRequestParameter("customField[" + i + "].fieldId", customFieldDef.getFieldId().toString());
addRequestParameter("customField[" + i + "].fieldValue", "11");
addRequestParameter("customField[" + i + "].fieldType", "1");
i++;
}
addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
actionPerform();
verifyNoActionErrors();
verifyNoActionMessages();
verifyForward(ActionForwards.previewEditPersonalInfo_success.toString());
setRequestPathInfo("/clientCustAction.do");
addRequestParameter("method", "updatePersonalInfo");
addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
actionPerform();
verifyForward(ActionForwards.updatePersonalInfo_success.toString());
client = TestObjectFactory.getClient(client.getCustomerId());
Assert.assertEquals(219, client.getCustomerDetail().getEthnicity().shortValue(), DELTA);
StaticHibernateUtil.getInterceptor().afterTransactionCompletion(new AuditTransactionForTests());
List<AuditLog> auditLogList = TestObjectFactory.getChangeLog(EntityType.CLIENT, client.getCustomerId());
Assert.assertEquals(1, auditLogList.size());
Assert.assertEquals(EntityType.CLIENT.getValue(), auditLogList.get(0).getEntityType());
Assert.assertEquals(client.getCustomerId(), auditLogList.get(0).getEntityId());
for (AuditLogRecord auditLogRecord : auditLogList.get(0).getAuditLogRecords()) {
if (auditLogRecord.getFieldName().equalsIgnoreCase("Gender")) {
matchValues(auditLogRecord, "Male", "Female");
} else if (auditLogRecord.getFieldName().equalsIgnoreCase("Ethnicity")) {
matchValues(auditLogRecord, "OBC", "FC");
} else if (auditLogRecord.getFieldName().equalsIgnoreCase("Number Of Children")) {
matchValues(auditLogRecord, "1", "2");
} else if (auditLogRecord.getFieldName().equalsIgnoreCase("Handicapped")) {
matchValues(auditLogRecord, "Yes", "No");
} else if (auditLogRecord.getFieldName().equalsIgnoreCase("Marital Status")) {
matchValues(auditLogRecord, "Married", "UnMarried");
} else if (auditLogRecord.getFieldName().equalsIgnoreCase("Education Level")) {
matchValues(auditLogRecord, "Both Literate", "Both Illiterate");
} else if (auditLogRecord.getFieldName().equalsIgnoreCase("Poverty Status")) {
matchValues(auditLogRecord, "Very poor", "Poor");
} else if (auditLogRecord.getFieldName().equalsIgnoreCase("Citizenship")) {
matchValues(auditLogRecord, "Hindu", "Muslim");
} else if (auditLogRecord.getFieldName().equalsIgnoreCase("Business Activities")) {
matchValues(auditLogRecord, "Trading", "-");
} else if (auditLogRecord.getFieldName().equalsIgnoreCase("Salutation")) {
matchValues(auditLogRecord, "Mr", "Mrs");
}
}
}
use of org.mifos.dto.domain.CustomFieldDto in project head by mifos.
the class SystemUserController method findMatchingAndSetFieldValue.
private CustomFieldDto findMatchingAndSetFieldValue(CustomFieldDto source, Set<CustomFieldDto> customFields) {
CustomFieldDto match = null;
for (CustomFieldDto possibleMatch : customFields) {
if (source.getFieldId().equals(possibleMatch.getFieldId())) {
source.setFieldValue(possibleMatch.getFieldValue());
match = source;
}
}
return match;
}
Aggregations