From 2375b57b80b9bcc5174040725bf3c257a752b44c Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Sat, 3 Oct 2009 18:13:38 +0000 Subject: [PATCH] fixed profile loading for hidden fields --- lam/lib/modules/inetOrgPerson.inc | 47 ++++++++++++++++++------------- 1 file changed, 27 insertions(+), 20 deletions(-) diff --git a/lam/lib/modules/inetOrgPerson.inc b/lam/lib/modules/inetOrgPerson.inc index 0f76931c..2359ac28 100644 --- a/lam/lib/modules/inetOrgPerson.inc +++ b/lam/lib/modules/inetOrgPerson.inc @@ -188,21 +188,26 @@ class inetOrgPerson extends baseModule { array('kind' => 'help', 'value' => 'employeeType')); } // profile checks - $return['profile_checks']['inetOrgPerson_title'] = array( - 'type' => 'ext_preg', - 'regex' => 'title', - 'error_message' => $this->messages['title'][0]); - $return['profile_checks']['inetOrgPerson_employeeType'] = array( - 'type' => 'ext_preg', - 'regex' => 'employeeType', - 'error_message' => $this->messages['employeeType'][0]); - // profile mappings - $return['profile_mappings'] = array( - 'inetOrgPerson_l' => 'l', - 'inetOrgPerson_st' => 'st', - 'inetOrgPerson_title' => 'title', - 'inetOrgPerson_employeeType' => 'employeeType' - ); + if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideJobTitle')) { + $return['profile_checks']['inetOrgPerson_title'] = array( + 'type' => 'ext_preg', + 'regex' => 'title', + 'error_message' => $this->messages['title'][0]); + $return['profile_mappings']['inetOrgPerson_title'] = 'title'; + } + if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideEmployeeType')) { + $return['profile_checks']['inetOrgPerson_employeeType'] = array( + 'type' => 'ext_preg', + 'regex' => 'employeeType', + 'error_message' => $this->messages['employeeType'][0]); + $return['profile_mappings']['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 $return['config_options']['all'] = array( array( @@ -1362,11 +1367,13 @@ class inetOrgPerson extends baseModule { function load_profile($profile) { // profile mappings in meta data parent::load_profile($profile); - // departments - if (isset($profile['inetOrgPerson_departmentNumber'][0]) && $profile['inetOrgPerson_departmentNumber'][0] != '') { - $departments = explode(';', $profile['inetOrgPerson_departmentNumber'][0]); - // remove extra spaces and set attributes - $this->attributes['departmentNumber'] = array_map('trim', $departments); + if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideDepartments')) { + // departments + if (isset($profile['inetOrgPerson_departmentNumber'][0]) && $profile['inetOrgPerson_departmentNumber'][0] != '') { + $departments = explode(';', $profile['inetOrgPerson_departmentNumber'][0]); + // remove extra spaces and set attributes + $this->attributes['departmentNumber'] = array_map('trim', $departments); + } } }