Code

Added printer patch
[gosa.git] / plugins / admin / fai / class_faiProfile.inc
index 373a8147a39159d0bd1fe05a3f0ca3f938a99319..65871611b31db6f43195d4ea74c3c9d924ceaa8b 100644 (file)
@@ -78,7 +78,7 @@ class faiProfile extends plugin
     }
     
     /* Get ldap connection */ 
-    $base = $_SESSION['faifilter']['base'];
+    $base = $_SESSION['CurrentMainBase'];
     $ldap->cd($base);
     $sort = array();
 
@@ -356,6 +356,7 @@ class faiProfile extends plugin
     $ldap = $this->config->get_ldap_link();
     $ldap->cd ($this->dn);
     $ldap->rmdir_recursive($this->dn);
+    show_ldap_error($ldap->get_error(), _("Removing FAI profile failed"));
     $this->handle_post_events("remove");    
   }
 
@@ -387,8 +388,12 @@ class faiProfile extends plugin
     }
 
     $ldap = $this->config->get_ldap_link();
-    $ldap->cd($_SESSION['faifilter']['base']);
-    $ldap->search("(&(objectClass=FAIprofile)(cn=".$this->cn.")(!cn=".$this->old_cn."))",array("*"));
+    $ldap->cd($_SESSION['CurrentMainBase']);
+    if ($this->old_cn == ""){
+      $ldap->search("(&(objectClass=FAIprofile)(cn=".$this->cn."))",array("*"));
+    } else {
+      $ldap->search("(&(objectClass=FAIprofile)(cn=".$this->cn.")(!cn=".$this->old_cn."))",array("*"));
+    }
 
     if($ldap->count()){
       $message[]=_("There is already a profile with this class name defined.");
@@ -412,13 +417,12 @@ class faiProfile extends plugin
 
     $this->attrs['FAIclass']=trim($this->FAIclass);
 
-    $ldap->cat($this->dn);
+    $ldap->cat($this->dn,array("objectClass"));
     if($ldap->count()!=0){
       /* Write FAIscript to ldap*/
       $ldap->cd($this->dn);
       $this->cleanup();
-$ldap->modify ($this->attrs); 
-
+      $ldap->modify ($this->attrs); 
     }else{
       /* Write FAIscript to ldap*/
       $ldap->cd($this->config->current['BASE']);
@@ -426,6 +430,10 @@ $ldap->modify ($this->attrs);
       $ldap->cd($this->dn);
       $ldap->add($this->attrs);
     }
+    show_ldap_error($ldap->get_error(), _("Saving FAI profile failed"));
+
+    /* Do object tagging */
+    $this->handle_object_tagging();
     show_ldap_error($ldap->get_error());
   }
 }