Search in sources :

Example 46 with PersonnelBO

use of org.mifos.customers.personnel.business.PersonnelBO in project head by mifos.

the class PersonnelSettingsAction method update.

@CloseSession
@TransactionDemarcate(validateAndResetToken = true)
public ActionForward update(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
    PersonnelSettingsActionForm personnelSettingsActionForm = (PersonnelSettingsActionForm) form;
    PersonnelBO personnel = (PersonnelBO) SessionUtils.getAttribute(Constants.BUSINESS_KEY, request);
    AddressDto address = null;
    if (personnelSettingsActionForm.getAddress() != null) {
        address = Address.toDto(personnelSettingsActionForm.getAddress());
    }
    this.personnelServiceFacade.updateUserSettings(personnel.getPersonnelId(), personnelSettingsActionForm.getEmailId(), personnelSettingsActionForm.getName(), personnelSettingsActionForm.getMaritalStatusValue(), personnelSettingsActionForm.getGenderValue(), address, personnelSettingsActionForm.getPreferredLocaleValue(), personnelSettingsActionForm.getPreferredSiteTypeId());
    MifosUser user = (MifosUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
    (new SitePreferenceHelper()).setSitePreferenceCookie(personnelServiceFacade.retrieveSitePreference(user.getUserId()), response);
    return mapping.findForward(ActionForwards.updateSettings_success.toString());
}
Also used : SitePreferenceHelper(org.mifos.ui.core.controller.util.helpers.SitePreferenceHelper) PersonnelBO(org.mifos.customers.personnel.business.PersonnelBO) MifosUser(org.mifos.security.MifosUser) AddressDto(org.mifos.dto.domain.AddressDto) PersonnelSettingsActionForm(org.mifos.customers.personnel.struts.actionforms.PersonnelSettingsActionForm) CloseSession(org.mifos.framework.util.helpers.CloseSession) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Example 47 with PersonnelBO

use of org.mifos.customers.personnel.business.PersonnelBO in project head by mifos.

the class PersonnelSettingsAction method get.

@TransactionDemarcate(saveToken = true)
public ActionForward get(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
    Short userId = getUserContext(request).getId();
    PersonnelBO personnel = this.personnelDao.findPersonnelById(userId);
    SessionUtils.removeAttribute(Constants.BUSINESS_KEY, request);
    SessionUtils.setAttribute(Constants.BUSINESS_KEY, personnel, request);
    UserSettingsDto userSettings = this.personnelServiceFacade.retrieveUserSettings();
    SessionUtils.setAttribute(PersonnelConstants.GENDER, userSettings.getGender(), request);
    SessionUtils.setAttribute(PersonnelConstants.MARITALSTATUS, userSettings.getMartialStatus(), request);
    SessionUtils.setAttribute(MasterConstants.LANGUAGE, userSettings.getLanguage(), request);
    SessionUtils.setAttribute(PersonnelConstants.SITE_TYPE_PREFERRED, userSettings.getSitePreference(), request);
    SessionUtils.setCollectionAttribute(PersonnelConstants.GENDER_LIST, userSettings.getGenders(), request);
    SessionUtils.setCollectionAttribute(PersonnelConstants.MARITAL_STATUS_LIST, userSettings.getMartialStatuses(), request);
    SessionUtils.setCollectionAttribute(PersonnelConstants.LANGUAGE_LIST, userSettings.getLanguages(), request);
    SessionUtils.setCollectionAttribute(PersonnelConstants.SITE_TYPES_LIST, userSettings.getSitePreferenceTypes(), request);
    SessionUtils.removeAttribute(PersonnelConstants.PERSONNEL_AGE, request);
    SessionUtils.setAttribute(PersonnelConstants.PERSONNEL_AGE, userSettings.getAge(), request);
    return mapping.findForward(ActionForwards.get_success.toString());
}
Also used : PersonnelBO(org.mifos.customers.personnel.business.PersonnelBO) UserSettingsDto(org.mifos.dto.screen.UserSettingsDto) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Example 48 with PersonnelBO

use of org.mifos.customers.personnel.business.PersonnelBO in project head by mifos.

the class PersonnelSettingsAction method manage.

@TransactionDemarcate(joinToken = true)
public ActionForward manage(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
    PersonnelBO personnel = (PersonnelBO) SessionUtils.getAttribute(Constants.BUSINESS_KEY, request);
    // FIXME - provide all details through userDetailDto
    UserDetailDto userInfo = this.personnelServiceFacade.retrieveUserInformation(personnel.getPersonnelId());
    PersonnelSettingsActionForm form1 = (PersonnelSettingsActionForm) form;
    form1.setFirstName(userInfo.getFirstName());
    form1.setMiddleName(personnel.getPersonnelDetails().getName().getMiddleName());
    form1.setSecondLastName(personnel.getPersonnelDetails().getName().getSecondLastName());
    form1.setLastName(userInfo.getLastName());
    form1.setGender(getStringValue(personnel.getPersonnelDetails().getGender()));
    form1.setUserName(personnel.getUserName());
    form1.setEmailId(personnel.getEmailId());
    form1.setGovernmentIdNumber(personnel.getPersonnelDetails().getGovernmentIdNumber());
    form1.setAddress(personnel.getPersonnelDetails().getAddress());
    form1.setDob(personnel.getPersonnelDetails().getDob().toString());
    form1.setPreferredLocale(personnel.getPreferredLocale().toString());
    form1.setPreferredSiteTypeId(personnel.getSitePreference());
    form1.setMaritalStatus(getStringValue(personnel.getPersonnelDetails().getMaritalStatus()));
    return mapping.findForward(ActionForwards.manage_success.toString());
}
Also used : PersonnelBO(org.mifos.customers.personnel.business.PersonnelBO) UserDetailDto(org.mifos.dto.domain.UserDetailDto) PersonnelSettingsActionForm(org.mifos.customers.personnel.struts.actionforms.PersonnelSettingsActionForm) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Example 49 with PersonnelBO

use of org.mifos.customers.personnel.business.PersonnelBO in project head by mifos.

the class CustSearchAction method preview.

@TransactionDemarcate(conditionToken = true)
public ActionForward preview(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
    CustSearchActionForm actionForm = (CustSearchActionForm) form;
    if (StringUtils.isNotBlank(actionForm.getOfficeId())) {
        List<PersonnelBO> personnelList = legacyPersonnelDao.getActiveLoanOfficersUnderOffice(getShortValue(actionForm.getOfficeId()));
        SessionUtils.setCollectionAttribute(CustomerSearchConstants.LOANOFFICERSLIST, personnelList, request);
    }
    UserContext userContext = getUserContext(request);
    Short userBranchId = userContext.getBranchId();
    String officeName = retrieveOfficeName(actionForm, userBranchId);
    SessionUtils.setAttribute(CustomerSearchConstants.OFFICE, officeName, request);
    SessionUtils.setAttribute("isCenterHierarchyExists", ClientRules.getCenterHierarchyExists(), request);
    SessionUtils.setAttribute(CustomerSearchConstants.LOADFORWARD, CustomerSearchConstants.LOADFORWARDNONLOANOFFICER, request);
    HashMap<String, ArrayList<CustomerStatusDetailDto>> customerStates = new HashMap<String, ArrayList<CustomerStatusDetailDto>>();
    customerStates.putAll(customerSearchServiceFacade.getAvailibleCustomerStates());
    SessionUtils.setMapAttribute("availibleCustomerStates", customerStates, request);
    List<ValueListElement> availibleClientGenders = clientServiceFacade.getClientGenders();
    SessionUtils.setCollectionAttribute("availibleClientGenders", availibleClientGenders, request);
    return mapping.findForward(CustomerSearchConstants.LOADFORWARDNONLOANOFFICER_SUCCESS);
}
Also used : CustomerStatusDetailDto(org.mifos.dto.screen.CustomerStatusDetailDto) CustSearchActionForm(org.mifos.customers.struts.actionforms.CustSearchActionForm) PersonnelBO(org.mifos.customers.personnel.business.PersonnelBO) HashMap(java.util.HashMap) UserContext(org.mifos.security.util.UserContext) ArrayList(java.util.ArrayList) ValueListElement(org.mifos.dto.domain.ValueListElement) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Example 50 with PersonnelBO

use of org.mifos.customers.personnel.business.PersonnelBO in project head by mifos.

the class CustSearchAction method get.

@TransactionDemarcate(joinToken = true)
public ActionForward get(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
    CustSearchActionForm actionForm = (CustSearchActionForm) form;
    boolean isCenterHierarchyExist = ClientRules.getCenterHierarchyExists();
    if (StringUtils.isNotBlank(actionForm.getLoanOfficerId())) {
        Short loanOfficerId = Short.valueOf(actionForm.getLoanOfficerId());
        List<CustomerDetailDto> customerList = this.centerServiceFacade.retrieveCustomersUnderUser(loanOfficerId);
        SessionUtils.setCollectionAttribute(CustomerSearchConstants.CUSTOMERLIST, customerList, request);
        SessionUtils.setAttribute("GrpHierExists", isCenterHierarchyExist, request);
        SessionUtils.setAttribute(CustomerSearchConstants.LOADFORWARD, CustomerSearchConstants.LOADFORWARDLOANOFFICER, request);
    }
    if (StringUtils.isNotBlank(actionForm.getOfficeId())) {
        List<PersonnelBO> personnelList = legacyPersonnelDao.getActiveLoanOfficersUnderOffice(getShortValue(actionForm.getOfficeId()));
        SessionUtils.setCollectionAttribute(CustomerSearchConstants.LOANOFFICERSLIST, personnelList, request);
    }
    UserContext userContext = getUserContext(request);
    Short userBranchId = userContext.getBranchId();
    String officeName = retrieveOfficeName(actionForm, userBranchId);
    SessionUtils.setAttribute("isCenterHierarchyExists", isCenterHierarchyExist, request);
    SessionUtils.setAttribute(CustomerSearchConstants.OFFICE, officeName, request);
    SessionUtils.setAttribute(CustomerSearchConstants.LOADFORWARD, CustomerSearchConstants.LOADFORWARDNONLOANOFFICER, request);
    HashMap<String, ArrayList<CustomerStatusDetailDto>> customerStates = new HashMap<String, ArrayList<CustomerStatusDetailDto>>();
    customerStates.putAll(customerSearchServiceFacade.getAvailibleCustomerStates());
    SessionUtils.setMapAttribute("availibleCustomerStates", customerStates, request);
    List<ValueListElement> availibleClientGenders = clientServiceFacade.getClientGenders();
    SessionUtils.setCollectionAttribute("availibleClientGenders", availibleClientGenders, request);
    return mapping.findForward(CustomerSearchConstants.LOADFORWARDLOANOFFICER_SUCCESS);
}
Also used : CustomerStatusDetailDto(org.mifos.dto.screen.CustomerStatusDetailDto) HashMap(java.util.HashMap) UserContext(org.mifos.security.util.UserContext) ArrayList(java.util.ArrayList) CustSearchActionForm(org.mifos.customers.struts.actionforms.CustSearchActionForm) PersonnelBO(org.mifos.customers.personnel.business.PersonnelBO) CustomerDetailDto(org.mifos.dto.domain.CustomerDetailDto) ValueListElement(org.mifos.dto.domain.ValueListElement) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Aggregations

PersonnelBO (org.mifos.customers.personnel.business.PersonnelBO)239 Test (org.junit.Test)91 UserContext (org.mifos.security.util.UserContext)65 ArrayList (java.util.ArrayList)62 Money (org.mifos.framework.util.helpers.Money)46 MifosRuntimeException (org.mifos.core.MifosRuntimeException)44 OfficeBO (org.mifos.customers.office.business.OfficeBO)44 MifosUser (org.mifos.security.MifosUser)44 PersistenceException (org.mifos.framework.exceptions.PersistenceException)41 Date (java.util.Date)39 LocalDate (org.joda.time.LocalDate)37 AccountException (org.mifos.accounts.exceptions.AccountException)37 DateTime (org.joda.time.DateTime)36 AccountPaymentEntity (org.mifos.accounts.business.AccountPaymentEntity)34 BusinessRuleException (org.mifos.service.BusinessRuleException)33 PersonnelBuilder (org.mifos.domain.builders.PersonnelBuilder)31 MeetingBO (org.mifos.application.meeting.business.MeetingBO)30 CustomerBO (org.mifos.customers.business.CustomerBO)27 ServiceException (org.mifos.framework.exceptions.ServiceException)27 LoanBO (org.mifos.accounts.loan.business.LoanBO)25