Code

Added speed optimization
[gosa.git] / plugins / admin / systems / class_glpiManufacturer.inc
index 8463743a2ccae2684c5030105e2068cd9a80f40a..eaaaaa94185ce06c67a40fba3494b9e1783bdd3e 100644 (file)
@@ -36,11 +36,12 @@ class glpiManufacturer extends plugin
 
   function execute()
   {
+    plugin::execute();
     $smarty  = get_smarty();
     $display = "";
 
     if((isset($_POST['remove_manu']))&&(isset($_POST['manufacturer']))){
-      $this->parent->handle->removeEnterprisesType($_POST['manufacturer']);
+      $this->parent->handle->removeEnterprise($_POST['manufacturer']);
     }
 
     if(isset($_POST['add_manu'])){
@@ -78,13 +79,21 @@ class glpiManufacturer extends plugin
         $tmp[$attrs]=$this->$attrs;
       }
 
-      if($this->Edit_Add == "add"){
-        $this->parent->handle->addEnterprisesType($tmp);
-      }else{
-        $this->parent->handle->updateEnterprisesType($tmp,$this->ID);
+      $allok = true;
+      if(empty($tmp['name'])){
+        print_red(_("Please specify a name."));
+        $allok = false;
       }
 
-      $this->editMode=false;
+      if($allok){
+        if($this->Edit_Add == "add"){
+          $this->parent->handle->addEnterprise($tmp);
+          $this->editMode=false;
+        }else{
+          $this->parent->handle->updateEnterprise($tmp,$this->ID);
+          $this->editMode=false;
+        }
+      }
     }
 
     if($this->editMode == true){
@@ -98,8 +107,8 @@ class glpiManufacturer extends plugin
     }
 
 
-    $smarty->assign("Manus",    $this->parent->handle->getEnterprisesTypes());
-    $smarty->assign("ManuKeys", array_flip($this->parent->handle->getEnterprisesTypes()));
+    $smarty->assign("Manus",    $this->parent->handle->getEnterprises());
+    $smarty->assign("ManuKeys", array_flip($this->parent->handle->getEnterprises()));
     $display.= $smarty->fetch(get_template_path('glpiManufacturer.tpl', TRUE));
     return($display);
   }