From 9d809cf8439be3c1f848fc5a4230807550bb607c Mon Sep 17 00:00:00 2001 From: ma0068 Date: Mon, 21 Jul 2025 16:33:26 +0200 Subject: [PATCH] Tab Dokumente - Refactor Mapping for List Accepted for correct view Akzeptiertdatum and AkzeptiertVon - Delete Testoutputs dokument_kurzbz List NotAccpeted - Correct ColumnName for NachreichungAm - Change Order Columns Uploaddatum, akzeptiertVon --- .../api/frontend/v1/stv/Dokumente.php | 29 ++++++++++++------- .../models/crm/Dokumentprestudent_model.php | 2 ++ .../Details/Dokumente/List/Accepted.js | 6 ++-- .../Details/Dokumente/List/Unaccepted.js | 2 -- 4 files changed, 23 insertions(+), 16 deletions(-) diff --git a/application/controllers/api/frontend/v1/stv/Dokumente.php b/application/controllers/api/frontend/v1/stv/Dokumente.php index 686094620..18c976eb6 100644 --- a/application/controllers/api/frontend/v1/stv/Dokumente.php +++ b/application/controllers/api/frontend/v1/stv/Dokumente.php @@ -101,22 +101,29 @@ class Dokumente extends FHCAPI_Controller } } - //Array for total list of accepted documents - $newDataMap = []; - foreach ($arrayAccepted as $item) { - $newDataMap[] = (array)$item; + //Mapping with document_kurzbz + $preDocMap = []; + foreach ($resultPreDoc as $pre) { + $preDocMap[$pre->dokument_kurzbz] = $pre; } - $listExistingKurzbz = array_column($newDataMap, 'dokument_kurzbz'); + $mergedArray = []; + foreach ($arrayAccepted as $doc) { + $merged = clone $doc; - foreach ($resultPreDoc as $item) - { - if (!in_array($item->dokument_kurzbz, $listExistingKurzbz)) - { - $newDataMap[] = (array)$item; + if (isset($preDocMap[$doc->dokument_kurzbz])) { + $merged->docdatum = $preDocMap[$doc->dokument_kurzbz]->docdatum; + $merged->insertvonma = $preDocMap[$doc->dokument_kurzbz]->insertvonma; + $merged->bezeichnung = $preDocMap[$doc->dokument_kurzbz]->bezeichnung; + } else { + $merged->akzeptiertdatum = null; + $merged->akzeptiertvon = null; } + + $mergedArray[] = $merged; } - $this->terminateWithSuccess($newDataMap); + + $this->terminateWithSuccess($mergedArray); } public function deleteZuordnung($prestudent_id, $dokument_kurzbz) diff --git a/application/models/crm/Dokumentprestudent_model.php b/application/models/crm/Dokumentprestudent_model.php index 2415ee483..6b1c222a8 100644 --- a/application/models/crm/Dokumentprestudent_model.php +++ b/application/models/crm/Dokumentprestudent_model.php @@ -102,6 +102,8 @@ class Dokumentprestudent_model extends DB_Model $qry.=" AND (v.archivierbar = FALSE OR v.archivierbar IS NULL)"; } + $qry.=" ORDER BY d.bezeichnung ASC"; + return $this->execQuery($qry, $parametersArray); } } diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Dokumente/List/Accepted.js b/public/js/components/Stv/Studentenverwaltung/Details/Dokumente/List/Accepted.js index 673c41210..bca7e00fa 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Dokumente/List/Accepted.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Dokumente/List/Accepted.js @@ -42,7 +42,6 @@ export default { hour12: false }); }}, - {title: "Akzeptiertvon", field: "insertvonma"}, { title: "UploadDatum", field: "hochgeladenamum", formatter: function (cell) { @@ -57,6 +56,7 @@ export default { hour12: false }); }}, + {title: "Akzeptiertvon", field: "insertvonma"}, {title: "Kurzbz", field: "dokument_kurzbz", visible: false}, {title: "Prestudent ID", field: "prestudent_id", visible: false}, {title: "nachgereicht", field: "nachgereicht", visible: false, @@ -69,7 +69,7 @@ export default { {title: "infotext", field: "infotext"}, {title: "akte_id", field: "akte_id"}, {title: "dms_id", field: "dms_id", visible: false}, - {title: "titel", field: "titel_intern"}, + {title: "titel", field: "titel_intern", visible: false}, {title: "vorhanden", field: "vorhanden", formatter:"tickCross", hozAlign:"center", @@ -196,7 +196,7 @@ export default { title: this.$p.t('global', 'akte_id') }); cm.getColumnByField('nachgereicht_am').component.updateDefinition({ - title: this.$p.t('global', 'dokument') + title: this.$p.t('dokumente', 'nachreichungAm') }); } }, diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Dokumente/List/Unaccepted.js b/public/js/components/Stv/Studentenverwaltung/Details/Dokumente/List/Unaccepted.js index 21dec91e8..e1110ddf3 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Dokumente/List/Unaccepted.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Dokumente/List/Unaccepted.js @@ -349,8 +349,6 @@ export default { @click:new="actionUploadFile" >