Skip to content
Open
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
54 changes: 18 additions & 36 deletions .phpstan-baseline.missingType.iterableValue.php
Original file line number Diff line number Diff line change
Expand Up @@ -14707,6 +14707,18 @@
'count' => 1,
'path' => __DIR__ . '/src/Glpi/Form/Destination/CommonITILField/LocationFieldConfig.php',
];
$ignoreErrors[] = [
'message' => '#^Method Glpi\\\\Form\\\\Destination\\\\CommonITILField\\\\OLAField\\:\\:applyConfiguratedValueToInputUsingAnswers\\(\\) has parameter \\$input with no value type specified in iterable type array\\.$#',
'identifier' => 'missingType.iterableValue',
'count' => 1,
'path' => __DIR__ . '/src/Glpi/Form/Destination/CommonITILField/OLAField.php',
];
$ignoreErrors[] = [
'message' => '#^Method Glpi\\\\Form\\\\Destination\\\\CommonITILField\\\\OLAField\\:\\:applyConfiguratedValueToInputUsingAnswers\\(\\) return type has no value type specified in iterable type array\\.$#',
'identifier' => 'missingType.iterableValue',
'count' => 1,
'path' => __DIR__ . '/src/Glpi/Form/Destination/CommonITILField/OLAField.php',
];
$ignoreErrors[] = [
'message' => '#^Method Glpi\\\\Form\\\\Destination\\\\CommonITILField\\\\OLATTOFieldConfig\\:\\:jsonDeserialize\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#',
'identifier' => 'missingType.iterableValue',
Expand Down Expand Up @@ -20419,6 +20431,12 @@
'count' => 1,
'path' => __DIR__ . '/src/Item_Line.php',
];
$ignoreErrors[] = [
'message' => '#^Method Item_Ola\\:\\:prepareInputForAdd\\(\\) return type has no value type specified in iterable type array\\.$#',
'identifier' => 'missingType.iterableValue',
'count' => 1,
'path' => __DIR__ . '/src/Item_Ola.php',
];
$ignoreErrors[] = [
'message' => '#^Method Item_OperatingSystem\\:\\:getRelationMassiveActionsSpecificities\\(\\) return type has no value type specified in iterable type array\\.$#',
'identifier' => 'missingType.iterableValue',
Expand Down Expand Up @@ -20821,18 +20839,6 @@
'count' => 1,
'path' => __DIR__ . '/src/KnowbaseItem_User.php',
];
$ignoreErrors[] = [
'message' => '#^Method LevelAgreement\\:\\:getDataForTicket\\(\\) return type has no value type specified in iterable type iterable\\.$#',
'identifier' => 'missingType.iterableValue',
'count' => 1,
'path' => __DIR__ . '/src/LevelAgreement.php',
];
$ignoreErrors[] = [
'message' => '#^Method LevelAgreement\\:\\:getFieldNames\\(\\) return type has no value type specified in iterable type array\\.$#',
'identifier' => 'missingType.iterableValue',
'count' => 1,
'path' => __DIR__ . '/src/LevelAgreement.php',
];
$ignoreErrors[] = [
'message' => '#^Method LevelAgreement\\:\\:getTypeDropdown\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#',
'identifier' => 'missingType.iterableValue',
Expand Down Expand Up @@ -23221,12 +23227,6 @@
'count' => 1,
'path' => __DIR__ . '/src/OlaLevel_Ticket.php',
];
$ignoreErrors[] = [
'message' => '#^Method OlaLevel_Ticket\\:\\:doLevelForTicket\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#',
'identifier' => 'missingType.iterableValue',
'count' => 1,
'path' => __DIR__ . '/src/OlaLevel_Ticket.php',
];
$ignoreErrors[] = [
'message' => '#^Method OperatingSystemKernelVersion\\:\\:displaySpecificTypeField\\(\\) has parameter \\$field with no value type specified in iterable type array\\.$#',
'identifier' => 'missingType.iterableValue',
Expand Down Expand Up @@ -29551,12 +29551,6 @@
'count' => 1,
'path' => __DIR__ . '/src/Ticket.php',
];
$ignoreErrors[] = [
'message' => '#^Method Ticket\\:\\:getDatasToAddOLA\\(\\) return type has no value type specified in iterable type array\\.$#',
'identifier' => 'missingType.iterableValue',
'count' => 1,
'path' => __DIR__ . '/src/Ticket.php',
];
$ignoreErrors[] = [
'message' => '#^Method Ticket\\:\\:getDatasToAddSLA\\(\\) return type has no value type specified in iterable type array\\.$#',
'identifier' => 'missingType.iterableValue',
Expand Down Expand Up @@ -29665,18 +29659,6 @@
'count' => 1,
'path' => __DIR__ . '/src/Ticket.php',
];
$ignoreErrors[] = [
'message' => '#^Method Ticket\\:\\:olaAffect\\(\\) has parameter \\$input with no value type specified in iterable type array\\.$#',
'identifier' => 'missingType.iterableValue',
'count' => 1,
'path' => __DIR__ . '/src/Ticket.php',
];
$ignoreErrors[] = [
'message' => '#^Method Ticket\\:\\:olaAffect\\(\\) has parameter \\$manual_olas_id with no value type specified in iterable type array\\.$#',
'identifier' => 'missingType.iterableValue',
'count' => 1,
'path' => __DIR__ . '/src/Ticket.php',
];
$ignoreErrors[] = [
'message' => '#^Method Ticket\\:\\:processMassiveActionsForOneItemtype\\(\\) has parameter \\$ids with no value type specified in iterable type array\\.$#',
'identifier' => 'missingType.iterableValue',
Expand Down
86 changes: 52 additions & 34 deletions .phpstan-baseline.php
Original file line number Diff line number Diff line change
Expand Up @@ -2806,7 +2806,7 @@
$ignoreErrors[] = [
'message' => '#^Property CommonDBTM\\:\\:\\$updates \\(list\\<string\\>\\) does not accept array\\<int\\<0, max\\>, string\\>\\.$#',
'identifier' => 'assign.propertyType',
'count' => 14,
'count' => 12,
'path' => __DIR__ . '/src/CommonITILObject.php',
];
$ignoreErrors[] = [
Expand Down Expand Up @@ -13861,6 +13861,36 @@
'count' => 1,
'path' => __DIR__ . '/src/Item_Line.php',
];
$ignoreErrors[] = [
'message' => '#^Method Item_Ola\\:\\:fillItemOlaData\\(\\) should return array\\{items_olas_id\\?\\: int, name\\: string, entities_id\\: int, is_recursive\\: bool, type\\: int, comment\\: string, number_time\\: int, use_ticket_calendar\\: bool, \\.\\.\\.\\} but returns array\\<string, mixed\\>\\.$#',
'identifier' => 'return.type',
'count' => 1,
'path' => __DIR__ . '/src/Item_Ola.php',
];
$ignoreErrors[] = [
'message' => '#^Offset \'linkid\' does not exist on array\\{id\\: int, name\\: string, entities_id\\: int, is_recursive\\: int, type\\: 0\\|1, comment\\: string, number_time\\: int, use_ticket_calendar\\: int, \\.\\.\\.\\}\\.$#',
'identifier' => 'offsetAccess.notFound',
'count' => 2,
'path' => __DIR__ . '/src/Item_Ola.php',
];
$ignoreErrors[] = [
'message' => '#^Offset string\\|null might not exist on array\\{start_time\\: string, olas_id\\: int, itemtype\\: class\\-string\\<CommonITILObject\\>, items_id\\: int\\}\\.$#',
'identifier' => 'offsetAccess.notFound',
'count' => 2,
'path' => __DIR__ . '/src/Item_Ola.php',
];
$ignoreErrors[] = [
'message' => '#^Parameter \\#1 \\$itemtype of method CommonDBConnexity\\:\\:getConnexityItem\\(\\) expects string, string\\|null given\\.$#',
'identifier' => 'argument.type',
'count' => 1,
'path' => __DIR__ . '/src/Item_Ola.php',
];
$ignoreErrors[] = [
'message' => '#^Parameter \\#2 \\$items_id of method CommonDBConnexity\\:\\:getConnexityItem\\(\\) expects string, string\\|null given\\.$#',
'identifier' => 'argument.type',
'count' => 1,
'path' => __DIR__ . '/src/Item_Ola.php',
];
$ignoreErrors[] = [
'message' => '#^Cannot access property \\$fields on CommonDBTM\\|false\\.$#',
'identifier' => 'property.nonObject',
Expand Down Expand Up @@ -14119,12 +14149,6 @@
'count' => 3,
'path' => __DIR__ . '/src/LevelAgreement.php',
];
$ignoreErrors[] = [
'message' => '#^Cannot call method add\\(\\) on CommonDBTM\\|false\\.$#',
'identifier' => 'method.nonObject',
'count' => 1,
'path' => __DIR__ . '/src/LevelAgreement.php',
];
$ignoreErrors[] = [
'message' => '#^Cannot call method clone\\(\\) on LevelAgreementLevel\\|false\\.$#',
'identifier' => 'method.nonObject',
Expand All @@ -14137,12 +14161,6 @@
'count' => 1,
'path' => __DIR__ . '/src/LevelAgreement.php',
];
$ignoreErrors[] = [
'message' => '#^Cannot call method deleteByCriteria\\(\\) on LevelAgreementLevel\\|false\\.$#',
'identifier' => 'method.nonObject',
'count' => 1,
'path' => __DIR__ . '/src/LevelAgreement.php',
];
$ignoreErrors[] = [
'message' => '#^Cannot call method find\\(\\) on LevelAgreementLevel\\|false\\.$#',
'identifier' => 'method.nonObject',
Expand Down Expand Up @@ -15481,12 +15499,6 @@
'count' => 1,
'path' => __DIR__ . '/src/NotificationTargetCommonITILObject.php',
];
$ignoreErrors[] = [
'message' => '#^Parameter \\#1 \\$item of method NotificationTargetCommonITILObject\\<T of CommonITILObject\\>\\:\\:getDataForObject\\(\\) expects CommonITILObject, \\(T of CommonITILObject\\)\\|null given\\.$#',
'identifier' => 'argument.type',
'count' => 1,
'path' => __DIR__ . '/src/NotificationTargetCommonITILObject.php',
];
$ignoreErrors[] = [
'message' => '#^Parameter \\#1 \\$itemtype of function getTableForItemType expects class\\-string\\<CommonDBTM\\>, string given\\.$#',
'identifier' => 'argument.type',
Expand Down Expand Up @@ -15961,6 +15973,12 @@
'count' => 1,
'path' => __DIR__ . '/src/NotificationTargetTicket.php',
];
$ignoreErrors[] = [
'message' => '#^Parameter \\#2 \\$id of static method Dropdown\\:\\:getDropdownName\\(\\) expects int, float\\|int\\|string given\\.$#',
'identifier' => 'argument.type',
'count' => 2,
'path' => __DIR__ . '/src/NotificationTargetTicket.php',
];
$ignoreErrors[] = [
'message' => '#^Argument of an invalid type array\\<array\\|string\\>\\|string supplied for foreach, only iterables are supported\\.$#',
'identifier' => 'foreach.nonIterable',
Expand Down Expand Up @@ -17863,12 +17881,6 @@
'count' => 1,
'path' => __DIR__ . '/src/RuleCommonITILObject.php',
];
$ignoreErrors[] = [
'message' => '#^Offset \'appendto\' might not exist on array\\<string, array\\<int\\|string\\>\\|string\\>\\|string\\.$#',
'identifier' => 'offsetAccess.notFound',
'count' => 1,
'path' => __DIR__ . '/src/RuleCommonITILObject.php',
];
$ignoreErrors[] = [
'message' => '#^Offset 1 might not exist on list\\{0\\?\\: string, 1\\?\\: non\\-empty\\-string\\}\\.$#',
'identifier' => 'offsetAccess.notFound',
Expand Down Expand Up @@ -18166,7 +18178,7 @@
$ignoreErrors[] = [
'message' => '#^Cannot assign offset \'name\' to array\\<string, array\\<int\\|string\\>\\|string\\>\\|string\\.$#',
'identifier' => 'offsetAssign.dimType',
'count' => 8,
'count' => 6,
'path' => __DIR__ . '/src/RuleTicket.php',
];
$ignoreErrors[] = [
Expand All @@ -18184,13 +18196,25 @@
$ignoreErrors[] = [
'message' => '#^Cannot assign offset \'table\' to array\\<string, array\\<int\\|string\\>\\|string\\>\\|string\\.$#',
'identifier' => 'offsetAssign.dimType',
'count' => 4,
'count' => 2,
'path' => __DIR__ . '/src/RuleTicket.php',
];
$ignoreErrors[] = [
'message' => '#^Cannot assign offset \'table\' to array\\|string\\.$#',
'identifier' => 'offsetAssign.dimType',
'count' => 9,
'count' => 7,
'path' => __DIR__ . '/src/RuleTicket.php',
];
$ignoreErrors[] = [
'message' => '#^Cannot assign offset \'type\' to array\\<string, array\\<int\\|string\\>\\|string\\>\\|string\\.$#',
'identifier' => 'offsetAssign.dimType',
'count' => 1,
'path' => __DIR__ . '/src/RuleTicket.php',
];
$ignoreErrors[] = [
'message' => '#^Cannot assign offset \'type\' to array\\|string\\.$#',
'identifier' => 'offsetAssign.dimType',
'count' => 1,
'path' => __DIR__ . '/src/RuleTicket.php',
];
$ignoreErrors[] = [
Expand Down Expand Up @@ -18757,12 +18781,6 @@
'count' => 9,
'path' => __DIR__ . '/src/Ticket.php',
];
$ignoreErrors[] = [
'message' => '#^Parameter \\#3 \\$specifictime of static method Html\\:\\:computeGenericDateTimeSearch\\(\\) expects int\\|string, int\\|false given\\.$#',
'identifier' => 'argument.type',
'count' => 1,
'path' => __DIR__ . '/src/TicketRecurrent.php',
];
$ignoreErrors[] = [
'message' => '#^Method TicketTask\\:\\:displayPlanningItem\\(\\) should return string but returns string\\|false\\.$#',
'identifier' => 'return.type',
Expand Down
6 changes: 6 additions & 0 deletions .phpstan-baseline.specific.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,12 @@
'count' => 1,
'path' => __DIR__ . '/src/Glpi/Inventory/MainAsset/Unmanaged.php',
];
$ignoreErrors[] = [
'message' => '#^Possibly invalid array key type string\\|null\\.$#',
'identifier' => 'offsetAccess.invalidOffset',
'count' => 2,
'path' => __DIR__ . '/src/Item_Ola.php',
];
$ignoreErrors[] = [
'message' => '#^Possibly invalid array key type string\\|null\\.$#',
'identifier' => 'offsetAccess.invalidOffset',
Expand Down
20 changes: 6 additions & 14 deletions front/ticket.form.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,15 @@
}
}

// form submitted (add & update)
// as _actors virtual field stores json, bypass automatic escaping
if (isset($_POST['_actors'])) {
$_POST['_actors'] = json_decode($_POST['_actors'], true);
$_REQUEST['_actors'] = $_POST['_actors'];
}

if (isset($_POST["add"])) {
// form submitted (add)
$track->check(-1, CREATE, $_POST);
$_POST = $track->enforceReadonlyFields($_POST, true);

Expand All @@ -83,6 +85,7 @@
}
Html::back();
} elseif (isset($_POST['update'])) {
// form submitted (update)
if (!$track::canUpdate()) {
throw new AccessDeniedHttpException();
}
Expand Down Expand Up @@ -123,6 +126,8 @@
}
Html::redirect(Ticket::getFormURLWithID($_POST["id"]) . $toadd);
}

