diff --git a/inc/targetchange.class.php b/inc/targetchange.class.php index 41a61afa9..7ec92b4cf 100644 --- a/inc/targetchange.class.php +++ b/inc/targetchange.class.php @@ -125,6 +125,23 @@ public function export($remove_uuid = false) { } else { // Convert IDs into UUIDs $export = $this->convertTags($export); + $questionLinks = [ + 'due_date_rule' => ['values' => self::DUE_DATE_RULE_ANSWER, 'field' => 'due_date_question'], + 'urgency_rule' => ['values' => self::URGENCY_RULE_ANSWER, 'field' => 'urgency_question'], + 'tag_type' => ['values' => self::TAG_TYPE_QUESTIONS, 'field' => 'tag_questions'], + 'category_rule' => ['values' => self::CATEGORY_RULE_ANSWER, 'field' => 'category_question'], + ]; + foreach ($questionLinks as $field => $fieldSetting) { + if (!is_array($fieldSetting['values'])) { + $fieldSetting['values'] = [$fieldSetting['values']]; + } + if (!in_array($export[$field], $fieldSetting['values'])) { + continue; + } + $question = new PluginFormcreatorQuestion(); + $question->getFromDB($export[$fieldSetting['field']]); + $export[$fieldSetting['field']] = $question->fields['uuid']; + } } unset($export[$idToRemove]); diff --git a/inc/targetticket.class.php b/inc/targetticket.class.php index b07621226..435b9d686 100644 --- a/inc/targetticket.class.php +++ b/inc/targetticket.class.php @@ -1172,6 +1172,26 @@ public function export($remove_uuid = false) { } else { // Convert IDs into UUIDs $export = $this->convertTags($export); + $questionLinks = [ + 'type_rule' => ['values' => self::REQUESTTYPE_ANSWER, 'field' => 'type_question'], + 'due_date_rule' => ['values' => self::DUE_DATE_RULE_ANSWER, 'field' => 'due_date_question'], + 'urgency_rule' => ['values' => self::URGENCY_RULE_ANSWER, 'field' => 'urgency_question'], + 'tag_type' => ['values' => self::TAG_TYPE_QUESTIONS, 'field' => 'tag_questions'], + 'category_rule' => ['values' => self::CATEGORY_RULE_ANSWER, 'field' => 'category_question'], + 'associate_rule' => ['values' => self::ASSOCIATE_RULE_ANSWER, 'field' => 'associate_question'], + 'location_rule' => ['values' => self::LOCATION_RULE_ANSWER, 'field' => 'location_question'], + ]; + foreach ($questionLinks as $field => $fieldSetting) { + if (!is_array($fieldSetting['values'])) { + $fieldSetting['values'] = [$fieldSetting['values']]; + } + if (!in_array($export[$field], $fieldSetting['values'])) { + continue; + } + $question = new PluginFormcreatorQuestion(); + $question->getFromDB($export[$fieldSetting['field']]); + $export[$fieldSetting['field']] = $question->fields['uuid']; + } } unset($export[$idToRemove]);