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