summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 00d9102)
raw | patch | inline | side by side (parent: 00d9102)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 23 Jan 2006 09:52:21 +0000 (09:52 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 23 Jan 2006 09:52:21 +0000 (09:52 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@2540 594d385d-05f5-0310-b6e9-bd551577e9d8
include/class_glpi.inc | patch | blob | history | |
plugins/admin/systems/class_glpiAccount.inc | patch | blob | history |
diff --git a/include/class_glpi.inc b/include/class_glpi.inc
index 2148dd2f0962d84e6bd7f298aafc08637aa378c5..5063a0007b3db6972ec1e9d73ef28d79f648f249 100644 (file)
--- a/include/class_glpi.inc
+++ b/include/class_glpi.inc
foreach($tmp as $t){
$ret[$t['ID']]=$t['name'];
}
+ sort($ret);
return($ret);
}else{
echo "not connected";
}
}
+ /* System type is used */
+ function is_systemTypeUsed($ID){
+ if($this->is_connected){
+ $ret = array();
+ $qry="SELECT name,type FROM glpi_computers WHERE type=".$ID." LIMIT 3;";
+ $res = $this->query($qry);
+ foreach($res as $val){
+ $ret[$val['name']] = $val['name'];
+ }
+ return($ret);
+ }else{
+ echo "not connected";
+ return(false);
+ }
+ }
+
+
/* Manufacturer
Returns all defined manufacturers
*/
diff --git a/plugins/admin/systems/class_glpiAccount.inc b/plugins/admin/systems/class_glpiAccount.inc
index 1f3cb999c205533381d04440a6c9d7ff676c7f96..f0340a059a20fbb6e83459fdc500e3edd1d72610 100644 (file)
/* Remove selected type from our system types list
*/
if((isset($_POST['del_type']))&&(!empty($_POST['select_type']))){
- $this->handle->removeSystemType($_POST['select_type']);
+ $tmp = $this->handle->is_systemTypeUsed($_POST['select_type']);
+ 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 system type, it is still in use by these system(s) '%s'"),$names));
+ }else{
+ $this->handle->removeSystemType($_POST['select_type']);
+ }
}
/* Rename selected system type to given string