summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f7e3a84)
raw | patch | inline | side by side (parent: f7e3a84)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 20 Jan 2006 09:36:16 +0000 (09:36 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 20 Jan 2006 09:36:16 +0000 (09:36 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@2534 594d385d-05f5-0310-b6e9-bd551577e9d8
include/class_glpi.inc | patch | blob | history | |
plugins/admin/systems/class_glpiPrinterCartridgesEdit.inc | patch | blob | history |
diff --git a/include/class_glpi.inc b/include/class_glpi.inc
index 544fd74630559b19ccaec84750389d6182ef1ca1..2148dd2f0962d84e6bd7f298aafc08637aa378c5 100644 (file)
--- a/include/class_glpi.inc
+++ b/include/class_glpi.inc
}
}
+ function getUsedDropdownTypes($id=false)
+ {
+ if($this->is_connected){
+ if($id){
+ $qry = "SELECT distinct(type) FROM glpi_cartridges_type WHERE type = ".$id.";";
+ }else{
+ $qry = "SELECT distinct(type) FROM glpi_cartridges_type;";
+ }
+ return($this->query($qry));
+ }else{
+ echo "not connected";
+ return(false);
+ }
+ }
}
//$s = new glpiDB("vserver-01","glpi","tester","glpi");
diff --git a/plugins/admin/systems/class_glpiPrinterCartridgesEdit.inc b/plugins/admin/systems/class_glpiPrinterCartridgesEdit.inc
index 5607b5127e66c1add66af37005ed9c188652cc54..ff8d42751a43bb6f07cf7074028394c1686c49e3 100644 (file)
/* Remove selected type from our printer types list
*/
if((isset($_POST['del_cartridge_type']))&&(!empty($_POST['select_type_cartridge']))){
- $this->parent->handle->removeCartridgeDropdownType($_POST['select_type_cartridge']);
+ $used = $this->parent->handle->getUsedDropdownTypes($_POST['select_type_cartridge']);
+ if(!count($used)){
+ $this->parent->handle->removeCartridgeDropdownType($_POST['select_type_cartridge']);
+ }else{
+ print_red(_("Can't delete this entry, it is still in use."));
+ }
}
/* Rename selected printer type to given string