use of org.mifos.platform.questionnaire.service.InformationOrderServiceFacade in project head by mifos.
the class LoanAccountAction method manage.
@TransactionDemarcate(joinToken = true)
public ActionForward manage(final ActionMapping mapping, final ActionForm form, final HttpServletRequest request, @SuppressWarnings("unused") final HttpServletResponse response) throws Exception {
LoanAccountActionForm loanActionForm = (LoanAccountActionForm) form;
String globalAccountNum = request.getParameter(GLOBAL_ACCOUNT_NUM);
CustomerBO customer = getCustomerFromRequest(request);
if (isGlimEnabled() || isNewGlimEnabled()) {
populateGlimAttributes(request, loanActionForm, globalAccountNum, customer);
}
String recurMonth = customer.getCustomerMeeting().getMeeting().getMeetingDetails().getRecurAfter().toString();
handleRepaymentsIndependentOfMeetingIfConfigured(request, loanActionForm, recurMonth);
LoanBO loanBO = new LoanDaoHibernate(new GenericDaoHibernate()).findByGlobalAccountNum(globalAccountNum);
UserContext userContext = getUserContext(request);
loanBO.setUserContext(userContext);
SessionUtils.setAttribute(PROPOSED_DISBURSAL_DATE, loanBO.getDisbursementDate(), request);
SessionUtils.removeAttribute(LOANOFFERING, request);
LoanOfferingBO loanOffering = getLoanOffering(loanBO.getLoanOffering().getPrdOfferingId(), userContext.getLocaleId());
loanActionForm.setInstallmentRange(loanBO.getMaxMinNoOfInstall());
loanActionForm.setLoanAmountRange(loanBO.getMaxMinLoanAmount());
MaxMinInterestRate interestRateRange = loanBO.getMaxMinInterestRate();
loanActionForm.setMaxInterestRate(interestRateRange.getMaxLoanAmount());
loanActionForm.setMinInterestRate(interestRateRange.getMinLoanAmount());
loanActionForm.setExternalId(loanBO.getExternalId());
if (null != loanBO.getFund()) {
loanActionForm.setLoanOfferingFund(loanBO.getFund().getFundId().toString());
}
if (configService.isRepaymentIndepOfMeetingEnabled()) {
MeetingDetailsEntity meetingDetail = loanBO.getLoanMeeting().getMeetingDetails();
loanActionForm.setMonthDay("");
loanActionForm.setMonthWeek("0");
loanActionForm.setMonthRank("0");
if (meetingDetail.getRecurrenceTypeEnum() == RecurrenceType.MONTHLY) {
setMonthlySchedule(loanActionForm, meetingDetail);
} else {
setWeeklySchedule(loanActionForm, meetingDetail);
}
}
setSessionAtributeForGLIM(request, loanBO);
SessionUtils.setAttribute(LOANOFFERING, loanOffering, request);
// Retrieve and set into the session all collateral types from the
// lookup_value_locale table associated with the current user context
// locale
SessionUtils.setCollectionAttribute(MasterConstants.COLLATERAL_TYPES, legacyMasterDao.getLookUpEntity(MasterConstants.COLLATERAL_TYPES).getCustomValueListElements(), request);
SessionUtils.setCollectionAttribute(MasterConstants.BUSINESS_ACTIVITIES, legacyMasterDao.findValueListElements(MasterConstants.LOAN_PURPOSES), request);
SessionUtils.setCollectionAttribute(CUSTOM_FIELDS, new ArrayList<CustomFieldDefinitionEntity>(), request);
SessionUtils.setAttribute(RECURRENCEID, loanBO.getLoanMeeting().getMeetingDetails().getRecurrenceTypeEnum().getValue(), request);
SessionUtils.setAttribute(RECURRENCENAME, loanBO.getLoanMeeting().getMeetingDetails().getRecurrenceType().getRecurrenceName(), request);
SessionUtils.setCollectionAttribute(LOANFUNDS, getFunds(loanOffering), request);
setRequestAttributesForEditPage(request, loanBO);
InformationOrderServiceFacade informationOrderServiceFacade = ApplicationContextProvider.getBean(InformationOrderServiceFacade.class);
SessionUtils.setCollectionAttribute("detailsInformationOrder", informationOrderServiceFacade.getInformationOrder("CreateLoan"), request);
setFormAttributes(loanBO, form, request);
return mapping.findForward(ActionForwards.manage_success.toString());
}
use of org.mifos.platform.questionnaire.service.InformationOrderServiceFacade in project head by mifos.
the class PictureFormFile method get.
@TransactionDemarcate(saveToken = true)
public ActionForward get(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
String clientSystemId = ((ClientCustActionForm) form).getGlobalCustNum();
ClientInformationDto clientInformationDto;
try {
clientInformationDto = clientServiceFacade.getClientInformationDto(clientSystemId);
} catch (MifosRuntimeException e) {
if (e.getCause() instanceof ApplicationException) {
throw (ApplicationException) e.getCause();
}
throw e;
}
// John W - for breadcrumb or another other action downstream that exists business_key set (until refactored)
ClientBO clientBO = (ClientBO) this.customerDao.findCustomerById(clientInformationDto.getClientDisplay().getCustomerId());
SessionUtils.removeThenSetAttribute(Constants.BUSINESS_KEY, clientBO, request);
SessionUtils.setAttribute(ClientConstants.IS_PHOTO_FIELD_HIDDEN, FieldConfig.getInstance().isFieldHidden("Client.Photo"), request);
setCurrentPageUrl(request, clientBO);
setQuestionGroupInstances(request, clientBO);
InformationOrderServiceFacade informationOrderServiceFacade = ApplicationContextProvider.getBean(InformationOrderServiceFacade.class);
SessionUtils.removeThenSetAttribute("clientInformationDto", clientInformationDto, request);
request.getSession().setAttribute("guarantyClientInformation", loanAccountServiceFacade.retrieveGuarantyClientInformation(clientInformationDto));
QuestionnaireServiceFacade questionnaireServiceFacade = questionnaireServiceFacadeLocator.getService(request);
List<QuestionGroupInstanceDetail> questions = new ArrayList<QuestionGroupInstanceDetail>();
questions.addAll(questionnaireServiceFacade.getQuestionGroupInstancesWithUnansweredQuestionGroups(clientInformationDto.getClientDisplay().getCustomerId(), "Create", "Client"));
questions.addAll(questionnaireServiceFacade.getQuestionGroupInstancesWithUnansweredQuestionGroups(clientInformationDto.getClientDisplay().getCustomerId(), "View", "Client"));
questions.addAll(questionnaireServiceFacade.getQuestionGroupInstancesWithUnansweredQuestionGroups(clientInformationDto.getClientDisplay().getCustomerId(), "Close", "Client"));
SessionUtils.setCollectionAttribute("questionGroups", questions, request);
SessionUtils.setCollectionAttribute("personalInformationOrder", informationOrderServiceFacade.getInformationOrder("Client"), request);
return mapping.findForward(ActionForwards.get_success.toString());
}
use of org.mifos.platform.questionnaire.service.InformationOrderServiceFacade 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.platform.questionnaire.service.InformationOrderServiceFacade in project head by mifos.
the class PictureFormFile method editPersonalInfo.
@TransactionDemarcate(joinToken = true)
public ActionForward editPersonalInfo(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
ClientCustActionForm actionForm = (ClientCustActionForm) form;
actionForm.clearMostButNotAllFieldsOnActionForm();
ClientBO clientFromSession = getClientFromSession(request);
final String clientSystemId = clientFromSession.getGlobalCustNum();
ClientBO client = this.customerDao.findClientBySystemId(clientSystemId);
short loanOfficerId = client.getCreatedBy();
String clientStatus = client.getCustomerStatus().getName();
ClientPersonalInfoDto personalInfo = this.clientServiceFacade.retrieveClientPersonalInfoForUpdate(clientSystemId, clientStatus, loanOfficerId);
SessionUtils.setCollectionAttribute(ClientConstants.SALUTATION_ENTITY, personalInfo.getClientDropdowns().getSalutations(), request);
SessionUtils.setCollectionAttribute(ClientConstants.GENDER_ENTITY, personalInfo.getClientDropdowns().getGenders(), request);
SessionUtils.setCollectionAttribute(ClientConstants.MARITAL_STATUS_ENTITY, personalInfo.getClientDropdowns().getMaritalStatuses(), request);
SessionUtils.setCollectionAttribute(ClientConstants.CITIZENSHIP_ENTITY, personalInfo.getClientDropdowns().getCitizenship(), request);
SessionUtils.setCollectionAttribute(ClientConstants.ETHNICITY_ENTITY, personalInfo.getClientDropdowns().getEthnicity(), request);
SessionUtils.setCollectionAttribute(ClientConstants.EDUCATION_LEVEL_ENTITY, personalInfo.getClientDropdowns().getEducationLevels(), request);
SessionUtils.setCollectionAttribute(ClientConstants.BUSINESS_ACTIVITIES_ENTITY, personalInfo.getClientDropdowns().getBusinessActivity(), request);
SessionUtils.setCollectionAttribute(ClientConstants.POVERTY_STATUS, personalInfo.getClientDropdowns().getPoverty(), request);
SessionUtils.setCollectionAttribute(ClientConstants.HANDICAPPED_ENTITY, personalInfo.getClientDropdowns().getHandicapped(), request);
UserContext userContext = getUserContext(request);
List<SpouseFatherLookupEntity> spouseFather = legacyMasterDao.findMasterDataEntitiesWithLocale(SpouseFatherLookupEntity.class);
SessionUtils.setCollectionAttribute(ClientConstants.SPOUSE_FATHER_ENTITY, spouseFather, request);
SessionUtils.setAttribute("CanEditPhoneNumber", ActivityMapper.getInstance().isEditPhoneNumberPermitted(userContext, userContext.getBranchId()), request);
InformationOrderServiceFacade informationOrderServiceFacade = ApplicationContextProvider.getBean(InformationOrderServiceFacade.class);
SessionUtils.setCollectionAttribute("personalInformationOrder", informationOrderServiceFacade.getInformationOrder("CreateClient"), request);
boolean isFamilyDetailsRequired = personalInfo.getClientRules().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);
}
SessionUtils.setCollectionAttribute(CustomerConstants.CUSTOM_FIELDS_LIST, new ArrayList<CustomFieldDto>(), request);
// customer specific
actionForm.setCustomerId(personalInfo.getCustomerDetail().getCustomerId().toString());
actionForm.setLoanOfficerId(personalInfo.getCustomerDetail().getLoanOfficerIdAsString());
actionForm.setGlobalCustNum(personalInfo.getCustomerDetail().getGlobalCustNum());
actionForm.setExternalId(personalInfo.getCustomerDetail().getExternalId());
actionForm.setAddress(Address.toAddress(client.getAddress()));
// client specific
actionForm.setGovernmentId(personalInfo.getClientDetail().getGovernmentId());
actionForm.setDateOfBirth(personalInfo.getClientDetail().getDateOfBirth());
actionForm.setClientDetailView(personalInfo.getClientDetail().getCustomerDetail());
ClientNameDetailDto clientName = personalInfo.getClientDetail().getClientName();
clientName.setNames(ClientRules.getNameSequence());
actionForm.setClientName(clientName);
String photoDelete = request.getParameter("photoDelete");
if (photoDelete != null && photoDelete.equals("true")) {
ApplicationContextProvider.getBean(ClientPhotoService.class).delete(client.getCustomerId().longValue());
}
boolean isPhotoFieldHidden = FieldConfig.getInstance().isFieldHidden("Client.Photo");
SessionUtils.setAttribute(ClientConstants.IS_PHOTO_FIELD_HIDDEN, isPhotoFieldHidden, request);
if (!isPhotoFieldHidden) {
ClientPhotoDto clientPhotoDto = this.clientServiceFacade.getClientPhoto(client.getCustomerId().longValue());
if (clientPhotoDto != null) {
FormFile formFile = new PictureFormFile(clientPhotoDto.getContentType(), clientPhotoDto.getOut(), client.getCustomerId().toString(), clientPhotoDto.getContentLength().intValue());
actionForm.setPicture(formFile);
} else {
actionForm.setPicture(null);
}
} else {
actionForm.setPicture(null);
}
ClientNameDetailDto spouseName = personalInfo.getClientDetail().getSpouseName();
if (spouseName != null) {
spouseName.setNames(ClientRules.getNameSequence());
actionForm.setSpouseName(spouseName);
}
actionForm.setSpouseName(spouseName);
actionForm.setCustomFields(new ArrayList<CustomFieldDto>());
SessionUtils.removeThenSetAttribute(Constants.BUSINESS_KEY, client, request);
return mapping.findForward(ActionForwards.editPersonalInfo_success.toString());
}
use of org.mifos.platform.questionnaire.service.InformationOrderServiceFacade in project head by mifos.
the class PictureFormFile method load.
@TransactionDemarcate(saveToken = true)
public ActionForward load(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
ClientCustActionForm actionForm = (ClientCustActionForm) form;
UserContext userContext = getUserContext(request);
actionForm.clearMostButNotAllFieldsOnActionForm();
SessionUtils.removeAttribute(CustomerConstants.CUSTOMER_MEETING, request);
Short officeId = actionForm.getOfficeIdValue();
String officeName = actionForm.getOfficeName();
Short groupFlag = actionForm.getGroupFlagValue();
String parentGroupId = actionForm.getParentGroupId();
ClientFormCreationDto clientFormCreationDto = this.clientServiceFacade.retrieveClientFormCreationData(groupFlag, officeId, parentGroupId);
if (clientFormCreationDto.getFormedByPersonnelId() != null) {
actionForm.setFormedByPersonnel(clientFormCreationDto.getFormedByPersonnelId().toString());
MeetingBO groupMeeting = customerDao.findCustomerById(Integer.valueOf(parentGroupId)).getCustomerMeetingValue();
clientFormCreationDto.getParentCustomerMeeting().setMeetingSchedule(CustomerUIHelperFn.getMeetingSchedule(groupMeeting, userContext));
SessionUtils.setAttribute("meeting", clientFormCreationDto.getParentCustomerMeeting(), request);
}
actionForm.setCenterDisplayName(clientFormCreationDto.getCenterDisplayName());
actionForm.setGroupDisplayName(clientFormCreationDto.getGroupDisplayName());
actionForm.setOfficeId(clientFormCreationDto.getOfficeId().toString());
actionForm.setOfficeName(officeName);
if (clientFormCreationDto.getFormedByPersonnelId() != null) {
actionForm.setLoanOfficerId(clientFormCreationDto.getFormedByPersonnelId().toString());
}
actionForm.setLoanOfficerName(clientFormCreationDto.getFormedByPersonnelName());
actionForm.setCustomFields(new ArrayList<CustomFieldDto>());
List<ApplicableAccountFeeDto> defaultFees = clientFormCreationDto.getDefaultFees();
actionForm.setDefaultFees(defaultFees);
List<ApplicableAccountFeeDto> additionalFees = clientFormCreationDto.getAdditionalFees();
SessionUtils.setCollectionAttribute(CustomerConstants.ADDITIONAL_FEES_LIST, additionalFees, request);
List<SpouseFatherLookupEntity> spouseFather = legacyMasterDao.findMasterDataEntitiesWithLocale(SpouseFatherLookupEntity.class);
SessionUtils.setCollectionAttribute(ClientConstants.SPOUSE_FATHER_ENTITY, spouseFather, request);
SessionUtils.setCollectionAttribute(ClientConstants.SALUTATION_ENTITY, clientFormCreationDto.getClientDropdowns().getSalutations(), request);
SessionUtils.setCollectionAttribute(ClientConstants.GENDER_ENTITY, clientFormCreationDto.getClientDropdowns().getGenders(), request);
SessionUtils.setCollectionAttribute(ClientConstants.MARITAL_STATUS_ENTITY, clientFormCreationDto.getClientDropdowns().getMaritalStatuses(), request);
SessionUtils.setCollectionAttribute(ClientConstants.CITIZENSHIP_ENTITY, clientFormCreationDto.getClientDropdowns().getCitizenship(), request);
SessionUtils.setCollectionAttribute(ClientConstants.ETHNICITY_ENTITY, clientFormCreationDto.getClientDropdowns().getEthnicity(), request);
SessionUtils.setCollectionAttribute(ClientConstants.EDUCATION_LEVEL_ENTITY, clientFormCreationDto.getClientDropdowns().getEducationLevels(), request);
SessionUtils.setCollectionAttribute(ClientConstants.BUSINESS_ACTIVITIES_ENTITY, clientFormCreationDto.getClientDropdowns().getBusinessActivity(), request);
SessionUtils.setCollectionAttribute(ClientConstants.POVERTY_STATUS, clientFormCreationDto.getClientDropdowns().getPoverty(), request);
SessionUtils.setCollectionAttribute(ClientConstants.HANDICAPPED_ENTITY, clientFormCreationDto.getClientDropdowns().getHandicapped(), request);
SessionUtils.setCollectionAttribute(CustomerConstants.CUSTOM_FIELDS_LIST, new ArrayList<CustomFieldDto>(), request);
SessionUtils.setCollectionAttribute(CustomerConstants.LOAN_OFFICER_LIST, clientFormCreationDto.getPersonnelList(), request);
SessionUtils.setCollectionAttribute(CustomerConstants.FORMEDBY_LOAN_OFFICER_LIST, clientFormCreationDto.getFormedByPersonnelList(), request);
SessionUtils.setCollectionAttribute(ClientConstants.SAVINGS_OFFERING_LIST, clientFormCreationDto.getSavingsOfferings(), request);
SessionUtils.setAttribute(GroupConstants.CENTER_HIERARCHY_EXIST, ClientRules.getCenterHierarchyExists(), request);
SessionUtils.setAttribute(ClientConstants.MAXIMUM_NUMBER_OF_FAMILY_MEMBERS, ClientRules.getMaximumNumberOfFamilyMembers(), request);
InformationOrderServiceFacade informationOrderServiceFacade = ApplicationContextProvider.getBean(InformationOrderServiceFacade.class);
SessionUtils.setCollectionAttribute("personalInformationOrder", informationOrderServiceFacade.getInformationOrder("CreateClient"), request);
boolean isFamilyDetailsRequired = ClientRules.isFamilyDetailsRequired();
SessionUtils.setAttribute(ClientConstants.ARE_FAMILY_DETAILS_REQUIRED, isFamilyDetailsRequired, request);
if (isFamilyDetailsRequired) {
boolean isFamilyDetailsMandatory = isFamilyDetailsMandatory();
if (!isFamilyDetailsMandatory) {
actionForm.removeFamilyMember(0);
}
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);
}
return mapping.findForward(ActionForwards.load_success.toString());
}
Aggregations