summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c36e7d4)
raw | patch | inline | side by side (parent: c36e7d4)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 23 Jan 2006 10:04:47 +0000 (10:04 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 23 Jan 2006 10:04:47 +0000 (10:04 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@2541 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 5063a0007b3db6972ec1e9d73ef28d79f648f249..6bfd37bc12552ae85211d3ea878a1fc738cd8e80 100644 (file)
--- a/include/class_glpi.inc
+++ b/include/class_glpi.inc
}
}
+ /* Operating system is used ? */
+ function is_osUsed($ID){
+ if($this->is_connected){
+ $ret = array();
+ $qry="SELECT name,type FROM glpi_computers WHERE os=".$ID." LIMIT 3;";
+ $res = $this->query($qry);
+ foreach($res as $val){
+ $ret[$val['name']] = $val['name'];
+ }
+ return($ret);
+ }else{
+ echo "not connected";
+ return(false);
+ }
+ }
+
+
/* Operating systems
Add a new operating system to the dropdown menus
*/
diff --git a/plugins/admin/systems/class_glpiAccount.inc b/plugins/admin/systems/class_glpiAccount.inc
index f0340a059a20fbb6e83459fdc500e3edd1d72610..c10adddd88a516a0c513cec7e02a796ac385b344 100644 (file)
/* Delete selected os from list and db
*/
if((isset($_POST['del_os']))&&(!empty($_POST['select_os']))){
- $this->handle->removeOS_byID($_POST['select_os']);
+ $tmp = $this->handle->is_osUsed($_POST['select_os']);
+
+ 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 operating system, it is still in use by these system(s) '%s'"),$names));
+
+
+ }else{
+ $this->handle->removeOS_byID($_POST['select_os']);
+ }
}
/* Rename selected os to given string