Skip to content

Commit

Permalink
fix(target-change): nug handling the comment field of a target change
Browse files Browse the repository at this point in the history
  • Loading branch information
btry committed Oct 13, 2017
1 parent 22f3508 commit 5371da5
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions inc/targetchange.class.php
Expand Up @@ -948,8 +948,6 @@ public function save(PluginFormcreatorForm_Answer $formanswer) {
$data['requesttypes_id'] = $requesttypes_id;

// Parse datas
$fullform = $formanswer->getFullForm();

$changeFields = [
'name',
'content',
Expand All @@ -960,11 +958,17 @@ public function save(PluginFormcreatorForm_Answer $formanswer) {
'checklistcontent'
];
foreach ($changeFields as $changeField) {
$data[$changeField] = $this->fields[$changeField];
//TODO: 2.7.0 rename PluginFormcreatorTargetChange's comment into content
if ($changeField == 'content') {
// This handles mismatch of the column content in Change itemtype and comment in TargetChange itemtype
$data[$changeField] = $this->fields[$changeField];
} else {
$data[$changeField] = $this->fields['comment'];
}
if (strpos($data[$changeField], '##FULLFORM##') !== false) {
$data[$changeField] = str_replace('##FULLFORM##', $formanswer->getFullForm(), $data[$changeField]);
}
$data[$changeField] = addslashes($this->parseTags($data[$changeField], $formanswer));
$data[$changeField] = addslashes($this->parseTags($data[$changeField], $formanswer));
}

$data['_users_id_recipient'] = $_SESSION['glpiID'];
Expand Down

0 comments on commit 5371da5

Please sign in to comment.