Code

Warn user if selected hotplug is no longer available
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 9 Oct 2007 13:19:20 +0000 (13:19 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 9 Oct 2007 13:19:20 +0000 (13:19 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@7479 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/personal/environment/class_environment.inc

index 51f09c0d97280f029242ef590ede0b5ad48ea4b3..d06ad5f02d031cce39c4e91237bbed5450cbb15a 100644 (file)
@@ -120,18 +120,22 @@ class environment extends plugin
       $ldap->cd($this->config->current['BASE']);
       for($i = 0 ; $i < $this->attrs['gotoHotplugDeviceDN']['count'] ; $i ++){
         $ldap->cat($this->attrs['gotoHotplugDeviceDN'][$i]);
-        $attrs = $ldap->fetch(); 
-
-        if(isset($attrs['gotoHotplugDevice'][0])){
-          $tmp      = preg_split("/\|/",$attrs['gotoHotplugDevice'][0]);
-          $tmp2     = array();
-          $tmp2['name']         = $attrs['cn'][0];
-          $tmp2['description']  = $tmp[0];
-          $tmp2['id']           = $tmp[1];
-          $tmp2['produkt']      = $tmp[2];
-          $tmp2['vendor']       = $tmp[3];
-          $tmp2['dn']           = $attrs['dn'];
-          $this->gotoHotplugDevices[] = $tmp2; 
+        if($ldap->count()){
+          $attrs = $ldap->fetch(); 
+
+          if(isset($attrs['gotoHotplugDevice'][0])){
+            $tmp      = preg_split("/\|/",$attrs['gotoHotplugDevice'][0]);
+            $tmp2     = array();
+            $tmp2['name']         = $attrs['cn'][0];
+            $tmp2['description']  = $tmp[0];
+            $tmp2['id']           = $tmp[1];
+            $tmp2['produkt']      = $tmp[2];
+            $tmp2['vendor']       = $tmp[3];
+            $tmp2['dn']           = $attrs['dn'];
+            $this->gotoHotplugDevices[] = $tmp2; 
+          }
+        }else{
+          print_red(sprintf(_("The selected hotplug device %s is no longer available, it will be removed when you save this account."),$this->attrs['gotoHotplugDeviceDN'][$i]));
         }
       }
     }