From c6814a86ab86db809cb719ad3f29cfacbc035df5 Mon Sep 17 00:00:00 2001 From: Rom1-B Date: Wed, 4 Feb 2026 08:38:25 +0100 Subject: [PATCH 1/2] Fix(CI): rector --- inc/group_group.class.php | 4 ++-- inc/history.class.php | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/inc/group_group.class.php b/inc/group_group.class.php index 5e3d66c..3ee0666 100644 --- a/inc/group_group.class.php +++ b/inc/group_group.class.php @@ -161,7 +161,7 @@ public function getGroups($ticket_id, $removeAlreadyAssigned = true) // To do an escalation, the user must be in a group currently assigned to the ticket // or no group is assigned to the ticket // TODO : matching with "view all tickets (yes/no) option in profile user" - if ($ticket_groups !== [] && count(array_intersect($ticket_groups, $user_groups)) == 0) { + if ($ticket_groups !== [] && array_intersect($ticket_groups, $user_groups) === []) { return []; } @@ -196,7 +196,7 @@ public function getGroups($ticket_id, $removeAlreadyAssigned = true) $groupname = $group_obj->fields['name']; } - if (count($groups) == 0) { + if ($groups === []) { Group_User::getUserGroups($_SESSION['glpiID']); } diff --git a/inc/history.class.php b/inc/history.class.php index 1c37f89..8e729c3 100644 --- a/inc/history.class.php +++ b/inc/history.class.php @@ -39,7 +39,7 @@ class PluginEscaladeHistory extends CommonDBTM public static function getFirstLineForTicket($tickets_id) { $found = self::getFullHistory($tickets_id); - if (count($found) == 0) { + if (count($found) === 0) { return false; } else { return array_pop($found); @@ -49,7 +49,7 @@ public static function getFirstLineForTicket($tickets_id) public static function getlastLineForTicket($tickets_id) { $found = self::getFullHistory($tickets_id); - if (count($found) == 0) { + if (count($found) === 0) { return false; } else { return array_shift($found); @@ -222,7 +222,7 @@ public static function getHistory($tickets_id, $full_history = false) echo ""; $i++; - if ($i == self::HISTORY_LIMIT && !$full_history) { + if ($i === self::HISTORY_LIMIT && !$full_history) { break; } } From 448f1fc694febd2accdd63e5a0f05c5828ceb3ba Mon Sep 17 00:00:00 2001 From: Rom1-B Date: Wed, 4 Feb 2026 09:07:18 +0100 Subject: [PATCH 2/2] fix --- inc/ticket.class.php | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/inc/ticket.class.php b/inc/ticket.class.php index 5a85c1f..898271e 100644 --- a/inc/ticket.class.php +++ b/inc/ticket.class.php @@ -1035,30 +1035,21 @@ public static function cloneAndLink($tickets_id) SELECT null AS id, {$newID} as tickets_id, users_id, type, use_notification, alternative_email FROM glpi_tickets_users WHERE tickets_id = {$tickets_id} AND type != 2"; - if (!$res = $DB->doQuery($query_users)) { - Session::addMessageAfterRedirect(__s('Error : adding actors (user)', 'escalade'), false, ERROR); - return; - } + $DB->doQuery($query_users); //groups $query_groups = "INSERT INTO glpi_groups_tickets SELECT null AS id, {$newID} as tickets_id, groups_id, type FROM glpi_groups_tickets WHERE tickets_id = {$tickets_id} AND type != 2"; - if (!$res = $DB->doQuery($query_groups)) { - Session::addMessageAfterRedirect(__s('Error : adding actors (group)', "escalade"), false, ERROR); - return; - } + $DB->doQuery($query_groups); //add documents $query_docs = "INSERT INTO glpi_documents_items (documents_id, items_id, itemtype, entities_id, is_recursive, date_mod) SELECT documents_id, {$newID}, 'Ticket', entities_id, is_recursive, date_mod FROM glpi_documents_items WHERE items_id = {$tickets_id} AND itemtype = 'Ticket'"; - if (!$res = $DB->doQuery($query_docs)) { - Session::addMessageAfterRedirect(__s('Error : adding documents', 'escalade'), false, ERROR); - return; - } + $DB->doQuery($query_docs); //add history to the new ticket $changes[0] = '0';