Skip to content

Commit dd156dc

Browse files
committed
Merge branch 'support/2.13.0' into support/2.14.0
2 parents 62a2480 + 3cad185 commit dd156dc

8 files changed

Lines changed: 449 additions & 3 deletions

ajax/showfields.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@
5858
try {
5959
$visibility = PluginFormcreatorFields::updateVisibility($_POST);
6060
} catch (Exception $e) {
61+
echo json_encode([
62+
'error' => $e->getMessage(),
63+
]);
6164
http_response_code(500);
6265
exit();
6366
}

hook.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -807,11 +807,18 @@ function plugin_formcreator_hook_update_profile(CommonDBTM $item) {
807807
}
808808
$dashboardRight = new DashboardRight();
809809
if ($item->fields['interface'] == 'helpdesk') {
810-
$dashboardRight->add([
810+
$dashboardRight->getFromDBByCrit([
811811
'dashboards_dashboards_id' => $dashboard->fields['id'],
812812
'itemtype' => Profile::getType(),
813813
'items_id' => $item->getID(),
814814
]);
815+
if ($dashboardRight->isNewItem()) {
816+
$dashboardRight->add([
817+
'dashboards_dashboards_id' => $dashboard->fields['id'],
818+
'itemtype' => Profile::getType(),
819+
'items_id' => $item->getID(),
820+
]);
821+
}
815822
} else {
816823
$dashboardRight->delete([
817824
'dashboards_dashboards_id' => $dashboard->fields['id'],

inc/abstractitiltarget.class.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,7 @@ protected function setTargetUrgency($data, $formanswer) {
443443
}
444444
if (!is_null($urgency) && $urgency != 0) {
445445
$data['urgency'] = $urgency;
446+
$data['priority'] = CommonITILObject::computePriority($data['urgency'], $data['impact']);;
446447
}
447448

448449
return $data;

inc/fields.class.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,8 @@ public static function isVisible(PluginFormcreatorConditionnableInterface $item,
140140
/** @var CommonDBTM $item */
141141
$itemtype = get_class($item);
142142
$itemId = $item->getID();
143-
if (!isset(self::$visibility[$itemtype][$itemId])) {
143+
144+
if (!isset(self::$visibility[$itemtype]) || !array_key_exists($itemId, self::$visibility[$itemtype])) {
144145
self::$visibility[$itemtype][$itemId] = null;
145146
} else if (self::$visibility[$itemtype][$itemId] !== null) {
146147
return self::$visibility[$itemtype][$itemId];

inc/notificationtargetformanswer.class.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,13 @@ public function addDataForTemplate($event, $options = []) {
7070
$this->data['##formcreator.validation_comment##'] = $this->obj->fields['comment'];
7171
$this->data['##formcreator.validation_link##'] = $link;
7272
$this->data['##formcreator.request_id##'] = $this->obj->fields['id'];
73+
74+
$this->getTags();
75+
foreach ($this->tag_descriptions[NotificationTarget::TAG_LANGUAGE] as $tag => $values) {
76+
if (!isset($this->data[$tag])) {
77+
$this->data[$tag] = $values['label'];
78+
}
79+
}
7380
}
7481

7582
public function getTags() {

install/install.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@ class PluginFormcreatorInstall {
8080
'2.13' => '2.13.1',
8181
'2.13.1' => '2.13.3',
8282
'2.13.3' => '2.13.4',
83-
'2.13.4' => '2.14',
83+
'2.13.4' => '2.13.5',
84+
'2.13.5' => '2.14',
8485
];
8586

8687
protected bool $resyncIssues = false;

install/mysql/plugin_formcreator_2.13.5_empty.sql

Lines changed: 352 additions & 0 deletions
Large diffs are not rendered by default.

install/upgrade_to_2.13.5.php

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
<?php
2+
/**
3+
* ---------------------------------------------------------------------
4+
* Formcreator is a plugin which allows creation of custom forms of
5+
* easy access.
6+
* ---------------------------------------------------------------------
7+
* LICENSE
8+
*
9+
* This file is part of Formcreator.
10+
*
11+
* Formcreator is free software; you can redistribute it and/or modify
12+
* it under the terms of the GNU General Public License as published by
13+
* the Free Software Foundation; either version 2 of the License, or
14+
* (at your option) any later version.
15+
*
16+
* Formcreator is distributed in the hope that it will be useful,
17+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
18+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19+
* GNU General Public License for more details.
20+
*
21+
* You should have received a copy of the GNU General Public License
22+
* along with Formcreator. If not, see <http://www.gnu.org/licenses/>.
23+
* ---------------------------------------------------------------------
24+
* @copyright Copyright © 2011 - 2021 Teclib'
25+
* @license http://www.gnu.org/licenses/gpl.txt GPLv3+
26+
* @link https://github.com/pluginsGLPI/formcreator/
27+
* @link https://pluginsglpi.github.io/formcreator/
28+
* @link http://plugins.glpi-project.org/#/plugin/formcreator
29+
* ---------------------------------------------------------------------
30+
*/
31+
32+
use Glpi\Toolbox\Sanitizer;
33+
34+
class PluginFormcreatorUpgradeTo2_13_5 {
35+
/** @var Migration */
36+
protected $migration;
37+
38+
public function isResyncIssuesRequired() {
39+
return false;
40+
}
41+
42+
/**
43+
* @param Migration $migration
44+
*/
45+
public function upgrade(Migration $migration) {
46+
$this->migration = $migration;
47+
$this->fixOldRadiosEncoding();
48+
}
49+
50+
public function fixOldRadiosEncoding() {
51+
global $DB;
52+
53+
$table = 'glpi_plugin_formcreator_questions';
54+
$questions = $DB->request([
55+
'SELECT' => ['id', 'values'],
56+
'FROM' => $table,
57+
'WHERE' => ['fieldtype' => 'radios']
58+
]);
59+
60+
foreach ($questions as $row) {
61+
$values = Sanitizer::unsanitize($row['values']);
62+
$values = Sanitizer::sanitize($values);
63+
$DB->update(
64+
$table,
65+
[
66+
'values' => $values
67+
],
68+
[
69+
'id' => $row['id']
70+
]
71+
);
72+
}
73+
}
74+
}

0 commit comments

Comments
 (0)