Skip to content

Commit 6dfaae9

Browse files
committed
fix: compatibility with GLPI 9.4
rich text switch removed, and always enabled fix #1022 Signed-off-by: btry <tbugier@teclib.com>
1 parent 0902184 commit 6dfaae9

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

inc/form_answer.class.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1081,7 +1081,7 @@ public function getFullForm() {
10811081
$output = '';
10821082
$eol = '\r\n';
10831083

1084-
if ($CFG_GLPI['use_rich_text']) {
1084+
if (version_compare(PluginFormcreatorCommon::getGlpiVersion(), 9.4) >= 0 || $CFG_GLPI['use_rich_text']) {
10851085
$output .= '<h1>' . __('Form data', 'formcreator') . '</h1>';
10861086
} else {
10871087
$output .= __('Form data', 'formcreator') . $eol;
@@ -1110,7 +1110,7 @@ public function getFullForm() {
11101110

11111111
// Get and display current section if needed
11121112
if ($last_section != $question_line['section_name']) {
1113-
if ($CFG_GLPI['use_rich_text']) {
1113+
if (version_compare(PluginFormcreatorCommon::getGlpiVersion(), 9.4) >= 0 || $CFG_GLPI['use_rich_text']) {
11141114
$output .= '<h2>' . Toolbox::addslashes_deep($question_line['section_name']) . '</h2>';
11151115
} else {
11161116
$output .= $eol . Toolbox::addslashes_deep($question_line['section_name']) . $eol;
@@ -1131,7 +1131,7 @@ public function getFullForm() {
11311131

11321132
if ($question_line['fieldtype'] != 'description') {
11331133
$question_no++;
1134-
if ($CFG_GLPI['use_rich_text']) {
1134+
if (version_compare(PluginFormcreatorCommon::getGlpiVersion(), 9.4) >= 0 || $CFG_GLPI['use_rich_text']) {
11351135
$output .= '<div>';
11361136
$output .= '<b>' . $question_no . ') ##question_' . $question_line['id'] . '## : </b>';
11371137
$output .= '##answer_' . $question_line['id'] . '##';

inc/targetticket.class.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ public function showForm($options=[]) {
117117
echo '<td><strong>' . __('Description') . ' <span style="color:red;">*</span></strong></td>';
118118
echo '<td colspan="3">';
119119
echo '<textarea name="comment" style="width:700px;" rows="15">' . $this->fields['comment'] . '</textarea>';
120-
if ($CFG_GLPI["use_rich_text"]) {
120+
if (version_compare(PluginFormcreatorCommon::getGlpiVersion(), 9.4) >= 0 || $CFG_GLPI["use_rich_text"]) {
121121
Html::initEditorSystem('comment');
122122
}
123123
echo '</td>';
@@ -850,7 +850,7 @@ public function prepareInputForUpdate($input) {
850850
return [];
851851
}
852852

853-
if ($CFG_GLPI['use_rich_text']) {
853+
if (version_compare(PluginFormcreatorCommon::getGlpiVersion(), 9.4) >= 0 || $CFG_GLPI['use_rich_text']) {
854854
$input['comment'] = Html::entity_decode_deep($input['comment']);
855855
}
856856

@@ -1114,13 +1114,13 @@ public function save(PluginFormcreatorForm_Answer $formanswer) {
11141114
if (strpos($data['content'], '##FULLFORM##') !== false) {
11151115
$data['content'] = str_replace('##FULLFORM##', $formanswer->getFullForm(), $data['content']);
11161116
}
1117-
if ($CFG_GLPI['use_rich_text']) {
1117+
if (version_compare(PluginFormcreatorCommon::getGlpiVersion(), 9.4) >= 0 || $CFG_GLPI['use_rich_text']) {
11181118
// replace HTML P tags with DIV tags
11191119
$data['content'] = str_replace(['<p>', '</p>'], ['<div>', '</div>'], $data['content']);
11201120
}
11211121

11221122
$data['content'] = $this->parseTags($data['content'], $formanswer);
1123-
if ($CFG_GLPI['use_rich_text']) {
1123+
if (version_compare(PluginFormcreatorCommon::getGlpiVersion(), 9.4) >= 0 || $CFG_GLPI['use_rich_text']) {
11241124
$data['content'] = htmlentities($data['content']);
11251125
}
11261126
$data['_users_id_recipient'] = $_SESSION['glpiID'];

0 commit comments

Comments
 (0)