diff --git a/application/controllers/components/stv/Notiz.php b/application/controllers/components/stv/Notiz.php index cdb15d9d3..28dcb33ef 100644 --- a/application/controllers/components/stv/Notiz.php +++ b/application/controllers/components/stv/Notiz.php @@ -48,7 +48,6 @@ class Notiz extends FHC_Controller $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR); $this->outputJson($result); } - elseif (!hasData($result)) { $this->outputJson($result); //success mit Wert null // $this->outputJson(getData($result) ?: []); @@ -158,9 +157,6 @@ class Notiz extends FHC_Controller } - - - //$result = $this->NotizModel->addNotizForType($type, $id, $titel, $text, $uid, $dms_id, $start, $ende, $erledigt, $verfasser_uid, $bearbeiter_uid); /* $result = $this->NotizModel->addNotizForPerson($id, $titel, $text, $erledigt, $verfasser_uid); @@ -172,7 +168,7 @@ class Notiz extends FHC_Controller return $this->outputJsonSuccess(true); } - public function updateNotiz($notiz_id) + public function updateNotizOldVersion($notiz_id) { $uid = getAuthUID(); $this->load->library('form_validation'); @@ -205,6 +201,63 @@ class Notiz extends FHC_Controller + $result = $this->NotizModel->update( + [ + 'notiz_id' => $notiz_id + ], + [ + 'titel' => $titel, + 'updatevon' => $uid, + 'updateamum' => date('c'), + 'text' => $text, + 'verfasser_uid' => $verfasser_uid, + 'bearbeiter_uid' => $bearbeiter_uid, + 'start' => $start, + 'ende' => $ende, + 'erledigt' => $erledigt + ] + ); + + if (isError($result)) + { + $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR); + return $this->outputJson(getError($result)); + } + return $this->outputJsonSuccess(true); + } + + public function updateNotiz($notiz_id) + { + $uid = getAuthUID(); + $this->load->library('form_validation'); + //$_POST = json_decode($this->input->raw_input_stream, true); + /* $this->form_validation->set_rules('titel', 'titel', 'required'); + $this->form_validation->set_rules('text', 'Text', 'required'); + + if ($this->form_validation->run() == false) + { + return $this->outputJsonError($this->form_validation->error_array()); + }*/ + + $this->load->model('person/Notiz_model', 'NotizModel'); + + if(!$notiz_id) + { + return $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR); + } + + $uid = getAuthUID(); + $titel = $this->input->post('titel'); + $text = $this->input->post('text'); + $verfasser_uid = isset($_POST['verfasser_uid']) ? $_POST['verfasser_uid'] : null; + $bearbeiter_uid = $uid; + $erledigt = $this->input->post('erledigt'); + $type = $this->input->post('typeId'); + $start = $this->input->post(date('von')); + $ende = $this->input->post(date('bis')); + + + $result = $this->NotizModel->update( [ 'notiz_id' => $notiz_id @@ -298,8 +351,7 @@ class Notiz extends FHC_Controller { $this->load->model('person/Notiz_model', 'NotizModel'); - //TODO(manu) check, ob mehr Dateien bzw. -versionen - //warum nur ein Eintrag??? + $this->NotizModel->addSelect('campus.tbl_dms_version.*'); $this->NotizModel->addJoin('public.tbl_notiz_dokument','ON (public.tbl_notiz_dokument.notiz_id = public.tbl_notiz.notiz_id)'); diff --git a/application/models/person/Notiz_model.php b/application/models/person/Notiz_model.php index 17cf9a140..7e7ffbe32 100644 --- a/application/models/person/Notiz_model.php +++ b/application/models/person/Notiz_model.php @@ -180,6 +180,8 @@ class Notiz_model extends DB_Model return $result; } + + /** * Add a Notiz for a given person with DMS_id */ @@ -244,6 +246,7 @@ class Notiz_model extends DB_Model * @param $person_id */ //Todo(Manu) rewrite in CI-Style + //Todo(Manu) auf andere types erweitern public function getNotizWithDocEntries($id) { $type = 'writeFunction'; @@ -267,6 +270,7 @@ class Notiz_model extends DB_Model notiz_id, z.notizzuordnung_id "; + return $this->execQuery($qry, array($id)); } diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Notizen.js b/public/js/components/Stv/Studentenverwaltung/Details/Notizen.js index 5d618592b..0dd0c9ce0 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Notizen.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Notizen.js @@ -52,7 +52,7 @@ export default { ], layout: 'fitDataFill', layoutColumnsOnNewData: false, - height: '150', + height: '200', selectable: true, index: 'notiz_id' }, @@ -96,6 +96,7 @@ export default { this.formData.erledigt = this.notizen.erledigt; this.formData.verfasser = this.notizen.verfasser_uid; this.formData.bearbeiter = this.notizen.bearbeiter_uid; + this.formData.anhang = this.notizen.anhang; if(this.notizen.dms_id){ console.log("loadEntries"); this.loadDocEntries(this.notizen.notiz_id); @@ -107,7 +108,7 @@ export default { this.resetFormData(); this.formData.typeId = 'person_id'; this.formData.titel = ''; - this.formData.action = 'Neue Notiz2'; + this.formData.action = 'Neue Notiz'; this.formData.text = null; this.formData.von = null; this.formData.bis = null;