From 9bdee6d0f874f60fb8886a96c0bc74b6217f9d5e Mon Sep 17 00:00:00 2001 From: Cris Date: Tue, 28 Jan 2020 17:33:04 +0100 Subject: [PATCH 1/2] Corrected SQL query: now retrieving employees UID via tbl_mitarbeiter Some Lectors, who were assigned as Projektbetreuer, received an email on their (past) student-email-account. Now this is corrected. --- application/views/lehre/lehrauftrag/acceptLehrauftragData.php | 3 ++- application/views/lehre/lehrauftrag/approveLehrauftragData.php | 3 ++- application/views/lehre/lehrauftrag/orderLehrauftragData.php | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/application/views/lehre/lehrauftrag/acceptLehrauftragData.php b/application/views/lehre/lehrauftrag/acceptLehrauftragData.php index 704ce5861..2a9cc4245 100644 --- a/application/views/lehre/lehrauftrag/acceptLehrauftragData.php +++ b/application/views/lehre/lehrauftrag/acceptLehrauftragData.php @@ -182,7 +182,8 @@ FROM (SELECT uid FROM - public.tbl_benutzer + public.tbl_benutzer JOIN public.tbl_mitarbeiter ma + ON tbl_benutzer.uid = ma.mitarbeiter_uid WHERE person_id = tmp_projektbetreuung.person_id ORDER BY aktiv DESC, updateaktivam DESC -- accept inactive as some person_ids have no active, but order them last diff --git a/application/views/lehre/lehrauftrag/approveLehrauftragData.php b/application/views/lehre/lehrauftrag/approveLehrauftragData.php index 4db115626..1da65a0b8 100644 --- a/application/views/lehre/lehrauftrag/approveLehrauftragData.php +++ b/application/views/lehre/lehrauftrag/approveLehrauftragData.php @@ -187,7 +187,8 @@ FROM (SELECT uid FROM - public.tbl_benutzer + public.tbl_benutzer JOIN public.tbl_mitarbeiter ma + ON tbl_benutzer.uid = ma.mitarbeiter_uid WHERE person_id = tmp_projektbetreuung.person_id ORDER BY aktiv DESC, updateaktivam DESC -- accept inactive as some person_ids have no active, but order them last diff --git a/application/views/lehre/lehrauftrag/orderLehrauftragData.php b/application/views/lehre/lehrauftrag/orderLehrauftragData.php index 66468e541..afe41b641 100644 --- a/application/views/lehre/lehrauftrag/orderLehrauftragData.php +++ b/application/views/lehre/lehrauftrag/orderLehrauftragData.php @@ -219,7 +219,8 @@ FROM (SELECT uid FROM - public.tbl_benutzer + public.tbl_benutzer JOIN public.tbl_mitarbeiter ma + ON tbl_benutzer.uid = ma.mitarbeiter_uid WHERE person_id = tmp_projektbetreuung.person_id ORDER BY aktiv DESC, updateaktivam DESC -- accept inactive as some person_ids have no active, but order them last From 98bb9987da518fc5fe4ee5e4635e5e1c637afc6e Mon Sep 17 00:00:00 2001 From: Cris Date: Wed, 29 Jan 2020 09:55:59 +0100 Subject: [PATCH 2/2] Now inkludierte Lehre also checking former (past) BIS Verwendungen MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This allows display of column 'Betrag' in Lehraufträge annehmen. (Important for external lectors, who want to see Betrag of their new Lehrauftraege. They usually don't have active BIS Verwendung at the beginning of each term, therefor last (past) BIS Verwendung needs to be checked) --- .../lehre/lehrauftrag/LehrauftragAkzeptieren.php | 4 ++-- application/models/codex/Bisverwendung_model.php | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/application/controllers/lehre/lehrauftrag/LehrauftragAkzeptieren.php b/application/controllers/lehre/lehrauftrag/LehrauftragAkzeptieren.php index dfb1390d3..b2282f6f2 100644 --- a/application/controllers/lehre/lehrauftrag/LehrauftragAkzeptieren.php +++ b/application/controllers/lehre/lehrauftrag/LehrauftragAkzeptieren.php @@ -184,14 +184,14 @@ class LehrauftragAkzeptieren extends Auth_Controller } /** - * Check if lectors latest active Verwendung has inkludierte Lehre + * Check if lectors latest Verwendung has inkludierte Lehre * - inkludierte_lehre is null OR 0: freelancer lector -> has NO inkludierte Lehre * - inkludierte_lehre -1: fix employed lector -> has inkludierte Lehre (all inclusive) * - inkludierte_lehre > 0: fix employed lector -> has inkludierte Lehre (value is amount of hours included) */ public function checkInkludierteLehre() { - $result = $this->BisverwendungModel->getLast($this->_uid); + $result = $this->BisverwendungModel->getLast($this->_uid, false); if (hasData($result)) { diff --git a/application/models/codex/Bisverwendung_model.php b/application/models/codex/Bisverwendung_model.php index 20f942865..707e8af36 100644 --- a/application/models/codex/Bisverwendung_model.php +++ b/application/models/codex/Bisverwendung_model.php @@ -15,7 +15,7 @@ class Bisverwendung_model extends DB_Model /** * Get latest (active) Verwendung of the user. * @param string $uid - * @param bool $active If false, returns latest Verwendung no matter if actual or not (ignores ending/beginning date). + * @param bool $active If false, returns latest Verwendung no matter if it is still actual. * @return array */ public function getLast($uid, $active = true) @@ -28,14 +28,14 @@ class Bisverwendung_model extends DB_Model mitarbeiter_uid = '. $this->escape($uid). ' AND ( beginn <= NOW() OR beginn IS NULL ) AND ( ende >= NOW() OR ende IS NULL ) - ORDER BY ende DESC NULLS LAST, beginn DESC NULLS LAST + ORDER BY ende DESC NULLS FIRST, beginn DESC NULLS LAST '; } else { $condition = ' mitarbeiter_uid = '. $this->escape($uid). ' - ORDER BY ende DESC NULLS LAST, beginn DESC NULLS LAST + ORDER BY ende DESC NULLS FIRST, beginn DESC NULLS LAST '; }