From: hickert Date: Tue, 9 Oct 2007 13:19:20 +0000 (+0000) Subject: Warn user if selected hotplug is no longer available X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=17bd04e073c92de71176f4b6d46e2cef244f0aef;p=gosa.git Warn user if selected hotplug is no longer available git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@7479 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/plugins/personal/environment/class_environment.inc b/plugins/personal/environment/class_environment.inc index 51f09c0d9..d06ad5f02 100644 --- a/plugins/personal/environment/class_environment.inc +++ b/plugins/personal/environment/class_environment.inc @@ -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])); } } }