Skip to content

Commit

Permalink
fix(targetticket,targetchange): handle import failure on missing ques…
Browse files Browse the repository at this point in the history
…tion

Signed-off-by: Thierry Bugier <tbugier@teclib.com>
  • Loading branch information
btry committed Oct 16, 2020
1 parent 9ef1d73 commit e17c5a3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions inc/targetchange.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,10 @@ public static function import(PluginFormcreatorLinker $linker, $input = [], $con
}
/**@var PluginFormcreatorQuestion $question */
$question = $linker->getObject($input[$fieldSetting['field']], PluginFormcreatorQuestion::class);
if ($question === false) {
$typeName = strtolower(self::getTypeName());
throw new ImportFailureException(sprintf(__('failed to add or update the %1$s %2$s: a question is missing and is used in a parameter of the target', 'formceator'), $typeName, $input['name']));
}
$input[$fieldSetting['field']] = $question->getID();
}

Expand Down
4 changes: 4 additions & 0 deletions inc/targetticket.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1107,6 +1107,10 @@ public static function import(PluginFormcreatorLinker $linker, $input = [], $con
}
/**@var PluginFormcreatorQuestion $question */
$question = $linker->getObject($input[$fieldSetting['field']], PluginFormcreatorQuestion::class);
if ($question === false) {
$typeName = strtolower(self::getTypeName());
throw new ImportFailureException(sprintf(__('failed to add or update the %1$s %2$s: a question is missing and is used in a parameter of the target', 'formceator'), $typeName, $input['name']));
}
$input[$fieldSetting['field']] = $question->getID();
}

Expand Down

0 comments on commit e17c5a3

Please sign in to comment.