From 43ac67c3d825dac14addf51a876ec0e7d67758ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 12 Feb 2023 23:13:45 +0100 Subject: [PATCH] clean code --- htdocs/ticket/class/ticket.class.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 6884d2e830d..bc50c0e31f8 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -1433,6 +1433,7 @@ class Ticket extends CommonObject $langs->load('ticket'); + $nofetch = empty($params['nofetch']) ? false : true; $datas = []; $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("Ticket").''; $datas['picto'] .= ' '.$this->getLibStatut(4); @@ -1445,6 +1446,12 @@ class Ticket extends CommonObject if ($this->date_modification) { $datas['date_modification'] = '
'.$langs->trans('DateModification').': '.dol_print_date($this->date_modification, 'dayhour'); } + // 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_TICKET, 1); + } return $datas; } @@ -1474,6 +1481,8 @@ class Ticket extends CommonObject $params = [ 'id' => $this->id, 'objecttype' => $this->element, + 'option' => $option, + 'nofetch' => 1, ]; $classfortooltip = 'classfortooltip'; $dataparams = '';