Skip to content

Commit

Permalink
fix(form): duplicate empty form
Browse files Browse the repository at this point in the history
Signed-off-by: Thierry Bugier <tbugier@teclib.com>
  • Loading branch information
btry committed Apr 14, 2020
1 parent 4969884 commit 5944935
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions inc/form.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -2002,13 +2002,15 @@ public static function import(PluginFormcreatorLinker $linker, $input = [], $con
$importedItems[] = $importedItem;
}
// Delete all other restrictions
$deleteCriteria = [];
if (count($importedItems) > 0) {
$FormProfile = new PluginFormcreatorForm_Profile();
$FormProfile->deleteByCriteria([
$formFk => $itemId,
['NOT' => ['id' => $importedItems]]
]);
$deleteCriteria = ['NOT' => ['id' => $importedItems]];
}
$FormProfile = new PluginFormcreatorSection();
$FormProfile->deleteByCriteria([
$formFk => $itemId,
$deleteCriteria,
]);
}

// import form's sections
Expand Down Expand Up @@ -2036,11 +2038,13 @@ public static function import(PluginFormcreatorLinker $linker, $input = [], $con
$importedItems[] = $importedItem;
}
// Delete all other restrictions
$FormProfile = new PluginFormcreatorSection();
$FormProfile->deleteByCriteria([
$formFk => $itemId,
['NOT' => ['id' => $importedItems]]
]);
if (count($importedItems) > 0) {
$FormProfile = new PluginFormcreatorSection();
$FormProfile->deleteByCriteria([
$formFk => $itemId,
['NOT' => ['id' => $importedItems]]
]);
}
}

// import form's targets
Expand Down

0 comments on commit 5944935

Please sign in to comment.