// in case user can update the ticket but not read it, redirect to the ticket list
Session::addMessageAfterRedirect(
__s('You have been redirected because you no longer have access to this ticket'),
true,
Expand Down Expand Up @@ -181,20 +186,6 @@
sprintf(__('%s updates an item'), $_SESSION["glpiname"])
);

Html::redirect(Ticket::getFormURLWithID($_POST["id"]));
} elseif (isset($_POST['ola_delete'])) {
$track->check($_POST["id"], UPDATE);

$track->deleteLevelAgreement("OLA", $_POST["id"], $_POST['type'], $_POST['delete_date']);
Event::log(
$_POST["id"],
"ticket",
4,
"tracking",
//TRANS: %s is the user login
sprintf(__('%s updates an item'), $_SESSION["glpiname"])
);

Html::redirect(Ticket::getFormURLWithID($_POST["id"]));
} elseif (isset($_POST['addme_as_actor'])) {
$id = (int) $_POST['id'];
Expand Down Expand Up @@ -234,6 +225,7 @@
Html::back();
}

// show form when editing a ticket
$id = (int) $_GET['id'];
if ($id > 0) {
$available_options = ['_openfollowup'];
Expand Down
7 changes: 2 additions & 5 deletions inc/relation.constant.php
Original file line number Diff line number Diff line change
Expand Up @@ -752,6 +752,7 @@
'glpi_tickettasks' => 'groups_id_tech',
'glpi_users' => 'groups_id',
'glpi_itilvalidationtemplates_targets' => 'groups_id',
'glpi_olas' => 'groups_id',
],

'glpi_holidays' => [
Expand Down Expand Up @@ -1036,15 +1037,11 @@
'_glpi_olalevelactions' => 'olalevels_id',
'_glpi_olalevelcriterias' => 'olalevels_id',
'_glpi_olalevels_tickets' => 'olalevels_id',
'glpi_tickets' => 'olalevels_id_ttr',
],

'glpi_olas' => [
'glpi_olalevels' => 'olas_id',
'glpi_tickets' => [
'olas_id_ttr',
'olas_id_tto',
],
'_glpi_items_olas' => 'olas_id',
],

'glpi_operatingsystemarchitectures' => [
Expand Down
2 changes: 1 addition & 1 deletion install/empty_data.php
Original file line number Diff line number Diff line change
Expand Up @@ -786,7 +786,7 @@ public function getEmptyData(): array
'hourmax' => 24,
], [
'id' => 32,
'itemtype' => 'OlaLevel_Ticket',
'itemtype' => 'Item_Ola',
'name' => 'olaticket',
'frequency' => 5 * MINUTE_TIMESTAMP,
'param' => null,
Expand Down
Loading
Loading