clean code

This commit is contained in:
Frédéric FRANCE 2023-02-12 23:19:03 +01:00
parent 43ac67c3d8
commit e1ca6ef019
2 changed files with 16 additions and 0 deletions

View File

@ -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'] = '<br><b>'.$langs->trans("EMail").':</b> '.$this->email;
}
$datas['address'] = '<br><b>'.$langs->trans("Address").':</b> '.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'] = '<br>' . $form->showCategories($this->id, Categorie::TYPE_MEMBER, 1);
}
$datas['divclose'] = '</div>';
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';

View File

@ -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"), '<br>', $texttoshow));
$datas['note'] .= '</div>';
}
// 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'] = '<br>' . $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);