summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f020425)
raw | patch | inline | side by side (parent: f020425)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 25 Jan 2006 07:12:01 +0000 (07:12 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 25 Jan 2006 07:12:01 +0000 (07:12 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@2563 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 08f94fad60494d4841abe2b01bd17f99e1bce7c6..3c16b9fc174e6cb27684f44ac7f60d97799cdb35 100644 (file)
--- a/include/class_glpi.inc
+++ b/include/class_glpi.inc
*/
function updateSystemType($name,$id)
{
-
if($this->is_connected){
$tmp = $this->query("SELECT * FROM glpi_type_computers WHERE ID=".$id.";");
if(isset($tmp[0])){
/* Operating systems
Returns all OSs
*/
- function getOSTypes()
+ function getOSTypes($keys = false)
{
if($this->is_connected){
$ret = array();
- $tmp=($this->query("SELECT * FROM glpi_dropdown_os;"));
+ $tmp=($this->query("SELECT * FROM glpi_dropdown_os ORDER by name;"));
- foreach($tmp as $t){
- $ret[$t['ID']]=$t['name'];
+ if($keys){
+ foreach($tmp as $t){
+ $ret[$t['name']]=$t['ID'];
+ }
+ }else{
+ foreach($tmp as $t){
+ $ret[$t['ID']]=$t['name'];
+ }
}
-
return($ret);
-
+
}else{
echo "not connected";
return(false);
*/
function updateOS($name,$id)
{
-
if($this->is_connected){
$tmp = $this->query("SELECT * FROM glpi_dropdown_os WHERE ID=".$id.";");
if(isset($tmp[0])){
}
+
+ /* check if given manufacturer ID ist still in use.
+ The problem is, that nearly every table uses manufacturers ....
+ */
+ function is_manufacturerUsed($id)
+ {
+ $tables = array();
+ foreach($this->deviceMappingGOsaGlpi as $table => $entry){
+ $tables[] = $entry;
+ }
+ $tables[] ="sdf";
+ print_a($tables);
+ exit();
+
+ if($this->is_connected){
+ $ret = array();
+ }else{
+ echo "not connected";
+ return(false);
+ }
+ }
+
/* Manufacturer
Updates already existing manufacturer
*/
diff --git a/plugins/admin/systems/class_glpiAccount.inc b/plugins/admin/systems/class_glpiAccount.inc
index 643503a2fd6c4db528b82673baddbcfb7f20c8a2..0f11882cd646b87c9f98bce03a5db07824833a22 100644 (file)
/* This appends a new system to our sytem types
*/
if((isset($_POST['add_type']))&&(!empty($_POST['type_string']))){
- $this->handle->addSystemType($_POST['type_string']);
+ $attr = $this->handle->getSystemTypes();
+ if(in_array(trim($_POST['type_string']),$attr)){
+ print_red(_("Adding new sytem type failed, this system type name is already used.")) ;
+ }else{
+ $this->handle->addSystemType(trim($_POST['type_string']));
+ }
}
/* Remove selected type from our system types list
/* Rename selected system type to given string
*/
if((isset($_POST['rename_type']))&&(!empty($_POST['select_type']))&&(!empty($_POST['type_string']))){
- $this->handle->updateSystemType($_POST['type_string'],$_POST['select_type']);
+ $attr = $this->handle->getSystemTypes();
+ if(in_array(trim($_POST['type_string']),$attr)){
+ print_red(_("Rename failed, this system type name is already used.")) ;
+ }else{
+ $this->handle->updateSystemType($_POST['type_string'],trim($_POST['select_type']));
+ }
}
/* Someone wants to edit the system types ...
/* Add new os to the db
*/
if((isset($_POST['add_os']))&&(!empty($_POST['is_string']))){
- $this->handle->addOS($_POST['is_string']);
+ $attr = $this->handle->getOSTypes();
+ if(in_array(trim($_POST['is_string']),$attr)){
+ print_red(_("Adding new operating system failed, specifed name is already used.")) ;
+ }else{
+ $this->handle->addOS(trim($_POST['is_string']));
+ }
}
/* Delete selected os from list and db
/* Rename selected os to given string
*/
if((isset($_POST['rename_os']))&&(!empty($_POST['select_os']))&&(!empty($_POST['is_string']))){
- $this->handle->updateOS($_POST['is_string'],$_POST['select_os']);
+ $attr = $this->handle->getOSTypes();
+ if(in_array(trim($_POST['is_string']),$attr)){
+ print_red(_("Updating operating system failed, specifed name is already used.")) ;
+ }else{
+ $this->handle->updateOS($_POST['is_string'],$_POST['select_os']);
+ }
}
/* Open dialog to edit os types