From 382bc4e80e21ee1e4bea76522be282f90635ab09 Mon Sep 17 00:00:00 2001 From: labiloute Date: Thu, 6 Nov 2025 02:13:19 +0100 Subject: [PATCH] FIX: fetch LDAP members in LDAP sync sync_groups_ldap2dolibarr.php (#36117) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * FIX: Add missing left join to filter by extrafields (#36092) Co-authored-by: Noé * 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é Co-authored-by: Laurent Destailleur --- htdocs/webportal/class/html.formwebportal.class.php | 5 ++++- scripts/user/sync_groups_ldap2dolibarr.php | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/htdocs/webportal/class/html.formwebportal.class.php b/htdocs/webportal/class/html.formwebportal.class.php index 82c0c743cfd..5b82a96ccb7 100644 --- a/htdocs/webportal/class/html.formwebportal.class.php +++ b/htdocs/webportal/class/html.formwebportal.class.php @@ -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, diff --git a/scripts/user/sync_groups_ldap2dolibarr.php b/scripts/user/sync_groups_ldap2dolibarr.php index e51e85d9deb..0de3bff13fe 100755 --- a/scripts/user/sync_groups_ldap2dolibarr.php +++ b/scripts/user/sync_groups_ldap2dolibarr.php @@ -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')] ?? '';