Adaptierung Notizcomponent: teleport datepicker, tinymce mount conditionally, fehlerhandling missing id and type

This commit is contained in:
ma0068
2024-02-07 09:28:30 +01:00
parent 1ddf5a8370
commit d56dbdf563
5 changed files with 47 additions and 49 deletions
@@ -100,21 +100,6 @@ class Notiz extends FHC_Controller
}
}
//Überprüfung ob type übergeben wurde (via Funktions- oder Postparameter)
$type = null;
if ($paramTyp)
$type = $paramTyp;
if(isset($_POST['typeId']))
$type = $this->input->post('typeId');
if(!$type)
{
$result = error('kein Type für ID vorhanden', ERROR);
$this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
return $this->outputJson(getError($result));
}
//Form Validation
$this->form_validation->set_rules('titel', 'titel', 'callback_titel_required');
$this->form_validation->set_rules('text', 'text', 'callback_text_required');
+8 -10
View File
@@ -152,6 +152,13 @@ class Notiz_model extends DB_Model
$verfasser_uid = null,
$bearbeiter_uid = null
) {
//check, ob id und type valid
if (!isset($id) || ($id == "undefined")) {
$this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
return error("Id(". $id. ') ist keine gültige ID!');
}
// Loads model Notizzuordnung_model
$this->load->model('person/Notizzuordnung_model', 'NotizzuordnungModel');
@@ -160,17 +167,8 @@ class Notiz_model extends DB_Model
if (isError($result))
{
$this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
$result = error($result->retval, EXIT_ERROR);
return $result;
return error($type . ' ist kein gültiger ID_TYP!');
}
/*
if(!$isValidType)
{
//Todo manu (correct return to controller)
$msg = "datatype " . $type . " not implemented for notes";
return error($msg, EXIT_ERROR);
}*/
// Start DB transaction
$this->db->trans_start(false);