Fix: view LDAP attributes of entry

This commit is contained in:
Regis Houssin 2009-12-22 19:14:33 +00:00
parent 35fc21c529
commit 6edbf70fd5
2 changed files with 6 additions and 16 deletions

View File

@ -53,16 +53,6 @@ if (! $result)
dol_print_error($db,"Failed to get adherent: ".$adh->error); dol_print_error($db,"Failed to get adherent: ".$adh->error);
exit; 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 * Actions
@ -206,12 +196,12 @@ if ($result > 0)
$info=$adh->_load_ldap_info(); $info=$adh->_load_ldap_info();
$dn=$adh->_load_ldap_dn($info,1); $dn=$adh->_load_ldap_dn($info,1);
$search = "(".$adh->_load_ldap_dn($info,2).")"; $search = "(".$adh->_load_ldap_dn($info,2).")";
$records=$ldap->search($dn,$search); $records=$ldap->getAttribute($dn,$search);
//print_r($records); //print_r($records);
// Affichage arbre // 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)) if (! is_array($records))
{ {
@ -219,7 +209,7 @@ if ($result > 0)
} }
else else
{ {
$result=show_ldap_content($records,0,0,true); $result=show_ldap_content($records,0,$records['count'],true);
} }
} }
else else

View File

@ -197,12 +197,12 @@ if ($result > 0)
$info=$fuser->_load_ldap_info(); $info=$fuser->_load_ldap_info();
$dn=$fuser->_load_ldap_dn($info,1); $dn=$fuser->_load_ldap_dn($info,1);
$search = "(".$fuser->_load_ldap_dn($info,2).")"; $search = "(".$fuser->_load_ldap_dn($info,2).")";
$records=$ldap->search($dn,$search); $records=$ldap->getAttribute($dn,$search);
//print_r($records); //print_r($records);
// Affichage arbre // 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)) if (! is_array($records))
{ {
@ -210,7 +210,7 @@ if ($result > 0)
} }
else else
{ {
$result=show_ldap_content($records,0,0,true); $result=show_ldap_content($records,0,$records['count'],true);
} }
} }
else else