use of org.mifos.dto.screen.ClientNameDetailDto in project head by mifos.
the class PictureFormFile method editFamilyInfo.
@TransactionDemarcate(joinToken = true)
public ActionForward editFamilyInfo(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
ClientCustActionForm actionForm = (ClientCustActionForm) form;
actionForm.clearMostButNotAllFieldsOnActionForm();
ClientBO clientFromSession = getClientFromSession(request);
ClientFamilyInfoDto clientFamilyInfo = this.clientServiceFacade.retrieveFamilyInfoForEdit(clientFromSession.getGlobalCustNum());
SessionUtils.setCollectionAttribute(ClientConstants.LIVING_STATUS_ENTITY, clientFamilyInfo.getClientDropdowns().getLivingStatus(), request);
SessionUtils.setCollectionAttribute(ClientConstants.GENDER_ENTITY, clientFamilyInfo.getClientDropdowns().getGenders(), request);
SessionUtils.setCollectionAttribute(CustomerConstants.CUSTOM_FIELDS_LIST, new ArrayList<CustomFieldDto>(), request);
UserContext userContext = getUserContext(request);
List<SpouseFatherLookupEntity> spouseFather = legacyMasterDao.findMasterDataEntitiesWithLocale(SpouseFatherLookupEntity.class);
SessionUtils.setCollectionAttribute(ClientConstants.SPOUSE_FATHER_ENTITY, spouseFather, request);
SessionUtils.setAttribute(ClientConstants.ARE_FAMILY_DETAILS_MANDATORY, isFamilyDetailsMandatory(), request);
// customer specific
actionForm.setCustomerId(clientFamilyInfo.getCustomerDetail().getCustomerId().toString());
actionForm.setLoanOfficerId(clientFamilyInfo.getCustomerDetail().getLoanOfficerIdAsString());
actionForm.setGlobalCustNum(clientFamilyInfo.getCustomerDetail().getGlobalCustNum());
actionForm.setExternalId(clientFamilyInfo.getCustomerDetail().getExternalId());
// client specific
actionForm.setGovernmentId(clientFamilyInfo.getClientDetail().getGovernmentId());
actionForm.setDateOfBirth(clientFamilyInfo.getClientDetail().getDateOfBirth());
actionForm.initializeFamilyMember();
actionForm.setClientDetailView(clientFamilyInfo.getClientDetail().getCustomerDetail());
actionForm.setClientName(clientFamilyInfo.getClientDetail().getClientName());
actionForm.setSpouseName(clientFamilyInfo.getClientDetail().getSpouseName());
actionForm.setCustomFields(new ArrayList<CustomFieldDto>());
// client family specific
int familyMemberCount = 0;
for (ClientNameDetailDto familyMember : clientFamilyInfo.getFamilyMembers()) {
actionForm.addFamilyMember();
actionForm.setFamilyPrimaryKey(familyMemberCount, familyMember.getCustomerNameId());
actionForm.setFamilyFirstName(familyMemberCount, familyMember.getFirstName());
actionForm.setFamilyMiddleName(familyMemberCount, familyMember.getMiddleName());
actionForm.setFamilyLastName(familyMemberCount, familyMember.getLastName());
actionForm.setFamilySecondLastName(familyMemberCount, familyMember.getSecondLastName());
actionForm.setFamilyRelationship(familyMemberCount, familyMember.getNameType());
Map<Integer, List<ClientFamilyDetailDto>> clientFamilyDetailsMap = clientFamilyInfo.getClientFamilyDetails();
Integer key = Integer.valueOf(familyMemberCount);
List<ClientFamilyDetailDto> clientFamilyDetails = clientFamilyDetailsMap.get(key);
if (clientFamilyDetails != null) {
for (ClientFamilyDetailDto clientFamilyDetailDto : clientFamilyDetails) {
Calendar cal = Calendar.getInstance();
if (clientFamilyDetailDto.getDateOfBirth() != null) {
String date1 = DateUtils.makeDateAsSentFromBrowser(clientFamilyDetailDto.getDateOfBirth());
java.util.Date date = DateUtils.getDate(date1);
cal.setTime(date);
actionForm.setFamilyDateOfBirthDD(familyMemberCount, String.valueOf(cal.get(Calendar.DAY_OF_MONTH)));
actionForm.setFamilyDateOfBirthMM(familyMemberCount, String.valueOf(cal.get(Calendar.MONTH) + 1));
actionForm.setFamilyDateOfBirthYY(familyMemberCount, String.valueOf(cal.get(Calendar.YEAR)));
}
actionForm.setFamilyGender(familyMemberCount, clientFamilyDetailDto.getGender());
actionForm.setFamilyLivingStatus(familyMemberCount, clientFamilyDetailDto.getLivingStatus());
}
}
familyMemberCount++;
}
ClientBO client = this.customerDao.findClientBySystemId(clientFromSession.getGlobalCustNum());
actionForm.setAddress(Address.toAddress(client.getAddress()));
SessionUtils.removeThenSetAttribute(Constants.BUSINESS_KEY, client, request);
return mapping.findForward(ActionForwards.editFamilyInfo_success.toString());
}
use of org.mifos.dto.screen.ClientNameDetailDto in project head by mifos.
the class PictureFormFile method updatePersonalInfo.
@CloseSession
@TransactionDemarcate(validateAndResetToken = true)
public ActionForward updatePersonalInfo(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
ClientCustActionForm actionForm = (ClientCustActionForm) form;
ClientBO clientInSession = getClientFromSession(request);
Integer oldClientVersionNumber = clientInSession.getVersionNo();
Integer customerId = clientInSession.getCustomerId();
String clientStatus = clientInSession.getCustomerStatus().getName();
List<CustomFieldDto> customFields = new ArrayList<CustomFieldDto>();
short loanOfficerId = clientInSession.getCreatedBy();
final String clientSystemId = clientInSession.getGlobalCustNum();
ClientPersonalInfoDto clientPersonalInfo = this.clientServiceFacade.retrieveClientPersonalInfoForUpdate(clientSystemId, clientStatus, loanOfficerId);
AddressDto address = null;
if (actionForm.getAddress() != null) {
address = Address.toDto(actionForm.getAddress());
}
if (clientPersonalInfo.getCustomerDetail() != null) {
if (clientPersonalInfo.getCustomerDetail().getAddress() != null) {
if (clientPersonalInfo.getCustomerDetail().getAddress().getPhoneNumber() != null && (!clientPersonalInfo.getCustomerDetail().getAddress().getPhoneNumber().equals(address.getPhoneNumber()))) {
UserContext userContext = getUserContext(request);
if (!ActivityMapper.getInstance().isEditPhoneNumberPermitted(userContext, userContext.getBranchId())) {
throw new CustomerException(SecurityConstants.KEY_ACTIVITY_NOT_ALLOWED);
}
} else if (clientPersonalInfo.getCustomerDetail().getAddress().getPhoneNumber() == null && address.getPhoneNumber() != null && !address.getPhoneNumber().equals("")) {
UserContext userContext = getUserContext(request);
if (!ActivityMapper.getInstance().isEditPhoneNumberPermitted(userContext, userContext.getBranchId())) {
throw new CustomerException(SecurityConstants.KEY_ACTIVITY_NOT_ALLOWED);
}
}
} else if (address.getPhoneNumber() != null && !address.getPhoneNumber().equals("")) {
UserContext userContext = getUserContext(request);
if (!ActivityMapper.getInstance().isEditPhoneNumberPermitted(userContext, userContext.getBranchId())) {
throw new CustomerException(SecurityConstants.KEY_ACTIVITY_NOT_ALLOWED);
}
}
} else if (address.getPhoneNumber() != null && !address.getPhoneNumber().equals("")) {
UserContext userContext = getUserContext(request);
if (!ActivityMapper.getInstance().isEditPhoneNumberPermitted(userContext, userContext.getBranchId())) {
throw new CustomerException(SecurityConstants.KEY_ACTIVITY_NOT_ALLOWED);
}
}
ClientNameDetailDto spouseFather = null;
if (!ClientRules.isFamilyDetailsRequired()) {
spouseFather = actionForm.getSpouseName();
}
InputStream picture = null;
if (actionForm.getPicture() != null && StringUtils.isNotBlank(actionForm.getPicture().getFileName())) {
picture = actionForm.getCustomerPicture();
}
ClientNameDetailDto clientNameDetails = actionForm.getClientName();
ClientPersonalDetailDto clientDetail = actionForm.getClientDetailView();
String governmentId = actionForm.getGovernmentId();
String clientDisplayName = actionForm.getClientName().getDisplayName();
String dateOfBirth = actionForm.getDateOfBirth();
ClientPersonalInfoUpdate personalInfo = new ClientPersonalInfoUpdate(customerId, oldClientVersionNumber, customFields, address, clientDetail, clientNameDetails, spouseFather, picture, governmentId, clientDisplayName, dateOfBirth);
this.clientServiceFacade.updateClientPersonalInfo(personalInfo, clientStatus, loanOfficerId);
return mapping.findForward(ActionForwards.updatePersonalInfo_success.toString());
}
use of org.mifos.dto.screen.ClientNameDetailDto in project head by mifos.
the class PictureFormFile method preview.
@TransactionDemarcate(joinToken = true)
public ActionForward preview(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
ClientCustActionForm actionForm = (ClientCustActionForm) form;
String governmentId = actionForm.getGovernmentId();
ClientNameDetailDto clientNameDetail = actionForm.getClientName();
clientNameDetail.setNames(ClientRules.getNameSequence());
String clientName = clientNameDetail.getDisplayName();
String givenDateOfBirth = actionForm.getDateOfBirth();
ClientNameDetailDto spouseName = actionForm.getSpouseName();
spouseName.setNames(ClientRules.getNameSequence());
DateTime dateOfBirth = new DateTime(DateUtils.getDateAsSentFromBrowser(givenDateOfBirth));
ProcessRulesDto processRules = this.clientServiceFacade.previewClient(governmentId, dateOfBirth, clientName, actionForm.isDefaultFeeRemoved(), actionForm.getOfficeIdValue(), actionForm.getLoanOfficerIdValue());
String pendingApprovalState = processRules.isClientPendingApprovalStateEnabled() ? CustomerConstants.YES : CustomerConstants.NO;
SessionUtils.setAttribute(CustomerConstants.PENDING_APPROVAL_DEFINED, pendingApprovalState, request);
Short officeId = actionForm.getOfficeIdValue();
Short groupFlag = actionForm.getGroupFlagValue();
String parentGroupId = actionForm.getParentGroupId();
ClientFormCreationDto clientFormCreationDto = this.clientServiceFacade.retrieveClientFormCreationData(groupFlag, officeId, parentGroupId);
InformationOrderServiceFacade informationOrderServiceFacade = ApplicationContextProvider.getBean(InformationOrderServiceFacade.class);
SessionUtils.setCollectionAttribute("personalInformationOrder", informationOrderServiceFacade.getInformationOrder("CreateClient"), request);
if (clientFormCreationDto.getFormedByPersonnelId() != null) {
UserContext userContext = getUserContext(request);
MeetingBO groupMeeting = customerDao.findCustomerById(Integer.valueOf(parentGroupId)).getCustomerMeetingValue();
clientFormCreationDto.getParentCustomerMeeting().setMeetingSchedule(CustomerUIHelperFn.getMeetingSchedule(groupMeeting, userContext));
SessionUtils.setAttribute("meeting", clientFormCreationDto.getParentCustomerMeeting(), request);
}
addWarningMessages(request, processRules, calculateAge(DateUtils.getDateAsSentFromBrowser(givenDateOfBirth)));
actionForm.setEditFamily("edit");
actionForm.setAge(calculateAge(DateUtils.getDateAsSentFromBrowser(givenDateOfBirth)));
actionForm.setClientName(clientNameDetail);
actionForm.setSpouseName(spouseName);
return mapping.findForward(ActionForwards.preview_success.toString());
}
use of org.mifos.dto.screen.ClientNameDetailDto in project head by mifos.
the class ClientCustActionForm method clearMostButNotAllFieldsOnActionForm.
public void clearMostButNotAllFieldsOnActionForm() {
setDefaultFees(new ArrayList<ApplicableAccountFeeDto>());
setAdditionalFees(new ArrayList<ApplicableAccountFeeDto>());
setCustomFields(new ArrayList<CustomFieldDto>());
setFamilyNames(new ArrayList<ClientNameDetailDto>());
setFamilyDetails(new ArrayList<ClientFamilyDetailDto>());
setFamilyRelationship(new ArrayList<Short>());
setFamilyFirstName(new ArrayList<String>());
setFamilyMiddleName(new ArrayList<String>());
setFamilyLastName(new ArrayList<String>());
setFamilySecondLastName(new ArrayList<String>());
setFamilyDateOfBirthDD(new ArrayList<String>());
setFamilyDateOfBirthMM(new ArrayList<String>());
setFamilyDateOfBirthYY(new ArrayList<String>());
setFamilyGender(new ArrayList<Short>());
setFamilyLivingStatus(new ArrayList<Short>());
initializeFamilyMember();
addFamilyMember();
setAddress(new Address());
setDisplayName(null);
setDateOfBirthDD(null);
setDateOfBirthMM(null);
setDateOfBirthYY(null);
setGovernmentId(null);
setMfiJoiningDate(null);
setGlobalCustNum(null);
setCustomerId(null);
setExternalId(null);
setLoanOfficerId(null);
setLoanOfficerName("");
setFormedByPersonnel(null);
setTrained(null);
setTrainedDate(null);
setClientName(new ClientNameDetailDto());
setSpouseName(new ClientNameDetailDto());
setClientDetailView(new ClientPersonalDetailDto());
setNextOrPreview("next");
setQuestionGroups(null);
for (int i = 0; i < getSelectedOfferings().size(); i++) {
getSelectedOfferings().set(i, null);
}
setFiles(new ArrayList<FormFile>());
setFilesMetadata(new ArrayList<UploadedFileDto>());
}
use of org.mifos.dto.screen.ClientNameDetailDto in project head by mifos.
the class ClientCustActionForm method constructFamilyDetails.
/*
* This is used to construct Name detail view and family detail view for each family member, Please note i have
* added display name into family detail view so that i can iterate over only one collection when i do preview of
* this page.
*/
public void constructFamilyDetails() {
this.familyDetails = new ArrayList<ClientFamilyDetailDto>();
this.familyNames = new ArrayList<ClientNameDetailDto>();
for (int row = 0; row < familyFirstName.size(); row++) {
ClientNameDetailDto familyNames = new ClientNameDetailDto();
familyNames.setFirstName(getFamilyFirstName(row));
familyNames.setMiddleName(getFamilyMiddleName(row));
familyNames.setLastName(getFamilyLastName(row));
familyNames.setSecondLastName(getFamilySecondLastName(row));
familyNames.setNameType(getFamilyRelationship(row));
familyNames.setDisplayName(new StringBuilder(getFamilyFirstName(row) + getFamilyLastName(row)));
familyNames.setNames(ClientRules.getNameSequence());
ClientFamilyDetailDto familyDetails = null;
try {
if (getFamilyDateOfBirth(row) != null) {
familyDetails = new ClientFamilyDetailDto(getFamilyRelationship(row), getFamilyGender(row), getFamilyLivingStatus(row), DateUtils.getDateAsSentFromBrowser(getFamilyDateOfBirth(row)));
familyDetails.setDisplayName(familyNames.getDisplayName());
familyDetails.setDateOfBirthForBrowser(getFamilyDateOfBirth(row));
} else {
familyDetails = new ClientFamilyDetailDto(getFamilyRelationship(row), getFamilyGender(row), getFamilyLivingStatus(row), null);
familyDetails.setDisplayName(familyNames.getDisplayName());
}
} catch (InvalidDateException e) {
}
this.familyNames.add(familyNames);
this.familyDetails.add(familyDetails);
}
}
Aggregations