Code

fixed problem with klicking apply more than once
[gosa.git] / plugins / admin / systems / class_glpiManufacturer.inc
index e7a9b65cb7a1a4bdb7cf227d2ebcde095f8a18a3..120818a5ddc7839b1b52c753c21d7da1ec59d8de 100644 (file)
@@ -57,7 +57,7 @@ class glpiManufacturer extends plugin
         }
         print_red(sprintf(_("You can't delete this manufacturer, it is still in use by these system(s) '%s'"),$names));
       }else{
-        //$this->parent->handle->removeEnterprise($_POST['manufacturer']);
+        $this->parent->handle->removeEnterprise($_POST['manufacturer']);
       }
     }
 
@@ -105,6 +105,21 @@ class glpiManufacturer extends plugin
         $allok = false;
       }
 
+      $attr = $this->parent->handle->getEnterprises();
+
+      if($this->ID == -1 ){
+        if(in_array($tmp['name'],$attr)){
+          $allok = false;
+          print_red(_("Specified name is already in use, please choose another one."));
+        }
+      }else{
+        unset($attr[$this->ID]);
+        if(in_array($tmp['name'],$attr)){
+          $allok = false;
+          print_red(_("Specified name is already in use, please choose another one."));
+        }
+      }
+
       /* all checks are ok , so save changes */
       if($allok){
         if($this->Edit_Add == "add"){
@@ -144,7 +159,7 @@ class glpiManufacturer extends plugin
   {
     foreach($this->attributes as $attr){
       if(isset($_POST[$attr])){
-        $this->$attr = $_POST[$attr];
+        $this->$attr = stripslashes($_POST[$attr]);
       }
     }
   }