Skip to content

Commit 91cc6ce

Browse files
committed
feat: handle rich text mode for GLPI 9.4
Signed-off-by: btry <tbugier@teclib.com>
1 parent 60856bf commit 91cc6ce

File tree

5 files changed

+6
-6
lines changed

5 files changed

+6
-6
lines changed

inc/fields/checkboxesfield.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ public function prepareQuestionInputForTarget($input) {
203203
}
204204
}
205205

206-
if ($CFG_GLPI['use_rich_text']) {
206+
if (version_compare(PluginFormcreatorCommon::getGlpiVersion(), 9.4) >= 0 || $CFG_GLPI['use_rich_text']) {
207207
$value = '<br />' . implode('<br />', $value);
208208
} else {
209209
$value = '\r\n' . implode('\r\n', $value);

inc/fields/multiselectfield.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ public function prepareQuestionInputForTarget($input) {
138138
$value[] = addslashes($input);
139139
}
140140
}
141-
if ($CFG_GLPI['use_rich_text']) {
141+
if (version_compare(PluginFormcreatorCommon::getGlpiVersion(), 9.4) >= 0 || $CFG_GLPI['use_rich_text']) {
142142
$value = '<br />' . implode('<br />', $value);
143143
} else {
144144
$value = '\r\n' . implode('\r\n', $value);

inc/issue.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ public function display($options = []) {
152152
if (!in_array($itemtype, ['Ticket', 'PluginFormcreatorForm_Answer'])) {
153153
html::displayRightError();
154154
}
155-
if ($CFG_GLPI['use_rich_text']) {
155+
if (version_compare(PluginFormcreatorCommon::getGlpiVersion(), 9.4) >= 0 || $CFG_GLPI['use_rich_text']) {
156156
Html::requireJs('tinymce');
157157
}
158158
if (plugin_formcreator_replaceHelpdesk() == PluginFormcreatorEntityconfig::CONFIG_SIMPLIFIED_SERVICE_CATALOG) {

inc/targetbase.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -810,7 +810,7 @@ protected function parseTags($content, PluginFormcreatorForm_Answer $formanswer,
810810
$value = $fieldObject->prepareQuestionInputForTarget($fieldObject->getValue());
811811
}
812812
if (is_array($value)) {
813-
if ($CFG_GLPI['use_rich_text']) {
813+
if (version_compare(PluginFormcreatorCommon::getGlpiVersion(), 9.4) >= 0 || $CFG_GLPI['use_rich_text']) {
814814
$value = '<br />' . implode('<br />', $value);
815815
} else {
816816
$value = "\r\n" . implode("\r\n", $value);

inc/targetchange.class.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -858,7 +858,7 @@ public function prepareInputForUpdate($input) {
858858
return [];
859859
}
860860

861-
if ($CFG_GLPI['use_rich_text']) {
861+
if (version_compare(PluginFormcreatorCommon::getGlpiVersion(), 9.4) >= 0 || $CFG_GLPI['use_rich_text']) {
862862
$input['comment'] = Html::entity_decode_deep($input['comment']);
863863
}
864864

@@ -996,7 +996,7 @@ public function save(PluginFormcreatorForm_Answer $formanswer) {
996996
if (strpos($data[$changeField], '##FULLFORM##') !== false) {
997997
$data[$changeField] = str_replace('##FULLFORM##', $formanswer->getFullForm(), $data[$changeField]);
998998
}
999-
if ($CFG_GLPI['use_rich_text']) {
999+
if (version_compare(PluginFormcreatorCommon::getGlpiVersion(), 9.4) >= 0 || $CFG_GLPI['use_rich_text']) {
10001000
// replace HTML P tags with DIV tags
10011001
$data['content'] = str_replace(['<p>', '</p>'], ['<div>', '</div>'], $data['content']);
10021002
}

0 commit comments

Comments
 (0)