From 5488bfbc28cfba7c6c3769600e3b415700efbbb6 Mon Sep 17 00:00:00 2001 From: Cris Date: Tue, 12 Nov 2019 17:42:51 +0100 Subject: [PATCH 01/21] Amended 'Hilfe zu dieser Seite' information for Lehrauftrag akzeptieren Added information about filter and selection. --- .../lehre/lehrauftrag/acceptLehrauftrag.php | 39 ++++++++++++++++--- 1 file changed, 34 insertions(+), 5 deletions(-) diff --git a/application/views/lehre/lehrauftrag/acceptLehrauftrag.php b/application/views/lehre/lehrauftrag/acceptLehrauftrag.php index 951dbfadf..5d1924c92 100644 --- a/application/views/lehre/lehrauftrag/acceptLehrauftrag.php +++ b/application/views/lehre/lehrauftrag/acceptLehrauftrag.php @@ -48,23 +48,52 @@ $this->load->view(

Wie nehme ich Lehraufträge an?

-

Sobald Ihnen ein oder mehrere Lehraufträge erteilt wurden, können Sie diese annehmen.

  1. Klicken Sie unten auf das Status-Icon 'Nur erteilte anzeigen' oder 'Alle anzeigen'
  2. -
  3. Wählen Sie einzelne Lehraufträge mit Klick auf die Zeilen oder alle über den Button 'Alle auswählen'.
  4. +
  5. Wählen Sie die Lehraufträge, die Sie annehmen möchten, selbst oder alle über den Button 'Alle auswählen'.
  6. Geben Sie Ihr CIS-Passwort ein und klicken auf Lehrauftrag annehmen.
-


+

Warum kann ich manche Lehraufträge nicht auswählen?

-

Nur Lehraufträge mit dem Status 'erteilt' können gewählt werden.
Angenommene Lehraufträge oder Lehraufträge in Bearbeitung werden nur zu Ihrer Information angezeigt. -

+
+ +

Filter

+
+
+ + + + + + + + + + + + + +
Alle
Alle Lehraufträge mit jedem Status
Bestellt
Nur bestellte UND bestellte Lehraufträge, die in Bearbeitung sind
Erteilt
Nur erteilte UND geänderte Lehraufträge, die in Bearbeitung sind
Angenommen
Nur von Ihnen angenommene Lehraufträge
+
+
+
+ +

Auswahl

+
+
    +
  • Einzeln auswählen: Strg + Klick auf einzelne Zeile(n)
  • +
  • Bereich auswählen: Shift + Klick auf Anfangs- und Endzeile
  • +
  • Alle auswählen: Button 'Alle auswählen'
  • +
+
+
From 7bc8255787244b6a7611019818100dccbdb9baac Mon Sep 17 00:00:00 2001 From: Cris Date: Tue, 12 Nov 2019 17:51:18 +0100 Subject: [PATCH 02/21] Added fixed column width to all betrag- and all status-columns --- .../lehre/lehrauftrag/acceptLehrauftragData.php | 12 ++++++------ .../lehre/lehrauftrag/approveLehrauftragData.php | 8 ++++---- .../views/lehre/lehrauftrag/orderLehrauftragData.php | 8 ++++---- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/application/views/lehre/lehrauftrag/acceptLehrauftragData.php b/application/views/lehre/lehrauftrag/acceptLehrauftragData.php index 0999d7ae6..caa221685 100644 --- a/application/views/lehre/lehrauftrag/acceptLehrauftragData.php +++ b/application/views/lehre/lehrauftrag/acceptLehrauftragData.php @@ -357,14 +357,14 @@ $filterWidgetArray = array( orgform_kurzbz: {headerFilter:"input"}, person_id: {visible: false}, typ: {headerFilter:"input", width: "7%"}, - auftrag: {headerFilter:"input", width: "23%"}, + auftrag: {headerFilter:"input", width: "15%"}, semester: {headerFilter:"input"}, - lv_oe_kurzbz: {headerFilter:"input", width: "12%"}, + lv_oe_kurzbz: {headerFilter:"input", width: "8%"}, gruppe: {headerFilter:"input", width: "5%"}, stunden: {align:"right", formatter: form_formatNulltoStringNumber, formatterParams:{precision:1}, headerFilter:"input", headerFilterFunc: hf_filterStringnumberWithOperator, bottomCalc:"sum", bottomCalcParams:{precision:1}, width: "5%"}, - betrag: {align:"right", formatter: form_formatNulltoStringNumber, + betrag: {align:"right", width: "6%", formatter: form_formatNulltoStringNumber, headerFilter:"input", headerFilterFunc: hf_filterStringnumberWithOperator, bottomCalc:"sum", bottomCalcParams:{precision:2}, bottomCalcFormatter:"money", bottomCalcFormatterParams:{decimal: ",", thousand: ".", symbol:"€"}, width: "8%"}, @@ -372,9 +372,9 @@ $filterWidgetArray = array( vertrag_stunden: {visible: false}, vertrag_betrag: {visible: false}, mitarbeiter_uid: {visible: false}, - bestellt: {align:"center", headerFilter:"input", mutator: mut_formatStringDate, tooltip: bestellt_tooltip}, - erteilt: {align:"center", headerFilter:"input", mutator: mut_formatStringDate, tooltip: erteilt_tooltip}, - akzeptiert: {align:"center", headerFilter:"input", mutator: mut_formatStringDate, tooltip: akzeptiert_tooltip}, + bestellt: {align:"center", headerFilter:"input", mutator: mut_formatStringDate, tooltip: bestellt_tooltip, width: "8%"}, + erteilt: {align:"center", headerFilter:"input", mutator: mut_formatStringDate, tooltip: erteilt_tooltip, width: "8%"}, + akzeptiert: {align:"center", headerFilter:"input", mutator: mut_formatStringDate, tooltip: akzeptiert_tooltip, width: "8%"}, bestellt_von: {visible: false}, erteilt_von: {visible: false}, akzeptiert_von: {visible: false} diff --git a/application/views/lehre/lehrauftrag/approveLehrauftragData.php b/application/views/lehre/lehrauftrag/approveLehrauftragData.php index 616450a5c..da472a680 100644 --- a/application/views/lehre/lehrauftrag/approveLehrauftragData.php +++ b/application/views/lehre/lehrauftrag/approveLehrauftragData.php @@ -385,16 +385,16 @@ $filterWidgetArray = array( stunden: {align:"right", formatter: form_formatNulltoStringNumber, formatterParams:{precision:1}, headerFilter:"input", headerFilterFunc: hf_filterStringnumberWithOperator, bottomCalc:"sum", bottomCalcParams:{precision:1}}, - betrag: {align:"right", formatter: form_formatNulltoStringNumber, + betrag: {align:"right", width: "8%", formatter: form_formatNulltoStringNumber, headerFilter:"input", headerFilterFunc: hf_filterStringnumberWithOperator, bottomCalc:"sum", bottomCalcParams:{precision:2}, bottomCalcFormatter:"money", bottomCalcFormatterParams:{decimal: ",", thousand: ".", symbol:"€"}}, vertrag_id: {visible: false}, vertrag_stunden: {visible: false}, vertrag_betrag: {visible: false}, mitarbeiter_uid: {visible: false}, - bestellt: {align:"center", headerFilter:"input", mutator: mut_formatStringDate, tooltip: bestellt_tooltip}, - erteilt: {align:"center", headerFilter:"input", mutator: mut_formatStringDate, tooltip: erteilt_tooltip}, - akzeptiert: {align:"center", headerFilter:"input", mutator: mut_formatStringDate, tooltip: akzeptiert_tooltip}, + bestellt: {align:"center", headerFilter:"input", mutator: mut_formatStringDate, tooltip: bestellt_tooltip, width: "8%"}, + erteilt: {align:"center", headerFilter:"input", mutator: mut_formatStringDate, tooltip: erteilt_tooltip, width: "8%"}, + akzeptiert: {align:"center", headerFilter:"input", mutator: mut_formatStringDate, tooltip: akzeptiert_tooltip, width: "8%"}, bestellt_von: {visible: false}, erteilt_von: {visible: false}, akzeptiert_von: {visible: false}, diff --git a/application/views/lehre/lehrauftrag/orderLehrauftragData.php b/application/views/lehre/lehrauftrag/orderLehrauftragData.php index 2abf658e8..0373a2193 100644 --- a/application/views/lehre/lehrauftrag/orderLehrauftragData.php +++ b/application/views/lehre/lehrauftrag/orderLehrauftragData.php @@ -390,7 +390,7 @@ $filterWidgetArray = array( headerFilter:"input", headerFilterFunc: hf_filterStringnumberWithOperator, bottomCalc:"sum", bottomCalcParams:{precision:1}}, stundensatz: {visible: false}, - betrag: {align:"right", formatter: form_formatNulltoStringNumber, + betrag: {align:"right", width: "8%", formatter: form_formatNulltoStringNumber, headerFilter:"input", headerFilterFunc: hf_filterStringnumberWithOperator, bottomCalc:"sum", bottomCalcParams:{precision:2}, bottomCalcFormatter:"money", bottomCalcFormatterParams:{decimal: ",", thousand: ".", symbol:"€"}}, @@ -398,9 +398,9 @@ $filterWidgetArray = array( vertrag_stunden: {visible: false}, vertrag_betrag: {visible: false}, mitarbeiter_uid: {visible: false}, - bestellt: {align:"center", headerFilter:"input", mutator: mut_formatStringDate, tooltip: bestellt_tooltip}, - erteilt: {align:"center", headerFilter:"input", mutator: mut_formatStringDate, tooltip: erteilt_tooltip}, - akzeptiert: {align:"center", headerFilter:"input", mutator: mut_formatStringDate, tooltip: akzeptiert_tooltip}, + bestellt: {align:"center", headerFilter:"input", mutator: mut_formatStringDate, tooltip: bestellt_tooltip, width: "8%"}, + erteilt: {align:"center", headerFilter:"input", mutator: mut_formatStringDate, tooltip: erteilt_tooltip, width: "8%"}, + akzeptiert: {align:"center", headerFilter:"input", mutator: mut_formatStringDate, tooltip: akzeptiert_tooltip, width: "8%"}, bestellt_von: {visible: false}, erteilt_von: {visible: false}, akzeptiert_von: {visible: false}, From 4da3062c00179dd21212925d4ff39bb201b9528a Mon Sep 17 00:00:00 2001 From: Cris Date: Mon, 25 Nov 2019 08:38:01 +0100 Subject: [PATCH 03/21] Added LV-ID to group-header title --- public/js/lehre/lehrauftrag/approveLehrauftrag.js | 2 +- public/js/lehre/lehrauftrag/orderLehrauftrag.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/public/js/lehre/lehrauftrag/approveLehrauftrag.js b/public/js/lehre/lehrauftrag/approveLehrauftrag.js index 2cc42abd0..da3697adf 100644 --- a/public/js/lehre/lehrauftrag/approveLehrauftrag.js +++ b/public/js/lehre/lehrauftrag/approveLehrauftrag.js @@ -96,7 +96,7 @@ function func_initialFilter(){ // ----------------------------------------------------------------------------------------------------------------- // Formats the group header function func_groupHeader(data){ - return data[0].lv_bezeichnung; // change name to lehrveranstaltung + return data[0].lv_bezeichnung + "  " + ' ( LV-ID: ' + data[0].lehrveranstaltung_id + ' )'; // change name to lehrveranstaltung; }; // Formats the rows diff --git a/public/js/lehre/lehrauftrag/orderLehrauftrag.js b/public/js/lehre/lehrauftrag/orderLehrauftrag.js index dfcc46636..d27da0e4e 100644 --- a/public/js/lehre/lehrauftrag/orderLehrauftrag.js +++ b/public/js/lehre/lehrauftrag/orderLehrauftrag.js @@ -100,9 +100,9 @@ function func_dataLoaded(data, table){ // Tabulator table format functions // ----------------------------------------------------------------------------------------------------------------- // Formats the group header -function func_groupHeader(data){ - return data[0].lv_bezeichnung; // change name to lehrveranstaltung -}; +function func_groupHeader(data) { + return data[0].lv_bezeichnung + "  " + ' ( LV-ID: ' + data[0].lehrveranstaltung_id + ' )'; // change name to lehrveranstaltung; +} // Formats the rows function func_rowFormatter(row){ From df555426a0a070959dcd551f048c87f67417976e Mon Sep 17 00:00:00 2001 From: Cris Date: Mon, 25 Nov 2019 08:39:53 +0100 Subject: [PATCH 04/21] Changed: column STG-type is visible now --- application/views/lehre/lehrauftrag/approveLehrauftragData.php | 2 +- application/views/lehre/lehrauftrag/orderLehrauftragData.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/application/views/lehre/lehrauftrag/approveLehrauftragData.php b/application/views/lehre/lehrauftrag/approveLehrauftragData.php index da472a680..59964a955 100644 --- a/application/views/lehre/lehrauftrag/approveLehrauftragData.php +++ b/application/views/lehre/lehrauftrag/approveLehrauftragData.php @@ -373,7 +373,7 @@ $filterWidgetArray = array( projektarbeit_id: {visible: false}, studiensemester_kurzbz: {headerFilter:"input"}, studiengang_kz: {visible: false}, - stg_typ_kurzbz: {visible: false}, + stg_typ_kurzbz: {headerFilter:"input", width: "5%"}, orgform_kurzbz: {headerFilter:"input"}, person_id: {visible: false}, typ: {headerFilter:"input"}, diff --git a/application/views/lehre/lehrauftrag/orderLehrauftragData.php b/application/views/lehre/lehrauftrag/orderLehrauftragData.php index 0373a2193..9c3437599 100644 --- a/application/views/lehre/lehrauftrag/orderLehrauftragData.php +++ b/application/views/lehre/lehrauftrag/orderLehrauftragData.php @@ -377,7 +377,7 @@ $filterWidgetArray = array( projektarbeit_id: {visible: false}, studiensemester_kurzbz: {headerFilter:"input"}, studiengang_kz: {visible: false}, - stg_typ_kurzbz: {visible: false}, + stg_typ_kurzbz: {headerFilter:"input", width: "5%"}, orgform_kurzbz: {headerFilter:"input"}, person_id: {visible: false}, typ: {headerFilter:"input"}, From ea09dfda58f7efbb4c77a12d900123e65eefd559 Mon Sep 17 00:00:00 2001 From: Cris Date: Mon, 25 Nov 2019 08:43:46 +0100 Subject: [PATCH 05/21] =?UTF-8?q?Optimized=20text=20of=20'Hilfe=20f=C3=BCr?= =?UTF-8?q?=20diese=20Seite'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added information for lectors page. Some minor text enhancements to avoid misunderstanding. --- application/views/lehre/lehrauftrag/approveLehrauftrag.php | 2 +- application/views/lehre/lehrauftrag/orderLehrauftrag.php | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/application/views/lehre/lehrauftrag/approveLehrauftrag.php b/application/views/lehre/lehrauftrag/approveLehrauftrag.php index 61cdd124d..71c1840c6 100644 --- a/application/views/lehre/lehrauftrag/approveLehrauftrag.php +++ b/application/views/lehre/lehrauftrag/approveLehrauftrag.php @@ -116,7 +116,7 @@ $this->load->view( Bestellt
Nur bestellte UND geänderte bestellte Lehraufträge Erteilt
Nur erteilte UND geänderte erteilte Lehraufträge Angenommen
Nur vom Lehrenden angenommene Lehraufträge - Geändert
Nur geänderte Lehraufträge, die den Status 'bestellt' oder 'erteilt' haben + Geändert
Nur Lehraufträge, die geändert wurden, nachdem sie bereits bestellt oder erteilt worden sind Dummies
Nur Lehraufträge, die mit einem Dummylektor angelegt sind diff --git a/application/views/lehre/lehrauftrag/orderLehrauftrag.php b/application/views/lehre/lehrauftrag/orderLehrauftrag.php index abcb3dbc4..8938a305c 100644 --- a/application/views/lehre/lehrauftrag/orderLehrauftrag.php +++ b/application/views/lehre/lehrauftrag/orderLehrauftrag.php @@ -86,6 +86,7 @@ $this->load->view(

Geänderte Lehraufträge

Im FAS können Änderungen an Stunden/Stundensatz eines Lehrauftrags durchgeführt werden, solange dieser nicht vom Lehrenden angenommen wurde.
+ Diese müssen dann erneut bestellt werden.

Wenn Änderungen an bereits bestellten oder erteilten Lehraufträgen vorgenommen wurden, werden diese in einem tooltip angezeigt.
Fahren Sie dazu mit der Maus über dem Status-Icon am Beginn der Zeile.
@@ -117,7 +118,7 @@ $this->load->view( Bestellt
Nur bestellte UND geänderte bestellte Lehraufträge Erteilt
Nur erteilte UND geänderte erteilte Lehraufträge Angenommen
Nur vom Lehrenden angenommene Lehraufträge - Geändert
Nur geänderte Lehraufträge, die den Status 'bestellt' oder 'erteilt' haben + Geändert
Nur Lehraufträge, die geändert wurden, nachdem sie bereits bestellt oder erteilt worden sind Dummies
Nur Lehraufträge, die mit einem Dummylektor angelegt sind From 0a335b7627e737847dbfb1b493acde5d974366a0 Mon Sep 17 00:00:00 2001 From: Cris Date: Mon, 25 Nov 2019 08:46:31 +0100 Subject: [PATCH 06/21] Added cronjob mailLehrauftraegeToApprove() This daily job sends information about all lehr-/projektauftraege ordered (and not approved) the day bofore. Receivers: Department-/Kompetenzfeldleiter --- .../controllers/jobs/LehrauftragJob.php | 426 ++++++++++++++++++ 1 file changed, 426 insertions(+) create mode 100644 application/controllers/jobs/LehrauftragJob.php diff --git a/application/controllers/jobs/LehrauftragJob.php b/application/controllers/jobs/LehrauftragJob.php new file mode 100644 index 000000000..780c592e1 --- /dev/null +++ b/application/controllers/jobs/LehrauftragJob.php @@ -0,0 +1,426 @@ +load->model('accounting/Vertrag_model', 'VertragModel'); + $this->load->model('accounting/Vertragvertragsstatus_model', 'VertragvertragsstatusModel'); + $this->load->model('education/Lehrveranstaltung_model', 'LehrveranstaltungModel'); + $this->load->model('person/Benutzerfunktion_model', 'BenutzerfunktionModel'); + $this->load->model('system/Benutzerrolle_model', 'BenutzerrolleModel'); + + // Load libraries + $this->load->library('PermissionLib'); + + // Load helpers + $this->load->helper('hlp_sancho_helper'); + } + + /** + * This daily job sends information about all lehr-/projektauftraege ordered (and not approved) the day bofore. + * Receivers: Department-/Kompetenzfeldleiter + **/ + public function mailLehrauftraegeToApprove() + { + // Get vertrag_ids of lehrauftraege that had been ordered and had NOT been approved or cancelled YESTERDAY + $this->VertragvertragsstatusModel->addSelect('vertrag_id'); + $result = $this->VertragvertragsstatusModel->getOrdered_fromDate('YESTERDAY'); + + // Get lehrveranstaltung_ids and studiensemester of the lehr-/or projektauftrag contracts + $lehreinheit_data_arr = array(); + if ($vertrag_arr = getData($result)) + { + foreach ($vertrag_arr as $vertrag) + { + $result = $this->VertragModel->getLehreinheitData($vertrag->vertrag_id, 'lehrveranstaltung_id, studiensemester_kurzbz'); + + if (hasData($result)) + { + $obj = new StdClass(); + $obj->lehrveranstaltung_id = $result->retval[0]->lehrveranstaltung_id; + $obj->studiensemester_kurzbz = $result->retval[0]->studiensemester_kurzbz; + $lehreinheit_data_arr []= $obj; + } + } + } + + /** + * Build the data array to be used in the email. Data array is clustered as follows: + * Array + * [studiensemester_kurzbz] // studiensemester of lehreinheit + * Array + * [oe_kurzbz] // oe of lehreinheits lehrveranstaltung + * [oe_bezeichnung] + * Array + * [stg_kz] // stg of lehreinheits lehrveranstaltung + * [stg_kurzbz] + * [stg_bezeichnung] + * [amount] // amount of new ordered lehrauftraege of that stg + */ + $data_arr = array(); + foreach ($lehreinheit_data_arr as $lehreinheit_data) + { + $result = $this->_getLVData($lehreinheit_data->lehrveranstaltung_id); + + if (hasData($result)) + { + // Search if studiensemester exists in data_arr + $ss_index = array_search($lehreinheit_data->studiensemester_kurzbz, array_column($data_arr, 'studiensemester_kurzbz')); + + // If studiensemester is new, add studienesemester, oe and stg + if ($ss_index === false) + { + $data = array( + 'studiensemester_kurzbz' => $lehreinheit_data->studiensemester_kurzbz + ); + + $data []= array( + 'oe_kurzbz' => $result->retval[0]->oe_kurzbz, + 'oe_bezeichnung' => $result->retval[0]->lv_oe_bezeichnung + ); + + // Add stg data to oe, start amount with 1 + $data[0][] = array( + 'stg_kz' => $result->retval[0]->studiengang_kz, + 'stg_kurzbz' => strtoupper($result->retval[0]->stg_typ. $result->retval[0]->stg_kurzbz), + 'stg_bezeichnung' => $result->retval[0]->lv_stg_bezeichnung, + 'amount' => 1 + ); + + // Push to final data_arr + $data_arr []= $data; + } + // Else if studiensemester exists + else + { + // Search if oe exists inside existing studiensemester of data_arr + $oe_index = array_search($result->retval[0]->oe_kurzbz, array_column($data_arr[$ss_index], 'oe_kurzbz')); + + // If oe is new, add oe and stg to studiensemester + if ($oe_index === false) + { + // Add oe data + $data_arr[$ss_index][] = array( + 'oe_kurzbz' => $result->retval[0]->oe_kurzbz, + 'oe_bezeichnung' => $result->retval[0]->lv_oe_bezeichnung, + + // Add stg data to oe, start amount with 1 + array( + 'stg_kz' => $result->retval[0]->studiengang_kz, + 'stg_kurzbz' => strtoupper($result->retval[0]->stg_typ. $result->retval[0]->stg_kurzbz), + 'stg_bezeichnung' => $result->retval[0]->lv_stg_bezeichnung, + 'amount' => 1 + ) + ); + } + // Else if oe exists + else + { + // Search if stg exists inside existing oe of data_arr + $stg_index = array_search($result->retval[0]->studiengang_kz, array_column($data_arr[$ss_index][$oe_index], 'stg_kz')); + + // If stg is new, add stg to oe, start amount with 1 + if ($stg_index === false) + { + $data_arr[$ss_index][$oe_index][] = array( + 'stg_kz' => $result->retval[0]->studiengang_kz, + 'stg_kurzbz' => strtoupper($result->retval[0]->stg_typ. $result->retval[0]->stg_kurzbz), + 'stg_bezeichnung' => $result->retval[0]->lv_stg_bezeichnung, + 'amount' => 1 + ); + } + // Else if stg exists + else + { + // Increase amount +1 + $data_arr[$ss_index][$oe_index][$stg_index]['amount'] = $data_arr[$ss_index][$oe_index][$stg_index]['amount'] + 1; + } + } + } + } + } + + /** + * Cluster data by uid of entitled mail receivers. + * Returning array is clustered as follows: + * Array + * [uid] + * Array + * [studiensemester_kurzbz] // studiensemester of lehreinheit + * Array + * [oe_kurzbz] // oe of lehreinheits lehrveranstaltung + * [oe_bezeichnung] + * Array + * [stg_kz] // stg of lehreinheits lehrveranstaltung + * [stg_kurzbz] + * [stg_bezeichnung] + * [amount] // amount of new ordered lehrauftraege of that stg + */ + $data_arr = $this->_clusterData_byReceiver($data_arr); + + // Send email + if(!$this->_sendMail($data_arr)) + { + $this->logError('Fehler beim Mailversand in Job MailLehrauftragToApprove'); + } + } + + /** + * This daily job sends information about all lehr-/projektauftraege approved the day bofore. + * Receivers: lectors + **/ + public function mailLehrauftraegeToAccept() + { + + } + + //****************************************************************************************************************** + // PRIVATE FUNCTIONS + //****************************************************************************************************************** + + /** + * Get data of given lehrveranstaltung. + * @param $lehrveranstaltung_id + * @return mixed + */ + private function _getLVData($lehrveranstaltung_id) + { + $this->LehrveranstaltungModel->addSelect(' + tbl_lehrveranstaltung.oe_kurzbz, + oe.bezeichnung AS "lv_oe_bezeichnung", + tbl_lehrveranstaltung.studiengang_kz, + stg.bezeichnung AS "lv_stg_bezeichnung", + stg.typ AS "stg_typ", + stg.kurzbz AS "stg_kurzbz" + '); + + $this->LehrveranstaltungModel->addJoin('lehre.tbl_studienplan_lehrveranstaltung stpllv', 'lehrveranstaltung_id'); + $this->LehrveranstaltungModel->addJoin('lehre.tbl_studienplan stpl', 'studienplan_id'); + $this->LehrveranstaltungModel->addJoin('lehre.tbl_studienordnung sto', 'studienordnung_id'); + $this->LehrveranstaltungModel->addJoin('public.tbl_studiengang stg', 'ON stg.studiengang_kz = tbl_lehrveranstaltung.studiengang_kz'); + $this->LehrveranstaltungModel->addJoin('public.tbl_organisationseinheit oe', 'ON oe.oe_kurzbz = tbl_lehrveranstaltung.oe_kurzbz'); + $this->LehrveranstaltungModel->addOrder('stpllv.insertamum', 'DESC'); + $this->LehrveranstaltungModel->addLimit(1); + + return $this->LehrveranstaltungModel->load($lehrveranstaltung_id); + } + + /** + * Send Sancho eMail about ordered Lehrauftraege. + * @param $data_arr + */ + private function _sendMail($data_arr) + { + // Loop through 'container' of mail recipients + foreach($data_arr as $data) + { + // Set mail recipients (department assistance/leader) + $to = $data['uid']. '@'. DOMAIN; + $html_table = $this->_renderData_LehrauftraegeToApprove($data); + + // Prepare mail content + $content_data_arr = array( + 'table' => $html_table + ); + + sendSanchoMail( + 'LehrauftragNeueBestellungen', + $content_data_arr, + $to, + 'Bestellung neuer Lehraufträge', + 'sancho_header_min_bw.jpg', + 'sancho_footer_min_bw.jpg' + ); + } + } + + /** + * Cluster the data array by entitled mail receiver. + * Returning array is clustered as follows: + * Array + * [uid] + * Array + * [studiensemester_kurzbz] // studiensemester of lehreinheit + * Array + * [oe_kurzbz] // oe of lehreinheits lehrveranstaltung + * [oe_bezeichnung] + * Array + * [stg_kz] // stg of lehreinheits lehrveranstaltung + * [stg_kurzbz] + * [stg_bezeichnung] + * [amount] // amount of new ordered lehrauftraege of that stg + * @param $data_arr + * @return array + * + */ + private function _clusterData_byReceiver($data_arr) + { + $mail_data_arr = array(); // final array with all data clustered by mail receiver + + // Loop through 'container' of studiensemester + foreach ($data_arr as $data) + { + $data_len = count($data) - 1; + + // Loop through 'container' of organisational units + for ($i = 0; $i < $data_len; $i++) + { + // Get all users entitled by organisational unit + $result = $this->BenutzerrolleModel->getBenutzerByBerechtigung(self::BERECHTIGUNG_LEHRAUFTRAG_ERTEILEN, $data[$i]['oe_kurzbz']); + + if ($berechtigung_arr = getData($result)) + { + // Loop through entitled users + foreach ($berechtigung_arr as $berechtigung) + { + // Search if UID exists inside mail_data_arr + $uid_index = array_search($berechtigung->uid, array_column($mail_data_arr, 'uid')); + + // If UID is new, add UID to final array + if ($uid_index === false) + { + // add UID with corresponding data + $mail_data_arr [] = array( + 'uid' => $berechtigung->uid, + array( + 'studiensemester_kurzbz' => $data['studiensemester_kurzbz'], + $data[$i] + ) + ); + } // Else if UID exists + else + { + // Search if studiensemester exists + $ss_index = array_search($data['studiensemester_kurzbz'], array_column($mail_data_arr, 'studiensemester_kurzbz')); + + // If studiensemester is new, add studiensemester to existing UID + if ($ss_index === false) + { + $mail_data_arr[$uid_index] []= array( + 'studiensemester_kurzbz' => $data['studiensemester_kurzbz'], + $data[$i] + ); + } + // Else if studiensemester exists + else + { + // Add corresponding data to existing studiensemester of UID + $mail_data_arr[$uid_index]['studiensemester_kurbz'][] = $data[$i]; + } + + } + } + } + } + } + + return $mail_data_arr; + } + + /** + * Render the data array for the mail template returing a HTML table. + * @param $data_arr Data to be used in HTML table + * @return string HTML table to be embedded in eMail + */ + private function _renderData_LehrauftraegeToApprove($data_arr) + { + $html = ''; + foreach ($data_arr as $studiensemester_container) + { + if (is_array($studiensemester_container)) // is_array 'trims' the outer associative key [uid] + { + if (isset($studiensemester_container['studiensemester_kurzbz'])) + { + $studiensemester = $studiensemester_container['studiensemester_kurzbz']; + + // Link to LehrauftragErteilen + $url = site_url(self::LEHRAUFTRAG_ERTEILEN_URI).'?studiensemester='. $studiensemester; + } + + // HTML table header + $html .= ' +
+ Studiensemester: '. $studiensemester. ' +

+ + + + + + + + + + ' + ; + + // HTML table body + foreach ($studiensemester_container as $oe_container) + { + if (is_array($oe_container)) // is_array 'trims' the outer associative key [studiensemester_kurzbz] + { + if (isset($oe_container['oe_bezeichnung'])) + { + $oe_bezeichnung = $oe_container['oe_bezeichnung']; + } + + foreach ($oe_container as $stg_data) + { + if (is_array($stg_data)) // is_array 'trims' the outer associative keys [oe_kurzbz] and [oe_bezeichnung] + { + $html .= ' + + + + + + + '; + } + } + } + } + + // HTML table body end and link + $html .= ' + +
LV-OrganisationseinheitStudiengangSTG-KurzbezeichnungAnzahl neu bestellter Lehraufträge
'. $oe_bezeichnung. ''. $stg_data['stg_bezeichnung']. ''. $stg_data['stg_kurzbz']. ''. $stg_data['amount']. '
+
+ '. anchor($url, 'Lehraufträge Übersicht '. $studiensemester). ' +

+ '; + } + } + + return $html; + } +} From 24db32f65843b06dadeff3a5728d02fed94baa4c Mon Sep 17 00:00:00 2001 From: Cris Date: Mon, 25 Nov 2019 08:55:30 +0100 Subject: [PATCH 07/21] Added function getOrdered_fromDate() to Vertragvertragsstatus_model This method returns all contracts, where the status had been set to 'bestellt' on given date. --- .../Vertragvertragsstatus_model.php | 29 ++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/application/models/accounting/Vertragvertragsstatus_model.php b/application/models/accounting/Vertragvertragsstatus_model.php index 7e76ef494..ad9cef423 100644 --- a/application/models/accounting/Vertragvertragsstatus_model.php +++ b/application/models/accounting/Vertragvertragsstatus_model.php @@ -130,5 +130,32 @@ class Vertragvertragsstatus_model extends DB_Model ); } - + /** + * Get all contracts, where the status had been set to 'bestellt' on given date + * @param string $string_date e.g. '01.11.2019' or special Date/Time inputs like 'YESTERDAY', 'TODAY', 'NOW' + * @param bool $further_processed If true, ALL ordered contracts of that day are retrieved, even if they were + * were ALSO approved/accepted/cancelled (further processed) on that same day. + * @return array + */ + public function getOrdered_fromDate($string_date = 'TODAY', $further_processed = false) + { + $condition = ' + vertragsstatus_kurzbz = \'bestellt\' AND + (insertamum)::date = date \''. $string_date .'\' + '; + + if (!$further_processed) + { + $condition .= ' + AND + vertrag_id NOT IN ( + SELECT vertrag_id + FROM lehre.tbl_vertrag_vertragsstatus + WHERE vertragsstatus_kurzbz IN (\'erteilt\', \'akzeptiert\', \'storno\') + ) + '; + } + + return $this->loadWhere($condition); + } } From 586c626ff05aa38068e28f9d55a3c7ca96ccf4ba Mon Sep 17 00:00:00 2001 From: Cris Date: Mon, 25 Nov 2019 09:35:42 +0100 Subject: [PATCH 08/21] Fixed: Corrected incorrect SQL query in Benutzerfunktion_model Incorrect bracket was causing error message. This is fixed now. --- application/models/person/Benutzerfunktion_model.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/models/person/Benutzerfunktion_model.php b/application/models/person/Benutzerfunktion_model.php index 30abfdf51..ceb427687 100644 --- a/application/models/person/Benutzerfunktion_model.php +++ b/application/models/person/Benutzerfunktion_model.php @@ -48,7 +48,7 @@ class Benutzerfunktion_model extends DB_Model if (is_string($funktion_kurzbz)) { - $query .= " AND funktion_kurzbz = ".$funktion_kurzbz.")"; + $query .= " AND funktion_kurzbz = '".$funktion_kurzbz."'"; } elseif (is_array($funktion_kurzbz) && count($funktion_kurzbz) > 0) { From 94bafe4d6d719cf22a93758ce681ece5657baf56 Mon Sep 17 00:00:00 2001 From: Cris Date: Mon, 25 Nov 2019 17:11:41 +0100 Subject: [PATCH 09/21] =?UTF-8?q?Fixed=20cancel-error-msg=20&=20wrong=20st?= =?UTF-8?q?atus=20'ge=C3=A4ndert'=20by=20adding=20permission?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Before the assistance was receiving error msg when cancelling a contract. Also study program leader and assistance got wrong status displayed. This was due to missing permission check in vertrag.rdf.php and is fixed now. --- rdf/vertrag.rdf.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rdf/vertrag.rdf.php b/rdf/vertrag.rdf.php index 5f1eea221..e2f45b61f 100644 --- a/rdf/vertrag.rdf.php +++ b/rdf/vertrag.rdf.php @@ -31,7 +31,7 @@ $uid = get_uid(); $rechte = new benutzerberechtigung(); $rechte->getBerechtigungen($uid); -if(!$rechte->isBerechtigt('vertrag/mitarbeiter')) +if(!$rechte->isBerechtigt('vertrag/mitarbeiter') && !$rechte->isBerechtigt('lehre/lehrauftrag_bestellen')) die('Sie haben keine Berechtigung für diese Seite'); $datum_obj = new datum(); From 45e381e0430d102f19cba1511ff55316c5c0048c Mon Sep 17 00:00:00 2001 From: hainberg Date: Tue, 26 Nov 2019 14:41:27 +0100 Subject: [PATCH 10/21] Added function getApproved_fromDate() to Vertragvertragsstatus_model This method returns all contracts, where the status had been set to 'erteilt' on given date. --- .../Vertragvertragsstatus_model.php | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/application/models/accounting/Vertragvertragsstatus_model.php b/application/models/accounting/Vertragvertragsstatus_model.php index ad9cef423..33ac3f87f 100644 --- a/application/models/accounting/Vertragvertragsstatus_model.php +++ b/application/models/accounting/Vertragvertragsstatus_model.php @@ -158,4 +158,33 @@ class Vertragvertragsstatus_model extends DB_Model return $this->loadWhere($condition); } + + /** + * Get all contracts, where the status had been set to 'erteilt' on given date + * @param string $string_date e.g. '01.11.2019' or special Date/Time inputs like 'YESTERDAY', 'TODAY', 'NOW' + * @param bool $further_processed If true, ALL contracts approved on that day are retrieved, even if they were + * were ALSO accepted/cancelled (further processed) on that same day. + * @return array + */ + public function getApproved_fromDate($string_date = 'TODAY', $further_processed = false) + { + $condition = ' + vertragsstatus_kurzbz = \'erteilt\' AND + (insertamum)::date = date \''. $string_date .'\' + '; + + if (!$further_processed) + { + $condition .= ' + AND + vertrag_id NOT IN ( + SELECT vertrag_id + FROM lehre.tbl_vertrag_vertragsstatus + WHERE vertragsstatus_kurzbz IN (\'akzeptiert\', \'storno\') + ) + '; + } + + return $this->loadWhere($condition); + } } From a93ddfbe3d0a0092a01d82e783124cdf73fa9777 Mon Sep 17 00:00:00 2001 From: Cris Date: Tue, 26 Nov 2019 14:44:24 +0100 Subject: [PATCH 11/21] Added cronjob mailLehrauftraegeToAccept() This daily job sends information about all lehr-/projektauftraege approved (and not accepted/cancelled) the day bofore. Receivers: lectors --- .../controllers/jobs/LehrauftragJob.php | 106 +++++++++++++++++- 1 file changed, 105 insertions(+), 1 deletion(-) diff --git a/application/controllers/jobs/LehrauftragJob.php b/application/controllers/jobs/LehrauftragJob.php index 780c592e1..b265bdc6c 100644 --- a/application/controllers/jobs/LehrauftragJob.php +++ b/application/controllers/jobs/LehrauftragJob.php @@ -200,7 +200,67 @@ class LehrauftragJob extends JOB_Controller **/ public function mailLehrauftraegeToAccept() { - + // Get vertrag_id and uid of lehrauftraege that had been approved and had NOT been accepted or cancelled YESTERDAY + $this->VertragvertragsstatusModel->addSelect('vertrag_id, uid'); + $this->VertragvertragsstatusModel->addOrder('uid'); + $result = $this->VertragvertragsstatusModel->getApproved_fromDate('YESTERDAY'); + + /** + * Build the data array to be used in the email. Data array is clustered as follows: + * Array + * [uid] // lectors uid (mail receiver) + * [studiensemester] // studiensemester of the lehrauftraege (can be more, e.g. 'WS2019 and SS2020') + * [amount] // amount of new approved lehrauftraege + **/ + if ($vertrag_arr = getData($result)) + { + $data_arr = array(); + foreach ($vertrag_arr as $vertrag) + { + // Get studiensemester of the lehrauftrag + $this->VertragModel->addSelect('vertragsstunden_studiensemester_kurzbz'); + $result = $this->VertragModel->load($vertrag->vertrag_id); + if ($studiensemester = getData($result)) + { + $studiensemester = $studiensemester[0]->vertragsstunden_studiensemester_kurzbz; + } + + // Search if uid exists in data_arr + $uid_index = array_search($vertrag->uid, array_column($data_arr, 'uid')); + + // If uid is new, add uid, studiensemester and start amount with 1 + if ($uid_index === false) + { + $data = array(); + $data['uid'] = $vertrag->uid; + $data['studiensemester'] = $studiensemester; + $data['amount']= 1; + $data_arr []= $data; + } + // Else if uid exists + else + { + // If studiensemester is new, add to studiensemester-string + if (strpos($data_arr[$uid_index]['studiensemester'], $studiensemester) === false) + { + $data_arr[$uid_index]['studiensemester'] .= ' und '. $studiensemester; + } + + // Increase amount +1 + $data_arr[$uid_index]['amount']++; + } + } + } + + // Send email + if ($this->_sendMail_toAccept($data_arr)) + { + $this->logInfo('SUCCEDED: Sending emails about yesterdays approved lehrauftraege succeded.'); + } + else + { + $this->logError('Error when sending emails in job MailLehrauftragToAccept'); + } } //****************************************************************************************************************** @@ -423,4 +483,48 @@ class LehrauftragJob extends JOB_Controller return $html; } + + /** + * Send Sancho eMail about ordered Lehrauftraege. + * @param $data_arr + */ + private function _sendMail_toAccept($data_arr) + { + // Loop through 'container' of mail recipients + foreach($data_arr as $data) + { + // Set mail recipient (lector) + $to = $data['uid']. '@'. DOMAIN; + + // Link to LehrauftragAkzeptieren + $url = site_url(self::LEHRAUFTRAG_AKZEPTIEREN_URI); + + // Get first name + $first_name = ''; + $this->load->model('person/Benutzer_model', 'BenutzerModel'); + $this->BenutzerModel->addSelect('vorname'); + $this->BenutzerModel->addJoin('public.tbl_person', 'person_id'); + $result = $this->BenutzerModel->loadWhere(array('uid' => $data['uid'])); + + if (hasData($result)) + { + $first_name = $result->retval[0]->vorname; + } + + // Prepare mail content + $content_data_arr = array( + 'vorname' => $first_name, + 'studiensemester' => $data['studiensemester'], + 'anzahl' => $data['amount'], + 'link' => anchor($url, 'Lehraufträge Übersicht') + ); + + sendSanchoMail( + 'LehrauftragNeueErteilte', + $content_data_arr, + $to, + 'Neu erteilte Lehraufträge zum Annehmen bereit' + ); + } + } } From bc4bebb39f33668024f0e3452a9e273a53b082c8 Mon Sep 17 00:00:00 2001 From: Cris Date: Tue, 26 Nov 2019 14:46:28 +0100 Subject: [PATCH 12/21] Minor changes in job MailLehrauftragToApprove Optimized code, added logInfo. --- application/controllers/jobs/LehrauftragJob.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/application/controllers/jobs/LehrauftragJob.php b/application/controllers/jobs/LehrauftragJob.php index b265bdc6c..e0a5fad27 100644 --- a/application/controllers/jobs/LehrauftragJob.php +++ b/application/controllers/jobs/LehrauftragJob.php @@ -162,7 +162,7 @@ class LehrauftragJob extends JOB_Controller else { // Increase amount +1 - $data_arr[$ss_index][$oe_index][$stg_index]['amount'] = $data_arr[$ss_index][$oe_index][$stg_index]['amount'] + 1; + $data_arr[$ss_index][$oe_index][$stg_index]['amount']++; } } } @@ -188,9 +188,13 @@ class LehrauftragJob extends JOB_Controller $data_arr = $this->_clusterData_byReceiver($data_arr); // Send email - if(!$this->_sendMail($data_arr)) + if(!$this->_sendMail_toApprove($data_arr)) { - $this->logError('Fehler beim Mailversand in Job MailLehrauftragToApprove'); + $this->logInfo('SUCCEDED: Sending emails about yesterdays ordered lehrauftraege succeded.'); + } + else + { + $this->logError('Error when sending emails in job MailLehrauftragToApprove'); } } @@ -298,7 +302,7 @@ class LehrauftragJob extends JOB_Controller * Send Sancho eMail about ordered Lehrauftraege. * @param $data_arr */ - private function _sendMail($data_arr) + private function _sendMail_toApprove($data_arr) { // Loop through 'container' of mail recipients foreach($data_arr as $data) From 8d95c3820bf52fe9396cc66d3fa6f6b07eb90028 Mon Sep 17 00:00:00 2001 From: Cris Date: Mon, 9 Dec 2019 15:47:43 +0100 Subject: [PATCH 13/21] Added column Studienplan to table of Lehrauftrag bestellen Added column with most recent, valid studiyplans of the records lv. --- .../lehrauftrag/orderLehrauftragData.php | 36 +++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/application/views/lehre/lehrauftrag/orderLehrauftragData.php b/application/views/lehre/lehrauftrag/orderLehrauftragData.php index 9c3437599..3df082642 100644 --- a/application/views/lehre/lehrauftrag/orderLehrauftragData.php +++ b/application/views/lehre/lehrauftrag/orderLehrauftragData.php @@ -16,6 +16,36 @@ SELECT studiensemester_kurzbz, studiengang_kz, stg_typ_kurzbz, + /* get valid STPL(s), to which the lehrveranstaltung is assigned to (can be more) */ + /* therefore join over lv, studiensemester and semester */ + ( + SELECT + string_agg(bezeichnung, \', \') + FROM ( + SELECT stpl.bezeichnung + FROM lehre.tbl_studienplan stpl + JOIN lehre.tbl_studienplan_semester stplsem USING (studienplan_id) + JOIN lehre.tbl_studienplan_lehrveranstaltung stpllv USING (studienplan_id) + JOIN lehre.tbl_lehrveranstaltung lv USING (lehrveranstaltung_id) + JOIN lehre.tbl_lehreinheit le USING (lehrveranstaltung_id) + WHERE + /* join over lv of the le */ + le.lehreinheit_id = auftraege.lehreinheit_id + AND stpl.aktiv + /* then restrict on stpl of les studiensemester */ + AND stplsem.studiensemester_kurzbz = le.studiensemester_kurzbz + /* then restrict on stpl of lvs semester*/ + AND stplsem.semester = stpllv.semester + /* then restrict on most recent inserted studienplan of the lv */ + AND studienplan_id = ( + SELECT stpllv.studienplan_id + FROM lehre.tbl_studienplan_lehrveranstaltung + WHERE lehrveranstaltung_id = lv.lehrveranstaltung_id + ORDER BY insertamum DESC + LIMIT 1 + ) + ) AS tmp_stpl + ) AS "studienplan_bezeichnung", orgform_kurzbz, person_id, typ, @@ -305,6 +335,7 @@ $filterWidgetArray = array( 'Studiensemester', 'Studiengang-KZ', 'Studiengang', + 'Studienplan', 'OrgForm', 'Person-ID', 'Typ', @@ -378,10 +409,11 @@ $filterWidgetArray = array( studiensemester_kurzbz: {headerFilter:"input"}, studiengang_kz: {visible: false}, stg_typ_kurzbz: {headerFilter:"input", width: "5%"}, + studienplan_bezeichnung: {headerFilter:"input", width: "7%"}, orgform_kurzbz: {headerFilter:"input"}, person_id: {visible: false}, typ: {headerFilter:"input"}, - auftrag: {headerFilter:"input", width:"20%"}, + auftrag: {headerFilter:"input", width:"15%"}, semester: {headerFilter:"input"}, lv_oe_kurzbz: {headerFilter:"input"}, gruppe: {headerFilter:"input"}, @@ -403,7 +435,7 @@ $filterWidgetArray = array( akzeptiert: {align:"center", headerFilter:"input", mutator: mut_formatStringDate, tooltip: akzeptiert_tooltip, width: "8%"}, bestellt_von: {visible: false}, erteilt_von: {visible: false}, - akzeptiert_von: {visible: false}, + akzeptiert_von: {visible: false} }', // col properties ); From 72ec67a605379d37c63078bb6cdc13be4bcd2025 Mon Sep 17 00:00:00 2001 From: Cris Date: Tue, 10 Dec 2019 10:26:50 +0100 Subject: [PATCH 14/21] Fixed: errormsg missing data_arr in cronjob is fixed now --- application/controllers/jobs/LehrauftragJob.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/controllers/jobs/LehrauftragJob.php b/application/controllers/jobs/LehrauftragJob.php index e0a5fad27..40b130eb0 100644 --- a/application/controllers/jobs/LehrauftragJob.php +++ b/application/controllers/jobs/LehrauftragJob.php @@ -216,9 +216,9 @@ class LehrauftragJob extends JOB_Controller * [studiensemester] // studiensemester of the lehrauftraege (can be more, e.g. 'WS2019 and SS2020') * [amount] // amount of new approved lehrauftraege **/ + $data_arr = array(); if ($vertrag_arr = getData($result)) { - $data_arr = array(); foreach ($vertrag_arr as $vertrag) { // Get studiensemester of the lehrauftrag From e8942a69b66f3405c84793a818bd7fcf333456cd Mon Sep 17 00:00:00 2001 From: Cris Date: Tue, 10 Dec 2019 12:04:03 +0100 Subject: [PATCH 15/21] Changed: linking URL to CIS_ROOT now --- application/controllers/jobs/LehrauftragJob.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/application/controllers/jobs/LehrauftragJob.php b/application/controllers/jobs/LehrauftragJob.php index 40b130eb0..2f6b928c7 100644 --- a/application/controllers/jobs/LehrauftragJob.php +++ b/application/controllers/jobs/LehrauftragJob.php @@ -22,7 +22,7 @@ class LehrauftragJob extends JOB_Controller const BERECHTIGUNG_LEHRAUFTRAG_AKZEPTIEREN = 'lehre/lehrauftrag_akzeptieren'; const LEHRAUFTRAG_ERTEILEN_URI = 'lehre/lehrauftrag/LehrauftragErteilen'; - const LEHRAUFTRAG_AKZEPTIEREN_URI = 'lehre/lehrauftrag/LehrauftragAkzeptieren'; + const LEHRAUFTRAG_AKZEPTIEREN_URI = '/lehre/lehrauftrag/LehrauftragAkzeptieren'; /** * Constructor @@ -501,7 +501,9 @@ class LehrauftragJob extends JOB_Controller $to = $data['uid']. '@'. DOMAIN; // Link to LehrauftragAkzeptieren - $url = site_url(self::LEHRAUFTRAG_AKZEPTIEREN_URI); + $url = CIS_ROOT. 'cis/index.php?menu='. + CIS_ROOT. 'cis/menu.php?content_id=&content='. + CIS_ROOT. index_page(). self::LEHRAUFTRAG_AKZEPTIEREN_URI; // Get first name $first_name = ''; From e35e4f039820496e9f9aeedc6fc6ddebd90c87d3 Mon Sep 17 00:00:00 2001 From: Cris Date: Tue, 10 Dec 2019 12:06:32 +0100 Subject: [PATCH 16/21] Changed: methods condition checking 'datum' instead of 'insertamum' --- application/models/accounting/Vertragvertragsstatus_model.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/application/models/accounting/Vertragvertragsstatus_model.php b/application/models/accounting/Vertragvertragsstatus_model.php index 33ac3f87f..c2bd9cc7d 100644 --- a/application/models/accounting/Vertragvertragsstatus_model.php +++ b/application/models/accounting/Vertragvertragsstatus_model.php @@ -141,7 +141,7 @@ class Vertragvertragsstatus_model extends DB_Model { $condition = ' vertragsstatus_kurzbz = \'bestellt\' AND - (insertamum)::date = date \''. $string_date .'\' + (datum)::date = date \''. $string_date .'\' '; if (!$further_processed) @@ -170,7 +170,7 @@ class Vertragvertragsstatus_model extends DB_Model { $condition = ' vertragsstatus_kurzbz = \'erteilt\' AND - (insertamum)::date = date \''. $string_date .'\' + (datum)::date = date \''. $string_date .'\' '; if (!$further_processed) From 34d736262b9f1a7e3b8a387047989eba7cf3289f Mon Sep 17 00:00:00 2001 From: alex Date: Tue, 10 Dec 2019 15:32:08 +0100 Subject: [PATCH 17/21] =?UTF-8?q?added=20Lehrauftr=C3=A4ge=20Lehrendeueber?= =?UTF-8?q?sicht=20to=20menu?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/config/navigation.php | 7 ++++ .../lehre/lehrauftrag/Lehrauftrag.php | 11 +++++- .../lehre/lehrauftrag/LehrendeUebersicht.php | 39 +++++++++++++++++++ 3 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 application/views/lehre/lehrauftrag/LehrendeUebersicht.php diff --git a/application/config/navigation.php b/application/config/navigation.php index 400e414ad..95ba87f58 100644 --- a/application/config/navigation.php +++ b/application/config/navigation.php @@ -156,6 +156,13 @@ $config['navigation_menu']['lehre/lehrauftrag/Lehrauftrag/*'] = array( 'icon' => '', 'sort' => 1, 'requiredPermissions' => 'lehre/lehrauftrag_erteilen:r' + ), + 'lehrauftragLehrendeÜbersicht' => array( + 'link' => site_url('lehre/lehrauftrag/Lehrauftrag/LehrendeUebersicht'), + 'description' => 'Lehrendenübersicht', + 'icon' => '', + 'sort' => 1, + 'requiredPermissions' => array('lehre/lehrauftrag_bestellen:r') ) ); $config['navigation_menu']['lehre/lehrauftrag/LehrauftragErteilen/*'] = array( diff --git a/application/controllers/lehre/lehrauftrag/Lehrauftrag.php b/application/controllers/lehre/lehrauftrag/Lehrauftrag.php index 70c054186..74094f7fb 100644 --- a/application/controllers/lehre/lehrauftrag/Lehrauftrag.php +++ b/application/controllers/lehre/lehrauftrag/Lehrauftrag.php @@ -26,7 +26,8 @@ class Lehrauftrag extends Auth_Controller array( 'index' => 'lehre/lehrauftrag_bestellen:r', 'orderLehrauftrag' => 'lehre/lehrauftrag_bestellen:rw', - 'Dashboard' => array('lehre/lehrauftrag_bestellen:r', 'lehre/lehrauftrag_erteilen:rw') + 'Dashboard' => array('lehre/lehrauftrag_bestellen:r', 'lehre/lehrauftrag_erteilen:rw'), + 'LehrendeUebersicht' => array('lehre/lehrauftrag_bestellen:r') ) ); @@ -69,6 +70,14 @@ class Lehrauftrag extends Auth_Controller $this->load->view('lehre/lehrauftrag/Dashboard.php'); } + /** + * Display of Lehrauftragsübersicht report + */ + public function LehrendeUebersicht() + { + $this->load->view('lehre/lehrauftrag/LehrendeUebersicht.php'); + } + // ----------------------------------------------------------------------------------------------------------------- // Public methods /** diff --git a/application/views/lehre/lehrauftrag/LehrendeUebersicht.php b/application/views/lehre/lehrauftrag/LehrendeUebersicht.php new file mode 100644 index 000000000..1ad295392 --- /dev/null +++ b/application/views/lehre/lehrauftrag/LehrendeUebersicht.php @@ -0,0 +1,39 @@ +load->view( + 'templates/FHC-Header', + array( + 'title' => 'Lehrauftrag bestellen', + 'jquery' => true, + 'bootstrap' => true, + 'fontawesome' => true, + 'sbadmintemplate' => true, + 'ajaxlib' => true, + 'navigationwidget' => true, + ) +); +?> + + +widgetlib->widget('NavigationWidget'); ?> +
+
+ +
+
+ +
+
+ +
+ +
+ +
+
+ + +load->view('templates/FHC-Footer'); ?> From d5df8d8584e6aa519c8f8a1c84278970ecc8f7ce Mon Sep 17 00:00:00 2001 From: Cris Date: Wed, 11 Dec 2019 11:52:16 +0100 Subject: [PATCH 18/21] Fixed: delete/change restrictions in FAS now ONLY when config var is true Before deleting/changing of lectors was disabled, no matter if the regarding config entry was set to true or false. This is fixed now. --- content/lvplanung/lehrveranstaltungDBDML.php | 7 +++++-- .../lvplanung/lehrveranstaltungoverlay.js.php | 11 ++++++----- content/student/studentDBDML.php | 3 ++- content/student/studentprojektarbeit.js.php | 18 ++++++++---------- 4 files changed, 21 insertions(+), 18 deletions(-) diff --git a/content/lvplanung/lehrveranstaltungDBDML.php b/content/lvplanung/lehrveranstaltungDBDML.php index 2b3090221..d506f0459 100644 --- a/content/lvplanung/lehrveranstaltungDBDML.php +++ b/content/lvplanung/lehrveranstaltungDBDML.php @@ -693,8 +693,11 @@ if(!$error) //Lehreinheitmitarbeiterzuteilung loeschen if(isset($_POST['lehreinheit_id']) && is_numeric($_POST['lehreinheit_id']) && isset($_POST['mitarbeiter_uid'])) { - // Wenn der Mitarbeiter schon einen Vertrag hat, wird das Loeschen verhindert - if (isset($_POST['vertrag_id']) && is_numeric($_POST['vertrag_id'])) + // Wenn der Mitarbeiter schon einen Vertrag hat UND + // der config Eintrag zum Anzeigen der Vertragsdetails true ist, + // wird das Loeschen verhindert + if (isset($_POST['vertrag_id']) && is_numeric($_POST['vertrag_id']) && + (defined('FAS_LV_LEKTORINNENZUTEILUNG_VERTRAGSDETAILS_ANZEIGEN') && FAS_LV_LEKTORINNENZUTEILUNG_VERTRAGSDETAILS_ANZEIGEN)) { $return = false; $errormsg = 'Löschen nur nach Stornierung des Vertrags möglich.'; diff --git a/content/lvplanung/lehrveranstaltungoverlay.js.php b/content/lvplanung/lehrveranstaltungoverlay.js.php index 38091a33f..64ad61d3c 100644 --- a/content/lvplanung/lehrveranstaltungoverlay.js.php +++ b/content/lvplanung/lehrveranstaltungoverlay.js.php @@ -43,6 +43,10 @@ var lehrveranstaltungLvGesamtNotenSelectUID=null; //LehreinheitID des Noten Eint var lehrveranstaltungNotenTreeloaded=false; var lehrveranstaltungGesamtNotenTreeloaded=false; var LehrveranstaltungAusbildungssemesterFilter=''; + +// Config-Eintrag, ob Vertragsdetails angezeigt werden sollen +var lehrveranstaltung_vertragsdetails_anzeigen = Boolean(); + // ********** Observer und Listener ************* // // **** @@ -1331,12 +1335,9 @@ function LeMitarbeiterAuswahl() document.getElementById('lehrveranstaltung-lehreinheitmitarbeiter-checkbox-bismelden').checked=false; var gesamtkosten = LeMitarbeiterGesamtkosten(); - - // Prüfe ob Vertragsdetails angezeigt werden - var vertragsdetails_anzeigen = new Boolean(); - + // Wenn Vertragsdetails angezeigt werden - if (vertragsdetails_anzeigen) { + if (lehrveranstaltung_vertragsdetails_anzeigen) { // Reset attributes document.getElementById('lehrveranstaltung-lehreinheitmitarbeiter-label-vertragsstatus').setAttribute("style", "font-weight: normal"); diff --git a/content/student/studentDBDML.php b/content/student/studentDBDML.php index 91988a062..24937b630 100644 --- a/content/student/studentDBDML.php +++ b/content/student/studentDBDML.php @@ -4032,7 +4032,8 @@ if(!$error) else { // Wenn der Projektbetreuer schon einen Vertrag hat, wird das Loeschen verhindert - if (isset($_POST['vertrag_id']) && is_numeric($_POST['vertrag_id'])) + if (isset($_POST['vertrag_id']) && is_numeric($_POST['vertrag_id']) && + (defined('FAS_STUDIERENDE_PROJEKTARBEIT_VERTRAGSDETAILS_ANZEIGEN') && FAS_STUDIERENDE_PROJEKTARBEIT_VERTRAGSDETAILS_ANZEIGEN)) { $return = false; $errormsg = 'Löschen nur nach Stornierung des Vertrags möglich.'; diff --git a/content/student/studentprojektarbeit.js.php b/content/student/studentprojektarbeit.js.php index 765f3738c..ab284808e 100644 --- a/content/student/studentprojektarbeit.js.php +++ b/content/student/studentprojektarbeit.js.php @@ -31,7 +31,9 @@ var StudentProjektbetreuerTreeDatasource=null; //Datasource des Projektbetreuer var StudentProjektbetreuerSelectPersonID=null; var StudentProjektbetreuerSelectProjektarbeitID=null; var StudentProjektbetreuerSelectBetreuerartKurzbz=null; -vertragsdetails_anzeigen = new Boolean(); + +// Config-Eintrag, ob Vertragsdetails angezeigt werden sollen +var projektarbeit_vertragsdetails_anzeigen = Boolean(); // ********** Observer und Listener ************* // @@ -117,7 +119,7 @@ var StudentProjektbetreuerTreeListener = //ohne dem setTimeout window.setTimeout(StudentProjektbetreuerTreeSelectID,10); - if(vertragsdetails_anzeigen) + if(projektarbeit_vertragsdetails_anzeigen) { var mindEinVertragExistiert = StudentProjektbetreuer_VertragExistiert(); @@ -181,10 +183,9 @@ function StudentProjektarbeitTreeLoad(uid) tree.builder.addListener(StudentProjektarbeitTreeListener); StudentProjektarbeitDisableFields(false); - var vertragsdetails_anzeigen = new Boolean(); - + // Wenn Vertragsdetails angezeigt werden - if (vertragsdetails_anzeigen) { + if (projektarbeit_vertragsdetails_anzeigen) { //Reset attributes document.getElementById('student-projektbetreuer-label-vertragsstatus').value = ''; document.getElementById('student-projektbetreuer-label-vertragsstunden').value = ''; @@ -891,12 +892,9 @@ function StudentProjektbetreuerAuswahl() document.getElementById('student-projektbetreuer-checkbox-neu').checked=false; var gesamtkosten = StudentProjektbetreuerGesamtkosten(); - - // Prüfe ob Vertragsdetails angezeigt werden - var vertragsdetails_anzeigen = new Boolean(); - + // Wenn Vertragsdetails angezeigt werden - if (vertragsdetails_anzeigen) { + if (projektarbeit_vertragsdetails_anzeigen) { //Reset attributes document.getElementById('student-projektbetreuer-label-vertragsstatus').setAttribute("style", "font-weight: normal"); document.getElementById('student-projektbetreuer-button-vertrag-stornieren').setAttribute("tooltiptext", From 9911d792e457adf737ab241f8d6f650315ff5837 Mon Sep 17 00:00:00 2001 From: Cris Date: Wed, 11 Dec 2019 15:31:36 +0100 Subject: [PATCH 19/21] Changed: Inkludierte Lehre when not is null AND not 0 Now the return value is also checking against 0. --- .../lehre/lehrauftrag/LehrauftragAkzeptieren.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/application/controllers/lehre/lehrauftrag/LehrauftragAkzeptieren.php b/application/controllers/lehre/lehrauftrag/LehrauftragAkzeptieren.php index 8ed9aa320..31e2ffb31 100644 --- a/application/controllers/lehre/lehrauftrag/LehrauftragAkzeptieren.php +++ b/application/controllers/lehre/lehrauftrag/LehrauftragAkzeptieren.php @@ -168,9 +168,9 @@ class LehrauftragAkzeptieren extends Auth_Controller /** * Check if lectors latest active Verwendung has inkludierte Lehre - * - inkludierte_lehre is null: freelancer lector -> has NO inkludierte Lehre - * - inkludierte_lehre -1: fix employed lector -> all inclusive Lehre - * - inkludierte_lehre > 0: fix employed lector -> given value is inclusive 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() { @@ -178,7 +178,7 @@ class LehrauftragAkzeptieren extends Auth_Controller if (hasData($result)) { - $this->outputJsonSuccess(!is_null($result->retval[0]->inkludierte_lehre)); + $this->outputJsonSuccess(!is_null($result->retval[0]->inkludierte_lehre) && $result->retval[0]->inkludierte_lehre != 0); } else { From 905df6912aaa3d43dabf8be01c004117abe1740c Mon Sep 17 00:00:00 2001 From: Cris Date: Wed, 11 Dec 2019 15:32:29 +0100 Subject: [PATCH 20/21] Changed: column description from 'Auftrag' -> to 'LV- / Projektbezeichnung' --- application/views/lehre/lehrauftrag/acceptLehrauftragData.php | 2 +- application/views/lehre/lehrauftrag/approveLehrauftragData.php | 2 +- application/views/lehre/lehrauftrag/orderLehrauftragData.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/application/views/lehre/lehrauftrag/acceptLehrauftragData.php b/application/views/lehre/lehrauftrag/acceptLehrauftragData.php index caa221685..13460d38e 100644 --- a/application/views/lehre/lehrauftrag/acceptLehrauftragData.php +++ b/application/views/lehre/lehrauftrag/acceptLehrauftragData.php @@ -296,7 +296,7 @@ $filterWidgetArray = array( 'OrgForm', 'Person-ID', 'Typ', - 'Auftrag', + 'LV- / Projektbezeichnung', 'Semester', 'Organisationseinheit', 'Gruppe', diff --git a/application/views/lehre/lehrauftrag/approveLehrauftragData.php b/application/views/lehre/lehrauftrag/approveLehrauftragData.php index 59964a955..045a34a94 100644 --- a/application/views/lehre/lehrauftrag/approveLehrauftragData.php +++ b/application/views/lehre/lehrauftrag/approveLehrauftragData.php @@ -306,7 +306,7 @@ $filterWidgetArray = array( 'OrgForm', 'Person-ID', 'Typ', - 'Auftrag', + 'LV- / Projektbezeichnung', 'Semester', 'Organisationseinheit', 'Gruppe', diff --git a/application/views/lehre/lehrauftrag/orderLehrauftragData.php b/application/views/lehre/lehrauftrag/orderLehrauftragData.php index 3df082642..5b68b6b37 100644 --- a/application/views/lehre/lehrauftrag/orderLehrauftragData.php +++ b/application/views/lehre/lehrauftrag/orderLehrauftragData.php @@ -339,7 +339,7 @@ $filterWidgetArray = array( 'OrgForm', 'Person-ID', 'Typ', - 'Auftrag', + 'LV- / Projektbezeichnung', 'Semester', 'Organisationseinheit', 'Gruppe', From cbdb90c227472756ae1b426003376272e9e4db29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20=C3=96sterreicher?= Date: Thu, 12 Dec 2019 13:39:07 +0100 Subject: [PATCH 21/21] Berechtigungsfunktion angepasst damit auch Berechtigungen aus den Rollen geladen werden --- .../models/system/Benutzerrolle_model.php | 48 +++++++++++-------- 1 file changed, 29 insertions(+), 19 deletions(-) diff --git a/application/models/system/Benutzerrolle_model.php b/application/models/system/Benutzerrolle_model.php index 5ce96a622..765ad9bd4 100644 --- a/application/models/system/Benutzerrolle_model.php +++ b/application/models/system/Benutzerrolle_model.php @@ -11,7 +11,7 @@ class Benutzerrolle_model extends DB_Model $this->dbTable = 'system.tbl_benutzerrolle'; $this->pk = 'benutzerberechtigung_id'; } - + /** * Checks if the given user is an admin */ @@ -19,9 +19,9 @@ class Benutzerrolle_model extends DB_Model { // Join with the table tbl_benutzer $this->addJoin('public.tbl_benutzer', 'uid'); - + $result = $this->loadWhere(array('person_id' => $person_id, 'rolle_kurzbz' => 'admin')); - + if (!isError($result)) { if (hasData($result)) @@ -33,25 +33,35 @@ class Benutzerrolle_model extends DB_Model $result = success(false); } } - + return $result; } - /** - * Get user who are authorized with berechtigung and, if given, authorized for the specific organisational unit. - * @param $berechtigung_kurzbz - * @param null $oe_kurzbz - * @return array - */ - public function getBenutzerByBerechtigung($berechtigung_kurzbz, $oe_kurzbz = null){ + /** + * Get user who are authorized with berechtigung and, if given, authorized for the specific organisational unit. + * @param $berechtigung_kurzbz + * @param null $oe_kurzbz + * @return array + */ + public function getBenutzerByBerechtigung($berechtigung_kurzbz, $oe_kurzbz = null) + { + $params = array(); + $query = ' + SELECT + * + FROM + system.vw_berechtigung_nichtrekursiv + WHERE + berechtigung_kurzbz = ?'; - $condition = array('berechtigung_kurzbz' => $berechtigung_kurzbz); + $params[] = $berechtigung_kurzbz; - if (is_string($oe_kurzbz)) - { - $condition['oe_kurzbz'] = $oe_kurzbz; - } + if (!is_null($oe_kurzbz)) + { + $query .= ' AND oe_kurzbz = ?'; + $params[] = $oe_kurzbz; + } - return $this->loadWhere($condition); - } -} \ No newline at end of file + return $this->execQuery($query, $params); + } +}