Code

Use get_list instead of ldap->ls.
[gosa.git] / plugins / admin / groups / class_groupMail.inc
index f7dbb724a4282ce06e9ea3801ae6ad471107f63d..b4bdc2962562fe5a5a8d1c9cd3ae86f04cccd983 100644 (file)
@@ -9,6 +9,7 @@ class mailgroup extends plugin
 
   var $uid                        = "";       // User id 
   var $cn                         = "";       // cn
+  var $orig_cn                    = "";       // cn
 
   var $method                     = "mailMethod"; // Used Mail method 
   var $mmethod                    = "";           // Contains the gosa.conf MAILMETHOD
@@ -47,6 +48,9 @@ class mailgroup extends plugin
   var $indexed_acl= array();
   var $indexed_user= array();
 
+  /* Copy & paste */
+  var $CopyPasteVars          = array("quotaUsage","imapacl");
+
   /* attribute list for save action */
   var $attributes= array( "mail",   "gosaMailServer", "gosaMailQuota", "gosaMailMaxSize",
       "gosaMailAlternateAddress", "gosaMailForwardingAddress",
@@ -62,6 +66,9 @@ class mailgroup extends plugin
      */
     plugin::plugin($config, $dn, $parent);
 
+    /* Save initial cn */
+    $this->orig_cn = $this->cn;
+
     /* Set mailMethod to the one defined in gosa.conf 
      */
     if (isset($this->config->current['MAILMETHOD'])){
@@ -836,7 +843,7 @@ I: Only insider delivery */
     }
     $ldap->cd($this->config->current['BASE']);
     $ldap->search ("(&(!(objectClass=gosaUserTemplate))(objectClass=gosaMailAccount)(|(mail=".$this->mail.")(gosaMailAlternateAddress=".
-        $this->mail."))(!(uid=".$this->cn."))(!(cn=".$this->cn.")))");
+        $this->mail."))(!(uid=".$this->orig_cn."))(!(cn=".$this->orig_cn.")))");
     if ($ldap->count() != 0){
       $message[]= _("The primary address you've entered is already in use.");
     }
@@ -1001,8 +1008,13 @@ I: Only insider delivery */
     }
   }
 
+  function PrepareForCopyPaste($source)
+  {
+    plugin::PrepareForCopyPaste($source);
 
+    /* Reset alternate mail addresses */
+    $this->gosaMailAlternateAddress = array();
+  }
 }
-
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
 ?>