From dc5368f346fc86656050cc6a913694920ea7bce0 Mon Sep 17 00:00:00 2001 From: ma0068 Date: Wed, 17 Jan 2024 13:23:52 +0100 Subject: [PATCH] =?UTF-8?q?Letzte=20=C3=84nderung?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controllers/components/stv/Notiz.php | 2 ++ application/models/person/Notiz_model.php | 21 ++++++++++++- public/js/components/Notiz/Notiz.js | 31 +++++++++++++++++-- .../Studentenverwaltung/Details/Notizen.js | 8 ++++- 4 files changed, 57 insertions(+), 5 deletions(-) diff --git a/application/controllers/components/stv/Notiz.php b/application/controllers/components/stv/Notiz.php index 1850a5609..82d494a16 100644 --- a/application/controllers/components/stv/Notiz.php +++ b/application/controllers/components/stv/Notiz.php @@ -61,6 +61,8 @@ class Notiz extends FHC_Controller $this->load->model('person/Notiz_model', 'NotizModel'); $this->NotizModel->addJoin('public.tbl_notiz_dokument', 'notiz_id', 'LEFT'); $this->NotizModel->addSelect('*'); + $this->NotizModel->addSelect("TO_CHAR(CASE WHEN public.tbl_notiz.updateamum >= public.tbl_notiz.insertamum + THEN public.tbl_notiz.updateamum ELSE public.tbl_notiz.insertamum END::timestamp, 'DD.MM.YYYY HH24:MI:SS') AS lastUpdate"); $this->NotizModel->addLimit(1); $result = $this->NotizModel->loadWhere( diff --git a/application/models/person/Notiz_model.php b/application/models/person/Notiz_model.php index 21c91884b..aac679915 100644 --- a/application/models/person/Notiz_model.php +++ b/application/models/person/Notiz_model.php @@ -266,9 +266,27 @@ class Notiz_model extends DB_Model */ public function getNotizWithDocEntries($id, $type) { + // ci query builder returns null +/* $this->db->select('n.*, count(dms_id) as countDoc, z.notizzuordnung_id'); + $this->db->select('(CASE WHEN n.updateamum >= n.insertamum THEN n.updateamum ELSE n.insertamum END) AS lastUpdate'); + $this->db->from('public.tbl_notiz n'); + $this->db->join('public.tbl_notizzuordnung z', 'n.notiz_id = z.notiz_id'); + $this->db->join('public.tbl_notiz_dokument dok', 'n.notiz_id = dok.notiz_id', 'left'); + $this->db->join('campus.tbl_dms_version', 'dok.notiz_id = campus.tbl_dms_version.dms_id', 'left'); + $this->db->where("z.$type", $id); + $this->db->group_by('n.notiz_id, z.notizzuordnung_id'); + + $query = $this->db->get(); + return $query->result();*/ + + $qry = " SELECT - n.*, count(dms_id) as countDoc, z.notizzuordnung_id + n.*, count(dms_id) as countDoc, z.notizzuordnung_id, + TO_CHAR (CASE + WHEN n.updateamum >= n.insertamum THEN n.updateamum + ELSE n.insertamum + END::timestamp, 'DD.MM.YYYY HH24:MI:SS') AS lastUpdate FROM public.tbl_notiz n JOIN @@ -284,6 +302,7 @@ class Notiz_model extends DB_Model "; return $this->execQuery($qry, array($id)); + } diff --git a/public/js/components/Notiz/Notiz.js b/public/js/components/Notiz/Notiz.js index be472de6d..3c1bbab27 100644 --- a/public/js/components/Notiz/Notiz.js +++ b/public/js/components/Notiz/Notiz.js @@ -13,6 +13,7 @@ export default { 'typeId', 'titel', 'text', + 'lastChange', 'von', 'bis', 'statusNew', @@ -49,6 +50,14 @@ export default { this.$emit('update:text', value); } }, +/* intLastChange: { + get() { + return this.lastChange; + }, + set(value) { + this.$emit('update:lastChange', value); + } + },*/ intVon: { get() { return this.von; @@ -142,6 +151,13 @@ export default { [{{this.typeId}}] + +
+
+

Neue Notiz

+

Notiz bearbeiten

+
+
@@ -156,6 +172,7 @@ export default {
+ @@ -179,7 +196,7 @@ export default { - +
- +
- + +
+ +
+ +

{{this.lastChange}}

+
+
+ ` diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Notizen.js b/public/js/components/Stv/Studentenverwaltung/Details/Notizen.js index 8e9917287..bbe03d785 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Notizen.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Notizen.js @@ -37,6 +37,7 @@ export default { {title: "Erledigt", field: "erledigt", visible: false}, {title: "Notiz_id", field: "notiz_id", visible: false}, {title: "Notizzuordnung_id", field: "notizzuordnung_id", visible: false}, + {title: "letzte Änderung", field: "lastupdate", visible: false}, { formatter: editIcon, cellClick: (e, cell) => { this.actionEditNotiz(cell.getData().notiz_id); @@ -66,6 +67,7 @@ export default { titel: null, statusNew: true, text: null, + lastChange: null, von: null, bis: null, document: null, @@ -93,6 +95,7 @@ export default { this.formData.titel = this.notizen.titel; this.formData.statusNew = false; this.formData.text = this.notizen.text; + this.formData.lastChange = this.notizen.lastupdate; this.formData.von = this.notizen.start; this.formData.bis = this.notizen.ende; this.formData.document = this.notizen.dms_id; @@ -115,6 +118,7 @@ export default { this.formData.titel = ''; this.formData.statusNew = true; this.formData.text = null; + this.formData.lastChange = null; this.formData.von = null; this.formData.bis = null; this.formData.document = null; @@ -212,6 +216,7 @@ export default { titel: null, statusNew: true, text: null, + lastChange: null, von: null, bis: null, document: null, @@ -299,6 +304,7 @@ export default { v-model:typeId="formData.typeId" v-model:titel="formData.titel" v-model:text="formData.text" + :lastChange="formData.lastChange" v-model:statusNew="formData.statusNew" v-model:von="formData.von" v-model:bis="formData.bis" @@ -312,7 +318,7 @@ export default { - + ` };