Code

Fixed long ldap query when searching for used phones.
[gosa.git] / plugins / admin / systems / class_workstationService.inc
index 757f0b9338d98c7db5cf7d0cd0325c694e0c40c5..8bb55fb52dc1c3d36bf1e0b68979e55ffd355444 100644 (file)
@@ -162,14 +162,12 @@ class workservice extends plugin
 
     /* Eventually colorize phones */
     $ldap->cd($this->config->current['BASE']);
-    foreach ($this->hardware_list as $cn => $desc){
-      $ldap->search("(goFonHardware=$cn)", array('cn'));
-      if ($ldap->count() > 0){
-        $ldap->fetch();
-        if ($ldap->getDN() != $this->dn){
-          $this->used_hardware[$cn]= $ldap->getDN();
+    $ldap->search("(goFonHardware=*)",array('cn','dn','goFonHardware'));
+    while($attrs = $ldap->fetch()){
+        $cn = $attrs['goFonHardware'][0];
+        if(isset($this->hardware_list[$cn])){
+          $this->used_hardware[$cn]= $cn;
         }
-      }
     }
 
     if(preg_match("/\+/",$this->gotoXHsync)){