summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 6c008c9)
raw | patch | inline | side by side (parent: 6c008c9)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 25 Jan 2006 10:15:21 +0000 (10:15 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 25 Jan 2006 10:15:21 +0000 (10:15 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@2578 594d385d-05f5-0310-b6e9-bd551577e9d8
plugins/admin/systems/class_glpiPrinterAccount.inc | patch | blob | history |
diff --git a/plugins/admin/systems/class_glpiPrinterAccount.inc b/plugins/admin/systems/class_glpiPrinterAccount.inc
index 0a6fa9a1d88ba6793c2523ef7acd5340503803bf..5ac4eb1b656b38cb8ecce50e461e4c761ccf02ad 100644 (file)
/* This appends a new printer to our sytem types
*/
if((isset($_POST['add_type']))&&(!empty($_POST['type_string']))){
- $this->handle->addPrinterType($_POST['type_string']);
+
+ $tmp = $this->handle->getPrinterTypes();
+ $allok = true;
+ foreach($tmp as $id => $name){
+ if(trim($name) == trim($_POST['type_string'])){
+ $allok = false;
+ }
+ }
+ if($allok){
+ $this->handle->addPrinterType($_POST['type_string']);
+ }else{
+ print_red(sprintf(_("Can't rename given printer type to '%s', because this type name already exists."),$_POST['type_string']));
+ }
}
/* Remove selected type from our printer types list
*/
if((isset($_POST['del_type']))&&(!empty($_POST['select_type']))){
- $this->handle->removePrinterType($_POST['select_type']);
+ $tmp = $this->handle->is_printerTypeUsed($_POST['select_type']);
+ if(count($tmp)){
+ $str = "";
+ foreach($tmp as $id => $name){
+ $str .= $name.", ";
+ }
+ $str = preg_replace("/, $/","",$str);
+ print_red(sprintf(_("Can't delete printer type, it is still in use by '%s'."),$str));
+ }else{
+ $this->handle->removePrinterType($_POST['select_type']);
+ }
}
/* Rename selected printer type to given string
*/
if((isset($_POST['rename_type']))&&(!empty($_POST['select_type']))&&(!empty($_POST['type_string']))){
- $this->handle->updatePrinterType($_POST['type_string'],$_POST['select_type']);
+ $tmp = $this->handle->getPrinterTypes();
+ $allok = true;
+ foreach($tmp as $id => $name){
+ if(trim($name) == trim($_POST['type_string'])){
+ $allok = false;
+ }
+ }
+ if($allok){
+ $this->handle->updatePrinterType($_POST['type_string'],$_POST['select_type']);
+ }else{
+ print_red(sprintf(_("Can't rename given printer type to '%s', because this type name already exists."),$_POST['type_string']));
+ }
}
/* Someone wants to edit the printer types ...