FIX: fetch LDAP members in LDAP sync sync_groups_ldap2dolibarr.php (#36117)

* FIX: Add missing left join to filter by extrafields (#36092)

Co-authored-by: Noé <noe@scopen.fr>

* FIX: fetch LDAP members in LDAP sync sync_groups_ldap2dolibarr.php

* Fix boolean parameter casing in fetch method

---------

Co-authored-by: noec764 <58433943+noec764@users.noreply.github.com>
Co-authored-by: Noé <noe@scopen.fr>
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
This commit is contained in:
labiloute 2025-11-06 02:13:19 +01:00 committed by GitHub
parent c3f8a2b2e6
commit 382bc4e80e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 2 deletions

View file

@ -414,7 +414,6 @@ class FormWebPortal extends Form
$classpath = $InfoFieldList[1];
$filter = empty($InfoFieldList[3]) ? '' : $InfoFieldList[3];
$sortfield = empty($InfoFieldList[4]) ? '' : $InfoFieldList[4];
if (!empty($classpath)) {
dol_include_once($classpath);
@ -519,6 +518,10 @@ class FormWebPortal extends Form
}
}
if (!empty($objecttmp->isextrafieldmanaged)) {
$sql .= " LEFT JOIN " . $this->db->prefix() . $this->db->sanitize($objecttmp->table_element) . "_extrafields as e ON t.rowid = e.fk_object";
}
// Add where from hooks
$parameters = array(
'object' => $objecttmp,

View file

@ -152,7 +152,7 @@ if ($result >= 0) {
// Warning $ldapuser has a key in lowercase
foreach ($ldaprecords as $key => $ldapgroup) {
$group = new UserGroup($db);
$group->fetch(0, $ldapgroup[getDolGlobalString('LDAP_KEY_GROUPS')]);
$group->fetch(0, $ldapgroup[getDolGlobalString('LDAP_KEY_GROUPS')], true); // Fetch LDAP groups AND members
$group->name = $ldapgroup[getDolGlobalString('LDAP_GROUP_FIELD_FULLNAME')] ?? '';
$group->nom = $group->name; // For backward compatibility
$group->note = $ldapgroup[getDolGlobalString('LDAP_GROUP_FIELD_DESCRIPTION')] ?? '';