localized tabulator preset backend error messages

This commit is contained in:
adisposkofh
2026-06-11 13:21:56 +02:00
parent 3ced1966f4
commit c9fe633706
3 changed files with 198 additions and 13 deletions
@@ -35,6 +35,11 @@ class TabulatorPresets extends FHCAPI_Controller
]);
$this->load->model('tabulator/Tabulator_preset_model', 'TabulatorPresetModel');
$this->loadPhrases([
'global',
'tabulator_presets'
]);
}
//------------------------------------------------------------------------------------------------------------------
@@ -44,7 +49,7 @@ class TabulatorPresets extends FHCAPI_Controller
{
$tableName = $this->input->get("tableName");
if (!$tableName) {
$this->terminateWithError(error("Invalid parameters!"));
$this->terminateWithError(error($this->p->t("global", "invalid_params_err_msg")));
}
$uid = getAuthUID();
@@ -61,7 +66,7 @@ class TabulatorPresets extends FHCAPI_Controller
$preset = $this->input->post("preset");
if (!$tableName || !$presetName || !$preset) {
$this->terminateWithError("Invalid parameters!", "general", 400);
$this->terminateWithError($this->p->t("global", "invalid_params_err_msg"), "general", 400);
}
$uid = getAuthUID();
@@ -70,7 +75,7 @@ class TabulatorPresets extends FHCAPI_Controller
$existingPresets = $this->getDataOrTerminateWithError($existingPresetsResult) ?? [];
if (count($existingPresets) > 19) {
$this->terminateWithError("Maximum number of presets reached!", "general", 409);
$this->terminateWithError($this->p->t("tabulator_presets", "max_presets_count_err_msg"), "general", 409);
}
$existingPresetNames = array_map(function($presetInfo) {
@@ -78,7 +83,7 @@ class TabulatorPresets extends FHCAPI_Controller
}, $existingPresets);
if (in_array($presetName, $existingPresetNames)) {
$this->terminateWithError("Preset name duplicate not allowed!", "general", 409);
$this->terminateWithError($this->p->t("tabulator_presets", "preset_name_duplicate_err_msg"), "general", 409);
}
$presetCreationResult = $this->TabulatorPresetModel->createTabulatorPreset($uid, $tableName, $presetName, $preset);
@@ -100,19 +105,19 @@ class TabulatorPresets extends FHCAPI_Controller
$preset = $this->input->post("preset");
if (!$presetId || !$preset) {
$this->terminateWithError("Invalid parameters!", "general", 400);
$this->terminateWithError($this->p->t("global", "invalid_params_err_msg"), "general", 400);
}
$existingPresetData = $this->TabulatorPresetModel->getTabulatorPreset($presetId);
$existingPresetArray = $this->getDataOrTerminateWithError($existingPresetData) ?? [null];
$existingPreset = $existingPresetArray[0];
if (!$existingPreset) {
$this->terminateWithError("Preset not found!", "general", 404);
$this->terminateWithError($this->p->t("tabulator_presets", "preset_not_found_err_msg"), "general", 404);
}
$uid = getAuthUID();
if ($existingPreset->benutzer_uid !== $uid) {
$this->terminateWithError("You are not allowed to update this preset!", "general", 403);
$this->terminateWithError($this->p->t("tabulator_presets", "preset_not_own_update_err_msg"), "general", 403);
}
$presetUpdateResult = $this->TabulatorPresetModel->updateTabulatorPreset($presetId, $preset);
@@ -131,19 +136,19 @@ class TabulatorPresets extends FHCAPI_Controller
{
$presetId = $this->input->post("presetId");
if (!$presetId) {
$this->terminateWithError("Invalid parameters!", "general", 400);
$this->terminateWithError($this->p->t("global", "invalid_params_err_msg"), "general", 400);
}
$presetData = $this->TabulatorPresetModel->getTabulatorPreset($presetId);
$presetArray = $this->getDataOrTerminateWithError($presetData) ?? [null];
$preset = $presetArray[0];
if (!$preset) {
$this->terminateWithError("Preset not found!", "general", 404);
$this->terminateWithError($this->p->t("tabulator_presets", "preset_not_found_err_msg"), "general", 404);
}
$uid = getAuthUID();
if ($preset->benutzer_uid !== $uid) {
$this->terminateWithError("You are not allowed to delete this preset!", "general", 403);
$this->terminateWithError($this->p->t("tabulator_presets", "preset_not_own_delete_err_msg"), "general", 403);
}
$presetDeletionResult = $this->TabulatorPresetModel->deleteTabulatorPreset($presetId);
@@ -50,7 +50,7 @@ class Tabulator_preset_model extends DB_Model
if (isError($presetCreationResult))
{
return error('Something went wrong with tabulator preset creation.');
return error('Something went wrong during preset creation!');
}
return success($presetCreationResult->retval);
@@ -62,7 +62,7 @@ class Tabulator_preset_model extends DB_Model
if (isError($presetUpdateResult))
{
return error('Something went wrong during tabulator preset update.');
return error('Something went wrong during preset update!');
}
return success($presetUpdateResult->retval);
@@ -74,7 +74,7 @@ class Tabulator_preset_model extends DB_Model
if (isError($presetDeletionReseult))
{
return error('Something went wrong during tabulator preset deletion.');
return error('Something went wrong during preset deletion!');
}
return success($presetDeletionReseult->retval);
+180
View File
@@ -33112,6 +33112,26 @@ array(
)
)
),
array(
'app' => 'anwesenheiten',
'category' => 'global',
'phrase' => 'invalid_params_err_msg',
'insertvon' => 'system',
'phrases' => array(
array(
'sprache' => 'German',
'text' => 'Ungültige Parameterübergabe!',
'description' => '',
'insertvon' => 'system'
),
array(
'sprache' => 'English',
'text' => 'Invalid parameters!',
'description' => '',
'insertvon' => 'system'
)
)
),
array(
'app' => 'anwesenheiten',
'category' => 'global',
@@ -58760,6 +58780,166 @@ I have been informed that I am under no obligation to consent to the transmissio
)
)
),
array(
'app' => 'core',
'category' => 'tabulator_presets',
'phrase' => 'max_presets_count_err_msg',
'insertvon' => 'system',
'phrases' => array(
array(
'sprache' => 'German',
'text' => 'Maximale Anzahl an Voreinstellungen erreicht!',
'description' => '',
'insertvon' => 'system'
),
array(
'sprache' => 'English',
'text' => 'Maximum number of presets reached!',
'description' => '',
'insertvon' => 'system'
)
)
),
array(
'app' => 'core',
'category' => 'tabulator_presets',
'phrase' => 'preset_name_duplicate_err_msg',
'insertvon' => 'system',
'phrases' => array(
array(
'sprache' => 'German',
'text' => 'Doppelte Voreinstellunge Namen sind nicht zulässig!',
'description' => '',
'insertvon' => 'system'
),
array(
'sprache' => 'English',
'text' => 'Preset name duplicate not allowed!',
'description' => '',
'insertvon' => 'system'
)
)
),
array(
'app' => 'core',
'category' => 'tabulator_presets',
'phrase' => 'preset_not_found_err_msg',
'insertvon' => 'system',
'phrases' => array(
array(
'sprache' => 'German',
'text' => 'Voreinstellung nicht gefunden!',
'description' => '',
'insertvon' => 'system'
),
array(
'sprache' => 'English',
'text' => 'Preset not found!',
'description' => '',
'insertvon' => 'system'
)
)
),
array(
'app' => 'core',
'category' => 'tabulator_presets',
'phrase' => 'preset_not_own_update_err_msg',
'insertvon' => 'system',
'phrases' => array(
array(
'sprache' => 'German',
'text' => 'Sie dürfen diese Voreinstellung nicht ändern!',
'description' => '',
'insertvon' => 'system'
),
array(
'sprache' => 'English',
'text' => 'You are not allowed to update this preset!',
'description' => '',
'insertvon' => 'system'
)
)
),
array(
'app' => 'core',
'category' => 'tabulator_presets',
'phrase' => 'preset_not_own_delete_err_msg',
'insertvon' => 'system',
'phrases' => array(
array(
'sprache' => 'German',
'text' => 'Sie dürfen diese Voreinstellung nicht löschen!',
'description' => '',
'insertvon' => 'system'
),
array(
'sprache' => 'English',
'text' => 'You are not allowed to delete this preset!',
'description' => '',
'insertvon' => 'system'
)
)
),
array(
'app' => 'core',
'category' => 'tabulator_presets',
'phrase' => 'preset_creation_generic_err_msg',
'insertvon' => 'system',
'phrases' => array(
array(
'sprache' => 'German',
'text' => 'Bei der Erstellung der Voreinstellung ist ein Fehler aufgetreten!',
'description' => '',
'insertvon' => 'system'
),
array(
'sprache' => 'English',
'text' => 'Something went wrong during preset creation!',
'description' => '',
'insertvon' => 'system'
)
)
),
array(
'app' => 'core',
'category' => 'tabulator_presets',
'phrase' => 'preset_update_generic_err_msg',
'insertvon' => 'system',
'phrases' => array(
array(
'sprache' => 'German',
'text' => 'Bei der Voreinstellungsänderung ist ein Fehler aufgetreten!',
'description' => '',
'insertvon' => 'system'
),
array(
'sprache' => 'English',
'text' => 'Something went wrong during preset update!',
'description' => '',
'insertvon' => 'system'
)
)
),
array(
'app' => 'core',
'category' => 'tabulator_presets',
'phrase' => 'preset_deletion_generic_err_msg',
'insertvon' => 'system',
'phrases' => array(
array(
'sprache' => 'German',
'text' => 'Beim Löschen der Voreinstellung ist ein Fehler aufgetreten!',
'description' => '',
'insertvon' => 'system'
),
array(
'sprache' => 'English',
'text' => 'Something went wrong during preset deletion!',
'description' => '',
'insertvon' => 'system'
)
)
),
// tabulator presets section phrases END
);