Skip to content

Commit 711842b

Browse files
RomainLvrRom1-BstonebuzztrasherMyvTsv
authored
GLPI 11 compatibility (#969)
* GLPI 11 compatibility * Apply suggestions * Fix phpstan * Fix massive actions error * Fix direct queries * Update inc/containerdisplaycondition.class.php Co-authored-by: Romain B. <[email protected]> * Update front/container.form.php Co-authored-by: Romain B. <[email protected]> * Update front/container.form.php Co-authored-by: Romain B. <[email protected]> * Update ajax/container.php Co-authored-by: Romain B. <[email protected]> * Update ajax/container.php Co-authored-by: Romain B. <[email protected]> * Update ajax/container.php Co-authored-by: Romain B. <[email protected]> * Update ajax/container.php Co-authored-by: Romain B. <[email protected]> * beta2 * typo * fix phpstan * fix path * Fix item link for container list * Fix reference * Migration genericobject fields to core (#996) * genericobject compatibility * review * glpi_plugin_genericobject_types * Check GenericObject version * Check glpi_plugin_genericobject_types table * fix escape * fix check version * fix(customasset): handle escaped backslashes in json decode itemtypes * Apply suggestion from @Rom1-B --------- Co-authored-by: MyuTsu <[email protected]> * beta3 * fix CS * release GLPI 11.0 --------- Co-authored-by: Romain B. <[email protected]> Co-authored-by: Rom1-B <[email protected]> Co-authored-by: Stanislas Kita <[email protected]> Co-authored-by: Johan Cwiklinski <[email protected]> Co-authored-by: MyuTsu <[email protected]>
1 parent c4c6d0e commit 711842b

32 files changed

+649
-476
lines changed

.github/workflows/continuous-integration.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
name: "Generate CI matrix"
2121
uses: "glpi-project/plugin-ci-workflows/.github/workflows/generate-ci-matrix.yml@v1"
2222
with:
23-
glpi-version: "10.0.x"
23+
glpi-version: "11.0.x"
2424
ci:
2525
name: "GLPI ${{ matrix.glpi-version }} - php:${{ matrix.php-version }} - ${{ matrix.db-image }}"
2626
needs: "generate-ci-matrix"

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](http://keepachangelog.com/)
66
and this project adheres to [Semantic Versioning](http://semver.org/).
77

8-
## [UNRELEASED]
8+
## [1.22.0] - 2025-09-30
9+
10+
### Added
11+
12+
- GLPI 11 compatibility
913

1014
### Fixed
1115

ajax/container.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,12 @@
3131
include('../../../inc/includes.php');
3232
Session::checkLoginUser();
3333

34-
use Glpi\Http\Response;
3534

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

3837
$right = PluginFieldsProfile::getRightOnContainer($_SESSION['glpiactiveprofile']['id'], $_GET['id']);
3938
if ($right < READ) {
40-
Response::sendError(403, 'Forbidden');
41-
return;
39+
throw new \Glpi\Exception\Http\AccessDeniedHttpException();
4240
}
4341

4442
$containers_id = $_GET['id'];
@@ -48,9 +46,10 @@
4846
$subtype = $_GET['subtype'];
4947
$input = $_GET['input'];
5048

51-
$item = new $itemtype();
49+
$dbu = new DbUtils();
50+
$item = $dbu->getItemForItemtype($itemtype);
5251
if ($items_id > 0 && !$item->getFromDB($items_id)) {
53-
Response::sendError(404, 'Not Found');
52+
throw new \Glpi\Exception\Http\NotFoundHttpException();
5453
}
5554
$item->input = $input;
5655

@@ -66,5 +65,5 @@
6665
echo '';
6766
}
6867
} else {
69-
Response::sendError(404, 'Not Found');
68+
throw new \Glpi\Exception\Http\NotFoundHttpException();
7069
}

ajax/container_display_condition.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,5 @@
5555
}
5656
}
5757
} else {
58-
http_response_code(400);
59-
die();
58+
throw new \RuntimeException('Invalid request', 400);
6059
}

ajax/reorder.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
|| !array_key_exists('new_order', $_POST)
3838
) {
3939
// Missing input
40-
exit();
40+
throw new \RuntimeException('Missing input', 400);
4141
}
4242

4343
$table = PluginFieldsField::getTable();
@@ -62,7 +62,7 @@
6262

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

6868
$field_id = $field_iterator->current()['id'];
@@ -72,7 +72,7 @@
7272
$DB->update(
7373
$table,
7474
[
75-
'ranking' => new \QueryExpression($DB->quoteName('ranking') . ' - 1'),
75+
'ranking' => new \Glpi\DBAL\QueryExpression($DB->quoteName('ranking') . ' - 1'),
7676
],
7777
[
7878
'plugin_fields_containers_id' => $container_id,
@@ -84,7 +84,7 @@
8484
$DB->update(
8585
$table,
8686
[
87-
'ranking' => new \QueryExpression($DB->quoteName('ranking') . ' + 1'),
87+
'ranking' => new \Glpi\DBAL\QueryExpression($DB->quoteName('ranking') . ' + 1'),
8888
],
8989
[
9090
'plugin_fields_containers_id' => $container_id,

ajax/status_override.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,5 @@
4343
$status_override->showForm($_GET['id'], $_GET);
4444
}
4545
} else {
46-
http_response_code(400);
47-
die();
46+
throw new \RuntimeException('Invalid request', 400);
4847
}

ajax/viewtranslations.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
Session::checkLoginUser();
4040

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

4545
$translation = new PluginFieldsLabelTranslation();
@@ -53,5 +53,3 @@
5353
} else {
5454
echo __('Access denied');
5555
}
56-
57-
Html::ajaxFooter();

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"require": {
3-
"php": ">=7.4",
4-
"symfony/yaml": "^5.4"
3+
"php": ">=8.2",
4+
"symfony/yaml": "^7.3"
55
},
66
"require-dev": {
77
"friendsofphp/php-cs-fixer": "^3.86",
@@ -15,7 +15,7 @@
1515
"config": {
1616
"optimize-autoloader": true,
1717
"platform": {
18-
"php": "7.4.0"
18+
"php": "8.2.99"
1919
},
2020
"sort-packages": true,
2121
"allow-plugins": {

0 commit comments

Comments
 (0)