Skip to content

GLPI 11 compatibility #969

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
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
2 changes: 1 addition & 1 deletion .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
name: "Generate CI matrix"
uses: "glpi-project/plugin-ci-workflows/.github/workflows/generate-ci-matrix.yml@v1"
with:
glpi-version: "10.0.x"
glpi-version: "11.0.x"
ci:
name: "GLPI ${{ matrix.glpi-version }} - php:${{ matrix.php-version }} - ${{ matrix.db-image }}"
needs: "generate-ci-matrix"
Expand Down
12 changes: 6 additions & 6 deletions ajax/container.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,13 @@
include('../../../inc/includes.php');
Session::checkLoginUser();

use Glpi\Http\Response;
use Glpi\Exception\Http\HttpException;

if (isset($_GET['action']) && $_GET['action'] === 'get_fields_html') {

$right = PluginFieldsProfile::getRightOnContainer($_SESSION['glpiactiveprofile']['id'], $_GET['id']);
if ($right < READ) {
Response::sendError(403, 'Forbidden');
return;
throw new HttpException(403, 'Forbidden');
}

$containers_id = $_GET['id'];
Expand All @@ -48,9 +47,10 @@
$subtype = $_GET['subtype'];
$input = $_GET['input'];

$item = new $itemtype();
$dbu = new DbUtils();
$item = $dbu->getItemForItemtype($itemtype);
if ($items_id > 0 && !$item->getFromDB($items_id)) {
Response::sendError(404, 'Not Found');
throw new HttpException(404, 'Not Found');
}
$item->input = $input;

Expand All @@ -66,5 +66,5 @@
echo '';
}
} else {
Response::sendError(404, 'Not Found');
throw new HttpException(404, 'Not Found');
}
3 changes: 1 addition & 2 deletions ajax/container_display_condition.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,5 @@
}
}
} else {
http_response_code(400);
die();
throw new \RuntimeException('Invalid request', 400);
}
8 changes: 4 additions & 4 deletions ajax/reorder.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
|| !array_key_exists('new_order', $_POST)
) {
// Missing input
exit();
throw new \RuntimeException('Missing input', 400);
}

$table = PluginFieldsField::getTable();
Expand All @@ -62,7 +62,7 @@

if (0 === $field_iterator->count()) {
// Unknown field
exit();
throw new \RuntimeException('Unknown field', 404);
}

$field_id = $field_iterator->current()['id'];
Expand All @@ -72,7 +72,7 @@
$DB->update(
$table,
[
'ranking' => new \QueryExpression($DB->quoteName('ranking') . ' - 1'),
'ranking' => new \Glpi\DBAL\QueryExpression($DB->quoteName('ranking') . ' - 1'),
],
[
'plugin_fields_containers_id' => $container_id,
Expand All @@ -84,7 +84,7 @@
$DB->update(
$table,
[
'ranking' => new \QueryExpression($DB->quoteName('ranking') . ' + 1'),
'ranking' => new \Glpi\DBAL\QueryExpression($DB->quoteName('ranking') . ' + 1'),
],
[
'plugin_fields_containers_id' => $container_id,
Expand Down
3 changes: 1 addition & 2 deletions ajax/status_override.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,5 @@
$status_override->showForm($_GET['id'], $_GET);
}
} else {
http_response_code(400);
die();
throw new \RuntimeException('Invalid request', 400);
}
4 changes: 1 addition & 3 deletions ajax/viewtranslations.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
Session::checkLoginUser();

if (!isset($_POST['itemtype']) || !isset($_POST['items_id']) || !isset($_POST['id'])) {
exit();
throw new \RuntimeException('Missing required parameters', 400);
}

$translation = new PluginFieldsLabelTranslation();
Expand All @@ -53,5 +53,3 @@
} else {
echo __('Access denied');
}

Html::ajaxFooter();
7 changes: 4 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
{
"require": {
"php": ">=7.4",
"symfony/yaml": "^5.4"
"php": ">=8.2",
"symfony/yaml": "^7.3"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.75",
"friendsoftwig/twigcs": "^6.1",
"glpi-project/phpstan-glpi": "^1.0",
"glpi-project/tools": "^0.7.5",
"php-parallel-lint/php-parallel-lint": "^1.4",
"phpstan/extension-installer": "^1.4",
Expand All @@ -15,7 +16,7 @@
"config": {
"optimize-autoloader": true,
"platform": {
"php": "7.4.0"
"php": "8.2.99"
},
"sort-packages": true,
"allow-plugins": {
Expand Down
Loading