Code

Added printer patch
[gosa.git] / plugins / admin / fai / class_faiProfile.inc
index a3976d254e099afc1c05d757d3add7badb22c478..65871611b31db6f43195d4ea74c3c9d924ceaa8b 100644 (file)
@@ -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");    
   }
 
@@ -388,7 +389,11 @@ class faiProfile extends plugin
 
     $ldap = $this->config->get_ldap_link();
     $ldap->cd($_SESSION['CurrentMainBase']);
-    $ldap->search("(&(objectClass=FAIprofile)(cn=".$this->cn.")(!cn=".$this->old_cn."))",array("*"));
+    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,7 +430,7 @@ $ldap->modify ($this->attrs);
       $ldap->cd($this->dn);
       $ldap->add($this->attrs);
     }
-    show_ldap_error($ldap->get_error());
+    show_ldap_error($ldap->get_error(), _("Saving FAI profile failed"));
 
     /* Do object tagging */
     $this->handle_object_tagging();