From c9f785e1901c7f4672e806d3eb2f1fe6d1ee0558 Mon Sep 17 00:00:00 2001 From: hickert Date: Wed, 31 Aug 2005 06:18:13 +0000 Subject: [PATCH] Fixed cn errors, when creating users with phone account and/or evironment account git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@1267 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../gofon/phoneaccount/class_phoneAccount.inc | 18 +++++++++++++++--- .../personal/environment/class_environment.inc | 11 ++++++++--- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/plugins/gofon/phoneaccount/class_phoneAccount.inc b/plugins/gofon/phoneaccount/class_phoneAccount.inc index 813ed4188..dde34df58 100644 --- a/plugins/gofon/phoneaccount/class_phoneAccount.inc +++ b/plugins/gofon/phoneaccount/class_phoneAccount.inc @@ -406,10 +406,16 @@ class phoneAccount extends plugin $this->goFonPINVoice = $this->goFonPIN; } + if((!isset($this->cn))||(empty($this->cn))){ + $CNname= $this->uid; + }else{ + $CNname= $this->cn; + } + $SQL[]= "INSERT INTO ".$a_SETUP['VOICE_TABLE']." (`customer_id`,`context`,`mailbox`,`password`,`fullname`,`email`,`pager`) VALUES - ('".$this->phoneNumbers[$i_new_key]."','default','".$this->phoneNumbers[$i_new_key]."','".$this->goFonPINVoice."','".$this->cn."','".$s_mail."','');"; + ('".$this->phoneNumbers[$i_new_key]."','default','".$this->phoneNumbers[$i_new_key]."','".$this->goFonPINVoice."','".$CNname."','".$s_mail."','');"; $i_is_accounted=false; @@ -436,7 +442,7 @@ class phoneAccount extends plugin $EXT[$i]['exten'] = $s_telenums; $EXT[$i]['priority']= 1; $EXT[$i]['app'] = "SetCIDName"; - $EXT[$i]['appdata'] = $this->cn; + $EXT[$i]['appdata'] = $CNname; $i ++; // If no macro is selected use Dial @@ -659,7 +665,11 @@ class phoneAccount extends plugin /* Transfer ACL's */ foreach($this->attributes as $val){ $smarty->assign($val."ACL", chkacl($this->acl, "$val")); - $smarty->assign($val,$this->$val); + if(isset($this->$val)){ + $smarty->assign($val,$this->$val); + }else{ + $smarty->assign($val,""); + } } /* Fill arrays */ @@ -818,6 +828,8 @@ class phoneAccount extends plugin $this->attrs['goFonMacro']=array(); } + unset($this->attrs['cn']); + /* Write back to ldap */ $ldap= $this->config->get_ldap_link(); $ldap->cd($this->dn); diff --git a/plugins/personal/environment/class_environment.inc b/plugins/personal/environment/class_environment.inc index e4556f53d..8dac38155 100644 --- a/plugins/personal/environment/class_environment.inc +++ b/plugins/personal/environment/class_environment.inc @@ -73,7 +73,9 @@ class environment extends plugin { plugin::plugin ($config, $dn); - if(!isset($this->attrs['uid'][0])){ + + + if((isset($this->attrs['cn'][0]))&&(!isset($this->attrs['uid'][0]))){ $suffix="Group"; $this->uid = $this->attrs['cn'][0]; $this->attrs['uid'] = $this->attrs['cn'][0]; @@ -227,7 +229,7 @@ class environment extends plugin $display= $this->show_header(_("Remove environment extension"), _("This server has environment extension enabled. You can disable it by clicking below.")); } else { - if((in_array("posixAccount",$this->attrs['objectClass']))||($this->parent->by_object['posixAccount']->is_account==true)){ + if((isset($this->attrs['objectClass']))&&((in_array("posixAccount",$this->attrs['objectClass'])))||($this->parent->by_object['posixAccount']->is_account==true)){ // 4. There is a PosixAccount $display= $this->show_header(_("Add environment extension"), _("This server has environment extension disabled. You can enable it by clicking below.")); @@ -611,7 +613,10 @@ class environment extends plugin if(preg_match("/[^0-9]/",$this->gotoProfileQuota)) { $message[]=_("Please set a valid profile quota size."); - } + } + if(!isset($this->attrs['objectClass'])){ + $this->attrs['objectClass']=array(); + } if(!$this->is_group){ if((!((in_array("posixAccount",$this->attrs['objectClass']))||($this->parent->by_object['posixAccount']->is_account==true)))&&(!$this->is_group)){ $message[]=(_("You need to setup a valid posix extension in order to enable evironment features.")); -- 2.30.2