diff --git a/inc/form_language.class.php b/inc/form_language.class.php index 98f9d0da5..002f0b693 100644 --- a/inc/form_language.class.php +++ b/inc/form_language.class.php @@ -111,10 +111,12 @@ public static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $ } public function prepareInputForAdd($input) { + global $CFG_GLPI; + $formFk = PluginFormcreatorForm::getForeignKeyField(); if (!isset($input['name'])) { Session::addMessageAfterRedirect( - __('The name cannot be empty!', 'formcreator'), + __('The name cannot be empty.', 'formcreator'), false, ERROR ); @@ -122,7 +124,15 @@ public function prepareInputForAdd($input) { } if (!isset($input[$formFk])) { Session::addMessageAfterRedirect( - __('The language must be associated to a form!', 'formcreator'), + __('The language must be associated to a form.', 'formcreator'), + false, + ERROR + ); + return []; + } + if (!isset($CFG_GLPI['languages'][$input['name']])) { + Session::addMessageAfterRedirect( + __('The specified language is not available.', 'formcreator'), false, ERROR );