From 0532feafe7c5f16b89647ca1d4034303cd1edf77 Mon Sep 17 00:00:00 2001 From: hickert Date: Wed, 13 Aug 2008 10:12:12 +0000 Subject: [PATCH] Updated component and printer checks. - Fixed empty() checks git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@12207 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../goto/admin/systems/goto/class_printGeneric.inc | 7 ++++--- .../systems/admin/systems/class_componentGeneric.inc | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/gosa-plugins/goto/admin/systems/goto/class_printGeneric.inc b/gosa-plugins/goto/admin/systems/goto/class_printGeneric.inc index 2463ed87b..702212d4d 100644 --- a/gosa-plugins/goto/admin/systems/goto/class_printGeneric.inc +++ b/gosa-plugins/goto/admin/systems/goto/class_printGeneric.inc @@ -320,7 +320,7 @@ class printgeneric extends plugin /* If this is a WS / Terminal depending printer, display account state button */ if(!preg_match("/^Printer$/i",$this->BelongsTo)){ - if((empty($this->cn)) && ($this->dn != "new")){ + if($this->cn == "" && ($this->dn != "new")){ $display= $this->show_enable_header(_("Add printer extension"), msgPool::featuresDisabled(_("printer"))._("You can't enable it while 'cn' is not present in entry. Possibly you are currently creating a new terminal template."),TRUE,TRUE); $this->is_account= false; @@ -666,7 +666,7 @@ class printgeneric extends plugin $dn= "cn=".$this->cn.get_ou('printerou').",".$this->base; /* must: cn */ - if(($this->BelongsTo == "Printer") && (empty($this->cn))){ + if(($this->BelongsTo == "Printer") && $this->cn == ""){ $message[]= msgPool::required(_("Name")); } @@ -866,7 +866,8 @@ class printgeneric extends plugin /* Remove empty values */ foreach($this->attrs as $name => $value){ - if(empty($value)){ + $value = trim($value); + if($value == ""){ unset($this->attrs[$name]); } } diff --git a/gosa-plugins/systems/admin/systems/class_componentGeneric.inc b/gosa-plugins/systems/admin/systems/class_componentGeneric.inc index 002b38b2e..294e9a0ed 100644 --- a/gosa-plugins/systems/admin/systems/class_componentGeneric.inc +++ b/gosa-plugins/systems/admin/systems/class_componentGeneric.inc @@ -232,7 +232,7 @@ class componentGeneric extends plugin if(preg_match("/cn=dhcp,/",$attrs['dn'])){ continue; } - if ($attrs['dn'] != $this->orig_dn){ + if ($attrs['dn'] != $this->orig_dn && preg_match("/".normalizePreg(get_ou("componentou"))."/",$attrs['dn'])){ $message[]= msgPool::duplicated(_("Component name")); break; } -- 2.30.2