Sanity check before settings are saved #655

This commit is contained in:
jokob-sk
2024-05-01 08:11:58 +10:00
parent 0e02b1beec
commit 2fbbf220fb
3 changed files with 35 additions and 17 deletions

0
front/php/templates/language/es_es.json Normal file → Executable file
View File

0
front/php/templates/language/it_it.json Normal file → Executable file
View File

View File

@@ -753,6 +753,21 @@ while ($row = $result -> fetchArray (SQLITE3_ASSOC)) {
} }
}); });
// console.log(settingsArray);
// sanity check to make sure settings were loaded & collected correctly
sanityCheck_notOK = true
$.each(settingsArray, function(index, value) {
// Do something with each element of the array
if(value[1] == "UI_LANG")
{
sanityCheck_notOK = isEmpty(value[3])
}
});
if(sanityCheck_notOK == false)
{
// trigger a save settings event in the backend // trigger a save settings event in the backend
$.ajax({ $.ajax({
method: "POST", method: "POST",
@@ -772,6 +787,9 @@ while ($row = $result -> fetchArray (SQLITE3_ASSOC)) {
} }
}); });
} else{
showModalOk('WARNING', "<?= lang("settings_missing_block")?>");
}
}) })