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
@@ -1842,17 +1842,31 @@ public function importJson($params = []) {
1842
1842
// parse json file(s)
1843
1843
foreach ($params['_json_file'] as$filename) {
1844
1844
if (!$json = file_get_contents(GLPI_TMP_DIR."/".$filename)) {
1845
-
Session::addMessageAfterRedirect(__("Forms import impossible, the file is empty"));
1845
+
Session::addMessageAfterRedirect(__("Forms import impossible, the file is empty", 'formcreator'));
1846
1846
continue;
1847
1847
}
1848
1848
if (!$forms_toimport = json_decode($json, true)) {
1849
-
Session::addMessageAfterRedirect(__("Forms import impossible, the file seems corrupt"));
1849
+
Session::addMessageAfterRedirect(__("Forms import impossible, the file seems corrupt", 'formcreator'));
1850
1850
continue;
1851
1851
}
1852
1852
if (!isset($forms_toimport['forms'])) {
1853
-
Session::addMessageAfterRedirect(__("Forms import impossible, the file seems corrupt"));
1853
+
Session::addMessageAfterRedirect(__("Forms import impossible, the file seems corrupt", 'formcreator'));
1854
1854
continue;
1855
1855
}
1856
+
if (isset($forms_toimport['schema_version'])) {
1857
+
if (($forms_toimport['schema_version']) != PLUGIN_FORMCREATOR_SCHEMA_VERSION) {
1858
+
Session::addMessageAfterRedirect(
1859
+
__("Forms import impossible, the file was generated with another version", 'formcreator'),
1860
+
false, ERROR
1861
+
);
1862
+
continue;
1863
+
}
1864
+
} else {
1865
+
Session::addMessageAfterRedirect(
1866
+
__("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