You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: inc/form.class.php
+17-3Lines changed: 17 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -1810,17 +1810,31 @@ public function importJson($params = []) {
1810
1810
// parse json file(s)
1811
1811
foreach ($params['_json_file'] as$filename) {
1812
1812
if (!$json = file_get_contents(GLPI_TMP_DIR."/".$filename)) {
1813
-
Session::addMessageAfterRedirect(__("Forms import impossible, the file is empty"));
1813
+
Session::addMessageAfterRedirect(__("Forms import impossible, the file is empty", 'formcreator'));
1814
1814
continue;
1815
1815
}
1816
1816
if (!$forms_toimport = json_decode($json, true)) {
1817
-
Session::addMessageAfterRedirect(__("Forms import impossible, the file seems corrupt"));
1817
+
Session::addMessageAfterRedirect(__("Forms import impossible, the file seems corrupt", 'formcreator'));
1818
1818
continue;
1819
1819
}
1820
1820
if (!isset($forms_toimport['forms'])) {
1821
-
Session::addMessageAfterRedirect(__("Forms import impossible, the file seems corrupt"));
1821
+
Session::addMessageAfterRedirect(__("Forms import impossible, the file seems corrupt", 'formcreator'));
1822
1822
continue;
1823
1823
}
1824
+
if (isset($forms_toimport['schema_version'])) {
1825
+
if (($forms_toimport['schema_version']) != PLUGIN_FORMCREATOR_SCHEMA_VERSION) {
1826
+
Session::addMessageAfterRedirect(
1827
+
__("Forms import impossible, the file was generated with another version", 'formcreator'),
1828
+
false, ERROR
1829
+
);
1830
+
continue;
1831
+
}
1832
+
} else {
1833
+
Session::addMessageAfterRedirect(
1834
+
__("The file does not specifies the schema version. It was probably generated with a version older than 2.10 and import is expected to create incomplete or buggy forms.", 'formcreator'),
0 commit comments