diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php
index b0ca0986ffb..6e77fd3fa95 100644
--- a/htdocs/adherents/class/adherent.class.php
+++ b/htdocs/adherents/class/adherent.class.php
@@ -2288,6 +2288,7 @@ class Adherent extends CommonObject
$datas = [];
+ $nofetch = empty($params['nofetch']) ? false : true;
if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
$langs->load("users");
return ['optimize' => $langs->trans("ShowUser")];
@@ -2318,6 +2319,12 @@ class Adherent extends CommonObject
$datas['email'] = '
'.$langs->trans("EMail").': '.$this->email;
}
$datas['address'] = '
'.$langs->trans("Address").': '.dol_format_address($this, 1, ' ', $langs);
+ // show categories for this record only in ajax to not overload lists
+ if (isModEnabled('categorie') && !$nofetch) {
+ require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
+ $form = new Form($this->db);
+ $datas['categories'] = '
' . $form->showCategories($this->id, Categorie::TYPE_MEMBER, 1);
+ }
$datas['divclose'] = '';
return $datas;
@@ -2353,6 +2360,7 @@ class Adherent extends CommonObject
'id' => $this->id,
'objecttype' => $this->element,
'option' => $option,
+ 'nofetch' => 1,
];
if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) {
$classfortooltip = 'classforajaxtooltip';
diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php
index fd5b55e70fe..11cb4f98dbd 100644
--- a/htdocs/comm/action/class/actioncomm.class.php
+++ b/htdocs/comm/action/class/actioncomm.class.php
@@ -1580,6 +1580,7 @@ class ActionComm extends CommonObject
$langs->load('agenda');
$datas = [];
+ $nofetch = empty($params['nofetch']) ? false : true;
// Set label of type
$labeltype = '';
if ($this->type_code) {
@@ -1631,6 +1632,12 @@ class ActionComm extends CommonObject
$datas['note'] .= (dol_textishtml($texttoshow) ? str_replace(array("\r", "\n"), "", $texttoshow) : str_replace(array("\r", "\n"), '
', $texttoshow));
$datas['note'] .= '';
}
+ // show categories for this record only in ajax to not overload lists
+ if (isModEnabled('categorie') && !$nofetch) {
+ require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
+ $form = new Form($this->db);
+ $datas['categories'] = '
' . $form->showCategories($this->id, Categorie::TYPE_ACTIONCOMM, 1);
+ }
return $datas;
}
@@ -1734,6 +1741,7 @@ class ActionComm extends CommonObject
'id' => $this->id,
'objecttype' => $this->element,
'option' => $option,
+ 'nofetch' => 1,
];
$classfortooltip = 'classforajaxtooltip';
$dataparams = ' data-params='.json_encode($params);