diff --git a/front/form.form.php b/front/form.form.php index ad8feb7b0..2877189e2 100644 --- a/front/form.form.php +++ b/front/form.form.php @@ -145,7 +145,7 @@ if ($_SESSION['glpiname'] == 'formcreator_temp_user') { // Form was saved by an annymous user unset($_SESSION['glpiname']); - Html::redirect('formdisplay.php?answer_saved'); + Html::redirect('formdisplay.php?answer_saved&id=' . $form->getID()); } // redirect to created item diff --git a/front/formdisplay.php b/front/formdisplay.php index d36b268d2..5d694fd2f 100644 --- a/front/formdisplay.php +++ b/front/formdisplay.php @@ -34,6 +34,7 @@ // Check if plugin is activated... if (!(new Plugin())->isActivated('formcreator')) { + PluginFormcreatorForm::header(); Html::displayNotFoundError(); } diff --git a/inc/form.class.php b/inc/form.class.php index 2ace39f05..3bb85c867 100644 --- a/inc/form.class.php +++ b/inc/form.class.php @@ -1476,6 +1476,7 @@ public function post_purgeItem() { PluginFormcreatorSection::class, PluginFormcreatorForm_Validator::class, PluginFormcreatorForm_Profile::class, + pluginFormcreatorForm_Language::class, ]; foreach ($associated as $itemtype) { $item = new $itemtype(); @@ -2569,8 +2570,7 @@ public function getTranslatableStrings(array $options = []) : array { } foreach ($strings[$type] as $id => $original) { if ($options['is_translated'] === true && !isset($translations[$original]) - || $options['is_translated'] === false && isset($translations[$original])) - { + || $options['is_translated'] === false && isset($translations[$original])) { unset($strings[$type][$id]); unset($strings['id'][$id]); } @@ -2656,7 +2656,7 @@ public function setTranslations(string $language, array $translations) : bool { * * @return string the best language for this form and session context */ - public function getBestLanguage() { + public function getBestLanguage() { global $DB; if ($this->isNewItem()) { diff --git a/inc/form_language.class.php b/inc/form_language.class.php index 9da4b111c..f4607b0cf 100644 --- a/inc/form_language.class.php +++ b/inc/form_language.class.php @@ -167,7 +167,7 @@ public function showForm($ID, $options = []) { echo ''; echo '' . __('Name') . ' *'; $used = []; - $rows = $this->find(); + $rows = $this->find([PluginFormcreatorForm::getForeignKeyField() => $item->getID()]); foreach ($rows as $row) { $used[$row['name']] = $row['name']; } diff --git a/inc/translatable.class.php b/inc/translatable.class.php index d9f856940..d8baa284f 100644 --- a/inc/translatable.class.php +++ b/inc/translatable.class.php @@ -98,9 +98,6 @@ public function getMyTranslatableStrings(array $options) : array { $id = PluginFormcreatorTranslation::getTranslatableStringId($this->fields[$searchOption['field']]); if ($options['id'] != '' && $id != $options['id']) { continue; - } - if (isset($options['is_untranslated']) && $options['is_untranslated']) { - } $strings[$searchOption['datatype']][$id] = $this->fields[$searchOption['field']]; $strings['id'][$id] = $searchOption['datatype']; diff --git a/inc/translation.class.php b/inc/translation.class.php index 3548a1706..5b9a5d14f 100644 --- a/inc/translation.class.php +++ b/inc/translation.class.php @@ -107,7 +107,7 @@ public static function getDropdownValue($post, $json = true) { $foundCount = 0; $data = []; - foreach(['itemlink', 'string', 'text'] as $stringType) { + foreach (['itemlink', 'string', 'text'] as $stringType) { foreach ($strings[$stringType] as $id => $string) { $foundCount++; if ($foundCount < ((int) $post['page'] - 1) * (int) $post['page_limit']) {