From 615266f1d3f4b9d410ccdbd9ee2a40b86ca46fe3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 11 May 2026 00:11:33 +0200 Subject: [PATCH] Move stats as view mode --- htdocs/ticket/list.php | 10 ++++++---- htdocs/ticket/stats/index.php | 20 ++++++++++++++++++-- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index b388021a9c7..b2de366003a 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -671,6 +671,9 @@ if (/* !empty($contextpage) && */ $contextpage != $_SERVER["PHP_SELF"]) { // $co if ($limit > 0 && $limit != $conf->liste_limit) { $param .= '&limit='.((int) $limit); } +if ($optioncss != '') { + $param .= '&optioncss='.urlencode($optioncss); +} foreach ($search as $key => $val) { if (is_array($search[$key])) { foreach ($search[$key] as $skey) { @@ -686,14 +689,11 @@ foreach ($search as $key => $val) { $param .= '&search_'.$key.'='.urlencode($search[$key]); } } -if ($optioncss != '') { - $param .= '&optioncss='.urlencode($optioncss); -} // Add $param from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; // Add $param from hooks $parameters = array('param' => &$param); -$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $param .= $hookmanager->resPrint; if ($socid > 0) { $param .= '&socid='.urlencode((string) ($socid)); @@ -770,6 +770,7 @@ print ''; print ''; print ''; print ''; +print ''; print ''; if ($socid) { @@ -786,6 +787,7 @@ if (!empty($socid)) { $newcardbutton = ''; $newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss' => 'reposition')); $newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss' => 'reposition')); +$newcardbutton .= dolGetButtonTitle($langs->trans('Statistics'), '', 'fa fa-chart-bar imgforviewmode', DOL_URL_ROOT.'/ticket/stats/index.php?mode=statistics&objecttype=ticket@ticket'.preg_replace('/(&|\?)*(mode|groupby)=[^&]+/', '', $param), '', ($mode == 'statistics' ? 2 : 1), array('morecss' => 'reposition')); $newcardbutton .= dolGetButtonTitleSeparator(); $newcardbutton .= dolGetButtonTitle($langs->trans('NewTicket'), '', 'fa fa-plus-circle', $url, '', $user->hasRight('ticket', 'write')); diff --git a/htdocs/ticket/stats/index.php b/htdocs/ticket/stats/index.php index 369af211c8d..37dd4c898bf 100644 --- a/htdocs/ticket/stats/index.php +++ b/htdocs/ticket/stats/index.php @@ -78,12 +78,27 @@ $langs->loadLangs(array('orders', 'companies', 'other', 'tickets')); $form = new Form($db); $object = new Ticket($db); -$title = $langs->trans("Statistics"); $dir = $conf->ticket->dir_temp; + +$title = $langs->trans("Statistics"); $help_url = ''; + llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-ticket page-stats'); -print load_fiche_titre($title, '', 'ticket'); +$param = ''; +$mode = 'statistics'; +$url = DOL_URL_ROOT.'/ticket/card.php?action=create&mode=init'.($socid ? '&socid='.$socid : ''); +if (!empty($socid)) { + $url .= '&socid='.$socid; +} +$newcardbutton = ''; +$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', DOL_URL_ROOT.'/ticket/list.php?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss' => 'reposition')); +$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', DOL_URL_ROOT.'/ticket/list.php?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss' => 'reposition')); +$newcardbutton .= dolGetButtonTitle($langs->trans('Statistics'), '', 'fa fa-chart-bar imgforviewmode', DOL_URL_ROOT.'/ticket/stats/index.php?mode=statistics&objecttype=ticket@ticket'.preg_replace('/(&|\?)*(mode|groupby)=[^&]+/', '', $param), '', ($mode == 'statistics' ? 2 : 1), array('morecss' => 'reposition')); +$newcardbutton .= dolGetButtonTitleSeparator(); +$newcardbutton .= dolGetButtonTitle($langs->trans('NewTicket'), '', 'fa fa-plus-circle', $url, '', $user->hasRight('ticket', 'write')); + +print_barre_liste($langs->trans('Tickets'), 0, $_SERVER["PHP_SELF"], '', '', '', '', 0, $langs->trans("Statistics"), $object->picto, 0, $newcardbutton, '', 0, 0, 0, 1); // @phan-suppress-current-line PhanPluginSuspiciousParamOrder dol_mkdir($dir); @@ -185,6 +200,7 @@ print $form->select_dolusers($userid, 'userid', 1, null, 0, '', '', '0', 0, 0, ' // Status print ''.$langs->trans("Status").''; $liststatus = $object->fields['fk_statut']['arrayofkeyval']; +print img_picto('', 'status', 'class="pictofixedwidth"'); print $form->selectarray('object_status', $liststatus, GETPOST('object_status', 'intcomma'), -4, 0, 0, '', 1); print ''; // Year