Skip to content

Commit 42b5243

Browse files
committed
Reverted unnecessary changes
1 parent 3f4b6fb commit 42b5243

9 files changed

+97
-31
lines changed

composer.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
},
66
"require-dev": {
77
"friendsofphp/php-cs-fixer": "^3.75",
8+
"friendsoftwig/twigcs": "^6.1",
89
"glpi-project/tools": "^0.7.4",
910
"php-parallel-lint/php-parallel-lint": "^1.4",
1011
"phpstan/extension-installer": "^1.4",
@@ -20,5 +21,10 @@
2021
"allow-plugins": {
2122
"phpstan/extension-installer": true
2223
}
24+
},
25+
"autoload-dev": {
26+
"psr-4": {
27+
"Glpi\\Tools\\": "../../tools/src/"
28+
}
2329
}
2430
}

composer.lock

Lines changed: 68 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

inc/containerdisplaycondition.class.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -406,11 +406,9 @@ public function computeDisplayContainer($item, $container_id)
406406

407407
if (count($found_dc)) {
408408
$display = true;
409-
410409
foreach ($found_dc as $data) {
411410
$displayCondition->getFromDB($data['id']);
412411
$result = $displayCondition->checkCondition($item);
413-
414412
if (!$result) {
415413
return $result;
416414
}
@@ -427,7 +425,6 @@ public function checkCondition($item)
427425
{
428426
$value = $this->fields['value'];
429427
$condition = $this->fields['condition'];
430-
431428
$searchOption = Search::getOptions(get_class($item))[$this->fields['search_option']];
432429

433430
$fields = array_merge($item->fields, $item->input);

inc/field.class.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -893,7 +893,6 @@ public static function showForTab($params)
893893
if ($item->fields['itilcategories_id'] == "") {
894894
$item->fields['itilcategories_id'] = $params['options']['itilcategories_id'];
895895
}
896-
897896
$functions = array_column(debug_backtrace(), 'function');
898897
$subtype = isset($_SESSION['glpi_tabs'][strtolower($item::getType())]) ? $_SESSION['glpi_tabs'][strtolower($item::getType())] : '';
899898
$type = substr($subtype, -strlen('$main')) === '$main'
@@ -974,7 +973,6 @@ public static function showForTab($params)
974973
echo "<div id='{$html_id}'>";
975974
}
976975
$display_condition = new PluginFieldsContainerDisplayCondition();
977-
978976
if ($display_condition->computeDisplayContainer($item, $c_id)) {
979977
self::showDomContainer(
980978
$c_id,
@@ -984,7 +982,6 @@ public static function showForTab($params)
984982
$field_options ?? [],
985983
);
986984
}
987-
988985
if (strpos($current_url, 'helpdesk.public.php') !== false || strpos($current_url, 'tracking.injector.php') !== false) {
989986
echo '</div>';
990987
}
@@ -993,8 +990,6 @@ public static function showForTab($params)
993990
//JS to trigger any change and check if container need to be display or not
994991
$ajax_url = Plugin::getWebDir('fields') . '/ajax/container.php';
995992
$items_id = !$item->isNewItem() ? $item->getID() : 0;
996-
997-
998993
echo Html::scriptBlock(
999994
<<<JAVASCRIPT
1000995
function refreshContainer() {

templates/container_display_conditions.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
<div id="container{{ rand }}" class="asset">
3333
<div class="flash-messages">
3434
<div class="alert alert-info">
35-
{{ __('The engine is used for hide block when main object meets condition')}}
35+
{{ __('The engine is used for hide block when main object meets condition') }}
3636
</div>
3737
</div>
3838
<div class="d-flex align-items-start mb-3">

templates/fields.html.twig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,11 +161,11 @@
161161
]) %}
162162

163163
{# fake label for DOM disposition #}
164-
<label class="col-form-label col-xxl-4 text-xxl-end" for="dropdown_items_id_testfield{{rand}}">
164+
<label class="col-form-label col-xxl-4 text-xxl-end" for="dropdown_items_id_testfield{{ rand }}">
165165
</label>
166166

167167
<div class="col-xxl-8 field-container">
168-
<span id='results_items_id{{rand}}' class='col-lg-14'>
168+
<span id='results_items_id{{ rand }}' class='col-lg-14'>
169169
{% if value.itemtype != '' %}
170170
{{ macros.dropdownField(value.itemtype, items_id_prefix ~ name, value.items_id, ' ', field_options|merge({
171171
'entity': value.itemtype == 'User' ? -1 : item.getEntityID(),

templates/forms/container_display_condition.html.twig

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,30 +39,28 @@
3939
{{ fields.dropdownArrayField('itemtype', container_display_condition.fields['itemtype']|default(null), container_itemtypes, __('Item type'), {'rand': rand, 'display_emptychoice': true}) }}
4040
{% do call('Ajax::updateItemOnSelectEvent',
4141
[
42-
'dropdown_itemtype'~ rand,
42+
'dropdown_itemtype' ~ rand,
4343
'results_fields',
4444
get_plugin_web_dir('fields') ~ '/ajax/container_display_condition.php',
4545
{
4646
'itemtype': '__VALUE__',
4747
'action' : 'get_itemtype_so',
4848
}
49-
])
50-
%}
49+
]) %}
5150
<div id='results_fields' class='form-field row col-12 col-sm-6 mb-2'>
5251
{% if not container_display_condition.isNewItem() %}
5352
{{ fields.dropdownArrayField('search_option', container_display_condition.fields['search_option']|default(null), search_options, '', {'no_label': true, 'rand': rand, 'display_emptychoice': false}) }}
5453
{% do call('Ajax::updateItemOnSelectEvent',
5554
[
56-
'dropdown_search_option'~ rand,
55+
'dropdown_search_option' ~ rand,
5756
'results_condition',
5857
get_plugin_web_dir('fields') ~ '/ajax/container_display_condition.php',
5958
{
6059
'search_option_id' : '__VALUE__',
6160
'itemtype' : container_display_condition.fields['itemtype'],
6261
'action' : 'get_condition_switch_so'
6362
}
64-
])
65-
%}
63+
]) %}
6664
{% endif %}
6765
</div>
6866

templates/status_overrides.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
<span class='ms-2'>
3737
{{ __("Here you can redefine the following options :") }}
3838
<ul>
39-
<li><i> {{__("Mandatory") }} </i></li>
39+
<li><i>{{__("Mandatory") }} </i></li>
4040
<li><i>{{ __("Read-only") }} </i></li>
4141
</ul>
4242
{{ __("for each field, depending on the states of the element attached to the container.") }}

twig_cs.dist.php

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

0 commit comments

Comments
 (0)