From 6edbf70fd5d51f5c7480a25e959b904503b22275 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 22 Dec 2009 19:14:33 +0000 Subject: [PATCH] Fix: view LDAP attributes of entry --- htdocs/adherents/ldap.php | 16 +++------------- htdocs/user/ldap.php | 6 +++--- 2 files changed, 6 insertions(+), 16 deletions(-) diff --git a/htdocs/adherents/ldap.php b/htdocs/adherents/ldap.php index abe56f388d1..524bf9e3a33 100644 --- a/htdocs/adherents/ldap.php +++ b/htdocs/adherents/ldap.php @@ -53,16 +53,6 @@ if (! $result) dol_print_error($db,"Failed to get adherent: ".$adh->error); exit; } -$adh->fetch_optionals($rowid); - -$adht = new AdherentType($db); -$result=$adht->fetch($adh->typeid); -if (! $result) -{ - dol_print_error($db,"Failed to get type of adherent: ".$adht->error); - exit; -} - /* * Actions @@ -206,12 +196,12 @@ if ($result > 0) $info=$adh->_load_ldap_info(); $dn=$adh->_load_ldap_dn($info,1); $search = "(".$adh->_load_ldap_dn($info,2).")"; - $records=$ldap->search($dn,$search); + $records=$ldap->getAttribute($dn,$search); //print_r($records); // Affichage arbre - if (sizeof($records) && (! isset($records['count']) || $records['count'] > 0)) + if (sizeof($records) && $records != false && (! isset($records['count']) || $records['count'] > 0)) { if (! is_array($records)) { @@ -219,7 +209,7 @@ if ($result > 0) } else { - $result=show_ldap_content($records,0,0,true); + $result=show_ldap_content($records,0,$records['count'],true); } } else diff --git a/htdocs/user/ldap.php b/htdocs/user/ldap.php index 3c0e8eac694..8ab04afc9a2 100644 --- a/htdocs/user/ldap.php +++ b/htdocs/user/ldap.php @@ -197,12 +197,12 @@ if ($result > 0) $info=$fuser->_load_ldap_info(); $dn=$fuser->_load_ldap_dn($info,1); $search = "(".$fuser->_load_ldap_dn($info,2).")"; - $records=$ldap->search($dn,$search); + $records=$ldap->getAttribute($dn,$search); //print_r($records); // Affichage arbre - if (sizeof($records) && (! isset($records['count']) || $records['count'] > 0)) + if (sizeof($records) && $records != false && (! isset($records['count']) || $records['count'] > 0)) { if (! is_array($records)) { @@ -210,7 +210,7 @@ if ($result > 0) } else { - $result=show_ldap_content($records,0,0,true); + $result=show_ldap_content($records,0,$records['count'],true); } } else