From 645b0c563ec176ef0055950e4d56665204d30d16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9=20Courtier?= Date: Tue, 14 Mar 2023 11:43:36 +0100 Subject: [PATCH 1/4] FIX: Add more context for selectForFormsListWhere Hook --- htdocs/core/class/html.form.class.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 9c14bfeb866..c4ade09e00f 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -6782,7 +6782,13 @@ class Form } // Add where from hooks - $parameters = array(); + $parameters = [ + 'object' => $objecttmp, + 'htmlname' => $htmlname, + 'filter' => $filter, + 'searchkey' => $searchkey + ]; + $reshook = $hookmanager->executeHooks('selectForFormsListWhere', $parameters); // Note that $action and $object may have been modified by hook if (!empty($hookmanager->resPrint)) { $sql .= $hookmanager->resPrint; From e618eb3e64252dc0106802c89bfb7845b9b54e39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9=20Courtier?= Date: Fri, 17 Mar 2023 10:58:41 +0100 Subject: [PATCH 2/4] FIX: Add missing hook on LibStatut --- htdocs/ticket/class/ticket.class.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index e03bdabe617..e77c7cc2562 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -1273,7 +1273,7 @@ class Ticket extends CommonObject public function LibStatut($status, $mode = 0, $notooltip = 0) { // phpcs:enable - global $langs; + global $langs, $hookmanager; $labelStatus = $this->statuts[$status]; $labelStatusShort = $this->statuts_short[$status]; @@ -1301,6 +1301,18 @@ class Ticket extends CommonObject $mode = 0; } + $parameters = array( + 'status' => $status, + 'mode' => $mode, + ); + + // Note that $action and $object may have been modified by hook + $reshook = $hookmanager->executeHooks('LibStatut', $parameters, $this); + + if ($reshook > 0) { + return $hookmanager->resPrint; + } + $params = array(); if ($notooltip) { $params = array('tooltip' => 'no'); From 66643a0dc6e17533389e34daec126b7f83f2b9fa Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 18 Mar 2023 00:33:51 +0100 Subject: [PATCH 3/4] Fix phpcs --- htdocs/ticket/class/ticket.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 9c883296305..e7392c33f1d 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -1306,8 +1306,8 @@ class Ticket extends CommonObject 'mode' => $mode, ); - // Note that $action and $object may have been modified by hook - $reshook = $hookmanager->executeHooks('LibStatut', $parameters, $this); + // Note that $action and $object may have been modified by hook + $reshook = $hookmanager->executeHooks('LibStatut', $parameters, $this); if ($reshook > 0) { return $hookmanager->resPrint; From 926c99f91344bf5efc5e5f50a1cf99e8efafdbd0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 18 Mar 2023 02:35:31 +0100 Subject: [PATCH 4/4] Update html.form.class.php --- htdocs/core/class/html.form.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index c4ade09e00f..36754934a0d 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -6782,12 +6782,12 @@ class Form } // Add where from hooks - $parameters = [ + $parameters = array( 'object' => $objecttmp, 'htmlname' => $htmlname, 'filter' => $filter, 'searchkey' => $searchkey - ]; + ); $reshook = $hookmanager->executeHooks('selectForFormsListWhere', $parameters); // Note that $action and $object may have been modified by hook if (!empty($hookmanager->resPrint)) {