Code

Updated System type & os type management, can't create existing entries, can't delete...
[gosa.git] / plugins / admin / systems / class_glpiManufacturer.inc
index 0c950d366a2837c35bbfc09f4249a9aa35564d9a..e7a9b65cb7a1a4bdb7cf227d2ebcde095f8a18a3 100644 (file)
@@ -42,7 +42,23 @@ class glpiManufacturer extends plugin
 
     /* Remove enterprise from db */
     if((isset($_POST['remove_manu']))&&(isset($_POST['manufacturer']))){
-      $this->parent->handle->removeEnterprise($_POST['manufacturer']);
+
+      $tmp = $this->parent->handle->is_manufacturerUsed($_POST['manufacturer']);
+      if(count($tmp)){
+
+        $names = "";
+        foreach($tmp as $name){
+          $names .= ", ".$name;
+        }
+        $names = preg_replace("/^, /","",$names);
+        $names = trim($names);
+        if(count($tmp) == 3){
+          $names .= " ...";
+        }
+        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']);
+      }
     }
 
     /* Add new Manufactuer : Open dialog with empty fields */