Skip to content

Commit a824aea

Browse files
LainowstonebuzzRom1-B
authored
Feature/glpi 11.0 (#169)
* Fix glpi 11 compatibility * Twig update * Update in twig * Update * Update * Pass in twig ticket form * Update credit consumption for ticket in twig * Fix error * Fix ci * Fix quantity update * Fix display of ticket config * Fix date display * Fix php stan * Fix header * Fix issues * Fix form on task & solution * Fix cs * bump setup * Fix ticket config display * Add suggestions * beta4 * psalm * beta5 * up composer * fix * release GLPI 11.0 --------- Co-authored-by: Stanislas <skita@teclib.com> Co-authored-by: Rom1-B <rom1.biot@gmail.com>
1 parent 4a5ecdc commit a824aea

36 files changed

+1612
-1672
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"

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ dist/
22
node_modules/
33
vendor/
44
.gh_token
5+
.php-cs-fixer.cache

.php-cs-fixer.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
use PhpCsFixer\Config;
4+
use PhpCsFixer\Finder;
5+
6+
$finder = Finder::create()
7+
->in(__DIR__)
8+
->name('*.php')
9+
->ignoreVCSIgnored(true);
10+
11+
$config = new Config();
12+
13+
$rules = [
14+
'@PER-CS2.0' => true,
15+
'trailing_comma_in_multiline' => ['elements' => ['arguments', 'array_destructuring', 'arrays']], // For PHP 7.4 compatibility
16+
];
17+
18+
return $config
19+
->setRules($rules)
20+
->setFinder($finder)
21+
->setUsingCache(false);

.phpcs.xml

Lines changed: 0 additions & 19 deletions
This file was deleted.

.twig_cs.dist.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use FriendsOfTwig\Twigcs\Finder\TemplateFinder;
6+
use FriendsOfTwig\Twigcs\Config\Config;
7+
use Glpi\Tools\GlpiTwigRuleset;
8+
9+
$finder = TemplateFinder::create()
10+
->in(__DIR__ . '/templates')
11+
->name('*.html.twig')
12+
->ignoreVCSIgnored(true);
13+
14+
return Config::create()
15+
->setFinder($finder)
16+
->setRuleSet(GlpiTwigRuleset::class)
17+
;

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ 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+
## [1.15.0] - 2025-09-29
9+
10+
### Added
11+
12+
- GLPI 11 compatibility
13+
814
## [1.14.1] - 2025-06-25
915

1016
### Fixed

ajax/dropdownQuantity.php

Lines changed: 2 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -29,53 +29,13 @@
2929
* -------------------------------------------------------------------------
3030
*/
3131

32-
include("../../../inc/includes.php");
3332
header("Content-Type: text/html; charset=UTF-8");
3433
Html::header_nocache();
3534

36-
Session::checkLoginUser();
37-
3835
/** @var DBmysql $DB */
3936
global $DB;
4037

4138
if (isset($_POST["entity"])) {
42-
$entity_query = [
43-
'SELECT' => ['overconsumption_allowed', 'quantity'],
44-
'FROM' => 'glpi_plugin_credit_entities',
45-
'WHERE' => [
46-
'id' => $_POST['entity'],
47-
],
48-
];
49-
$entity_result = $DB->request($entity_query)->current();
50-
51-
$overconsumption_allowed = $entity_result['overconsumption_allowed'];
52-
$quantity_sold = (int)$entity_result['quantity'];
53-
54-
if (0 !== $quantity_sold && !$overconsumption_allowed) {
55-
$ticket_query = [
56-
'SELECT' => [
57-
'SUM' => 'consumed AS consumed_total',
58-
],
59-
'FROM' => 'glpi_plugin_credit_tickets',
60-
'WHERE' => [
61-
'plugin_credit_entities_id' => $_POST['entity'],
62-
],
63-
];
64-
$ticket_result = $DB->request($ticket_query)->current();
65-
66-
$consumed = (int)$ticket_result['consumed_total'];
67-
$max = max(0, $quantity_sold - $consumed);
68-
69-
Dropdown::showNumber("plugin_credit_quantity", ['value' => '',
70-
'min' => 0,
71-
'max' => $max,
72-
'step' => 1,
73-
]);
74-
} else {
75-
Dropdown::showNumber("plugin_credit_quantity", ['value' => '',
76-
'min' => 0,
77-
'max' => 1000000,
78-
'step' => 1,
79-
]);
80-
}
39+
$max = PluginCreditEntity::getMaximumConsumptionForCredit($_POST["entity"]);
40+
echo $max;
8141
}

composer.json

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,20 @@
11
{
22
"require": {
3-
"php": ">=7.4"
3+
"php": ">=8.2"
44
},
55
"require-dev": {
6-
"glpi-project/tools": "^0.8.0",
7-
"php-parallel-lint/php-parallel-lint": "^1.4",
8-
"phpstan/extension-installer": "^1.4",
9-
"phpstan/phpstan": "^2.1",
10-
"phpstan/phpstan-deprecation-rules": "^2.0",
11-
"squizlabs/php_codesniffer": "^3.13"
6+
"glpi-project/tools": "^0.8"
127
},
138
"config": {
149
"optimize-autoloader": true,
1510
"platform": {
16-
"php": "7.4.0"
11+
"php": "8.2.99"
1712
},
18-
"sort-packages": true,
19-
"allow-plugins": {
20-
"phpstan/extension-installer": true
13+
"sort-packages": true
14+
},
15+
"autoload-dev": {
16+
"psr-4": {
17+
"Glpi\\Tools\\": "../../tools/src/"
2118
}
2219
}
2320
}

0 commit comments

Comments
 (0)