diff --git a/application/controllers/components/stv/Notiz.php b/application/controllers/components/stv/Notiz.php index 4918e6627..7b78b06f8 100644 --- a/application/controllers/components/stv/Notiz.php +++ b/application/controllers/components/stv/Notiz.php @@ -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'); diff --git a/application/models/person/Notiz_model.php b/application/models/person/Notiz_model.php index ea0d7d361..2822cac47 100644 --- a/application/models/person/Notiz_model.php +++ b/application/models/person/Notiz_model.php @@ -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); diff --git a/public/js/components/Notiz/NotizComponent.js b/public/js/components/Notiz/NotizComponent.js index dd0abab23..eb8b8dd1d 100644 --- a/public/js/components/Notiz/NotizComponent.js +++ b/public/js/components/Notiz/NotizComponent.js @@ -67,7 +67,7 @@ export default { }, frozen: true }], - layout: 'fitDataFill', + layout: 'fitColumns', layoutColumnsOnNewData: false, height: '150', selectableRangeMode: 'click', @@ -135,7 +135,7 @@ export default { actionNewNotiz(){ this.resetFormData(); }, - addNewNotiz(notizData) { + addNewNotiz() { const formData = new FormData(); formData.append('data', JSON.stringify(this.notizData)); @@ -158,6 +158,7 @@ export default { } }).catch(error => { if (error.response) { + console.log(error.response); this.$fhcAlert.alertError(error.response.data); } }).finally(() => { @@ -303,8 +304,6 @@ export default { editor.on('input', () => { const newContent = editor.getContent(); vm.notizData.text = newContent; - //vm.text = newContent; - console.log('vm.text: ' + newContent); }); }, }); @@ -317,7 +316,10 @@ export default { this.getUid(); }, async mounted() { - this.initTinyMCE(); + if(this.showTinyMCE){ + this.initTinyMCE(); + } + await this.$p.loadCategory(['notiz','global']); let cm = this.$refs.table.tabulator.columnManager; @@ -353,11 +355,13 @@ export default { watch: { //watcher für Tinymce-Textfeld 'notizData.text': function (newVal) { - const tinymcsVal = this.editor.getContent(); + if(this.showTinyMCE) { + const tinymcsVal = this.editor.getContent(); - if (tinymcsVal != newVal) { - //Inhalt des Editors aktualisieren - this.editor.setContent(newVal); + if (tinymcsVal != newVal) { + //Inhalt des Editors aktualisieren + this.editor.setContent(newVal); + } } }, //Watcher für autocomplete Bearbeiter und Verfasser @@ -379,7 +383,9 @@ export default { } }, beforeDestroy() { - this.editor.destroy(); + if(this.showTinyMCE) { + this.editor.destroy(); + } }, template: `