Skip to content

Commit 5d48cba

Browse files
committed
Merge remote-tracking branch 'origin/support/2.13.0' into support/2.14.0
2 parents 9cfeea4 + 52a9fc2 commit 5d48cba

9 files changed

Lines changed: 78 additions & 13 deletions

inc/abstracttarget.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ protected function prepareTemplate($template, PluginFormcreatorFormAnswer $formA
221221
* @param PluginFormcreatorFormanswer $formanswer the source formanswer
222222
* @return array
223223
*/
224-
protected function appendFieldsData(array$input, PluginFormcreatorFormanswer $formanswer): array {
224+
protected function appendFieldsData(array $input, PluginFormcreatorFormanswer $formanswer): array {
225225
global $DB;
226226

227227
//get all PluginFormcreatorAnswer

inc/common.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -841,7 +841,7 @@ public static function showMiniDashboard(): void {
841841

842842
if (PluginFormcreatorEntityconfig::getUsedConfig('is_dashboard_visible', Session::getActiveEntity()) == PluginFormcreatorEntityconfig::CONFIG_DASHBOARD_VISIBLE) {
843843
if (version_compare(GLPI_VERSION, '10.0.3') > 0) {
844-
$dashboard = new Glpi\Dashboard\Grid('plugin_formcreator_issue_counters', 33, 1, 'mini_core');
844+
$dashboard = new Glpi\Dashboard\Grid('plugin_formcreator_issue_counters', 33, 2, 'mini_core');
845845
} else {
846846
$dashboard = new Glpi\Dashboard\Grid('plugin_formcreator_issue_counters', 33, 0, 'mini_core');
847847
}

inc/field/textfield.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public function getValueForDesign(): string {
109109
}
110110

111111
public function getValueForTargetText($domain, $richText): ?string {
112-
return Sanitizer::encodeHtmlSpecialChars($this->value);
112+
return Sanitizer::encodeHtmlSpecialChars($this->value ?? '');
113113
}
114114

115115
public function moveUploads() {

inc/issue.class.php

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -509,13 +509,25 @@ public function rawSearchOptions() {
509509
$hide_technician = false;
510510
$hide_technician_group = false;
511511
if (!Session::isCron()) {
512-
$user = new User();
513-
if (empty($user->getAnonymizedName(Session::getActiveEntity()))) {
514-
$hide_technician = true;
515-
}
516-
$group = new Group();
517-
if (empty($group->getAnonymizedName(Session::getActiveEntity()))) {
518-
$hide_technician_group = true;
512+
$anonymisation = Entity::getUsedConfig(
513+
'anonymize_support_agents',
514+
Session::getActiveEntity()
515+
);
516+
switch ($anonymisation) {
517+
case Entity::ANONYMIZE_USE_GENERIC:
518+
case Entity::ANONYMIZE_USE_NICKNAME:
519+
$hide_technician = true;
520+
$hide_technician_group = true;
521+
break;
522+
523+
case Entity::ANONYMIZE_USE_GENERIC_USER:
524+
case Entity::ANONYMIZE_USE_NICKNAME_USER:
525+
$hide_technician = true;
526+
break;
527+
528+
case Entity::ANONYMIZE_USE_GENERIC_GROUP:
529+
$hide_technician_group = true;
530+
break;
519531
}
520532
}
521533

inc/question.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class PluginFormcreatorQuestion extends CommonDBChild implements
5555
public $taborientation = 'horizontal';
5656

5757
/** @var PluginFormcreatorFieldInterface|null $field a field describing the question denpending on its field type */
58-
private ?PluginFormcreatorFieldInterface $field = null;
58+
public ?PluginFormcreatorFieldInterface $field = null;
5959

6060
private $skipChecks = false;
6161

inc/targetchange.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,7 @@ public function save(PluginFormcreatorFormAnswer $formanswer): ?CommonDBTM {
689689

690690
$data = $this->prepareUploadedFiles($data, $formanswer);
691691

692-
$this->appendFieldsData($formanswer, $data);
692+
$data = $this->appendFieldsData($data, $formanswer);
693693

694694
// Cleanup actors array
695695
$data = $this->cleanActors($data);

inc/targetproblem.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ public function save(PluginFormcreatorFormAnswer $formanswer): ?CommonDBTM {
209209

210210
$data = $this->prepareUploadedFiles($data, $formanswer);
211211

212-
$this->appendFieldsData($formanswer, $data);
212+
$data = $this->appendFieldsData($data, $formanswer);
213213

214214
// Cleanup actors array
215215
$data = $this->cleanActors($data);

install/upgrade_to_2.13.7.php

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
* ---------------------------------------------------------------------
3030
*/
3131

32+
use Glpi\Dashboard\Dashboard;
33+
use Glpi\Dashboard\Item;
3234
use Glpi\Toolbox\Sanitizer;
3335

3436
class PluginFormcreatorUpgradeTo2_13_7 {
@@ -45,6 +47,7 @@ public function isResyncIssuesRequired() {
4547
public function upgrade(Migration $migration) {
4648
$this->migration = $migration;
4749
$this->fixEncodingInQuestions();
50+
$this->resizeWidgets();
4851
}
4952

5053
/**
@@ -83,4 +86,38 @@ public function fixEncodingInQuestions() {
8386
);
8487
}
8588
}
89+
90+
/**
91+
* Resize widgets of the `plugin_formcreator_issue_counters` dashboard to match
92+
* the mini_tickets core dashboard style
93+
*
94+
* @return void
95+
*/
96+
public function resizeWidgets() {
97+
// Get container
98+
$dashboard = new Dashboard();
99+
$found = $dashboard->getFromDB("plugin_formcreator_issue_counters");
100+
101+
if (!$found) {
102+
// Unable to fetch dashboard
103+
return;
104+
};
105+
106+
$di = new Item();
107+
$cards = $di->find(['dashboards_dashboards_id' => $dashboard->fields['id']]);
108+
$x = 0;
109+
110+
foreach ($cards as $card) {
111+
$di = new Item();
112+
$di->update([
113+
'id' => $card['id'],
114+
'width' => 4,
115+
'height' => 2,
116+
'x' => $x,
117+
'y' => 0,
118+
]);
119+
120+
$x +=4;
121+
}
122+
}
86123
}

templates/field/fieldsfield.html.twig

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,4 +70,20 @@
7070
input_class: 'col-xxl-8',
7171
}) }}
7272
{% endif %}
73+
74+
{{ fields.nullField({
75+
label_class: 'col-xxl-4',
76+
input_class: 'col-xxl-8',
77+
}) }}
78+
79+
{{ fields.dropdownYesNo(
80+
'required',
81+
item.field.getField().fields['mandatory'],
82+
__('Required', 'formcreator'), {
83+
label_class: 'col-xxl-4',
84+
input_class: 'col-xxl-8',
85+
disabled: true,
86+
}
87+
) }}
88+
7389
{% endblock %}

0 commit comments

Comments
 (0)