Search in sources :

Example 1 with PersonnelSettingsActionForm

use of org.mifos.customers.personnel.struts.actionforms.PersonnelSettingsActionForm 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 2 with PersonnelSettingsActionForm

use of org.mifos.customers.personnel.struts.actionforms.PersonnelSettingsActionForm in project head by mifos.

the class PersonnelSettingsAction method preview.

@TransactionDemarcate(joinToken = true)
public ActionForward preview(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
    PersonnelSettingsActionForm personnelactionForm = (PersonnelSettingsActionForm) form;
    Integer prefeeredLocaleId = null;
    if (personnelactionForm.getPreferredLocaleValue() != null) {
        prefeeredLocaleId = personnelactionForm.getPreferredLocaleValue().intValue();
    }
    UserSettingsDto userSettings = this.personnelServiceFacade.retrieveUserSettings(personnelactionForm.getGenderValue(), personnelactionForm.getMaritalStatusValue(), prefeeredLocaleId, personnelactionForm.getPreferredSiteTypeId());
    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);
    return mapping.findForward(ActionForwards.preview_success.toString());
}
Also used : UserSettingsDto(org.mifos.dto.screen.UserSettingsDto) PersonnelSettingsActionForm(org.mifos.customers.personnel.struts.actionforms.PersonnelSettingsActionForm) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Example 3 with PersonnelSettingsActionForm

use of org.mifos.customers.personnel.struts.actionforms.PersonnelSettingsActionForm 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)

Aggregations

PersonnelSettingsActionForm (org.mifos.customers.personnel.struts.actionforms.PersonnelSettingsActionForm)3 TransactionDemarcate (org.mifos.framework.util.helpers.TransactionDemarcate)3 PersonnelBO (org.mifos.customers.personnel.business.PersonnelBO)2 AddressDto (org.mifos.dto.domain.AddressDto)1 UserDetailDto (org.mifos.dto.domain.UserDetailDto)1 UserSettingsDto (org.mifos.dto.screen.UserSettingsDto)1 CloseSession (org.mifos.framework.util.helpers.CloseSession)1 MifosUser (org.mifos.security.MifosUser)1 SitePreferenceHelper (org.mifos.ui.core.controller.util.helpers.SitePreferenceHelper)1