fixed profile loading for hidden fields

This commit is contained in:
Roland Gruber 2009-10-03 18:13:38 +00:00
parent fb91567007
commit 2375b57b80
1 changed files with 27 additions and 20 deletions

View File

@ -188,21 +188,26 @@ class inetOrgPerson extends baseModule {
array('kind' => 'help', 'value' => 'employeeType')); array('kind' => 'help', 'value' => 'employeeType'));
} }
// profile checks // profile checks
$return['profile_checks']['inetOrgPerson_title'] = array( if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideJobTitle')) {
'type' => 'ext_preg', $return['profile_checks']['inetOrgPerson_title'] = array(
'regex' => 'title', 'type' => 'ext_preg',
'error_message' => $this->messages['title'][0]); 'regex' => 'title',
$return['profile_checks']['inetOrgPerson_employeeType'] = array( 'error_message' => $this->messages['title'][0]);
'type' => 'ext_preg', $return['profile_mappings']['inetOrgPerson_title'] = 'title';
'regex' => 'employeeType', }
'error_message' => $this->messages['employeeType'][0]); if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideEmployeeType')) {
// profile mappings $return['profile_checks']['inetOrgPerson_employeeType'] = array(
$return['profile_mappings'] = array( 'type' => 'ext_preg',
'inetOrgPerson_l' => 'l', 'regex' => 'employeeType',
'inetOrgPerson_st' => 'st', 'error_message' => $this->messages['employeeType'][0]);
'inetOrgPerson_title' => 'title', $return['profile_mappings']['inetOrgPerson_employeeType'] = 'employeeType';
'inetOrgPerson_employeeType' => 'employeeType' }
); if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideLocation')) {
$return['profile_mappings']['inetOrgPerson_l'] = 'l';
}
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideState')) {
$return['profile_mappings']['inetOrgPerson_st'] = 'st';
}
// configuration settings // configuration settings
$return['config_options']['all'] = array( $return['config_options']['all'] = array(
array( array(
@ -1362,11 +1367,13 @@ class inetOrgPerson extends baseModule {
function load_profile($profile) { function load_profile($profile) {
// profile mappings in meta data // profile mappings in meta data
parent::load_profile($profile); parent::load_profile($profile);
// departments if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideDepartments')) {
if (isset($profile['inetOrgPerson_departmentNumber'][0]) && $profile['inetOrgPerson_departmentNumber'][0] != '') { // departments
$departments = explode(';', $profile['inetOrgPerson_departmentNumber'][0]); if (isset($profile['inetOrgPerson_departmentNumber'][0]) && $profile['inetOrgPerson_departmentNumber'][0] != '') {
// remove extra spaces and set attributes $departments = explode(';', $profile['inetOrgPerson_departmentNumber'][0]);
$this->attributes['departmentNumber'] = array_map('trim', $departments); // remove extra spaces and set attributes
$this->attributes['departmentNumber'] = array_map('trim', $departments);
}
} }
} }