use of org.mifos.customers.client.struts.actionforms.ClientCustActionForm in project head by mifos.
the class PictureFormFile method prevEditPersonalInfo.
@TransactionDemarcate(joinToken = true)
public ActionForward prevEditPersonalInfo(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse httpservletresponse) throws Exception {
ClientCustActionForm actionForm = (ClientCustActionForm) form;
boolean isFamilyDetailsRequired = ClientRules.isFamilyDetailsRequired();
SessionUtils.setAttribute(ClientConstants.ARE_FAMILY_DETAILS_REQUIRED, isFamilyDetailsRequired, request);
if (isFamilyDetailsRequired) {
SessionUtils.setAttribute(ClientConstants.ARE_FAMILY_DETAILS_MANDATORY, isFamilyDetailsMandatory(), request);
SessionUtils.setAttribute(ClientConstants.ARE_FAMILY_DETAILS_HIDDEN, false, request);
} else {
SessionUtils.setAttribute(ClientConstants.ARE_FAMILY_DETAILS_MANDATORY, isSpouseFatherInformationMandatory(), request);
SessionUtils.setAttribute(ClientConstants.ARE_FAMILY_DETAILS_HIDDEN, isSpouseFatherInformationHidden(), request);
}
actionForm.setAge(calculateAge(DateUtils.getDateAsSentFromBrowser(actionForm.getDateOfBirth())));
return mapping.findForward(ActionForwards.prevEditPersonalInfo_success.toString());
}
use of org.mifos.customers.client.struts.actionforms.ClientCustActionForm in project head by mifos.
the class PictureFormFile method prevFamilyInfoNext.
@TransactionDemarcate(joinToken = true)
public ActionForward prevFamilyInfoNext(ActionMapping mapping, ActionForm form, @SuppressWarnings("unused") HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse httpservletresponse) throws Exception {
ClientCustActionForm actionForm = (ClientCustActionForm) form;
actionForm.setFamilyDateOfBirth();
actionForm.constructFamilyDetails();
return mapping.findForward(ActionForwards.prevFamilyInfoNext_success.toString());
}
use of org.mifos.customers.client.struts.actionforms.ClientCustActionForm in project head by mifos.
the class PictureFormFile method deleteFile.
@TransactionDemarcate(joinToken = true)
public ActionForward deleteFile(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
ClientCustActionForm actionForm = (ClientCustActionForm) form;
String fileName = request.getParameter("fileName");
if (fileName != null) {
int index = 0;
for (FormFile formFile : actionForm.getFiles()) {
if (formFile.getFileName().equals(fileName)) {
index = actionForm.getFiles().indexOf(formFile);
break;
}
}
if (index >= 0) {
actionForm.getFiles().remove(index);
actionForm.getFilesMetadata().remove(index);
}
}
return mapping.findForward(ActionForwards.load_success.toString());
}
use of org.mifos.customers.client.struts.actionforms.ClientCustActionForm in project head by mifos.
the class ClientCustActionStrutsTest method testCreateSuccessWithoutGroup.
@Test
public void testCreateSuccessWithoutGroup() throws Exception {
SecurityContext securityContext = new SecurityContextImpl();
MifosUser principal = new MifosUserBuilder().nonLoanOfficer().withAdminRole().build();
Authentication authentication = new TestingAuthenticationToken(principal, principal);
securityContext.setAuthentication(authentication);
SecurityContextHolder.setContext(securityContext);
// List<FeeDto> feesToRemove = getFees(RecurrenceType.WEEKLY);
setRequestPathInfo("/clientCustAction.do");
addRequestParameter("method", "load");
addRequestParameter("officeId", "3");
addRequestParameter("groupFlag", "0");
addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
actionPerform();
flowKey = (String) request.getAttribute(Constants.CURRENTFLOWKEY);
List<BusinessActivityEntity> povertyStatus = (List<BusinessActivityEntity>) SessionUtils.getAttribute(ClientConstants.POVERTY_STATUS, request);
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("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();
MeetingBO weeklyMeeting = new MeetingBuilder().weekly().every(1).occuringOnA(WeekDay.WEDNESDAY).build();
SessionUtils.setAttribute(CustomerConstants.CUSTOMER_MEETING, weeklyMeeting, request);
setRequestPathInfo("/clientCustAction.do");
addRequestParameter("method", "preview");
addRequestParameter("input", "mfiInfo");
addRequestParameter("loanOfficerId", "1");
addRequestParameter("formedByPersonnel", "1");
addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
actionPerform();
verifyNoActionErrors();
verifyNoActionMessages();
verifyForward(ActionForwards.preview_success.toString());
setRequestPathInfo("/clientCustAction.do");
addRequestParameter("method", "create");
addRequestParameter("input", "create");
addRequestParameter("status", "1");
addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
actionPerform();
verifyNoActionErrors();
verifyNoActionMessages();
verifyForward(ActionForwards.create_success.toString());
ClientCustActionForm actionForm = (ClientCustActionForm) request.getSession().getAttribute("clientCustActionForm");
client = TestObjectFactory.getClient(actionForm.getCustomerIdAsInt());
// removeFees(feesToRemove);
}
Aggregations