Code

Updated component and printer checks.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 13 Aug 2008 10:12:12 +0000 (10:12 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 13 Aug 2008 10:12:12 +0000 (10:12 +0000)
- Fixed empty() checks

git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@12207 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/goto/admin/systems/goto/class_printGeneric.inc
gosa-plugins/systems/admin/systems/class_componentGeneric.inc

index 2463ed87b6f505fc9ad59337e639be90d8a22a41..702212d4d1cebea43bc2fa6cdc349d41e3bd56ef 100644 (file)
@@ -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]);
         }
       }
index 002b38b2eb4c3fe12d580b6c3e15e2b56c079d73..294e9a0ede38867d304d63b9f602128ded60f153 100644 (file)
@@ -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;
           }