Code

Disable type field, if there are cartrigdes assigned.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 20 Jan 2006 09:46:34 +0000 (09:46 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 20 Jan 2006 09:46:34 +0000 (09:46 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@2535 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/systems/class_glpiPrinterAccount.inc
plugins/admin/systems/glpiPrinter.tpl

index c6f3f281da4c3578ee2ea983076288b8c49b998d..2fbffd147c576f7b3b8ebf3862c14208c693cae2 100644 (file)
@@ -415,11 +415,15 @@ class glpiPrinterAccount extends plugin
     /* Remove cartridge  
      */
     if((isset($_POST['RemoveCartridge']))&&(isset($_POST['Cartridges']))){
-      if(isset($this->usedCartridges[$_POST['Cartridges']])){
-        if($this->usedCartridges[$_POST['Cartridges']]['status'] == "exists"){
-          $this->usedCartridges[$_POST['Cartridges']]['status'] = "deleted";
-        }else{
-          unset($this->usedCartridges[$_POST['Cartridges']]);
+
+      foreach($_POST['Cartridges'] as $cartID){
+
+        if(isset($this->usedCartridges[$cartID])){
+          if($this->usedCartridges[$cartID]['status'] == "exists"){
+            $this->usedCartridges[$cartID]['status'] = "deleted";
+          }else{
+            unset($this->usedCartridges[$cartID]);
+          }
         }
       }
     }
@@ -525,6 +529,19 @@ class glpiPrinterAccount extends plugin
       $smarty->assign("tech_num",               _("N/A"));
     }
 
+    /* If theres a cartridge selected, you can't change the printer type.
+     */ 
+    $disp = true;
+
+    foreach($this->usedCartridges as $cart){
+      if($cart['status'] != "deleted"){
+        $disp = false;
+      }
+    }
+    if($disp==false){
+      $smarty->assign("typeACL","disabled");
+    }
+
     $display.= $smarty->fetch(get_template_path('glpiPrinter.tpl', TRUE));
     return($display);
   }
index 054217bc1f22e252c6157fed7ed48092a84fa543..835a00eca76a3cce466c2be5640ac494d8303b0e 100644 (file)
                        <table summary="" width="100%"> 
                                <tr>
                                        <td>
-                                               <select name="Cartridges" {$CartridgesACL} style="height:100px;width:100%;" multiple>
+                                               <select name="Cartridges[]" {$CartridgesACL} style="height:100px;width:100%;" multiple>
                                                        {html_options values=$CartridgeKeys output=$Cartridges}
                                                </select>
                                                <input name="AddCartridge"      value="{t}Add{/t}" type="submit">