From: hickert Date: Fri, 20 Jan 2006 09:46:34 +0000 (+0000) Subject: Disable type field, if there are cartrigdes assigned. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=25c3b361a9765b517d7b133f00125dd02d122cac;p=gosa.git Disable type field, if there are cartrigdes assigned. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@2535 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/plugins/admin/systems/class_glpiPrinterAccount.inc b/plugins/admin/systems/class_glpiPrinterAccount.inc index c6f3f281d..2fbffd147 100644 --- a/plugins/admin/systems/class_glpiPrinterAccount.inc +++ b/plugins/admin/systems/class_glpiPrinterAccount.inc @@ -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); } diff --git a/plugins/admin/systems/glpiPrinter.tpl b/plugins/admin/systems/glpiPrinter.tpl index 054217bc1..835a00eca 100644 --- a/plugins/admin/systems/glpiPrinter.tpl +++ b/plugins/admin/systems/glpiPrinter.tpl @@ -105,7 +105,7 @@
- {html_options values=$CartridgeKeys output=$Cartridges}