diff --git a/application/controllers/Cis/Profil.php b/application/controllers/Cis/Profil.php index c20fb9907..12585f4f5 100755 --- a/application/controllers/Cis/Profil.php +++ b/application/controllers/Cis/Profil.php @@ -367,7 +367,7 @@ class Profil extends Auth_Controller if ( - isSuccess($adresse_res = $this->AdresseModel->addSelect(["adresse_id","strasse", "tbl_adressentyp.bezeichnung as typ", "plz", "ort","zustelladresse"])) && + isSuccess($adresse_res = $this->AdresseModel->addSelect(["adresse_id","strasse", "tbl_adressentyp.bezeichnung as typ", "plz", "ort","zustelladresse","heimatadresse"])) && isSuccess($adresse_res = $this->AdresseModel->addOrder("zustelladresse", "DESC")) && isSuccess($adresse_res = $this->AdresseModel->addJoin("tbl_adressentyp", "typ=adressentyp_kurzbz")) ) { @@ -578,7 +578,7 @@ class Profil extends Auth_Controller if ( - isSuccess($adresse_res = $this->AdresseModel->addSelect(["adresse_id","strasse", "tbl_adressentyp.bezeichnung as typ", "plz", "ort","zustelladresse"])) && + isSuccess($adresse_res = $this->AdresseModel->addSelect(["adresse_id","strasse", "tbl_adressentyp.bezeichnung as typ", "plz", "ort","zustelladresse","heimatadresse"])) && isSuccess($adresse_res = $this->AdresseModel->addOrder("zustelladresse", "DESC")) && isSuccess($adresse_res = $this->AdresseModel->addJoin("tbl_adressentyp", "typ=adressentyp_kurzbz")) ) { diff --git a/application/controllers/Cis/ProfilUpdate.php b/application/controllers/Cis/ProfilUpdate.php index 93167a0b3..ba38ff0d2 100755 --- a/application/controllers/Cis/ProfilUpdate.php +++ b/application/controllers/Cis/ProfilUpdate.php @@ -213,19 +213,21 @@ class ProfilUpdate extends Auth_Controller public function insertProfilRequest() { + //! deprecated code + //? Name of user is now queried in the database table model Profil_update_model.php + /* $name = $this->PersonModel->getFullName($this->uid); + if(isError($name)){ + // error handling + var_dump($name); + return; + } */ $json = json_decode($this->input->raw_input_stream); $payload = $json->payload; $identifier = property_exists($json->payload,"kontakt_id")? "kontakt_id" : (property_exists($json->payload,"adresse_id")? "adresse_id" : null); - $name = $this->PersonModel->getFullName($this->uid); - if(isError($name)){ - // error handling - var_dump($name); - return; - } - $data = ["topic"=>$json->topic,"uid" => $this->uid, "name"=>getData($name), "requested_change" => json_encode($payload), "insertamum" => "NOW()", "insertvon"=>$this->uid,"status"=>"pending" ]; + $data = ["topic"=>$json->topic,"uid" => $this->uid, "requested_change" => json_encode($payload), "insertamum" => "NOW()", "insertvon"=>$this->uid,"status"=>"pending" ]; //? insert fileID in the dataset if sent with post request if(isset($json->fileID)){ $data['attachment_id'] = $json->fileID; diff --git a/application/models/person/Profil_update_model.php b/application/models/person/Profil_update_model.php index 05643af59..497da5621 100755 --- a/application/models/person/Profil_update_model.php +++ b/application/models/person/Profil_update_model.php @@ -51,7 +51,13 @@ class Profil_update_model extends DB_Model //? queries the tbl_profil_updates without permissions of the user public function getProfilUpdatesWhere($whereClause){ - + if(array_key_exists("uid",$whereClause)){ + $whereClause["public.tbl_profil_update.uid"]= $whereClause["uid"]; + unset($whereClause["uid"]); + } + $this->addSelect(["public.tbl_profil_update.*","public.tbl_person.vorname"]); + $this->addJoin("public.tbl_benutzer","public.tbl_benutzer.uid = public.tbl_profil_update.uid"); + $this->addJoin("public.tbl_person","public.tbl_person.person_id = public.tbl_benutzer.person_id"); $res = $this->loadWhere($whereClause); if(isError($res)){ return error("Could not load public.tbl_profil_update with whereClause"); @@ -86,10 +92,11 @@ class Profil_update_model extends DB_Model $parameters = []; $query=" SELECT - profil_update_id, uid, name, topic, requested_change, tbl_profil_update.updateamum, tbl_profil_update.updatevon, tbl_profil_update.insertamum, tbl_profil_update.insertvon, status, status_timestamp, status_message, attachment_id + profil_update_id, tbl_profil_update.uid, (tbl_person.vorname || ' ' || tbl_person.nachname) AS name , topic, requested_change, tbl_profil_update.updateamum, tbl_profil_update.updatevon, tbl_profil_update.insertamum, tbl_profil_update.insertvon, status, status_timestamp, status_message, attachment_id FROM public.tbl_profil_update JOIN public.tbl_student ON public.tbl_student.student_uid=public.tbl_profil_update.uid JOIN public.tbl_prestudent ON public.tbl_prestudent.prestudent_id=public.tbl_student.prestudent_id + JOIN public.tbl_person ON public.tbl_prestudent.person_id=public.tbl_person.person_id JOIN public.tbl_studiengang ON public.tbl_studiengang.studiengang_kz=public.tbl_prestudent.studiengang_kz JOIN public.tbl_organisationseinheit ON public.tbl_organisationseinheit.oe_kurzbz=public.tbl_studiengang.oe_kurzbz Where public.tbl_studiengang.oe_kurzbz IN ? "; @@ -110,8 +117,10 @@ class Profil_update_model extends DB_Model } } if($mitarbeiterBerechtigung) { - $this->addSelect(["profil_update_id", "uid", "name", "topic", "requested_change", "tbl_profil_update.updateamum", "tbl_profil_update.updatevon", "tbl_profil_update.insertamum", "tbl_profil_update.insertvon", "status", "status_timestamp", "status_message", "attachment_id"]); + $this->addSelect(["profil_update_id", "tbl_profil_update.uid", "(tbl_person.vorname || ' ' || tbl_person.nachname) AS name", "topic", "requested_change", "tbl_profil_update.updateamum", "tbl_profil_update.updatevon", "tbl_profil_update.insertamum", "tbl_profil_update.insertvon", "status", "status_timestamp", "status_message", "attachment_id"]); $this->addJoin('tbl_mitarbeiter','tbl_mitarbeiter.mitarbeiter_uid=tbl_profil_update.uid'); + $this->addJoin('tbl_benutzer','tbl_benutzer.uid=tbl_profil_update.uid'); + $this->addJoin('tbl_person','tbl_benutzer.person_id=tbl_person.person_id'); $mitarbeiterRequests = $this->loadWhere($whereClause); if(isError($mitarbeiterRequests)) return error("db error: ". getData($mitarbeiterRequests)); $mitarbeiterRequests = getData($mitarbeiterRequests)?:[]; diff --git a/public/js/apps/Cis/ProfilUpdateRequests.js b/public/js/apps/Cis/ProfilUpdateRequests.js index fb810652c..007a08f90 100755 --- a/public/js/apps/Cis/ProfilUpdateRequests.js +++ b/public/js/apps/Cis/ProfilUpdateRequests.js @@ -55,7 +55,7 @@ const app = Vue.createApp({ }, //? adds tooltip with the status message of a profil update request if its status is not pending columnDefaults: { - tooltip: function (e, cell, onRendered) { + tooltip: (e, cell, onRendered) =>{ //e - mouseover event //cell - cell component //onRendered - onRendered callback registration function @@ -68,7 +68,8 @@ const app = Vue.createApp({ let el = document.createElement("div"); el.classList.add("border", "border-dark"); - let statusDateEl = document.createElement("p"); + let statusDateEl = document.createElement("span"); + statusDateEl.classList.add("d-block","mb-1"); statusDateEl.innerHTML = "Request was " + status + " on " + statusDate; let statusMessageEl = document.createElement("span"); @@ -240,7 +241,7 @@ const app = Vue.createApp({ updateData: function (event) { this.$refs.UpdatesTable.tabulator.setData(); //? store the selected view in the session storage of the browser - sessionStorage.setItem("showAll", JSON.stringify(event.target.value)); + sessionStorage.setItem("showAll", event.target.value); }, }, mounted() { @@ -252,7 +253,7 @@ const app = Vue.createApp({ }, template: `