Skip to content

Commit

Permalink
fix(section): duplication of conditions: bad itemtype
Browse files Browse the repository at this point in the history
Signed-off-by: Thierry Bugier <tbugier@teclib.com>
  • Loading branch information
btry committed Jan 28, 2020
1 parent 73fca7b commit cfcbea3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
2 changes: 0 additions & 2 deletions inc/condition.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ public static function import(PluginFormcreatorLinker $linker, $input = [], $con
}
}
$input['plugin_formcreator_questions_id'] = $linked->getID();
$input['itemtype'] = $linked->getType();

// Add or update condition
$originalId = $input[$idKey];
Expand Down Expand Up @@ -177,7 +176,6 @@ public function export($remove_uuid = false) {
$condition['plugin_formcreator_questions_id'] = $question->fields['uuid'];
}
unset($condition[$idToRemove]);
unset($condition['itemtype']);

return $condition;
}
Expand Down
8 changes: 4 additions & 4 deletions inc/question.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -937,13 +937,13 @@ public static function import(PluginFormcreatorLinker $linker, $input = [], $con
foreach ($input['_conditions'] as $condition) {
PluginFormcreatorCondition::import($linker, $condition, $itemId);
}
$field = PluginFormcreatorFields::getFieldInstance(
$input['fieldtype'],
$item
);
}

// Import parameters
$field = PluginFormcreatorFields::getFieldInstance(
$input['fieldtype'],
$item
);
if (isset($input['_parameters'])) {
$parameters = $field->getParameters();
foreach ($parameters as $fieldName => $parameter) {
Expand Down
2 changes: 1 addition & 1 deletion inc/section.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ public function export($remove_uuid = false) {
}
}

// get question conditions
// get section conditions
$section['_conditions'] = [];
$condition = new PluginFormcreatorCondition();
$all_conditions = $condition->getConditionsFromItem($this);
Expand Down

0 comments on commit cfcbea3

Please sign in to comment.