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());
}
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());
}
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());
}
Aggregations