Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions inc/group_group.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 [];
}

Expand Down Expand Up @@ -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']);
}

Expand Down
6 changes: 3 additions & 3 deletions inc/history.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -222,7 +222,7 @@ public static function getHistory($tickets_id, $full_history = false)
echo "</div>";

$i++;
if ($i == self::HISTORY_LIMIT && !$full_history) {
if ($i === self::HISTORY_LIMIT && !$full_history) {
break;
}
}
Expand Down
15 changes: 3 additions & 12 deletions inc/ticket.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down