Code

Fixed cn errors, when creating users with phone account and/or evironment account
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 31 Aug 2005 06:18:13 +0000 (06:18 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 31 Aug 2005 06:18:13 +0000 (06:18 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@1267 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/gofon/phoneaccount/class_phoneAccount.inc
plugins/personal/environment/class_environment.inc

index 813ed41881b689bb2603f12774175cdaf8e5b85b..dde34df58f5d077ba39a2da6e836dd36c39cfcec 100644 (file)
@@ -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);
index e4556f53dcfc0ad4c359fc203d264ef51ed367f6..8dac38155451c77815df349b87826e2395a7863e 100644 (file)
@@ -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."));