diff --git a/inc/condition.class.php b/inc/condition.class.php index 7a7aa3071..42037d316 100644 --- a/inc/condition.class.php +++ b/inc/condition.class.php @@ -58,6 +58,11 @@ class PluginFormcreatorCondition extends CommonDBChild implements PluginFormcrea const SHOW_CONDITION_QUESTION_VISIBLE = 7; const SHOW_CONDITION_QUESTION_INVISIBLE = 8; + public static function getTypeName($nb = 0) { + return _n('Condition', 'Conditions', $nb, 'formcreator'); + } + + public function prepareInputForAdd($input) { // generate a unique id if (!isset($input['uuid']) @@ -100,7 +105,7 @@ public static function import(PluginFormcreatorLinker $linker, $input = [], $con global $DB; if (!isset($input['uuid']) && !isset($input['id'])) { - throw new ImportFailureException('UUID or ID is mandatory'); + throw new ImportFailureException(sprintf('UUID or ID is mandatory for %1$s', static::getTypeName(1))); } // restore key and FK diff --git a/inc/form.class.php b/inc/form.class.php index 068e1abf3..07c87ed30 100644 --- a/inc/form.class.php +++ b/inc/form.class.php @@ -1823,7 +1823,7 @@ public static function import(PluginFormcreatorLinker $linker, $input = [], $con global $DB; if (!isset($input['uuid']) && !isset($input['id'])) { - throw new ImportFailureException('UUID or ID is mandatory'); + throw new ImportFailureException(sprintf('UUID or ID is mandatory for %1$s', static::getTypeName(1))); } $input['_skip_checks'] = true; diff --git a/inc/form_profile.class.php b/inc/form_profile.class.php index 1fd1db9b1..9c6f84bc8 100644 --- a/inc/form_profile.class.php +++ b/inc/form_profile.class.php @@ -166,7 +166,7 @@ public static function showForForm(CommonDBTM $item, $withtemplate = '') { */ public static function import(PluginFormcreatorLinker $linker, $input = [], $containerId = 0) { if (!isset($input['uuid']) && !isset($input['id'])) { - throw new ImportFailureException('UUID or ID is mandatory'); + throw new ImportFailureException(sprintf('UUID or ID is mandatory for %1$s', static::getTypeName(1))); } $formFk = PluginFormcreatorForm::getForeignKeyField(); diff --git a/inc/item_targetticket.class.php b/inc/item_targetticket.class.php index b1cb8ce12..109bffa33 100644 --- a/inc/item_targetticket.class.php +++ b/inc/item_targetticket.class.php @@ -47,6 +47,10 @@ class PluginFormcreatorItem_TargetTicket extends CommonDBRelation static public $logs_for_item_1 = false; + public static function getTypeName($nb = 0) { + return _n('Composite ticket relation', 'Composite ticket relations', $nb, 'formcreator'); + } + public function export($remove_uuid = false) { if ($this->isNewItem()) { return false; @@ -88,7 +92,7 @@ public function export($remove_uuid = false) { public static function import(PluginFormcreatorLinker $linker, $input = [], $containerId = 0) { if (!isset($input['uuid']) && !isset($input['id'])) { - throw new ImportFailureException('UUID or ID is mandatory'); + throw new ImportFailureException(sprintf('UUID or ID is mandatory for %1$s', static::getTypeName(1))); } $targetTicketFk = PluginFormcreatorTargetTicket::getForeignKeyField(); diff --git a/inc/question.class.php b/inc/question.class.php index 70fc4a8e1..75647be38 100644 --- a/inc/question.class.php +++ b/inc/question.class.php @@ -901,7 +901,7 @@ public static function import(PluginFormcreatorLinker $linker, $input = [], $con global $DB; if (!isset($input['uuid']) && !isset($input['id'])) { - throw new ImportFailureException('UUID or ID is mandatory'); + throw new ImportFailureException(sprintf('UUID or ID is mandatory for %1$s', static::getTypeName(1))); } // restore key and FK diff --git a/inc/questiondependency.class.php b/inc/questiondependency.class.php index 20da5e226..7ab3bf101 100644 --- a/inc/questiondependency.class.php +++ b/inc/questiondependency.class.php @@ -62,6 +62,10 @@ public function __construct(PluginFormcreatorFieldInterface $field, array $optio $this->fieldtype = isset($options['fieldType']) ? $options['fieldType'] : []; } + public static function getTypeName($nb = 0) { + return _n('Question dependency', 'Question dependencies', $nb, 'formcreator'); + } + public function getParameterFormSize() { return 0; } @@ -133,7 +137,7 @@ public static function import(PluginFormcreatorLinker $linker, $input = [], $con global $DB; if (!isset($input['uuid']) && !isset($input['id'])) { - throw new ImportFailureException('UUID or ID is mandatory'); + throw new ImportFailureException(sprintf('UUID or ID is mandatory for %1$s', static::getTypeName(1))); } $questionFk = PluginFormcreatorQuestion::getForeignKeyField(); diff --git a/inc/questionrange.class.php b/inc/questionrange.class.php index e980172ff..ef80b2bbe 100644 --- a/inc/questionrange.class.php +++ b/inc/questionrange.class.php @@ -47,6 +47,10 @@ class PluginFormcreatorQuestionRange protected $domId = 'plugin_formcreator_questionRange'; + public static function getTypeName($nb = 0) { + return _n('Question range', 'Question ranges', $nb, 'formcreator'); + } + public function getParameterFormSize() { return 0; } @@ -125,7 +129,7 @@ public static function import(PluginFormcreatorLinker $linker, $input = [], $con global $DB; if (!isset($input['uuid']) && !isset($input['id'])) { - throw new ImportFailureException('UUID or ID is mandatory'); + throw new ImportFailureException(sprintf('UUID or ID is mandatory for %1$s', static::getTypeName(1))); } $questionFk = PluginFormcreatorQuestion::getForeignKeyField(); diff --git a/inc/questionregex.class.php b/inc/questionregex.class.php index 96ba2f57c..d655a5f26 100644 --- a/inc/questionregex.class.php +++ b/inc/questionregex.class.php @@ -47,6 +47,10 @@ class PluginFormcreatorQuestionRegex protected $domId = 'plugin_formcreator_questionRegex'; + public static function getTypeName($nb = 0) { + return _n('Question regular expression', 'Question regular expressions', $nb, 'formcreator'); + } + public function getParameterFormSize() { return 1; } @@ -120,7 +124,7 @@ public static function import(PluginFormcreatorLinker $linker, $input = [], $con global $DB; if (!isset($input['uuid']) && !isset($input['id'])) { - throw new ImportFailureException('UUID or ID is mandatory'); + throw new ImportFailureException(sprintf('UUID or ID is mandatory for %1$s', static::getTypeName(1))); } $questionFk = PluginFormcreatorQuestion::getForeignKeyField(); diff --git a/inc/section.class.php b/inc/section.class.php index 9dee4531c..c7b993d33 100644 --- a/inc/section.class.php +++ b/inc/section.class.php @@ -226,7 +226,7 @@ public static function import(PluginFormcreatorLinker $linker, $input = [], $con global $DB; if (!isset($input['uuid']) && !isset($input['id'])) { - throw new ImportFailureException('UUID or ID is mandatory'); + throw new ImportFailureException(sprintf('UUID or ID is mandatory for %1$s', static::getTypeName(1))); } // restore key and FK diff --git a/inc/target_actor.class.php b/inc/target_actor.class.php index 8036d04cf..25aedd243 100644 --- a/inc/target_actor.class.php +++ b/inc/target_actor.class.php @@ -80,6 +80,11 @@ static function getEnumRole() { // TODO : support ACTOR_ROLE_SUPPLIER ]; } + + public static function getTypeName($nb = 0) { + return _n('Target actor', 'Target actors', $nb, 'formcreator'); + } + public function prepareInputForAdd($input) { // generate a unique id @@ -92,7 +97,7 @@ public function prepareInputForAdd($input) { public static function import(PluginFormcreatorLinker $linker, $input = [], $containerId = 0) { if (!isset($input['uuid']) && !isset($input['id'])) { - throw new ImportFailureException('UUID or ID is mandatory'); + throw new ImportFailureException(sprintf('UUID or ID is mandatory for %1$s', static::getTypeName(1))); } $input[static::$items_id] = $containerId; diff --git a/inc/targetchange.class.php b/inc/targetchange.class.php index 5fd966830..2960c139f 100644 --- a/inc/targetchange.class.php +++ b/inc/targetchange.class.php @@ -135,7 +135,7 @@ public static function import(PluginFormcreatorLinker $linker, $input = [], $con global $DB; if (!isset($input['uuid']) && !isset($input['id'])) { - throw new ImportFailureException('UUID or ID is mandatory'); + throw new ImportFailureException(sprintf('UUID or ID is mandatory for %1$s', static::getTypeName(1))); } $formFk = PluginFormcreatorForm::getForeignKeyField(); diff --git a/inc/targetticket.class.php b/inc/targetticket.class.php index 672b8b731..a0c739428 100644 --- a/inc/targetticket.class.php +++ b/inc/targetticket.class.php @@ -1030,7 +1030,7 @@ public static function import(PluginFormcreatorLinker $linker, $input = [], $con global $DB; if (!isset($input['uuid']) && !isset($input['id'])) { - throw new ImportFailureException('UUID or ID is mandatory'); + throw new ImportFailureException(sprintf('UUID or ID is mandatory for %1$s', static::getTypeName(1))); } $formFk = PluginFormcreatorForm::getForeignKeyField();