From a86dcbd290c6fd9e7239315a088a0292e87580c9 Mon Sep 17 00:00:00 2001 From: alex Date: Wed, 11 Nov 2020 23:29:18 +0100 Subject: [PATCH 01/74] - Added matr_aktiv to person table for indication of not yet active matrikelnummern - PersonModel getPersonStammdaten: staatsbuergerschafts- and geburtsnationcode are also retrieved --- application/models/person/Person_model.php | 3 ++- system/dbupdate_3.3.php | 21 ++++++++++++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/application/models/person/Person_model.php b/application/models/person/Person_model.php index d8ddb381c..f200bb3c3 100644 --- a/application/models/person/Person_model.php +++ b/application/models/person/Person_model.php @@ -152,7 +152,8 @@ class Person_model extends DB_Model */ public function getPersonStammdaten($person_id, $zustellung_only = false) { - $this->addSelect('public.tbl_person.*, s.kurztext as staatsbuergerschaft, g.kurztext as geburtsnation'); + $this->addSelect('public.tbl_person.*, tbl_person.staatsbuergerschaft AS staatsbuergerschaft_code, tbl_person.geburtsnation AS geburtsnation_code, + s.kurztext as staatsbuergerschaft, g.kurztext as geburtsnation'); $this->addJoin('bis.tbl_nation s', 'public.tbl_person.staatsbuergerschaft = s.nation_code', 'LEFT'); $this->addJoin('bis.tbl_nation g', 'public.tbl_person.geburtsnation = g.nation_code', 'LEFT'); diff --git a/system/dbupdate_3.3.php b/system/dbupdate_3.3.php index 62682fb75..55f971d7d 100644 --- a/system/dbupdate_3.3.php +++ b/system/dbupdate_3.3.php @@ -4428,6 +4428,25 @@ if($result = $db->db_query("SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE } } +//Spalte matr_aktiv in tbl_person zum Markieren von noch nicht scharfgeschaltenen Matrikelnummern vom Datenverbund +if(!$result = @$db->db_query("SELECT matr_aktiv FROM public.tbl_person LIMIT 1")) +{ + $qry = "ALTER TABLE public.tbl_person ADD COLUMN matr_aktiv boolean NOT NULL DEFAULT false; + COMMENT ON COLUMN public.tbl_person.matr_aktiv IS 'Zeigt an, ob Matrikelnummer aktiv oder nur vorläufig ist.';"; + + if(!$db->db_query($qry)) + echo 'public.tbl_person: '.$db->db_last_error().'
'; + else + echo '
public.tbl_person: Spalte matr_aktiv hinzugefuegt'; + + $qry = "UPDATE public.tbl_person SET matr_aktiv = true;"; + + if(!$db->db_query($qry)) + echo 'public.tbl_person: '.$db->db_last_error().'
'; + else + echo '
public.tbl_person: Spalte matr_aktiv auf true gesetzt'; +} + // *** Pruefung und hinzufuegen der neuen Attribute und Tabellen echo '

Pruefe Tabellen und Attribute!

'; @@ -4627,7 +4646,7 @@ $tabellen=array( "public.tbl_ortraumtyp" => array("ort_kurzbz","hierarchie","raumtyp_kurzbz"), "public.tbl_organisationseinheit" => array("oe_kurzbz", "oe_parent_kurzbz", "bezeichnung","organisationseinheittyp_kurzbz", "aktiv","mailverteiler","freigabegrenze","kurzzeichen","lehre","standort","warn_semesterstunden_frei","warn_semesterstunden_fix","standort_id"), "public.tbl_organisationseinheittyp" => array("organisationseinheittyp_kurzbz", "bezeichnung", "beschreibung"), - "public.tbl_person" => array("person_id","staatsbuergerschaft","geburtsnation","sprache","anrede","titelpost","titelpre","nachname","vorname","vornamen","gebdatum","gebort","gebzeit","foto","anmerkung","homepage","svnr","ersatzkennzeichen","familienstand","geschlecht","anzahlkinder","aktiv","insertamum","insertvon","updateamum","updatevon","ext_id","bundesland_code","kompetenzen","kurzbeschreibung","zugangscode", "foto_sperre","matr_nr","zugangscode_timestamp","udf_values","bpk"), + "public.tbl_person" => array("person_id","staatsbuergerschaft","geburtsnation","sprache","anrede","titelpost","titelpre","nachname","vorname","vornamen","gebdatum","gebort","gebzeit","foto","anmerkung","homepage","svnr","ersatzkennzeichen","familienstand","geschlecht","anzahlkinder","aktiv","insertamum","insertvon","updateamum","updatevon","ext_id","bundesland_code","kompetenzen","kurzbeschreibung","zugangscode", "foto_sperre","matr_nr","zugangscode_timestamp","udf_values","bpk","matr_aktiv"), "public.tbl_person_fotostatus" => array("person_fotostatus_id","person_id","fotostatus_kurzbz","datum","insertamum","insertvon","updateamum","updatevon"), "public.tbl_personfunktionstandort" => array("personfunktionstandort_id","funktion_kurzbz","person_id","standort_id","position","anrede"), "public.tbl_preincoming" => array("preincoming_id","person_id","mobilitaetsprogramm_code","zweck_code","firma_id","universitaet","aktiv","bachelorthesis","masterthesis","von","bis","uebernommen","insertamum","insertvon","updateamum","updatevon","anmerkung","zgv","zgv_ort","zgv_datum","zgv_name","zgvmaster","zgvmaster_datum","zgvmaster_ort","zgvmaster_name","program_name","bachelor","master","jahre","person_id_emergency","person_id_coordinator_dep","person_id_coordinator_int","code","deutschkurs1","deutschkurs2","research_area","deutschkurs3","ext_id"), From 3c2fdc1991c23601d274235557dbeb185f21567e Mon Sep 17 00:00:00 2001 From: alex Date: Wed, 25 Nov 2020 16:31:13 +0100 Subject: [PATCH 02/74] added Aufenthaltsfoerderung_model --- .../models/codex/Aufenthaltfoerderung_model.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 application/models/codex/Aufenthaltfoerderung_model.php diff --git a/application/models/codex/Aufenthaltfoerderung_model.php b/application/models/codex/Aufenthaltfoerderung_model.php new file mode 100644 index 000000000..b650b3a05 --- /dev/null +++ b/application/models/codex/Aufenthaltfoerderung_model.php @@ -0,0 +1,14 @@ +dbTable = 'bis.tbl_aufenthaltfoerderung'; + $this->pk = 'aufenthaltfoerderung_code'; + } +} From ace636ef52832991ef2ecc7100105df2fa79e7b2 Mon Sep 17 00:00:00 2001 From: alex Date: Fri, 27 Nov 2020 03:03:37 +0100 Subject: [PATCH 03/74] workerqueues (JQW_Controller and JobsQueueLib.php): added getJobsByTypeStatus method --- application/core/JQW_Controller.php | 13 +++++++++++++ application/libraries/JobsQueueLib.php | 12 ++++++++++++ 2 files changed, 25 insertions(+) diff --git a/application/core/JQW_Controller.php b/application/core/JQW_Controller.php index 72a2a972b..2d471f03b 100644 --- a/application/core/JQW_Controller.php +++ b/application/core/JQW_Controller.php @@ -47,6 +47,19 @@ abstract class JQW_Controller extends JOB_Controller return $jobs; } + /** + * To get all the jobs specified by the given parameters + */ + protected function getJobsByTypeStatus($type, $status) + { + $jobs = $this->jobsqueuelib->getJobsByTypeStatus($type, $status); + + // If an error occurred then log it in database + if (isError($jobs)) $this->logError(getError($jobs), array($type, $status)); + + return $jobs; + } + /** * To get all the jobs specified by the given parameters */ diff --git a/application/libraries/JobsQueueLib.php b/application/libraries/JobsQueueLib.php index 0eb7c9b72..aaa318b97 100644 --- a/application/libraries/JobsQueueLib.php +++ b/application/libraries/JobsQueueLib.php @@ -56,6 +56,18 @@ class JobsQueueLib return $this->_ci->JobsQueueModel->loadWhere(array('status' => self::STATUS_NEW, 'type' => $type)); } + /** + * To get all the jobs specified by the given parameters + */ + public function getJobsByTypeStatus($type, $status) + { + $this->_ci->JobsQueueModel->resetQuery(); + + $this->_ci->JobsQueueModel->addOrder('creationtime', 'DESC'); + + return $this->_ci->JobsQueueModel->loadWhere(array('status' => $status, 'type' => $type)); + } + /** * To get all the jobs specified by the given parameters */ From ee7d51d2b361acccbdfdd3bb060fa20b31b78794 Mon Sep 17 00:00:00 2001 From: KarpAlex Date: Mon, 15 Mar 2021 23:27:28 +0100 Subject: [PATCH 04/74] =?UTF-8?q?Pruefung=5Fmodel.php:=20method=20for=20re?= =?UTF-8?q?trieving=20Pr=C3=BCfung=20by=20person=20and=20studiensemester?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../models/education/Pruefung_model.php | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/application/models/education/Pruefung_model.php b/application/models/education/Pruefung_model.php index d10364979..e3776c4ad 100644 --- a/application/models/education/Pruefung_model.php +++ b/application/models/education/Pruefung_model.php @@ -11,4 +11,29 @@ class Pruefung_model extends DB_Model $this->dbTable = 'campus.tbl_pruefung'; $this->pk = 'pruefung_id'; } + + /** + * Gets Pruefungen of a person for a Studiensemester. + * @param int $person_id + * @param string $studiensemester_kurzbz + * @return object + */ + public function getByPerson($person_id, $studiensemester_kurzbz) + { + $qry = ' + SELECT prfg.*, pers.matr_nr, lv.ects, stg.studiengang_kz, prst.prestudent_id, + UPPER(stg.typ||stg.kurzbz) AS studiengang, stg.bezeichnung AS studiengang_bezeichnung + FROM public.tbl_person pers + JOIN public.tbl_prestudent prst USING (person_id) + JOIN public.tbl_student USING (prestudent_id) + JOIN lehre.tbl_pruefung prfg USING (student_uid) + JOIN lehre.tbl_lehreinheit le USING (lehreinheit_id) + JOIN lehre.tbl_lehrveranstaltung lv USING (lehrveranstaltung_id) + JOIN public.tbl_studiengang stg ON prst.studiengang_kz = stg.studiengang_kz + WHERE pers.person_id = ? + AND le.studiensemester_kurzbz = ? + ORDER BY prfg.datum, pruefung_id'; + + return $this->execQuery($qry, array($person_id, $studiensemester_kurzbz)); + } } From 5b369f70206d7a6d9b0106c846a99a2347e1e5e0 Mon Sep 17 00:00:00 2001 From: KarpAlex Date: Mon, 29 Mar 2021 18:49:41 +0200 Subject: [PATCH 05/74] Zaugnisnote_model: added getByPerson method --- .../models/education/Zeugnisnote_model.php | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/application/models/education/Zeugnisnote_model.php b/application/models/education/Zeugnisnote_model.php index 7ed0e6456..08c4beca1 100644 --- a/application/models/education/Zeugnisnote_model.php +++ b/application/models/education/Zeugnisnote_model.php @@ -12,4 +12,28 @@ class Zeugnisnote_model extends DB_Model $this->pk = array('studiensemester_kurzbz', 'student_uid', 'lehrveranstaltung_id'); $this->hasSequence = false; } + + /** + * Gets Pruefungen of a person for a Studiensemester. + * @param int $person_id + * @param string $studiensemester_kurzbz + * @return object + */ + public function getByPerson($person_id, $studiensemester_kurzbz) + { + $qry = ' + SELECT note.*, pers.matr_nr, lv.ects, stg.studiengang_kz, prst.prestudent_id, + UPPER(stg.typ||stg.kurzbz) AS studiengang, stg.bezeichnung AS studiengang_bezeichnung + FROM public.tbl_person pers + JOIN public.tbl_prestudent prst USING (person_id) + JOIN public.tbl_student USING (prestudent_id) + JOIN lehre.tbl_zeugnisnote note USING (student_uid) + JOIN lehre.tbl_lehrveranstaltung lv USING (lehrveranstaltung_id) + JOIN public.tbl_studiengang stg ON prst.studiengang_kz = stg.studiengang_kz + WHERE pers.person_id = ? + AND note.studiensemester_kurzbz = ? + ORDER BY note.benotungsdatum'; + + return $this->execQuery($qry, array($person_id, $studiensemester_kurzbz)); + } } From 5fa856c138fb5e751d8c92b27a02bd068e5871a6 Mon Sep 17 00:00:00 2001 From: KarpAlex Date: Thu, 22 Apr 2021 01:02:32 +0200 Subject: [PATCH 06/74] add erhalter kz to getByPerson method from Zeugnisnote_model.php --- application/models/education/Zeugnisnote_model.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/models/education/Zeugnisnote_model.php b/application/models/education/Zeugnisnote_model.php index 08c4beca1..1b2081148 100644 --- a/application/models/education/Zeugnisnote_model.php +++ b/application/models/education/Zeugnisnote_model.php @@ -22,7 +22,7 @@ class Zeugnisnote_model extends DB_Model public function getByPerson($person_id, $studiensemester_kurzbz) { $qry = ' - SELECT note.*, pers.matr_nr, lv.ects, stg.studiengang_kz, prst.prestudent_id, + SELECT note.*, pers.matr_nr, lv.ects, stg.studiengang_kz, prst.prestudent_id, stg.erhalter_kz, UPPER(stg.typ||stg.kurzbz) AS studiengang, stg.bezeichnung AS studiengang_bezeichnung FROM public.tbl_person pers JOIN public.tbl_prestudent prst USING (person_id) From b22c9753559f65b2a979c64353a4d24516a95094 Mon Sep 17 00:00:00 2001 From: FHBGLD <33415881+FHBGLD@users.noreply.github.com> Date: Tue, 4 May 2021 14:19:48 +0200 Subject: [PATCH 07/74] Create set_gemeinde.php --- vilesci/stammdaten/set_gemeinde.php | 163 ++++++++++++++++++++++++++++ 1 file changed, 163 insertions(+) create mode 100644 vilesci/stammdaten/set_gemeinde.php diff --git a/vilesci/stammdaten/set_gemeinde.php b/vilesci/stammdaten/set_gemeinde.php new file mode 100644 index 000000000..df07be120 --- /dev/null +++ b/vilesci/stammdaten/set_gemeinde.php @@ -0,0 +1,163 @@ + delete from bis.tbl_gemeinde; +Skript aufrufen, csv auswählen und hochladen. +Datei wird eingelesen und in die DB gespeichert. +*/ + +require_once('../../config/system.config.inc.php'); +require_once(DOC_ROOT.'include/functions.inc.php'); +require_once(DOC_ROOT.'include/benutzerberechtigung.class.php'); +require_once(DOC_ROOT.'include/gemeinde.class.php'); +require_once(DOC_ROOT.'include/benutzerberechtigung.class.php'); + + +$user = get_uid(); + +$rechte = new benutzerberechtigung(); +$rechte->getBerechtigungen($user); + +if(!$rechte->isBerechtigt('basis/gemeinde')) { + die('Sie haben keine Berechtigung fuer diese Seite'); +} + +$tmp_gemeinde_ar = array(); + +if(isset($_FILES['parsefile']) && $_FILES['parsefile']['error'] == 0) { + + $rows = array_map('str_getcsv', file( $_FILES['parsefile']['tmp_name'] )); + $header = array_shift($rows); + $data = array(); + foreach($rows as $row) { + $data[] = array_combine($header, $row); + } + + foreach ($data as $gemeinde_details) { + + //Wenn nicht gültig dann überspringen + if ($gemeinde_details['Gültig'] == 'Nein') continue; + + //es können mehrere plz in einer zeile stehen + $plzs = explode(' ', trim($gemeinde_details['PLZ'])); + + foreach ($plzs as $plz) { + $tmp_obj_gemeinde = null; + $tmp_obj_gemeinde = new gemeinde(); + $tmp_obj_gemeinde->plz = $plz; + $tmp_obj_gemeinde->name = $gemeinde_details['Gemeindename']; + $tmp_obj_gemeinde->ortschaftskennziffer = $gemeinde_details['Ortschaftskennziffer']; + $tmp_obj_gemeinde->ortschaftsname = $gemeinde_details['Ortschaftsname']; + $tmp_obj_gemeinde->bulacode = $gemeinde_details['BULA_Code']; + $tmp_obj_gemeinde->bulabez = $gemeinde_details['BULA_Bez']; + $tmp_obj_gemeinde->kennziffer = $gemeinde_details['Gemeindekennziffer']; + + //print_r($tmp_obj_gemeinde); + $tmp_obj_gemeinde->save(); + $tmp_gemeinde_ar[] = $tmp_obj_gemeinde; + // if ($tmp_obj_gemeinde->save()) { + // echo "
"; + // echo "gemeinde save true"; + // echo "
"; + // print_r($tmp_obj_gemeinde); + // echo "
"; + // } else { + // echo "
"; + // echo "gemeinde save false"; + // echo "
"; + // print_r($tmp_obj_gemeinde); + // echo "
"; + // } + } + } +} +?> + + + + + + set gemeinde skript + + +
Filesyntax: (Standard xlsx-File von https://www.bis.ac.at/BISSuite, gespeichert als csv! erste Zeile ist Header (alles was oberhalb ist kann entfernt werden) -> dann Daten) +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
GemeindekennzifferGemeindenameOrtschaftskennzifferOrtschaftsnamePLZBULA_CodeBULA_BezGültig
10101Eisenstadt1Eisenstadt70001BGLDJa
10101Eisenstadt2Kleinhöflein im Burgenland7000 7001 70021BGLDJa
........................
+
+
+
PLZ Kodextabelle + +
+
+
+				
+			
+
+ + From aac4467d8a82a1a29f2422b37a19383932bdad57 Mon Sep 17 00:00:00 2001 From: FHBGLD <33415881+FHBGLD@users.noreply.github.com> Date: Wed, 5 May 2021 11:52:12 +0200 Subject: [PATCH 08/74] Update set_gemeinde.php --- vilesci/stammdaten/set_gemeinde.php | 92 +++++++++++++++-------------- 1 file changed, 48 insertions(+), 44 deletions(-) diff --git a/vilesci/stammdaten/set_gemeinde.php b/vilesci/stammdaten/set_gemeinde.php index df07be120..5cc2f0097 100644 --- a/vilesci/stammdaten/set_gemeinde.php +++ b/vilesci/stammdaten/set_gemeinde.php @@ -101,55 +101,59 @@ if(isset($_FILES['parsefile']) && $_FILES['parsefile']['error'] == 0) { set gemeinde skript -
Filesyntax: (Standard xlsx-File von https://www.bis.ac.at/BISSuite, gespeichert als csv! erste Zeile ist Header (alles was oberhalb ist kann entfernt werden) -> dann Daten) -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
GemeindekennzifferGemeindenameOrtschaftskennzifferOrtschaftsnamePLZBULA_CodeBULA_BezGültig
10101Eisenstadt1Eisenstadt70001BGLDJa
10101Eisenstadt2Kleinhöflein im Burgenland7000 7001 70021BGLDJa
........................
+
+ Filesyntax:(Standard xlsx-File von https://www.bis.ac.at/BISSuite, gespeichert als csv! erste Zeile ist Header (alles was oberhalb ist kann entfernt werden) -> dann Daten) +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
GemeindekennzifferGemeindenameOrtschaftskennzifferOrtschaftsnamePLZBULA_CodeBULA_BezGültig
10101Eisenstadt1Eisenstadt70001BGLDJa
10101Eisenstadt2Kleinhöflein im Burgenland7000 7001 70021BGLDJa
........................


PLZ Kodextabelle
+
 				
Date: Tue, 18 May 2021 22:44:31 +0200
Subject: [PATCH 09/74] created bis.tbl_oehbeitrag for storing oehbeitrag and
 Versicherung amounts

---
 system/dbupdate_3.3.php | 59 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 59 insertions(+)

diff --git a/system/dbupdate_3.3.php b/system/dbupdate_3.3.php
index e658d7a97..990fb0308 100644
--- a/system/dbupdate_3.3.php
+++ b/system/dbupdate_3.3.php
@@ -4767,6 +4767,64 @@ if($result = @$db->db_query("SELECT 1 FROM system.tbl_berechtigung WHERE berecht
 	}
 }
 
+// Creates table bis.tbl_oehbeitrag if it doesn't exist and grants privileges
+if (!$result = @$db->db_query('SELECT 1 FROM bis.tbl_oehbeitrag LIMIT 1'))
+{
+	$qry = 'CREATE TABLE bis.tbl_oehbeitrag (
+			    oehbeitrag_id integer NOT NULL,
+				studierendenbeitrag numeric(5,2) NOT NULL,
+				versicherung numeric(5,2) NOT NULL,
+				von_studiensemester_kurzbz varchar(16) NOT NULL,
+				bis_studiensemester_kurzbz varchar(16),
+				insertamum timestamp DEFAULT NOW(),
+				insertvon varchar(32),
+				updateamum timestamp,
+				updatevon varchar(32)
+			);
+
+			COMMENT ON TABLE bis.tbl_oehbeitrag IS \'Table to save amount of Oehbeitrag and Versicherung.\';
+			COMMENT ON COLUMN bis.tbl_oehbeitrag.studierendenbeitrag IS \'Amount of Studierendenbeitrag, Oehbeitrag without Versicherung.\';
+			COMMENT ON COLUMN bis.tbl_oehbeitrag.versicherung IS \'Amount of Versicherung as part of the Oehbeitrag\';
+			COMMENT ON COLUMN bis.tbl_oehbeitrag.von_studiensemester_kurzbz IS \'Semester from which amounts are valid\';
+			COMMENT ON COLUMN bis.tbl_oehbeitrag.bis_studiensemester_kurzbz IS \'Semester until which amounts are valid\';
+
+			CREATE SEQUENCE bis.seq_oehbeitrag_oehbeitrag_id
+			    START WITH 1
+			    INCREMENT BY 1
+			    NO MINVALUE
+			    NO MAXVALUE
+			    CACHE 1;
+
+			ALTER TABLE bis.tbl_oehbeitrag ALTER COLUMN oehbeitrag_id SET DEFAULT nextval(\'bis.seq_oehbeitrag_oehbeitrag_id\'::regclass);
+
+			GRANT SELECT, UPDATE ON SEQUENCE bis.seq_oehbeitrag_oehbeitrag_id TO vilesci;
+			GRANT SELECT, UPDATE ON SEQUENCE bis.seq_oehbeitrag_oehbeitrag_id TO fhcomplete;
+
+			ALTER TABLE bis.tbl_oehbeitrag ADD CONSTRAINT pk_oehbeitrag PRIMARY KEY (oehbeitrag_id);
+
+			ALTER TABLE bis.tbl_oehbeitrag ADD CONSTRAINT fk_oehbeitrag_von_studiensemester_kurzbz FOREIGN KEY (von_studiensemester_kurzbz) REFERENCES public.tbl_studiensemester(studiensemester_kurzbz) ON UPDATE CASCADE ON DELETE RESTRICT;
+			ALTER TABLE bis.tbl_oehbeitrag ADD CONSTRAINT fk_oehbeitrag_bis_studiensemester_kurzbz FOREIGN KEY (bis_studiensemester_kurzbz) REFERENCES public.tbl_studiensemester(studiensemester_kurzbz) ON UPDATE CASCADE ON DELETE RESTRICT;
+
+			ALTER TABLE bis.tbl_oehbeitrag ADD CONSTRAINT uk_oehbeitrag_von_studiensemester_kurzbz UNIQUE (von_studiensemester_kurzbz);';
+
+	if (!$db->db_query($qry))
+		echo 'bis.tbl_oehbeitrag: '.$db->db_last_error().'
'; + else + echo '
bis.tbl_oehbeitrag table created'; + + $qry = 'GRANT SELECT ON TABLE bis.tbl_oehbeitrag TO web;'; + if (!$db->db_query($qry)) + echo 'bis.tbl_oehbeitrag: '.$db->db_last_error().'
'; + else + echo '
Granted privileges to web on bis.tbl_oehbeitrag'; + + $qry = 'GRANT SELECT, UPDATE, INSERT, DELETE ON TABLE bis.tbl_oehbeitrag TO vilesci;'; + if (!$db->db_query($qry)) + echo 'bis.tbl_oehbeitrag: '.$db->db_last_error().'
'; + else + echo '
Granted privileges to vilesci on bis.tbl_oehbeitrag'; +} + // *** Pruefung und hinzufuegen der neuen Attribute und Tabellen echo '

Pruefe Tabellen und Attribute!

'; @@ -4798,6 +4856,7 @@ $tabellen=array( "bis.tbl_mobilitaetsprogramm" => array("mobilitaetsprogramm_code","kurzbz","beschreibung","sichtbar","sichtbar_outgoing"), "bis.tbl_nation" => array("nation_code","entwicklungsstand","eu","ewr","kontinent","kurztext","langtext","engltext","sperre","nationengruppe_kurzbz", "iso3166_1_a2","iso3166_1_a3"), "bis.tbl_nationengruppe" => array("nationengruppe_kurzbz","nationengruppe_bezeichnung","aktiv"), + "bis.tbl_oehbeitrag" => array("oehbeitrag_id","studierendenbeitrag","versicherung","von_studiensemester_kurzbz","bis_studiensemester_kurzbz","bezeichnung_mehrsprachig", "insertamum", "insertvon", "updateamum", "updatevon"), "bis.tbl_orgform" => array("orgform_kurzbz","code","bezeichnung","rolle","bisorgform_kurzbz","bezeichnung_mehrsprachig"), "bis.tbl_verwendung" => array("verwendung_code","verwendungbez"), "bis.tbl_zgv" => array("zgv_code","zgv_bez","zgv_kurzbz","bezeichnung"), From 989a1080b4a1cd18ba916497c3edf177369ec8cd Mon Sep 17 00:00:00 2001 From: KarpAlex Date: Thu, 20 May 2021 00:56:10 +0200 Subject: [PATCH 10/74] added codex/Oehbeitrag_model and method getByStudienesemester --- application/models/codex/Oehbeitrag_model.php | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 application/models/codex/Oehbeitrag_model.php diff --git a/application/models/codex/Oehbeitrag_model.php b/application/models/codex/Oehbeitrag_model.php new file mode 100644 index 000000000..d12dbf23f --- /dev/null +++ b/application/models/codex/Oehbeitrag_model.php @@ -0,0 +1,35 @@ +dbTable = 'bis.tbl_oehbeitrag'; + $this->pk = 'oehbeitrag_id'; + } + + /** + * Gets oehbeitrag data valid for a certain Studiensemester. + * @param string $studiensemester_kurzbz + * @return object + */ + public function getByStudiensemester($studiensemester_kurzbz) + { + $qry = "WITH semstart AS ( + SELECT start FROM public.tbl_studiensemester + WHERE studiensemester_kurzbz = ? + ) + SELECT * FROM bis.tbl_oehbeitrag oehb + JOIN public.tbl_studiensemester semvon ON oehb.von_studiensemester_kurzbz = semvon.studiensemester_kurzbz + LEFT JOIN public.tbl_studiensemester sembis ON oehb.bis_studiensemester_kurzbz = sembis.studiensemester_kurzbz + JOIN semstart ON semstart.start::date >= semvon.start::date AND (sembis.studiensemester_kurzbz IS NULL OR semstart.start::date <= sembis.start::date) + ORDER BY semvon.start + LIMIT 1"; + + return $this->execQuery($qry, array($studiensemester_kurzbz)); + } +} From 3dddc97575d17696aec6e94ee0df91e708da03fb Mon Sep 17 00:00:00 2001 From: KarpAlex Date: Thu, 27 May 2021 16:29:27 +0200 Subject: [PATCH 11/74] dbupdate_3.3.php: removed "bzeichnung_mehrsprachig" feld from bis.tbl_oehbeitrag table check --- system/dbupdate_3.3.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/dbupdate_3.3.php b/system/dbupdate_3.3.php index 9d9f63a60..914877ca3 100644 --- a/system/dbupdate_3.3.php +++ b/system/dbupdate_3.3.php @@ -4875,7 +4875,7 @@ $tabellen=array( "bis.tbl_mobilitaetsprogramm" => array("mobilitaetsprogramm_code","kurzbz","beschreibung","sichtbar","sichtbar_outgoing"), "bis.tbl_nation" => array("nation_code","entwicklungsstand","eu","ewr","kontinent","kurztext","langtext","engltext","sperre","nationengruppe_kurzbz", "iso3166_1_a2","iso3166_1_a3"), "bis.tbl_nationengruppe" => array("nationengruppe_kurzbz","nationengruppe_bezeichnung","aktiv"), - "bis.tbl_oehbeitrag" => array("oehbeitrag_id","studierendenbeitrag","versicherung","von_studiensemester_kurzbz","bis_studiensemester_kurzbz","bezeichnung_mehrsprachig", "insertamum", "insertvon", "updateamum", "updatevon"), + "bis.tbl_oehbeitrag" => array("oehbeitrag_id","studierendenbeitrag","versicherung","von_studiensemester_kurzbz","bis_studiensemester_kurzbz","insertamum","insertvon","updateamum","updatevon"), "bis.tbl_orgform" => array("orgform_kurzbz","code","bezeichnung","rolle","bisorgform_kurzbz","bezeichnung_mehrsprachig"), "bis.tbl_verwendung" => array("verwendung_code","verwendungbez"), "bis.tbl_zgv" => array("zgv_code","zgv_bez","zgv_kurzbz","bezeichnung"), From 4b237cbc7fa778f1a01513599b3a9f4972970d40 Mon Sep 17 00:00:00 2001 From: KarpAlex Date: Fri, 28 May 2021 02:12:55 +0200 Subject: [PATCH 12/74] =?UTF-8?q?oehbeitrag=20versicherung:=20possible=20t?= =?UTF-8?q?o=20display=20and=20add=20Oehbeitraege=20and=20Versicherungsbei?= =?UTF-8?q?tr=C3=A4ge=20per=20semester?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/controllers/codex/Oehbeitrag.php | 148 ++++++++++++ application/models/codex/Oehbeitrag_model.php | 53 +++++ application/views/codex/oehbeitrag.php | 69 ++++++ public/js/codex/oehbeitrag.js | 217 ++++++++++++++++++ 4 files changed, 487 insertions(+) create mode 100644 application/controllers/codex/Oehbeitrag.php create mode 100644 application/views/codex/oehbeitrag.php create mode 100644 public/js/codex/oehbeitrag.js diff --git a/application/controllers/codex/Oehbeitrag.php b/application/controllers/codex/Oehbeitrag.php new file mode 100644 index 000000000..818815e95 --- /dev/null +++ b/application/controllers/codex/Oehbeitrag.php @@ -0,0 +1,148 @@ + 'admin:r',// TODO which Berechtigung? + 'getValidStudiensemester' => 'admin:r', + 'addOehbeitrag' => 'admin:rw', + 'deleteOehbeitrag' => 'admin:rw' + ) + ); + + $this->load->model('codex/Oehbeitrag_model', 'OehbeitragModel'); + $this->load->model('organisation/Studiensemester_model', 'StudiensemesterModel'); + } + + public function index() + { + $oehbeitraege = array(); + + $oehbeitragRes = $this->_loadOehbeitraege(); + + if (isError($oehbeitragRes)) + show_error(getError($oehbeitragRes)); + + if (hasData($oehbeitragRes)) + $oehbeitraege = getData($oehbeitragRes); + + $this->load->view("codex/oehbeitrag.php", array('oehbeitraege' => $oehbeitraege)); + } + + public function getValidStudiensemester() + { + $studiensemester = array(); + + $studiensemesterres = $this->OehbeitragModel->getUnassignedStudiensemester(self::STUDIENSEMESTER_START); + + if (isError($studiensemesterres)) + { + $this->outputJsonError(getError($studiensemesterres)); + die(); + } + + if (hasData($studiensemesterres)) + $studiensemester = getData($studiensemesterres); + + $this->outputJsonSuccess($studiensemester); + } + + public function addOehbeitrag() + { + $studierendenbeitrag = $this->input->post('studierendenbeitrag'); + $versicherung = $this->input->post('versicherung'); + $von_studiensemester_kurzbz = $this->input->post('von_studiensemester_kurzbz'); + $bis_studiensemester_kurzbz = $this->input->post('bis_studiensemester_kurzbz'); + if ($bis_studiensemester_kurzbz == 'null') + $bis_studiensemester_kurzbz = null; + + if (!is_numeric($studierendenbeitrag)) + $this->outputJsonError('Ungültiger Studierendenbeitrag'); + elseif (!is_numeric($versicherung)) + $this->outputJsonError('Ungültige Versicherung'); + else + { + $vonBisCheck = $this->_checkVonBisStudiensemester($von_studiensemester_kurzbz, $bis_studiensemester_kurzbz); + + if (isError($vonBisCheck)) + $this->outputJsonError(getError($vonBisCheck)); + else + { + $data = array( + 'studierendenbeitrag' => $studierendenbeitrag, + 'versicherung' => $versicherung, + 'von_studiensemester_kurzbz' => $von_studiensemester_kurzbz, + 'bis_studiensemester_kurzbz' => $bis_studiensemester_kurzbz + ); + + $insertRes = $this->OehbeitragModel->insert($data); + + $this->outputJson($insertRes); + } + } + } + + public function deleteOehbeitrag() + { + $oehbeitrag_id = $this->input->post("oehbeitrag_id"); + + $this->outputJson($this->OehbeitragModel->delete($oehbeitrag_id)); + } + + private function _loadOehbeitraege() + { + $this->OehbeitragModel->addJoin('public.tbl_studiensemester', 'tbl_oehbeitrag.von_studiensemester_kurzbz = tbl_studiensemester.studiensemester_kurzbz'); + $this->OehbeitragModel->addOrder('public.tbl_studiensemester.start', 'DESC'); + return $this->OehbeitragModel->load(); + } + + private function _checkVonBisStudiensemester($von_studiensemester_kurzbz, $bis_studiensemester_kurzbz) + { + $regex = "/^(WS|SS)\d{4}$/"; + if (!preg_match($regex, $von_studiensemester_kurzbz)) + return error("Ungültiges Von-Studiensemester"); + + if (!preg_match($regex, $bis_studiensemester_kurzbz) && $bis_studiensemester_kurzbz != null) + return error("Ungültiges Bis-Studiensemester"); + + $this->StudiensemesterModel->addSelect("start"); + $vonStudiensemesterRes = $this->StudiensemesterModel->load($von_studiensemester_kurzbz); + + if (!hasData($vonStudiensemesterRes)) + return error("Fehler beim Holen von Von-Studiensemester"); + + $this->StudiensemesterModel->addSelect("start"); + $bisStudiensemesterRes = $this->StudiensemesterModel->load($bis_studiensemester_kurzbz); + + if (!hasData($bisStudiensemesterRes)) + return error("Fehler beim Holen von Bis-Studiensemester"); + + $vonStudiensemester = getData($vonStudiensemesterRes)[0]->start; + $bisStudiensemester = getData($bisStudiensemesterRes)[0]->start; + + if ($bis_studiensemester_kurzbz != null && new DateTime($vonStudiensemester) > new DateTime($bisStudiensemester)) + return error("Von-Studiensemester größer als Bis-Studiensemester"); + + $assignableRes = $this->OehbeitragModel->checkIfStudiensemesterAssignable($von_studiensemester_kurzbz, $bis_studiensemester_kurzbz); + + if (isError($assignableRes)) + return $assignableRes; + + if (hasData($assignableRes)) + { + $assignable = getData($assignableRes)[0]; + + if (!$assignable) + return error("Keine Zuweisung möglich, Semesterüberschneidung"); + } + + return success("Studiensemester gültig"); + } +} diff --git a/application/models/codex/Oehbeitrag_model.php b/application/models/codex/Oehbeitrag_model.php index d12dbf23f..ace532908 100644 --- a/application/models/codex/Oehbeitrag_model.php +++ b/application/models/codex/Oehbeitrag_model.php @@ -32,4 +32,57 @@ class Oehbeitrag_model extends DB_Model return $this->execQuery($qry, array($studiensemester_kurzbz)); } + + /** + * Gets all Studiensemester for which no Oehbeitrag value assignment. + * @param string $start_studiensemester_kurzbz semester before the given semester are ignored + * @return object + */ + public function getUnassignedStudiensemester($start_studiensemester_kurzbz) + { + $qry = "SELECT * FROM public.tbl_studiensemester sem + WHERE sem.start >= (SELECT start FROM public.tbl_studiensemester WHERE studiensemester_kurzbz = ?) + AND NOT EXISTS (SELECT 1 FROM bis.tbl_oehbeitrag oeh + JOIN public.tbl_studiensemester oeh_von ON oeh.von_studiensemester_kurzbz = oeh_von.studiensemester_kurzbz + LEFT JOIN public.tbl_studiensemester oeh_bis ON oeh.bis_studiensemester_kurzbz = oeh_bis.studiensemester_kurzbz + WHERE sem.start::date >= oeh_von.start::date AND (sem.start::date <= oeh_bis.start::date OR oeh_bis.studiensemester_kurzbz IS NULL)) + ORDER BY sem.start"; + + return $this->execQuery($qry, array($start_studiensemester_kurzbz)); + } + + /** + * Checks if a Öhbeitrag can be assigned for a Studiensemester range. + * @param string $von_studiensemester_kurzbz + * @param string $bis_studiensemester_kurzbz + * @return object + */ + public function checkIfStudiensemesterAssignable($von_studiensemester_kurzbz, $bis_studiensemester_kurzbz = null) + { + $params = array($von_studiensemester_kurzbz); + + $allStdSemSpanQry = "SELECT count(studiensemester_kurzbz) as number_assigned FROM public.tbl_studiensemester sem + WHERE start >= (SELECT start FROM public.tbl_studiensemester WHERE studiensemester_kurzbz = ?)"; + + if ($bis_studiensemester_kurzbz != null) + { + $allStdSemSpanQry .= " AND (start <= (SELECT start FROM public.tbl_studiensemester WHERE studiensemester_kurzbz = ?))"; + $params[] = $bis_studiensemester_kurzbz; + } + + $allStdSemSpanQry .= " AND EXISTS (SELECT 1 FROM bis.tbl_oehbeitrag + JOIN public.tbl_studiensemester sem_von ON tbl_oehbeitrag.von_studiensemester_kurzbz = sem_von.studiensemester_kurzbz + LEFT JOIN public.tbl_studiensemester sem_bis ON tbl_oehbeitrag.bis_studiensemester_kurzbz = sem_bis.studiensemester_kurzbz + WHERE sem.start >= sem_von.start AND (sem.start <= sem_bis.start OR sem_bis.studiensemester_kurzbz IS NULL))"; + + $nrAssigned = $this->execQuery($allStdSemSpanQry, $params); + + if (isError($nrAssigned)) + return $nrAssigned; + + if (!hasData($nrAssigned)) + return error("Fehler bei Überprüfung der Möglichkeit der Semesterzuweisung"); + + return success(array(getData($nrAssigned)[0]->number_assigned == 0)); + } } diff --git a/application/views/codex/oehbeitrag.php b/application/views/codex/oehbeitrag.php new file mode 100644 index 000000000..afb2170ff --- /dev/null +++ b/application/views/codex/oehbeitrag.php @@ -0,0 +1,69 @@ +load->view( + 'templates/FHC-Header', + array( + 'title' => 'ÖH-Beitragsverwaltung', + 'jquery' => true, + 'jqueryui' => true, + 'bootstrap' => true, + 'fontawesome' => true, + 'sbadmintemplate' => true, + 'tablesorter' => true, + 'dialoglib' => true, + 'ajaxlib' => true, + 'navigationwidget' => true, + 'customCSSs' => array('public/css/sbadmin2/tablesort_bootstrap.css'/*, 'public/css/codex/oehbeitrag.css'*/), + 'customJSs' => array('public/js/tablesort/tablesort.js', 'public/js/codex/oehbeitrag.js') + ) +); +?> + + +
+ + widgetlib->widget('NavigationWidget');*/ ?> + +
+
+
+
+ +
+
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + +
Gültig vonGültig bis (inkl.)StudierendenbetragVersicherungsbetragAktion
von_studiensemester_kurzbz ?>bis_studiensemester_kurzbz == null ? 'unbeschränkt' : $oehbeitrag->bis_studiensemester_kurzbz ?>studierendenbeitrag, 2, ',', '.') ?>versicherung, 2, ',', '.') ?>
+
+
+
+
+
+ + +load->view('templates/FHC-Footer'); ?> diff --git a/public/js/codex/oehbeitrag.js b/public/js/codex/oehbeitrag.js new file mode 100644 index 000000000..6346c8ba0 --- /dev/null +++ b/public/js/codex/oehbeitrag.js @@ -0,0 +1,217 @@ +const BASE_URL = FHC_JS_DATA_STORAGE_OBJECT.app_root + FHC_JS_DATA_STORAGE_OBJECT.ci_router; +const CALLED_PATH = FHC_JS_DATA_STORAGE_OBJECT.called_path; +const CONTROLLER_URL = BASE_URL + "/"+CALLED_PATH; + +/** + * javascript file for Öhbeitrag GUI + */ +$(document).ready(function () +{ + //initialise table sorter + //Tablesort.addTablesorter("oehbeitraegeTbl", [], ["zebra"]); + + $("#addNewOeh").click( + function() + { + let callback = function(data) + { + if (FHC_AjaxClient.hasData(data)) + { + let studiensemester = FHC_AjaxClient.getData(data); + let nextOehbeitragId = Oehbeitrag.newBeitragId; + + let newRowHtml = ""+ + ""; + newRowHtml += ""; + newRowHtml += ""; + newRowHtml += ""; + newRowHtml += ""; + newRowHtml += ""+ + ""+ + ""+ + ""; + +/* $("#saveHeading, .saveCell").show();*/ + $("#oehbeitraegeTbl tbody").prepend(newRowHtml); + $("#addOeh_"+Oehbeitrag.newBeitragId).click( + function() + { + // get form data into object + let oehbeitrag = { + "von_studiensemester_kurzbz": $("#von_studiensemester_kurzbz_"+nextOehbeitragId).val(), + "bis_studiensemester_kurzbz": $("#bis_studiensemester_kurzbz_"+nextOehbeitragId).val(), + "studierendenbeitrag": $("#studierendenbeitrag_"+nextOehbeitragId).val().replace(",", "."), + "versicherung": $("#versicherung_"+nextOehbeitragId).val().replace(",", ".") + } + + Oehbeitrag.addOehbeitrag(oehbeitrag, nextOehbeitragId); + } + ); + + // increase counter for newly added rows + Oehbeitrag.newBeitragId++; + } + else + FHC_DialogLib.alertInfo("ÖH-Beiträge für alle Studiensemester festgelegt"); + } + + Oehbeitrag.getValidStudiensemester(callback); + } + ) + + $(".deleteBtn").click( + function() + { + let oehbeitrag_id_prefixed = $(this).prop("id"); + let oehbeitrag_id = oehbeitrag_id_prefixed.substr(oehbeitrag_id_prefixed.indexOf('_')+1); + + Oehbeitrag.deleteOehbeitrag(oehbeitrag_id); + } + ) +}); + +var Oehbeitrag = { + newBeitragId: 0, + // ----------------------------------------------------------------------------------------------------------------- + // ajax calls + getValidStudiensemester: function(callback) + { + FHC_AjaxClient.ajaxCallGet( + CALLED_PATH + "/getValidStudiensemester", + null, + { + successCallback: callback, + errorCallback: function() + { + FHC_DialogLib.alertError('Fehler beim Holen der Semester'); + } + } + ); + }, + addOehbeitrag: function(oehbeitrag, nextOehbeitragId) + { + FHC_AjaxClient.ajaxCallPost( + CALLED_PATH + '/addOehbeitrag', + oehbeitrag, + { + successCallback: function(data, textStatus, jqXHR) { + console.log(data); + if (FHC_AjaxClient.isError(data)) + { + FHC_DialogLib.alertError(FHC_AjaxClient.getError(data)); + } + else if (FHC_AjaxClient.hasData(data)) + { + console.log(data); + let inserted_id = FHC_AjaxClient.getData(data); + + // refresh table row in GUI + let bis_studiensemester_kurzbz = oehbeitrag.bis_studiensemester_kurzbz == 'null' ? 'unbeschränkt' : oehbeitrag.bis_studiensemester_kurzbz; + + $("#studierendenbeitrag_"+nextOehbeitragId).parent().html(Oehbeitrag._formatDecimalGerman(oehbeitrag.studierendenbeitrag)); + $("#versicherung_"+nextOehbeitragId).parent().html(Oehbeitrag._formatDecimalGerman(oehbeitrag.versicherung)); + $("#von_studiensemester_kurzbz_"+nextOehbeitragId).parent().html(oehbeitrag.von_studiensemester_kurzbz); + $("#bis_studiensemester_kurzbz_"+nextOehbeitragId).parent().html(bis_studiensemester_kurzbz); + + // add delete button instead of save btn + $("#addOeh_"+nextOehbeitragId).parent().html(""); + + $("#delete_"+inserted_id).click( + function() + { + let oehbeitrag_id_prefixed = $(this).prop("id"); + let oehbeitrag_id = oehbeitrag_id_prefixed.substr(oehbeitrag_id_prefixed.indexOf('_')+1); + + Oehbeitrag.deleteOehbeitrag(oehbeitrag_id); + } + ) + } + else + { + FHC_DialogLib.alertError('Fehler beim Hinzufügen des Öhbeitrags'); + } + }, + errorCallback: function() + { + FHC_DialogLib.alertError('Fehler beim Hinzufügen des Öhbeitrags'); + } + } + ); + }, + deleteOehbeitrag: function(oehbeitrag_id) + { + FHC_AjaxClient.ajaxCallPost( + CALLED_PATH + '/deleteOehbeitrag', + {"oehbeitrag_id": oehbeitrag_id}, + { + successCallback: function(data, textStatus, jqXHR) { + if (FHC_AjaxClient.hasData(data)) + { + console.log(data); + $("#delete_"+oehbeitrag_id).closest("tr").remove(); + } + else + { + FHC_DialogLib.alertError('Fehler beim Löschen des Öhbeitrags'); + } + }, + errorCallback: function() + { + FHC_DialogLib.alertError('Fehler beim Löschen des Öhbeitrags'); + } + } + ); + }, + + // ----------------------------------------------------------------------------------------------------------------- + // (private) methods + _printStudiensemesterDropdown(name, studiensemester) + { + let rowHtml = ""; + let first = true; + for (let idx in studiensemester) + { + let selected = first ? ' selected' : ''; + let studiensemester_kurzbz = studiensemester[idx].studiensemester_kurzbz; + rowHtml += ""; + first = false; + } + + return rowHtml; + }, + /** + * Formats a numeric value as a float with two decimals + * @param sum + * @returns {string} + */ + _formatDecimalGerman: function(sum) + { + var dec = null; + + if(sum === null) + dec = parseFloat(0).toFixed(2).replace(".", ","); + else if(sum === '') + { + dec = '' + } + else + { + dec = parseFloat(sum).toFixed(2); + + dec = dec.split('.'); + var dec1 = dec[0]; + var dec2 = ',' + dec[1]; + var rgx = /(\d+)(\d{3})/; + while (rgx.test(dec1)) { + dec1 = dec1.replace(rgx, '$1' + '.' + '$2'); + } + dec = dec1 + dec2; + } + return dec; + } +}; From fc3921ecadf453388bfffc35459f59e2d4c8b4ac Mon Sep 17 00:00:00 2001 From: KarpAlex Date: Fri, 28 May 2021 02:15:26 +0200 Subject: [PATCH 13/74] dbupdate_3.3.php: removed "bezeichnung_mehrsprachig" field from bis.tbl_oehbeitrag table check --- system/dbupdate_3.3.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/dbupdate_3.3.php b/system/dbupdate_3.3.php index 990fb0308..8ab352f08 100644 --- a/system/dbupdate_3.3.php +++ b/system/dbupdate_3.3.php @@ -4856,7 +4856,7 @@ $tabellen=array( "bis.tbl_mobilitaetsprogramm" => array("mobilitaetsprogramm_code","kurzbz","beschreibung","sichtbar","sichtbar_outgoing"), "bis.tbl_nation" => array("nation_code","entwicklungsstand","eu","ewr","kontinent","kurztext","langtext","engltext","sperre","nationengruppe_kurzbz", "iso3166_1_a2","iso3166_1_a3"), "bis.tbl_nationengruppe" => array("nationengruppe_kurzbz","nationengruppe_bezeichnung","aktiv"), - "bis.tbl_oehbeitrag" => array("oehbeitrag_id","studierendenbeitrag","versicherung","von_studiensemester_kurzbz","bis_studiensemester_kurzbz","bezeichnung_mehrsprachig", "insertamum", "insertvon", "updateamum", "updatevon"), + "bis.tbl_oehbeitrag" => array("oehbeitrag_id","studierendenbeitrag","versicherung","von_studiensemester_kurzbz","bis_studiensemester_kurzbz","insertamum","insertvon","updateamum","updatevon"), "bis.tbl_orgform" => array("orgform_kurzbz","code","bezeichnung","rolle","bisorgform_kurzbz","bezeichnung_mehrsprachig"), "bis.tbl_verwendung" => array("verwendung_code","verwendungbez"), "bis.tbl_zgv" => array("zgv_code","zgv_bez","zgv_kurzbz","bezeichnung"), From df8c946bb2c575a9e873735e9fe71d6f13f62f88 Mon Sep 17 00:00:00 2001 From: KarpAlex Date: Mon, 31 May 2021 23:20:56 +0200 Subject: [PATCH 14/74] enabled updating of oehbeitrag values --- application/controllers/codex/Oehbeitrag.php | 92 ++++++- application/models/codex/Oehbeitrag_model.php | 34 ++- application/views/codex/oehbeitrag.php | 20 +- public/css/codex/oehbeitrag.css | 9 + public/js/codex/oehbeitrag.js | 258 +++++++++++++++--- 5 files changed, 349 insertions(+), 64 deletions(-) create mode 100644 public/css/codex/oehbeitrag.css diff --git a/application/controllers/codex/Oehbeitrag.php b/application/controllers/codex/Oehbeitrag.php index 818815e95..9aa5e4402 100644 --- a/application/controllers/codex/Oehbeitrag.php +++ b/application/controllers/codex/Oehbeitrag.php @@ -13,6 +13,7 @@ class Oehbeitrag extends Auth_Controller 'index' => 'admin:r',// TODO which Berechtigung? 'getValidStudiensemester' => 'admin:r', 'addOehbeitrag' => 'admin:rw', + 'updateOehbeitrag' => 'admin:rw', 'deleteOehbeitrag' => 'admin:rw' ) ); @@ -38,14 +39,16 @@ class Oehbeitrag extends Auth_Controller public function getValidStudiensemester() { + $oehbeitrag_id = $this->input->get('oehbeitrag_id'); + $oehbeitrag_id_arr = isset($oehbeitrag_id) ? array($oehbeitrag_id) : null; + $studiensemester = array(); - $studiensemesterres = $this->OehbeitragModel->getUnassignedStudiensemester(self::STUDIENSEMESTER_START); - + $studiensemesterres = $this->OehbeitragModel->getUnassignedStudiensemester(self::STUDIENSEMESTER_START, $oehbeitrag_id_arr); if (isError($studiensemesterres)) { $this->outputJsonError(getError($studiensemesterres)); - die(); + return; } if (hasData($studiensemesterres)) @@ -63,9 +66,9 @@ class Oehbeitrag extends Auth_Controller if ($bis_studiensemester_kurzbz == 'null') $bis_studiensemester_kurzbz = null; - if (!is_numeric($studierendenbeitrag)) + if (!$this->_checkAmount($studierendenbeitrag)) $this->outputJsonError('Ungültiger Studierendenbeitrag'); - elseif (!is_numeric($versicherung)) + elseif (!$this->_checkAmount($versicherung)) $this->outputJsonError('Ungültige Versicherung'); else { @@ -82,13 +85,65 @@ class Oehbeitrag extends Auth_Controller 'bis_studiensemester_kurzbz' => $bis_studiensemester_kurzbz ); - $insertRes = $this->OehbeitragModel->insert($data); - - $this->outputJson($insertRes); + $this->outputJson($this->OehbeitragModel->insert($data)); } } } + public function updateOehbeitrag() + { + $oehbeitrag_id = $this->input->post("oehbeitrag_id"); + $data = $this->input->post("data"); + + if (!is_numeric($oehbeitrag_id) || isEmptyArray($data)) + { + $this->outputJsonError("Ungültige Parameter"); + return; + } + + foreach ($data as $idx => $value) + { + if ($idx == 'studierendenbeitrag' || $idx == 'versicherung') + { + if (!$this->_checkAmount($value)) + { + $this->outputJsonError("Ungültiger $idx"); + return; + } + } + elseif ($idx == 'von_studiensemester_kurzbz' || $idx == 'bis_studiensemester_kurzbz') + { + $this->OehbeitragModel->addSelect('von_studiensemester_kurzbz, bis_studiensemester_kurzbz'); + $vonBisStudiensemesterRes = $this->OehbeitragModel->load($oehbeitrag_id); + + if (!hasData($vonBisStudiensemesterRes)) + { + $this->outputJsonError("Fehler beim Holen des Öhbeitrags"); + return; + } + + $vonBisStudiensemester = getData($vonBisStudiensemesterRes); + + $von_studiensemester_kurzbz = $idx == 'von_studiensemester_kurzbz' ? $value : $vonBisStudiensemester[0]->von_studiensemester_kurzbz; + + if ($idx == 'bis_studiensemester_kurzbz') + $bis_studiensemester_kurzbz = $data[$idx] = $value == 'null' ? null : $value; + else + $bis_studiensemester_kurzbz = $vonBisStudiensemester[0]->bis_studiensemester_kurzbz; + + $checkStudiensemester = $this->_checkVonBisStudiensemester($von_studiensemester_kurzbz, $bis_studiensemester_kurzbz, $oehbeitrag_id); + + if (isError($checkStudiensemester)) + { + $this->outputJsonError(getError($checkStudiensemester)); + return; + } + } + } + + $this->outputJson($this->OehbeitragModel->update($oehbeitrag_id, $data)); + } + public function deleteOehbeitrag() { $oehbeitrag_id = $this->input->post("oehbeitrag_id"); @@ -98,12 +153,19 @@ class Oehbeitrag extends Auth_Controller private function _loadOehbeitraege() { - $this->OehbeitragModel->addJoin('public.tbl_studiensemester', 'tbl_oehbeitrag.von_studiensemester_kurzbz = tbl_studiensemester.studiensemester_kurzbz'); - $this->OehbeitragModel->addOrder('public.tbl_studiensemester.start', 'DESC'); + $this->OehbeitragModel->addSelect('oehbeitrag_id, von_studiensemester_kurzbz, bis_studiensemester_kurzbz, studierendenbeitrag, versicherung, sem_von.start as von_datum, sem_bis.ende as bis_datum'); + $this->OehbeitragModel->addJoin('public.tbl_studiensemester sem_von', 'tbl_oehbeitrag.von_studiensemester_kurzbz = sem_von.studiensemester_kurzbz'); + $this->OehbeitragModel->addJoin('public.tbl_studiensemester sem_bis', 'tbl_oehbeitrag.bis_studiensemester_kurzbz = sem_bis.studiensemester_kurzbz', 'LEFT'); + $this->OehbeitragModel->addOrder('sem_von.start', 'DESC'); return $this->OehbeitragModel->load(); } - private function _checkVonBisStudiensemester($von_studiensemester_kurzbz, $bis_studiensemester_kurzbz) + private function _checkAmount($amount) + { + return is_numeric($amount) && $amount <= 99999.99; + } + + private function _checkVonBisStudiensemester($von_studiensemester_kurzbz, $bis_studiensemester_kurzbz, $oehbeitrag_id = null) { $regex = "/^(WS|SS)\d{4}$/"; if (!preg_match($regex, $von_studiensemester_kurzbz)) @@ -130,7 +192,13 @@ class Oehbeitrag extends Auth_Controller if ($bis_studiensemester_kurzbz != null && new DateTime($vonStudiensemester) > new DateTime($bisStudiensemester)) return error("Von-Studiensemester größer als Bis-Studiensemester"); - $assignableRes = $this->OehbeitragModel->checkIfStudiensemesterAssignable($von_studiensemester_kurzbz, $bis_studiensemester_kurzbz); + $oehbeitrag_id_arr = isset($oehbeitrag_id) ? array($oehbeitrag_id) : null; + + $assignableRes = $this->OehbeitragModel->checkIfStudiensemesterAssignable( + $von_studiensemester_kurzbz, + $bis_studiensemester_kurzbz, + $oehbeitrag_id_arr + ); if (isError($assignableRes)) return $assignableRes; diff --git a/application/models/codex/Oehbeitrag_model.php b/application/models/codex/Oehbeitrag_model.php index ace532908..abc35a663 100644 --- a/application/models/codex/Oehbeitrag_model.php +++ b/application/models/codex/Oehbeitrag_model.php @@ -34,30 +34,40 @@ class Oehbeitrag_model extends DB_Model } /** - * Gets all Studiensemester for which no Oehbeitrag value assignment. + * Gets all Studiensemester for which no Oehbeitrag value assignment exists. * @param string $start_studiensemester_kurzbz semester before the given semester are ignored * @return object */ - public function getUnassignedStudiensemester($start_studiensemester_kurzbz) + public function getUnassignedStudiensemester($start_studiensemester_kurzbz, $excluded_oehbeitrag_id = array()) { + $params = array($start_studiensemester_kurzbz); + $qry = "SELECT * FROM public.tbl_studiensemester sem WHERE sem.start >= (SELECT start FROM public.tbl_studiensemester WHERE studiensemester_kurzbz = ?) AND NOT EXISTS (SELECT 1 FROM bis.tbl_oehbeitrag oeh JOIN public.tbl_studiensemester oeh_von ON oeh.von_studiensemester_kurzbz = oeh_von.studiensemester_kurzbz LEFT JOIN public.tbl_studiensemester oeh_bis ON oeh.bis_studiensemester_kurzbz = oeh_bis.studiensemester_kurzbz - WHERE sem.start::date >= oeh_von.start::date AND (sem.start::date <= oeh_bis.start::date OR oeh_bis.studiensemester_kurzbz IS NULL)) - ORDER BY sem.start"; + WHERE sem.start::date >= oeh_von.start::date AND (sem.start::date <= oeh_bis.start::date OR oeh_bis.studiensemester_kurzbz IS NULL)"; - return $this->execQuery($qry, array($start_studiensemester_kurzbz)); + if (!isEmptyArray($excluded_oehbeitrag_id)) + { + $qry .= " AND oehbeitrag_id NOT IN ?"; + $params[] = $excluded_oehbeitrag_id; + } + + $qry .= ") ORDER BY sem.start"; + + return $this->execQuery($qry, $params); } /** * Checks if a Öhbeitrag can be assigned for a Studiensemester range. * @param string $von_studiensemester_kurzbz * @param string $bis_studiensemester_kurzbz - * @return object + * @param array $excluded_oehbeitrag_id + * @return object array with true if assignable, with false if not */ - public function checkIfStudiensemesterAssignable($von_studiensemester_kurzbz, $bis_studiensemester_kurzbz = null) + public function checkIfStudiensemesterAssignable($von_studiensemester_kurzbz, $bis_studiensemester_kurzbz = null, $excluded_oehbeitrag_id = array()) { $params = array($von_studiensemester_kurzbz); @@ -73,7 +83,15 @@ class Oehbeitrag_model extends DB_Model $allStdSemSpanQry .= " AND EXISTS (SELECT 1 FROM bis.tbl_oehbeitrag JOIN public.tbl_studiensemester sem_von ON tbl_oehbeitrag.von_studiensemester_kurzbz = sem_von.studiensemester_kurzbz LEFT JOIN public.tbl_studiensemester sem_bis ON tbl_oehbeitrag.bis_studiensemester_kurzbz = sem_bis.studiensemester_kurzbz - WHERE sem.start >= sem_von.start AND (sem.start <= sem_bis.start OR sem_bis.studiensemester_kurzbz IS NULL))"; + WHERE sem.start >= sem_von.start AND (sem.start <= sem_bis.start OR sem_bis.studiensemester_kurzbz IS NULL)"; + + if (!isEmptyArray($excluded_oehbeitrag_id)) + { + $allStdSemSpanQry .= " AND oehbeitrag_id NOT IN ?"; + $params[] = $excluded_oehbeitrag_id; + } + + $allStdSemSpanQry .= ")"; $nrAssigned = $this->execQuery($allStdSemSpanQry, $params); diff --git a/application/views/codex/oehbeitrag.php b/application/views/codex/oehbeitrag.php index afb2170ff..47892527a 100644 --- a/application/views/codex/oehbeitrag.php +++ b/application/views/codex/oehbeitrag.php @@ -12,7 +12,7 @@ $this->load->view( 'dialoglib' => true, 'ajaxlib' => true, 'navigationwidget' => true, - 'customCSSs' => array('public/css/sbadmin2/tablesort_bootstrap.css'/*, 'public/css/codex/oehbeitrag.css'*/), + 'customCSSs' => array('public/css/sbadmin2/tablesort_bootstrap.css', 'public/css/codex/oehbeitrag.css'), 'customJSs' => array('public/js/tablesort/tablesort.js', 'public/js/codex/oehbeitrag.js') ) ); @@ -41,7 +41,7 @@ $this->load->view( Gültig von - Gültig bis (inkl.) + Gültig bis Studierendenbetrag Versicherungsbetrag Aktion @@ -50,10 +50,18 @@ $this->load->view( - von_studiensemester_kurzbz ?> - bis_studiensemester_kurzbz == null ? 'unbeschränkt' : $oehbeitrag->bis_studiensemester_kurzbz ?> - studierendenbeitrag, 2, ',', '.') ?> - versicherung, 2, ',', '.') ?> + von_datum), 'd.m.Y') . '/' . $oehbeitrag->von_studiensemester_kurzbz ?> + + + bis_studiensemester_kurzbz == null ? 'unbeschränkt' : (date_format(date_create($oehbeitrag->bis_datum), 'd.m.Y') . '/' . $oehbeitrag->bis_studiensemester_kurzbz) ?> + + + studierendenbeitrag, 2, ',', '.') ?> + + + versicherung, 2, ',', '.') ?> + + diff --git a/public/css/codex/oehbeitrag.css b/public/css/codex/oehbeitrag.css new file mode 100644 index 000000000..335489a1b --- /dev/null +++ b/public/css/codex/oehbeitrag.css @@ -0,0 +1,9 @@ +.inline-inputfield { + width: auto; + display: inline; +} + +.fa-edit, .fa-check { + cursor: pointer; + font-size: 1.2em; +} \ No newline at end of file diff --git a/public/js/codex/oehbeitrag.js b/public/js/codex/oehbeitrag.js index 6346c8ba0..68d39a897 100644 --- a/public/js/codex/oehbeitrag.js +++ b/public/js/codex/oehbeitrag.js @@ -8,8 +8,9 @@ const CONTROLLER_URL = BASE_URL + "/"+CALLED_PATH; $(document).ready(function () { //initialise table sorter - //Tablesort.addTablesorter("oehbeitraegeTbl", [], ["zebra"]); + Oehbeitrag._addTablesorter(); + // set trigger for adding new Oehhbeitrag $("#addNewOeh").click( function() { @@ -22,18 +23,14 @@ $(document).ready(function () let newRowHtml = ""+ ""; - newRowHtml += ""; + newRowHtml += Oehbeitrag._getStudiensemesterDropdown(Oehbeitrag.newBeitragId, 'von_studiensemester_kurzbz', studiensemester); newRowHtml += ""; - newRowHtml += ""; + newRowHtml += Oehbeitrag._getStudiensemesterDropdown(Oehbeitrag.newBeitragId, 'bis_studiensemester_kurzbz', studiensemester); newRowHtml += ""; - newRowHtml += ""+ - ""+ - ""+ + newRowHtml += ""+ + ""+ + " " + + " "+ ""; /* $("#saveHeading, .saveCell").show();*/ @@ -43,13 +40,25 @@ $(document).ready(function () { // get form data into object let oehbeitrag = { - "von_studiensemester_kurzbz": $("#von_studiensemester_kurzbz_"+nextOehbeitragId).val(), - "bis_studiensemester_kurzbz": $("#bis_studiensemester_kurzbz_"+nextOehbeitragId).val(), - "studierendenbeitrag": $("#studierendenbeitrag_"+nextOehbeitragId).val().replace(",", "."), - "versicherung": $("#versicherung_"+nextOehbeitragId).val().replace(",", ".") + "von_studiensemester_kurzbz": $("#input_von_studiensemester_kurzbz_"+nextOehbeitragId).val(), + "bis_studiensemester_kurzbz": $("#input_bis_studiensemester_kurzbz_"+nextOehbeitragId).val(), + "studierendenbeitrag": $("#input_studierendenbeitrag_"+nextOehbeitragId).val().replace(",", "."), + "versicherung": $("#input_versicherung_"+nextOehbeitragId).val().replace(",", ".") } - Oehbeitrag.addOehbeitrag(oehbeitrag, nextOehbeitragId); + let studiensemester_von_bis = { + "von_semester_with_date": $("#input_von_studiensemester_kurzbz_"+nextOehbeitragId+" option:selected").text(), + "bis_semester_with_date": $("#input_bis_studiensemester_kurzbz_"+nextOehbeitragId+" option:selected").text() + } + + Oehbeitrag.addOehbeitrag(oehbeitrag, studiensemester_von_bis, nextOehbeitragId); + } + ); + + $("#delete_"+nextOehbeitragId).click( + function() + { + $(this).parent('td').parent('tr').remove(); } ); @@ -64,26 +73,32 @@ $(document).ready(function () } ) + // set trigger for deleting Oehhbeitrag $(".deleteBtn").click( function() { let oehbeitrag_id_prefixed = $(this).prop("id"); - let oehbeitrag_id = oehbeitrag_id_prefixed.substr(oehbeitrag_id_prefixed.indexOf('_')+1); + let oehbeitrag_id = oehbeitrag_id_prefixed.substr(oehbeitrag_id_prefixed.lastIndexOf('_')+1); Oehbeitrag.deleteOehbeitrag(oehbeitrag_id); } - ) + ); + + // set trigger for updating Oehhbeitrag + Oehbeitrag._setUpdateEvents(); }); var Oehbeitrag = { newBeitragId: 0, // ----------------------------------------------------------------------------------------------------------------- // ajax calls - getValidStudiensemester: function(callback) + getValidStudiensemester: function(callback, oehbeitrag_id) { + let params = oehbeitrag_id ? {"oehbeitrag_id": oehbeitrag_id} : null; + FHC_AjaxClient.ajaxCallGet( CALLED_PATH + "/getValidStudiensemester", - null, + params, { successCallback: callback, errorCallback: function() @@ -93,33 +108,42 @@ var Oehbeitrag = { } ); }, - addOehbeitrag: function(oehbeitrag, nextOehbeitragId) + addOehbeitrag: function(oehbeitrag, studiensemester_von_bis, nextOehbeitragId) { FHC_AjaxClient.ajaxCallPost( CALLED_PATH + '/addOehbeitrag', oehbeitrag, { successCallback: function(data, textStatus, jqXHR) { - console.log(data); if (FHC_AjaxClient.isError(data)) { FHC_DialogLib.alertError(FHC_AjaxClient.getError(data)); } else if (FHC_AjaxClient.hasData(data)) { - console.log(data); let inserted_id = FHC_AjaxClient.getData(data); // refresh table row in GUI - let bis_studiensemester_kurzbz = oehbeitrag.bis_studiensemester_kurzbz == 'null' ? 'unbeschränkt' : oehbeitrag.bis_studiensemester_kurzbz; + let bis_studiensemester_kurzbz = oehbeitrag.bis_studiensemester_kurzbz == 'null' ? 'unbeschränkt' : studiensemester_von_bis.bis_semester_with_date; - $("#studierendenbeitrag_"+nextOehbeitragId).parent().html(Oehbeitrag._formatDecimalGerman(oehbeitrag.studierendenbeitrag)); - $("#versicherung_"+nextOehbeitragId).parent().html(Oehbeitrag._formatDecimalGerman(oehbeitrag.versicherung)); - $("#von_studiensemester_kurzbz_"+nextOehbeitragId).parent().html(oehbeitrag.von_studiensemester_kurzbz); - $("#bis_studiensemester_kurzbz_"+nextOehbeitragId).parent().html(bis_studiensemester_kurzbz); + $("#input_studierendenbeitrag_"+nextOehbeitragId).parent('td').html( + Oehbeitrag._formatDecimalGerman(oehbeitrag.studierendenbeitrag)+" " + ); + $("#input_versicherung_"+nextOehbeitragId).parent('td').html( + Oehbeitrag._formatDecimalGerman(oehbeitrag.versicherung)+" " + ); + $("#input_von_studiensemester_kurzbz_"+nextOehbeitragId).parent('td').html( + studiensemester_von_bis.von_semester_with_date+" " + ); + $("#input_bis_studiensemester_kurzbz_"+nextOehbeitragId).parent('td').html( + bis_studiensemester_kurzbz+" " + ); // add delete button instead of save btn - $("#addOeh_"+nextOehbeitragId).parent().html(""); + $("#addOeh_"+nextOehbeitragId).parent('td').html(""); + + // add update and delete events + Oehbeitrag._setUpdateEvents(); $("#delete_"+inserted_id).click( function() @@ -143,6 +167,52 @@ var Oehbeitrag = { } ); }, + updateOehbeitrag(oehbeitrag_id, fieldname, fieldelement, inputtype) + { + let oehbeitragdata = {}; + let fieldvalue = fieldelement.val(); + oehbeitragdata[fieldname] = fieldvalue; + + FHC_AjaxClient.ajaxCallPost( + CALLED_PATH + '/updateOehbeitrag', + { + "oehbeitrag_id": oehbeitrag_id, + "data": oehbeitragdata + }, + { + successCallback: function(data, textStatus, jqXHR) { + if (FHC_AjaxClient.isError(data)) + { + FHC_DialogLib.alertError(FHC_AjaxClient.getError(data)); + } + else if (FHC_AjaxClient.hasData(data)) + { + if (inputtype == 'semester') + fieldvalue = $(fieldelement).find("option:selected").text(); + else + fieldvalue = Oehbeitrag._formatDecimalGerman(fieldvalue); + $("#confirm_"+fieldname+"_"+oehbeitrag_id).parent('td').html( + fieldvalue+" " + ); + $("#edit_"+fieldname+"_"+oehbeitrag_id).click( + function() + { + Oehbeitrag._setUpdateEvent($(this).prop("id"), fieldname, inputtype); + } + ); + } + else + { + FHC_DialogLib.alertError('Fehler beim Hinzufügen des Öhbeitrags'); + } + }, + errorCallback: function() + { + FHC_DialogLib.alertError('Fehler beim Hinzufügen des Öhbeitrags'); + } + } + ); + }, deleteOehbeitrag: function(oehbeitrag_id) { FHC_AjaxClient.ajaxCallPost( @@ -152,8 +222,8 @@ var Oehbeitrag = { successCallback: function(data, textStatus, jqXHR) { if (FHC_AjaxClient.hasData(data)) { - console.log(data); $("#delete_"+oehbeitrag_id).closest("tr").remove(); + Oehbeitrag._addTablesorter(); } else { @@ -170,20 +240,128 @@ var Oehbeitrag = { // ----------------------------------------------------------------------------------------------------------------- // (private) methods - _printStudiensemesterDropdown(name, studiensemester) + _renderOehbeitragTable(oehbeitraege) { - let rowHtml = ""; - let first = true; - for (let idx in studiensemester) + for (let oehbeitragidx in oehbeitraege) { - let selected = first ? ' selected' : ''; - let studiensemester_kurzbz = studiensemester[idx].studiensemester_kurzbz; - rowHtml += ""; - first = false; + let oehbeitrag = oehbeitraege[oehbeitragidx]; + + + } + }, + _setUpdateEvents() + { + $(".editStudierendenbeitrag").off('click').click( + function() + { + Oehbeitrag._setUpdateEvent($(this).prop("id"), 'studierendenbeitrag'); + } + ); + + $(".editVersicherung").off('click').click( + function() + { + Oehbeitrag._setUpdateEvent($(this).prop("id"), 'versicherung'); + } + ); + + $(".editBisStudiensemester").off('click').click( + function() + { + Oehbeitrag._setUpdateEvent($(this).prop("id"), 'bis_studiensemester_kurzbz', 'semester'); + } + ); + + $(".editVonStudiensemester").off('click').click( + function() + { + Oehbeitrag._setUpdateEvent($(this).prop("id"), 'von_studiensemester_kurzbz', 'semester'); + } + ); + + }, + _setUpdateEvent(oehbeitrag_id_prefixed, fieldname, inputtype) + { + let initElement = $("#"+oehbeitrag_id_prefixed); // clicked element triggering event + let oehbeitrag_id = oehbeitrag_id_prefixed.substr(oehbeitrag_id_prefixed.lastIndexOf('_')+1); + let currFieldvalue = initElement.parent('td').text().trim(); + + let callback = function(validSemesterData) + { + let inputHtml = ""; + + // if semester dropdown, retrieve valid semester + if (inputtype === 'semester') + { + if (FHC_AjaxClient.hasData(validSemesterData)) + { + let studiensemester = FHC_AjaxClient.getData(validSemesterData); + + inputHtml = Oehbeitrag._getStudiensemesterDropdown(oehbeitrag_id, fieldname, studiensemester, currFieldvalue, 'inline-inputfield'); + } + } + else // otherwise display textfield + { + inputHtml = ""; + } + + inputHtml += " "; + + initElement.parent('td').html(inputHtml); + + // set the update event + $("#confirm_"+fieldname+"_"+oehbeitrag_id).click( + function() + { + Oehbeitrag.updateOehbeitrag(oehbeitrag_id, fieldname, $("#input_" + fieldname + "_" + oehbeitrag_id), inputtype); + } + ); } + if (inputtype == 'semester') + { + Oehbeitrag.getValidStudiensemester(callback, oehbeitrag_id); + } + else + callback(null); + }, + _getStudiensemesterDropdown(oehbeitrag_id, name, studiensemester, selectedDateSemester, formatclass) + { + let selectedDateSemesterArr = null; + if (selectedDateSemester) + { + selectedDateSemesterArr = selectedDateSemester.split('/'); + } + + let rowHtml = ""; + let inlineClass = formatclass != null ? ' '+formatclass : ''; + + rowHtml += ""; + return rowHtml; }, + _compareGermanDates: function(datea, dateb) + { + return datea.split(".").reverse().join("") < dateb.split(".").reverse().join(""); + }, + _addTablesorter: function() + { + let headers = {headers: { 0: { sorter: false}, 1: { sorter: false}, 4: { sorter: false}}}; + Tablesort.addTablesorter("oehbeitraegeTbl", [[0,0],[1,0]], ["zebra"], 8, headers); + }, /** * Formats a numeric value as a float with two decimals * @param sum @@ -213,5 +391,9 @@ var Oehbeitrag = { dec = dec1 + dec2; } return dec; + }, + _formatDateToGerman: function(date) + { + return date.substring(8, 10) + "." + date.substring(5, 7) + "." + date.substring(0, 4); } }; From 59449380527aad505a1937af3b97616add273b59 Mon Sep 17 00:00:00 2001 From: KarpAlex Date: Tue, 1 Jun 2021 15:18:54 +0200 Subject: [PATCH 15/74] Oehbeitraege GUI: correct table sorting and refreshing of tablesorter --- application/models/codex/Oehbeitrag_model.php | 3 ++- public/css/codex/oehbeitrag.css | 9 +++++-- public/js/codex/oehbeitrag.js | 26 +++++++++++++++++-- 3 files changed, 33 insertions(+), 5 deletions(-) diff --git a/application/models/codex/Oehbeitrag_model.php b/application/models/codex/Oehbeitrag_model.php index abc35a663..0df016ba8 100644 --- a/application/models/codex/Oehbeitrag_model.php +++ b/application/models/codex/Oehbeitrag_model.php @@ -36,6 +36,7 @@ class Oehbeitrag_model extends DB_Model /** * Gets all Studiensemester for which no Oehbeitrag value assignment exists. * @param string $start_studiensemester_kurzbz semester before the given semester are ignored + * @param array $excluded_oehbeitrag_id oehbeitraege to be ignored, i.e. which are assigned * @return object */ public function getUnassignedStudiensemester($start_studiensemester_kurzbz, $excluded_oehbeitrag_id = array()) @@ -64,7 +65,7 @@ class Oehbeitrag_model extends DB_Model * Checks if a Öhbeitrag can be assigned for a Studiensemester range. * @param string $von_studiensemester_kurzbz * @param string $bis_studiensemester_kurzbz - * @param array $excluded_oehbeitrag_id + * @param array $excluded_oehbeitrag_id oehbeitraege to ignore, i.e. which are assignable * @return object array with true if assignable, with false if not */ public function checkIfStudiensemesterAssignable($von_studiensemester_kurzbz, $bis_studiensemester_kurzbz = null, $excluded_oehbeitrag_id = array()) diff --git a/public/css/codex/oehbeitrag.css b/public/css/codex/oehbeitrag.css index 335489a1b..103c5d367 100644 --- a/public/css/codex/oehbeitrag.css +++ b/public/css/codex/oehbeitrag.css @@ -3,7 +3,12 @@ display: inline; } -.fa-edit, .fa-check { +.fa-edit { cursor: pointer; font-size: 1.2em; -} \ No newline at end of file +} + +.fa-check { + cursor: pointer; + font-size: 1.4em; +} diff --git a/public/js/codex/oehbeitrag.js b/public/js/codex/oehbeitrag.js index 68d39a897..9186c1bf0 100644 --- a/public/js/codex/oehbeitrag.js +++ b/public/js/codex/oehbeitrag.js @@ -154,6 +154,9 @@ var Oehbeitrag = { Oehbeitrag.deleteOehbeitrag(oehbeitrag_id); } ) + + // refresh tablesorter + Oehbeitrag._addTablesorter(); } else { @@ -200,6 +203,8 @@ var Oehbeitrag = { Oehbeitrag._setUpdateEvent($(this).prop("id"), fieldname, inputtype); } ); + + Oehbeitrag._addTablesorter(); } else { @@ -359,8 +364,25 @@ var Oehbeitrag = { }, _addTablesorter: function() { - let headers = {headers: { 0: { sorter: false}, 1: { sorter: false}, 4: { sorter: false}}}; - Tablesort.addTablesorter("oehbeitraegeTbl", [[0,0],[1,0]], ["zebra"], 8, headers); + // add parser through the tablesorter addParser method + $.tablesorter.addParser({ + // set a unique id + id: 'germandatesort', + is: function(s, table, cell, $cell) { + // return false so this parser is not auto detected + return false; + }, + format: function(s, table, cell, cellIndex) { + // format data, should sort by leading german date + return s.substring(0, 10).split(".").reverse().join(""); + }, + // set type, either numeric or text + type: 'numeric' + }); + + let headers = {headers: { 0: {sorter: "germandatesort"}, 1: {sorter: "germandatesort"}, 4: {sorter: false}}}; + + Tablesort.addTablesorter("oehbeitraegeTbl", [[0,1]], ["zebra"], 8, headers); }, /** * Formats a numeric value as a float with two decimals From b206c019dfcf1da013697e77f33c58fee5b6e8fd Mon Sep 17 00:00:00 2001 From: KarpAlex Date: Wed, 9 Jun 2021 01:34:47 +0200 Subject: [PATCH 16/74] Oehbeitrag GUI: correct decimal format conversion before after update --- application/controllers/codex/Oehbeitrag.php | 4 +- public/js/codex/oehbeitrag.js | 58 +++++++++----------- 2 files changed, 28 insertions(+), 34 deletions(-) diff --git a/application/controllers/codex/Oehbeitrag.php b/application/controllers/codex/Oehbeitrag.php index 9aa5e4402..7fc8f381f 100644 --- a/application/controllers/codex/Oehbeitrag.php +++ b/application/controllers/codex/Oehbeitrag.php @@ -107,7 +107,7 @@ class Oehbeitrag extends Auth_Controller { if (!$this->_checkAmount($value)) { - $this->outputJsonError("Ungültiger $idx"); + $this->outputJsonError("Ungültige(r) $idx"); return; } } @@ -162,7 +162,7 @@ class Oehbeitrag extends Auth_Controller private function _checkAmount($amount) { - return is_numeric($amount) && $amount <= 99999.99; + return is_numeric($amount) && (float) $amount <= 99999.99; } private function _checkVonBisStudiensemester($von_studiensemester_kurzbz, $bis_studiensemester_kurzbz, $oehbeitrag_id = null) diff --git a/public/js/codex/oehbeitrag.js b/public/js/codex/oehbeitrag.js index 9186c1bf0..f8fc403f0 100644 --- a/public/js/codex/oehbeitrag.js +++ b/public/js/codex/oehbeitrag.js @@ -127,10 +127,10 @@ var Oehbeitrag = { let bis_studiensemester_kurzbz = oehbeitrag.bis_studiensemester_kurzbz == 'null' ? 'unbeschränkt' : studiensemester_von_bis.bis_semester_with_date; $("#input_studierendenbeitrag_"+nextOehbeitragId).parent('td').html( - Oehbeitrag._formatDecimalGerman(oehbeitrag.studierendenbeitrag)+" " + Oehbeitrag._formatDecimal(oehbeitrag.studierendenbeitrag)+" " ); $("#input_versicherung_"+nextOehbeitragId).parent('td').html( - Oehbeitrag._formatDecimalGerman(oehbeitrag.versicherung)+" " + Oehbeitrag._formatDecimal(oehbeitrag.versicherung)+" " ); $("#input_von_studiensemester_kurzbz_"+nextOehbeitragId).parent('td').html( studiensemester_von_bis.von_semester_with_date+" " @@ -174,6 +174,10 @@ var Oehbeitrag = { { let oehbeitragdata = {}; let fieldvalue = fieldelement.val(); + + if (inputtype != 'semester') // formal number as decimal with point separator + fieldvalue = Oehbeitrag._formatDecimal(fieldvalue, "."); + oehbeitragdata[fieldname] = fieldvalue; FHC_AjaxClient.ajaxCallPost( @@ -193,7 +197,7 @@ var Oehbeitrag = { if (inputtype == 'semester') fieldvalue = $(fieldelement).find("option:selected").text(); else - fieldvalue = Oehbeitrag._formatDecimalGerman(fieldvalue); + fieldvalue = Oehbeitrag._formatDecimal(fieldvalue); $("#confirm_"+fieldname+"_"+oehbeitrag_id).parent('td').html( fieldvalue+" " ); @@ -245,15 +249,6 @@ var Oehbeitrag = { // ----------------------------------------------------------------------------------------------------------------- // (private) methods - _renderOehbeitragTable(oehbeitraege) - { - for (let oehbeitragidx in oehbeitraege) - { - let oehbeitrag = oehbeitraege[oehbeitragidx]; - - - } - }, _setUpdateEvents() { $(".editStudierendenbeitrag").off('click').click( @@ -386,32 +381,31 @@ var Oehbeitrag = { }, /** * Formats a numeric value as a float with two decimals - * @param sum - * @returns {string} + * @param value + * @param decSeparator the new decimal separator + * @returns {string} formatted value */ - _formatDecimalGerman: function(sum) + _formatDecimal: function(value, decSeparator) { - var dec = null; + let dec = null; + let prevSeparator = "."; - if(sum === null) - dec = parseFloat(0).toFixed(2).replace(".", ","); - else if(sum === '') - { - dec = '' - } + if (decSeparator === ".") + prevSeparator = ","; else - { - dec = parseFloat(sum).toFixed(2); + decSeparator = ","; - dec = dec.split('.'); - var dec1 = dec[0]; - var dec2 = ',' + dec[1]; - var rgx = /(\d+)(\d{3})/; - while (rgx.test(dec1)) { - dec1 = dec1.replace(rgx, '$1' + '.' + '$2'); - } - dec = dec1 + dec2; + dec = value.split(prevSeparator); + if (dec.length === 2) + { + dec = parseFloat(dec[0] + '.' + dec[1]).toFixed(2); + dec = dec.replace(prevSeparator, decSeparator); } + else if (Math.floor(value) == value) // if integer, add zeros + dec = value + decSeparator + '00'; + else + dec = value; + return dec; }, _formatDateToGerman: function(date) From 3d224123214aff06788b042c6a14f2d0e6c6626f Mon Sep 17 00:00:00 2001 From: KarpAlex Date: Mon, 14 Jun 2021 18:39:29 +0200 Subject: [PATCH 17/74] added parameters aktiv, lehre, offiziell, positiv to getByPerson method of Zeugnisnote_model.php --- .../models/education/Zeugnisnote_model.php | 44 ++++++++++++++++--- 1 file changed, 38 insertions(+), 6 deletions(-) diff --git a/application/models/education/Zeugnisnote_model.php b/application/models/education/Zeugnisnote_model.php index 1b2081148..306f56e8c 100644 --- a/application/models/education/Zeugnisnote_model.php +++ b/application/models/education/Zeugnisnote_model.php @@ -17,23 +17,55 @@ class Zeugnisnote_model extends DB_Model * Gets Pruefungen of a person for a Studiensemester. * @param int $person_id * @param string $studiensemester_kurzbz + * @param bool $aktiv + * @param bool $lehre + * @param bool $offiziell + * @param bool $positiv * @return object */ - public function getByPerson($person_id, $studiensemester_kurzbz) + public function getByPerson($person_id, $studiensemester_kurzbz, $aktiv = true, $lehre = null, $offiziell = null, $positiv = null) { + $params = array($person_id, $studiensemester_kurzbz); + $qry = ' - SELECT note.*, pers.matr_nr, lv.ects, stg.studiengang_kz, prst.prestudent_id, stg.erhalter_kz, + SELECT zgnisnote.*, pers.matr_nr, lv.ects, stg.studiengang_kz, prst.prestudent_id, stg.erhalter_kz, UPPER(stg.typ||stg.kurzbz) AS studiengang, stg.bezeichnung AS studiengang_bezeichnung FROM public.tbl_person pers JOIN public.tbl_prestudent prst USING (person_id) JOIN public.tbl_student USING (prestudent_id) - JOIN lehre.tbl_zeugnisnote note USING (student_uid) + JOIN lehre.tbl_zeugnisnote zgnisnote USING (student_uid) + JOIN lehre.tbl_note note ON zgnisnote.note = note.note JOIN lehre.tbl_lehrveranstaltung lv USING (lehrveranstaltung_id) JOIN public.tbl_studiengang stg ON prst.studiengang_kz = stg.studiengang_kz WHERE pers.person_id = ? - AND note.studiensemester_kurzbz = ? - ORDER BY note.benotungsdatum'; + AND zgnisnote.studiensemester_kurzbz = ?'; - return $this->execQuery($qry, array($person_id, $studiensemester_kurzbz)); + if (isset($aktiv)) + { + $qry .= ' AND note.aktiv = ?'; + $params[] = $aktiv; + } + + if (isset($lehre)) + { + $qry .= ' AND note.lehre = ?'; + $params[] = $lehre; + } + + if (isset($offiziell)) + { + $qry .= ' AND note.offiziell = ?'; + $params[] = $offiziell; + } + + if (isset($positiv)) + { + $qry .= ' AND note.positiv = ?'; + $params[] = $positiv; + } + + $qry .= ' ORDER BY zgnisnote.benotungsdatum'; + + return $this->execQuery($qry, $params); } } From 2682026fec25ad77594cc2a5daa92742aa8b2a51 Mon Sep 17 00:00:00 2001 From: KarpAlex Date: Mon, 14 Jun 2021 19:13:38 +0200 Subject: [PATCH 18/74] add column melderelevant to public.tbl_studiengang --- system/dbupdate_3.3.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/system/dbupdate_3.3.php b/system/dbupdate_3.3.php index 914877ca3..1437ddfe8 100644 --- a/system/dbupdate_3.3.php +++ b/system/dbupdate_3.3.php @@ -4767,7 +4767,7 @@ if($result = @$db->db_query("SELECT 1 FROM system.tbl_berechtigung WHERE berecht } } -//Spalte matr_aktiv in tbl_person zum Markieren von noch nicht scharfgeschaltenen Matrikelnummern vom Datenverbund +// Spalte matr_aktiv in tbl_person zum Markieren von noch nicht scharfgeschaltenen Matrikelnummern vom Datenverbund if(!$result = @$db->db_query("SELECT matr_aktiv FROM public.tbl_person LIMIT 1")) { $qry = "ALTER TABLE public.tbl_person ADD COLUMN matr_aktiv boolean NOT NULL DEFAULT false; @@ -4844,6 +4844,17 @@ if (!$result = @$db->db_query('SELECT 1 FROM bis.tbl_oehbeitrag LIMIT 1')) echo '
Granted privileges to vilesci on bis.tbl_oehbeitrag'; } +// Add column melderelevant to public.tbl_studiengang +if(!$result = @$db->db_query("SELECT melderelevant FROM public.tbl_studiengang")) +{ + $qry = "ALTER TABLE public.tbl_studiengang ADD COLUMN melderelevant boolean NOT NULL DEFAULT FALSE;"; + + if(!$db->db_query($qry)) + echo 'public.tbl_studiengang: '.$db->db_last_error().'
'; + else + echo '
public.tbl_studiengang: Neue Spalte melderelevant hinzugefuegt.'; +} + // *** Pruefung und hinzufuegen der neuen Attribute und Tabellen echo '

Pruefe Tabellen und Attribute!

'; @@ -5075,7 +5086,7 @@ $tabellen=array( "public.tbl_statistik" => array("statistik_kurzbz","bezeichnung","url","gruppe","sql","content_id","insertamum","insertvon","updateamum","updatevon","berechtigung_kurzbz","publish","preferences"), "public.tbl_student" => array("student_uid","matrikelnr","prestudent_id","studiengang_kz","semester","verband","gruppe","updateamum","updatevon","insertamum","insertvon","ext_id"), "public.tbl_studentlehrverband" => array("student_uid","studiensemester_kurzbz","studiengang_kz","semester","verband","gruppe","updateamum","updatevon","insertamum","insertvon","ext_id"), - "public.tbl_studiengang" => array("studiengang_kz","kurzbz","kurzbzlang","typ","bezeichnung","english","farbe","email","telefon","max_semester","max_verband","max_gruppe","erhalter_kz","bescheid","bescheidbgbl1","bescheidbgbl2","bescheidgz","bescheidvom","orgform_kurzbz","titelbescheidvom","aktiv","ext_id","zusatzinfo_html","moodle","sprache","testtool_sprachwahl","studienplaetze","oe_kurzbz","lgartcode","mischform","projektarbeit_note_anzeige", "onlinebewerbung"), + "public.tbl_studiengang" => array("studiengang_kz","kurzbz","kurzbzlang","typ","bezeichnung","english","farbe","email","telefon","max_semester","max_verband","max_gruppe","erhalter_kz","bescheid","bescheidbgbl1","bescheidbgbl2","bescheidgz","bescheidvom","orgform_kurzbz","titelbescheidvom","aktiv","ext_id","zusatzinfo_html","moodle","sprache","testtool_sprachwahl","studienplaetze","oe_kurzbz","lgartcode","mischform","projektarbeit_note_anzeige", "onlinebewerbung","melderelevant"), "public.tbl_studiengangstyp" => array("typ","bezeichnung","beschreibung","bezeichnung_mehrsprachig"), "public.tbl_studienjahr" => array("studienjahr_kurzbz","bezeichnung"), "public.tbl_studiensemester" => array("studiensemester_kurzbz","bezeichnung","start","ende","studienjahr_kurzbz","ext_id","beschreibung","onlinebewerbung"), From 27b0679640baeeceb776a25cd5a875c917181fc3 Mon Sep 17 00:00:00 2001 From: KarpAlex Date: Tue, 15 Jun 2021 19:03:41 +0200 Subject: [PATCH 19/74] dbupdate_3.3.php: column melderelevant prefill with values, added comment --- system/dbupdate_3.3.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/system/dbupdate_3.3.php b/system/dbupdate_3.3.php index 1437ddfe8..b4d322590 100644 --- a/system/dbupdate_3.3.php +++ b/system/dbupdate_3.3.php @@ -4844,10 +4844,12 @@ if (!$result = @$db->db_query('SELECT 1 FROM bis.tbl_oehbeitrag LIMIT 1')) echo '
Granted privileges to vilesci on bis.tbl_oehbeitrag'; } -// Add column melderelevant to public.tbl_studiengang +// Add column melderelevant to public.tbl_studiengang and prefill values if(!$result = @$db->db_query("SELECT melderelevant FROM public.tbl_studiengang")) { - $qry = "ALTER TABLE public.tbl_studiengang ADD COLUMN melderelevant boolean NOT NULL DEFAULT FALSE;"; + $qry = "ALTER TABLE public.tbl_studiengang ADD COLUMN melderelevant boolean NOT NULL DEFAULT FALSE; + UPDATE public.tbl_studiengang SET melderelevant = TRUE WHERE tbl_studiengang.studiengang_kz < 10000 AND tbl_studiengang.studiengang_kz <> 0; + COMMENT ON COLUMN public.tbl_studiengang.melderelevant IS 'Zeigt an, ob Studenten aus Studiengang an Ministerien gemeldet werden müssen'"; if(!$db->db_query($qry)) echo 'public.tbl_studiengang: '.$db->db_last_error().'
'; From ca80d727348b9c8fc76c86f1b7fab8e6c305f466 Mon Sep 17 00:00:00 2001 From: KarpAlex Date: Mon, 21 Jun 2021 17:42:08 +0200 Subject: [PATCH 20/74] =?UTF-8?q?added=20=C3=96hbeitragsverwaltung=20to=20?= =?UTF-8?q?main=20menu?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/config/navigation.php | 8 ++++++++ application/controllers/codex/Oehbeitrag.php | 2 ++ application/views/codex/oehbeitrag.php | 2 +- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/application/config/navigation.php b/application/config/navigation.php index 84004b58e..31cf9a0b0 100644 --- a/application/config/navigation.php +++ b/application/config/navigation.php @@ -23,6 +23,14 @@ $config['navigation_header'] = array( 'expand' => true, 'sort' => 10, 'requiredPermissions' => 'basis/vilesci:r' + ), + 'oehbeitragsverwaltung' => array( + 'link' => site_url('codex/Oehbeitrag'), + 'icon' => '', + 'description' => 'Öhbeitragsverwaltung', + 'expand' => true, + 'sort' => 20, + 'requiredPermissions' => 'admin:w' ) ) ), diff --git a/application/controllers/codex/Oehbeitrag.php b/application/controllers/codex/Oehbeitrag.php index 7fc8f381f..f1e5bf508 100644 --- a/application/controllers/codex/Oehbeitrag.php +++ b/application/controllers/codex/Oehbeitrag.php @@ -20,6 +20,8 @@ class Oehbeitrag extends Auth_Controller $this->load->model('codex/Oehbeitrag_model', 'OehbeitragModel'); $this->load->model('organisation/Studiensemester_model', 'StudiensemesterModel'); + + $this->load->library('WidgetLib'); } public function index() diff --git a/application/views/codex/oehbeitrag.php b/application/views/codex/oehbeitrag.php index 47892527a..675a06c95 100644 --- a/application/views/codex/oehbeitrag.php +++ b/application/views/codex/oehbeitrag.php @@ -21,7 +21,7 @@ $this->load->view(
- widgetlib->widget('NavigationWidget');*/ ?> + widgetlib->widget('NavigationWidget'); ?>
From 264ba0e66fc7d103ccce6ab51a989775fda79d37 Mon Sep 17 00:00:00 2001 From: KarpAlex Date: Tue, 22 Jun 2021 16:48:06 +0200 Subject: [PATCH 21/74] dbupdate_3.3.php: - added bis.tbl_bisstandort - added LIMIT 1 to melderelevant SELECT - added columns foerderrelevant and standort to public.tbl_studiengang and public.tbl_prestudent --- system/dbupdate_3.3.php | 80 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 75 insertions(+), 5 deletions(-) diff --git a/system/dbupdate_3.3.php b/system/dbupdate_3.3.php index b4d322590..6f0a02a6b 100644 --- a/system/dbupdate_3.3.php +++ b/system/dbupdate_3.3.php @@ -4845,11 +4845,11 @@ if (!$result = @$db->db_query('SELECT 1 FROM bis.tbl_oehbeitrag LIMIT 1')) } // Add column melderelevant to public.tbl_studiengang and prefill values -if(!$result = @$db->db_query("SELECT melderelevant FROM public.tbl_studiengang")) +if (!$result = @$db->db_query("SELECT melderelevant FROM public.tbl_studiengang LIMIT 1")) { $qry = "ALTER TABLE public.tbl_studiengang ADD COLUMN melderelevant boolean NOT NULL DEFAULT FALSE; UPDATE public.tbl_studiengang SET melderelevant = TRUE WHERE tbl_studiengang.studiengang_kz < 10000 AND tbl_studiengang.studiengang_kz <> 0; - COMMENT ON COLUMN public.tbl_studiengang.melderelevant IS 'Zeigt an, ob Studenten aus Studiengang an Ministerien gemeldet werden müssen'"; + COMMENT ON COLUMN public.tbl_studiengang.melderelevant IS 'Zeigt an, ob Studierende aus Studiengang an Ministerien gemeldet werden müssen'"; if(!$db->db_query($qry)) echo 'public.tbl_studiengang: '.$db->db_last_error().'
'; @@ -4857,6 +4857,75 @@ if(!$result = @$db->db_query("SELECT melderelevant FROM public.tbl_studiengang") echo '
public.tbl_studiengang: Neue Spalte melderelevant hinzugefuegt.'; } +// TABLE bis.tbl_bisstandort +if (!@$db->db_query("SELECT 1 FROM bis.tbl_bisstandort LIMIT 1")) +{ + $qry = " + CREATE TABLE bis.tbl_bisstandort ( + standort_code integer, + bezeichnung character varying(256), + aktiv boolean NOT NULL DEFAULT TRUE, + insertamum timestamp DEFAULT NOW(), + insertvon varchar(32), + updateamum timestamp, + updatevon varchar(32) + ); + ALTER TABLE bis.tbl_bisstandort ADD CONSTRAINT pk_bisstandort PRIMARY KEY (standort_code); + COMMENT ON TABLE bis.tbl_bisstandort IS 'Key-Table of Locations'; + INSERT INTO bis.tbl_bisstandort(standort_code, bezeichnung, insertvon) VALUES (22, 'Wien', 'dbcheck'); + INSERT INTO bis.tbl_bisstandort(standort_code, bezeichnung, insertvon) VALUES (14, 'Pinkafeld', 'dbcheck'); + INSERT INTO bis.tbl_bisstandort(standort_code, bezeichnung, insertvon) VALUES (3, 'Eisenstadt', 'dbcheck');"; + + if (!$db->db_query($qry)) + echo 'bis.tbl_bisstandort '.$db->db_last_error().'
'; + else + echo '
Created table bis.tbl_bisstandort'; + + // GRANT SELECT ON TABLE bis.tbl_bisstandort TO web; + $qry = 'GRANT SELECT ON TABLE bis.tbl_bisstandort TO web;'; + if (!$db->db_query($qry)) + echo 'bis.tbl_bisstandort '.$db->db_last_error().'
'; + else + echo '
Granted privileges to web on bis.tbl_bisstandort'; + + // GRANT SELECT, UPDATE, INSERT, DELETE ON TABLE bis.tbl_bisstandort TO vilesci; + $qry = 'GRANT SELECT, UPDATE, INSERT, DELETE ON TABLE bis.tbl_bisstandort TO vilesci;'; + if (!$db->db_query($qry)) + echo 'bis.tbl_bisstandort '.$db->db_last_error().'
'; + else + echo '
Granted privileges to vilesci on bis.tbl_bisstandort'; +} + +// Add columns foerderrelevant and standort to public.tbl_studiengang +if (!$result = @$db->db_query("SELECT foerderrelevant, standort_code FROM public.tbl_studiengang LIMIT 1")) +{ + $qry = "ALTER TABLE public.tbl_studiengang ADD COLUMN foerderrelevant boolean NOT NULL DEFAULT TRUE; + ALTER TABLE public.tbl_studiengang ADD COLUMN standort_code integer; + ALTER TABLE public.tbl_studiengang ADD CONSTRAINT fk_studiengang_standort_code FOREIGN KEY (standort_code) REFERENCES bis.tbl_bisstandort(standort_code) ON DELETE RESTRICT ON UPDATE CASCADE; + COMMENT ON COLUMN public.tbl_studiengang.foerderrelevant IS 'Zeigt an, ob Studierende aus Studiengang bei Meldung für Förderungen relevant sind'; + COMMENT ON COLUMN public.tbl_studiengang.standort_code IS 'Zu meldender Standortcode der Studierenden des Studiengangs'"; + + if(!$db->db_query($qry)) + echo 'public.tbl_studiengang: '.$db->db_last_error().'
'; + else + echo '
public.tbl_studiengang: Neue Spalten foerderrelevant, standort_code hinzugefuegt.'; +} + +// Add columns foerderrelevant and standort to public.tbl_prestudent +if (!$result = @$db->db_query("SELECT foerderrelevant, standort_code FROM public.tbl_prestudent LIMIT 1")) +{ + $qry = "ALTER TABLE public.tbl_prestudent ADD COLUMN foerderrelevant boolean; + ALTER TABLE public.tbl_prestudent ADD COLUMN standort_code integer; + ALTER TABLE public.tbl_prestudent ADD CONSTRAINT fk_prestudent_standort_code FOREIGN KEY (standort_code) REFERENCES bis.tbl_bisstandort(standort_code) ON DELETE RESTRICT ON UPDATE CASCADE; + COMMENT ON COLUMN public.tbl_prestudent.foerderrelevant IS 'Zeigt an, ob Studierende bei Meldung für Förderungen relevant sind. Überschreibt förderrelevant auf Studienganglevel.'; + COMMENT ON COLUMN public.tbl_prestudent.standort_code IS 'Zu meldender Standortcode des Studierenden. Überschreibt standort auf Studienganglevel.';"; + + if(!$db->db_query($qry)) + echo 'public.tbl_prestudent: '.$db->db_last_error().'
'; + else + echo '
public.tbl_prestudent: Neue Spalten foerderrelevant, standort_code hinzugefuegt.'; +} + // *** Pruefung und hinzufuegen der neuen Attribute und Tabellen echo '

Pruefe Tabellen und Attribute!

'; @@ -4874,6 +4943,7 @@ $tabellen=array( "bis.tbl_bisfunktion" => array("bisverwendung_id","studiengang_kz","sws","updateamum","updatevon","insertamum","insertvon","ext_id"), "bis.tbl_bisio" => array("bisio_id","mobilitaetsprogramm_code","nation_code","von","bis","zweck_code","student_uid","updateamum","updatevon","insertamum","insertvon","ext_id","ort","universitaet","lehreinheit_id","ects_erworben","ects_angerechnet"), "bis.tbl_bisio_zweck" => array("bisio_id","zweck_code"), + "bis.tbl_bisstandort" => array("standort_code","bezeichnung","aktiv","insertamum","insertvon","updateamum","updatevon"), "bis.tbl_bisverwendung" => array("bisverwendung_id","ba1code","ba2code","vertragsstunden","beschausmasscode","verwendung_code","mitarbeiter_uid","hauptberufcode","hauptberuflich","habilitation","beginn","ende","updateamum","updatevon","insertamum","insertvon","ext_id","dv_art","inkludierte_lehre","zeitaufzeichnungspflichtig"), "bis.tbl_bundesland" => array("bundesland_code","kurzbz","bezeichnung"), "bis.tbl_entwicklungsteam" => array("mitarbeiter_uid","studiengang_kz","besqualcode","beginn","ende","updateamum","updatevon","insertamum","insertvon","ext_id"), @@ -5059,7 +5129,7 @@ $tabellen=array( "public.tbl_ortraumtyp" => array("ort_kurzbz","hierarchie","raumtyp_kurzbz"), "public.tbl_organisationseinheit" => array("oe_kurzbz", "oe_parent_kurzbz", "bezeichnung","organisationseinheittyp_kurzbz", "aktiv","mailverteiler","freigabegrenze","kurzzeichen","lehre","standort","warn_semesterstunden_frei","warn_semesterstunden_fix","standort_id"), "public.tbl_organisationseinheittyp" => array("organisationseinheittyp_kurzbz", "bezeichnung", "beschreibung"), - "public.tbl_person" => array("person_id","staatsbuergerschaft","geburtsnation","sprache","anrede","titelpost","titelpre","nachname","vorname","vornamen","gebdatum","gebort","gebzeit","foto","anmerkung","homepage","svnr","ersatzkennzeichen","familienstand","geschlecht","anzahlkinder","aktiv","insertamum","insertvon","updateamum","updatevon","ext_id","bundesland_code","kompetenzen","kurzbeschreibung","zugangscode", "foto_sperre","matr_nr","zugangscode_timestamp","udf_values","bpk"), + "public.tbl_person" => array("person_id","staatsbuergerschaft","geburtsnation","sprache","anrede","titelpost","titelpre","nachname","vorname","vornamen","gebdatum","gebort","gebzeit","foto","anmerkung","homepage","svnr","ersatzkennzeichen","familienstand","geschlecht","anzahlkinder","aktiv","insertamum","insertvon","updateamum","updatevon","ext_id","bundesland_code","kompetenzen","kurzbeschreibung","zugangscode", "foto_sperre","matr_nr","zugangscode_timestamp","udf_values","bpk","matr_aktiv"), "public.tbl_person_fotostatus" => array("person_fotostatus_id","person_id","fotostatus_kurzbz","datum","insertamum","insertvon","updateamum","updatevon"), "public.tbl_personfunktionstandort" => array("personfunktionstandort_id","funktion_kurzbz","person_id","standort_id","position","anrede"), "public.tbl_preincoming" => array("preincoming_id","person_id","mobilitaetsprogramm_code","zweck_code","firma_id","universitaet","aktiv","bachelorthesis","masterthesis","von","bis","uebernommen","insertamum","insertvon","updateamum","updatevon","anmerkung","zgv","zgv_ort","zgv_datum","zgv_name","zgvmaster","zgvmaster_datum","zgvmaster_ort","zgvmaster_name","program_name","bachelor","master","jahre","person_id_emergency","person_id_coordinator_dep","person_id_coordinator_int","code","deutschkurs1","deutschkurs2","research_area","deutschkurs3","ext_id"), @@ -5071,7 +5141,7 @@ $tabellen=array( "public.tbl_preoutgoing_lehrveranstaltung" => array("preoutgoing_lehrveranstaltung_id","preoutgoing_id","bezeichnung","ects","endversion","insertamum","insertvon","updateamum","updatevon","wochenstunden","unitcode"), "public.tbl_preoutgoing_preoutgoing_status" => array("status_id","preoutgoing_status_kurzbz","preoutgoing_id","datum","insertamum","insertvon","updateamum","updatevon"), "public.tbl_preoutgoing_status" => array("preoutgoing_status_kurzbz","bezeichnung"), - "public.tbl_prestudent" => array("prestudent_id","aufmerksamdurch_kurzbz","person_id","studiengang_kz","berufstaetigkeit_code","ausbildungcode","zgv_code","zgvort","zgvdatum","zgvmas_code","zgvmaort","zgvmadatum","aufnahmeschluessel","facheinschlberuf","reihungstest_id","anmeldungreihungstest","reihungstestangetreten","rt_gesamtpunkte","rt_punkte1","rt_punkte2","bismelden","anmerkung","dual","insertamum","insertvon","updateamum","updatevon","ext_id","ausstellungsstaat","rt_punkte3", "zgvdoktor_code", "zgvdoktorort", "zgvdoktordatum","mentor","zgvnation","zgvmanation","zgvdoktornation","gsstudientyp_kurzbz","aufnahmegruppe_kurzbz","udf_values","priorisierung"), + "public.tbl_prestudent" => array("prestudent_id","aufmerksamdurch_kurzbz","person_id","studiengang_kz","berufstaetigkeit_code","ausbildungcode","zgv_code","zgvort","zgvdatum","zgvmas_code","zgvmaort","zgvmadatum","aufnahmeschluessel","facheinschlberuf","reihungstest_id","anmeldungreihungstest","reihungstestangetreten","rt_gesamtpunkte","rt_punkte1","rt_punkte2","bismelden","anmerkung","dual","insertamum","insertvon","updateamum","updatevon","ext_id","ausstellungsstaat","rt_punkte3", "zgvdoktor_code", "zgvdoktorort", "zgvdoktordatum","mentor","zgvnation","zgvmanation","zgvdoktornation","gsstudientyp_kurzbz","aufnahmegruppe_kurzbz","udf_values","priorisierung","foerderrelevant","standort_code"), "public.tbl_prestudentstatus" => array("prestudent_id","status_kurzbz","studiensemester_kurzbz","ausbildungssemester","datum","orgform_kurzbz","insertamum","insertvon","updateamum","updatevon","ext_id","studienplan_id","bestaetigtam","bestaetigtvon","fgm","faktiv", "anmerkung","bewerbung_abgeschicktamum","rt_stufe","statusgrund_id"), "public.tbl_raumtyp" => array("raumtyp_kurzbz","beschreibung","kosten"), "public.tbl_reihungstest" => array("reihungstest_id","studiengang_kz","ort_kurzbz","anmerkung","datum","uhrzeit","updateamum","updatevon","insertamum","insertvon","ext_id","freigeschaltet","max_teilnehmer","oeffentlich","studiensemester_kurzbz","aufnahmegruppe_kurzbz","stufe","anmeldefrist"), @@ -5088,7 +5158,7 @@ $tabellen=array( "public.tbl_statistik" => array("statistik_kurzbz","bezeichnung","url","gruppe","sql","content_id","insertamum","insertvon","updateamum","updatevon","berechtigung_kurzbz","publish","preferences"), "public.tbl_student" => array("student_uid","matrikelnr","prestudent_id","studiengang_kz","semester","verband","gruppe","updateamum","updatevon","insertamum","insertvon","ext_id"), "public.tbl_studentlehrverband" => array("student_uid","studiensemester_kurzbz","studiengang_kz","semester","verband","gruppe","updateamum","updatevon","insertamum","insertvon","ext_id"), - "public.tbl_studiengang" => array("studiengang_kz","kurzbz","kurzbzlang","typ","bezeichnung","english","farbe","email","telefon","max_semester","max_verband","max_gruppe","erhalter_kz","bescheid","bescheidbgbl1","bescheidbgbl2","bescheidgz","bescheidvom","orgform_kurzbz","titelbescheidvom","aktiv","ext_id","zusatzinfo_html","moodle","sprache","testtool_sprachwahl","studienplaetze","oe_kurzbz","lgartcode","mischform","projektarbeit_note_anzeige", "onlinebewerbung","melderelevant"), + "public.tbl_studiengang" => array("studiengang_kz","kurzbz","kurzbzlang","typ","bezeichnung","english","farbe","email","telefon","max_semester","max_verband","max_gruppe","erhalter_kz","bescheid","bescheidbgbl1","bescheidbgbl2","bescheidgz","bescheidvom","orgform_kurzbz","titelbescheidvom","aktiv","ext_id","zusatzinfo_html","moodle","sprache","testtool_sprachwahl","studienplaetze","oe_kurzbz","lgartcode","mischform","projektarbeit_note_anzeige", "onlinebewerbung","melderelevant","foerderrelevant","standort_code"), "public.tbl_studiengangstyp" => array("typ","bezeichnung","beschreibung","bezeichnung_mehrsprachig"), "public.tbl_studienjahr" => array("studienjahr_kurzbz","bezeichnung"), "public.tbl_studiensemester" => array("studiensemester_kurzbz","bezeichnung","start","ende","studienjahr_kurzbz","ext_id","beschreibung","onlinebewerbung"), From 72b7e5b1fee32d4adfee86dce552a28cfd9b3b5d Mon Sep 17 00:00:00 2001 From: KarpAlex Date: Wed, 23 Jun 2021 15:55:51 +0200 Subject: [PATCH 22/74] dbupdate_3.3.php: foerderrelevant field of tbl_prestudent: prefill with false where possible --- system/dbupdate_3.3.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/system/dbupdate_3.3.php b/system/dbupdate_3.3.php index 6f0a02a6b..a26844aa3 100644 --- a/system/dbupdate_3.3.php +++ b/system/dbupdate_3.3.php @@ -4917,6 +4917,16 @@ if (!$result = @$db->db_query("SELECT foerderrelevant, standort_code FROM public $qry = "ALTER TABLE public.tbl_prestudent ADD COLUMN foerderrelevant boolean; ALTER TABLE public.tbl_prestudent ADD COLUMN standort_code integer; ALTER TABLE public.tbl_prestudent ADD CONSTRAINT fk_prestudent_standort_code FOREIGN KEY (standort_code) REFERENCES bis.tbl_bisstandort(standort_code) ON DELETE RESTRICT ON UPDATE CASCADE; + UPDATE public.tbl_prestudent ps -- set foerderrelevant false for incoming, ausserordentlich, gsextern + SET foerderrelevant = FALSE + WHERE EXISTS (SELECT 1 FROM public.tbl_prestudentstatus WHERE prestudent_id = ps.prestudent_id AND status_kurzbz = 'Incoming') -- incoming + OR EXISTS (SELECT 1 FROM public.tbl_prestudent + JOIN public.tbl_person USING (person_id) + LEFT JOIN public.tbl_student USING (prestudent_id) + LEFT JOIN bis.tbl_gsstudientyp USING (gsstudientyp_kurzbz) + WHERE prestudent_id = ps.prestudent_id + AND (SUBSTRING(matrikelnr, 4, 1) = '9' -- ausserordentlich + OR studientyp_code = 'E')); -- extern COMMENT ON COLUMN public.tbl_prestudent.foerderrelevant IS 'Zeigt an, ob Studierende bei Meldung für Förderungen relevant sind. Überschreibt förderrelevant auf Studienganglevel.'; COMMENT ON COLUMN public.tbl_prestudent.standort_code IS 'Zu meldender Standortcode des Studierenden. Überschreibt standort auf Studienganglevel.';"; From 9a24d2d7c758fa3fc70b523af765f6a321cb3820 Mon Sep 17 00:00:00 2001 From: KarpAlex Date: Wed, 23 Jun 2021 17:57:31 +0200 Subject: [PATCH 23/74] dbupdate_3.3.php: removed inserts for bis.tbl_bisstandort, FHs should insert their data as needed --- system/dbupdate_3.3.php | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/system/dbupdate_3.3.php b/system/dbupdate_3.3.php index a26844aa3..e758967b1 100644 --- a/system/dbupdate_3.3.php +++ b/system/dbupdate_3.3.php @@ -4860,21 +4860,17 @@ if (!$result = @$db->db_query("SELECT melderelevant FROM public.tbl_studiengang // TABLE bis.tbl_bisstandort if (!@$db->db_query("SELECT 1 FROM bis.tbl_bisstandort LIMIT 1")) { - $qry = " - CREATE TABLE bis.tbl_bisstandort ( - standort_code integer, - bezeichnung character varying(256), - aktiv boolean NOT NULL DEFAULT TRUE, - insertamum timestamp DEFAULT NOW(), - insertvon varchar(32), - updateamum timestamp, - updatevon varchar(32) - ); - ALTER TABLE bis.tbl_bisstandort ADD CONSTRAINT pk_bisstandort PRIMARY KEY (standort_code); - COMMENT ON TABLE bis.tbl_bisstandort IS 'Key-Table of Locations'; - INSERT INTO bis.tbl_bisstandort(standort_code, bezeichnung, insertvon) VALUES (22, 'Wien', 'dbcheck'); - INSERT INTO bis.tbl_bisstandort(standort_code, bezeichnung, insertvon) VALUES (14, 'Pinkafeld', 'dbcheck'); - INSERT INTO bis.tbl_bisstandort(standort_code, bezeichnung, insertvon) VALUES (3, 'Eisenstadt', 'dbcheck');"; + $qry = "CREATE TABLE bis.tbl_bisstandort ( + standort_code integer, + bezeichnung character varying(256), + aktiv boolean NOT NULL DEFAULT TRUE, + insertamum timestamp DEFAULT NOW(), + insertvon varchar(32), + updateamum timestamp, + updatevon varchar(32) + ); + ALTER TABLE bis.tbl_bisstandort ADD CONSTRAINT pk_bisstandort PRIMARY KEY (standort_code); + COMMENT ON TABLE bis.tbl_bisstandort IS 'Key-Table of Locations';"; if (!$db->db_query($qry)) echo 'bis.tbl_bisstandort '.$db->db_last_error().'
'; From 1ce0045f86ac85f9e442cac6a263fdf58fd58cfe Mon Sep 17 00:00:00 2001 From: KarpAlex Date: Fri, 25 Jun 2021 13:19:02 +0200 Subject: [PATCH 24/74] - Prestudent_model.php: added getStandortCode and getFoerderrelevant methods - indent formatting --- application/models/crm/Prestudent_model.php | 31 ++++++++++++++++++++- system/dbupdate_3.3.php | 2 +- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/application/models/crm/Prestudent_model.php b/application/models/crm/Prestudent_model.php index 2e014800c..a304073c8 100644 --- a/application/models/crm/Prestudent_model.php +++ b/application/models/crm/Prestudent_model.php @@ -290,7 +290,6 @@ class Prestudent_model extends DB_Model $prestudentdata->prestudentstatus = $lastStatusData; - if ($this->hasUDF()) { $prestudentdata->prestudentUdfs = $this->getUDFs($prestudent_id); @@ -581,4 +580,34 @@ class Prestudent_model extends DB_Model return $this->execQuery($query, array($person_id)); } + + /** + * Gets förderrelevant flag for a prestudent, from prestudent, or, if not set on prestudent level, from studiengang + * @param int $prestudent_id + * @return object + */ + public function getFoerderrelevant($prestudent_id) + { + $query = 'SELECT COALESCE (ps.foerderrelevant, stg.foerderrelevant) AS foerderrelevant + FROM public.tbl_prestudent ps + LEFT JOIN public.tbl_studiengang stg USING (studiengang_kz) + WHERE prestudent_id = ?'; + + return $this->execQuery($query, array($prestudent_id)); + } + + /** + * Gets bis standort_code for a prestudent, from prestudent, or, if not set on prestudent level, from studiengang + * @param int $prestudent_id + * @return object + */ + public function getStandortCode($prestudent_id) + { + $query = 'SELECT COALESCE (ps.standort_code, stg.standort_code) AS standort_code + FROM public.tbl_prestudent ps + LEFT JOIN public.tbl_studiengang stg USING (studiengang_kz) + WHERE prestudent_id = ?'; + + return $this->execQuery($query, array($prestudent_id)); + } } diff --git a/system/dbupdate_3.3.php b/system/dbupdate_3.3.php index e758967b1..52af3f881 100644 --- a/system/dbupdate_3.3.php +++ b/system/dbupdate_3.3.php @@ -4920,7 +4920,7 @@ if (!$result = @$db->db_query("SELECT foerderrelevant, standort_code FROM public JOIN public.tbl_person USING (person_id) LEFT JOIN public.tbl_student USING (prestudent_id) LEFT JOIN bis.tbl_gsstudientyp USING (gsstudientyp_kurzbz) - WHERE prestudent_id = ps.prestudent_id + WHERE prestudent_id = ps.prestudent_id AND (SUBSTRING(matrikelnr, 4, 1) = '9' -- ausserordentlich OR studientyp_code = 'E')); -- extern COMMENT ON COLUMN public.tbl_prestudent.foerderrelevant IS 'Zeigt an, ob Studierende bei Meldung für Förderungen relevant sind. Überschreibt förderrelevant auf Studienganglevel.'; From 6ed2808a17b061482746c7409ed03fbdf3f179c0 Mon Sep 17 00:00:00 2001 From: KarpAlex Date: Mon, 28 Jun 2021 13:41:43 +0200 Subject: [PATCH 25/74] prestudent.class.php, interessentenimport.php: when incoming is created, foerderrelevant is set to false --- include/prestudent.class.php | 10 +++++++--- vilesci/personen/import/interessentenimport.php | 3 +++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/include/prestudent.class.php b/include/prestudent.class.php index 823e5a9aa..15e03cc3f 100644 --- a/include/prestudent.class.php +++ b/include/prestudent.class.php @@ -70,6 +70,7 @@ class prestudent extends person public $gsstudientyp_kurzbz='Intern'; public $aufnahmegruppe_kurzbz; public $priorisierung = null; + public $foerderrelevant = null; public $status_kurzbz; public $studiensemester_kurzbz; @@ -163,6 +164,7 @@ class prestudent extends person $this->gsstudientyp_kurzbz = $row->gsstudientyp_kurzbz; $this->aufnahmegruppe_kurzbz = $row->aufnahmegruppe_kurzbz; $this->priorisierung = $row->priorisierung; + $this->foerderrelevant = $row->foerderrelevant; if(!person::load($row->person_id)) return false; @@ -249,7 +251,7 @@ class prestudent extends person reihungstest_id, anmeldungreihungstest, reihungstestangetreten, rt_gesamtpunkte, rt_punkte1, rt_punkte2, rt_punkte3, bismelden, insertamum, insertvon, updateamum, updatevon, anmerkung, dual, ausstellungsstaat, mentor, - gsstudientyp_kurzbz, aufnahmegruppe_kurzbz, priorisierung) VALUES('. + gsstudientyp_kurzbz, aufnahmegruppe_kurzbz, priorisierung, foerderrelevant) VALUES('. $this->db_add_param($this->aufmerksamdurch_kurzbz).",". $this->db_add_param($this->person_id).",". $this->db_add_param($this->studiengang_kz).",". @@ -283,7 +285,8 @@ class prestudent extends person $this->db_add_param($this->mentor).",". $this->db_add_param($this->gsstudientyp_kurzbz).",". $this->db_add_param($this->aufnahmegruppe_kurzbz).",". - $this->db_add_param($this->priorisierung).");"; + $this->db_add_param($this->priorisierung).",". + $this->db_add_param($this->foerderrelevant, FHC_BOOLEAN).");"; } else { @@ -319,7 +322,8 @@ class prestudent extends person ' dual='.$this->db_add_param($this->dual, FHC_BOOLEAN).",". ' ausstellungsstaat='.$this->db_add_param($this->ausstellungsstaat).",". ' aufnahmegruppe_kurzbz='.$this->db_add_param($this->aufnahmegruppe_kurzbz).",". - ' priorisierung='.$this->db_add_param($this->priorisierung).' '. + ' priorisierung='.$this->db_add_param($this->priorisierung).",". + ' foerderrelevant='.$this->db_add_param($this->foerderrelevant, FHC_BOOLEAN).' '. " WHERE prestudent_id=".$this->db_add_param($this->prestudent_id).";"; } diff --git a/vilesci/personen/import/interessentenimport.php b/vilesci/personen/import/interessentenimport.php index a6f77bf6e..88150cf76 100644 --- a/vilesci/personen/import/interessentenimport.php +++ b/vilesci/personen/import/interessentenimport.php @@ -720,6 +720,9 @@ if (isset($_POST['save'])) $prestudent->reihungstestangetreten = false; $prestudent->bismelden = true; + if ($incoming === true)// incomings sind bei Meldung nicht förderrelevant + $prestudent->foerderrelevant = false; + //Wenn die Person schon im System erfasst ist, dann die ZGV des Datensatzes uebernehmen $qry_zgv = " SELECT From 340f410fa5812ca15ca4e49b43544cb1c224d623 Mon Sep 17 00:00:00 2001 From: KarpAlex Date: Tue, 29 Jun 2021 04:00:40 +0200 Subject: [PATCH 26/74] - added foerderrelevant and standort_code to prestudent.class.php and studiengang.class.php to all methods - foerderrelevant and standort for Studiengang can be edited in vilesci studiengang_details.php --- include/prestudent.class.php | 46 ++++++++++++---------- include/studiengang.class.php | 26 +++++++++++- vilesci/stammdaten/studiengang_details.php | 41 +++++++++++++++++++ 3 files changed, 91 insertions(+), 22 deletions(-) diff --git a/include/prestudent.class.php b/include/prestudent.class.php index 15e03cc3f..42380825b 100644 --- a/include/prestudent.class.php +++ b/include/prestudent.class.php @@ -71,6 +71,7 @@ class prestudent extends person public $aufnahmegruppe_kurzbz; public $priorisierung = null; public $foerderrelevant = null; + public $standort_code = null; public $status_kurzbz; public $studiensemester_kurzbz; @@ -165,6 +166,7 @@ class prestudent extends person $this->aufnahmegruppe_kurzbz = $row->aufnahmegruppe_kurzbz; $this->priorisierung = $row->priorisierung; $this->foerderrelevant = $row->foerderrelevant; + $this->standort_code = $row->standort_code; if(!person::load($row->person_id)) return false; @@ -251,7 +253,7 @@ class prestudent extends person reihungstest_id, anmeldungreihungstest, reihungstestangetreten, rt_gesamtpunkte, rt_punkte1, rt_punkte2, rt_punkte3, bismelden, insertamum, insertvon, updateamum, updatevon, anmerkung, dual, ausstellungsstaat, mentor, - gsstudientyp_kurzbz, aufnahmegruppe_kurzbz, priorisierung, foerderrelevant) VALUES('. + gsstudientyp_kurzbz, aufnahmegruppe_kurzbz, priorisierung, foerderrelevant, standort_code) VALUES('. $this->db_add_param($this->aufmerksamdurch_kurzbz).",". $this->db_add_param($this->person_id).",". $this->db_add_param($this->studiengang_kz).",". @@ -286,7 +288,8 @@ class prestudent extends person $this->db_add_param($this->gsstudientyp_kurzbz).",". $this->db_add_param($this->aufnahmegruppe_kurzbz).",". $this->db_add_param($this->priorisierung).",". - $this->db_add_param($this->foerderrelevant, FHC_BOOLEAN).");"; + $this->db_add_param($this->foerderrelevant, FHC_BOOLEAN).",". + $this->db_add_param($this->standort_code).");"; } else { @@ -323,7 +326,8 @@ class prestudent extends person ' ausstellungsstaat='.$this->db_add_param($this->ausstellungsstaat).",". ' aufnahmegruppe_kurzbz='.$this->db_add_param($this->aufnahmegruppe_kurzbz).",". ' priorisierung='.$this->db_add_param($this->priorisierung).",". - ' foerderrelevant='.$this->db_add_param($this->foerderrelevant, FHC_BOOLEAN).' '. + ' foerderrelevant='.$this->db_add_param($this->foerderrelevant, FHC_BOOLEAN).",". + ' standort_code='.$this->db_add_param($this->standort_code)." ". " WHERE prestudent_id=".$this->db_add_param($this->prestudent_id).";"; } @@ -919,6 +923,8 @@ class prestudent extends person $ps->gsstudientyp_kurzbz = $row->gsstudientyp_kurzbz; $ps->aufnahmegruppe_kurzbz = $row->aufnahmegruppe_kurzbz; $ps->priorisierung = $row->priorisierung; + $ps->foerderrelevant = $row->foerderrelevant; + $ps->standort_code = $row->standort_code; $ps->status_kurzbz = $row->status_kurzbz; $ps->studiensemester_kurzbz = $row->studiensemester_kurzbz; @@ -1081,23 +1087,23 @@ class prestudent extends person studiensemester_kurzbz, ausbildungssemester, datum, insertamum, insertvon, updateamum, updatevon, ext_id, orgform_kurzbz, bestaetigtam, bestaetigtvon, anmerkung, bewerbung_abgeschicktamum, studienplan_id, rt_stufe, statusgrund_id) VALUES('. - $this->db_add_param($this->prestudent_id).",". - $this->db_add_param($this->status_kurzbz).",". - $this->db_add_param($this->studiensemester_kurzbz).",". - $this->db_add_param($this->ausbildungssemester).",". - $this->db_add_param($this->datum).",". - $this->db_add_param($this->insertamum).",". - $this->db_add_param($this->insertvon).",". - $this->db_add_param($this->updateamum).",". - $this->db_add_param($this->updatevon).",". - $this->db_add_param($this->ext_id_prestudent).",". - $this->db_add_param($this->orgform_kurzbz).",". - $this->db_add_param($this->bestaetigtam).",". - $this->db_add_param($this->bestaetigtvon).",". - $this->db_add_param($this->anmerkung_status).",". - $this->db_add_param($this->bewerbung_abgeschicktamum).",". - $this->db_add_param($this->studienplan_id,FHC_INTEGER).",". - $this->db_add_param($this->rt_stufe,FHC_INTEGER).",". + $this->db_add_param($this->prestudent_id).",". + $this->db_add_param($this->status_kurzbz).",". + $this->db_add_param($this->studiensemester_kurzbz).",". + $this->db_add_param($this->ausbildungssemester).",". + $this->db_add_param($this->datum).",". + $this->db_add_param($this->insertamum).",". + $this->db_add_param($this->insertvon).",". + $this->db_add_param($this->updateamum).",". + $this->db_add_param($this->updatevon).",". + $this->db_add_param($this->ext_id_prestudent).",". + $this->db_add_param($this->orgform_kurzbz).",". + $this->db_add_param($this->bestaetigtam).",". + $this->db_add_param($this->bestaetigtvon).",". + $this->db_add_param($this->anmerkung_status).",". + $this->db_add_param($this->bewerbung_abgeschicktamum).",". + $this->db_add_param($this->studienplan_id,FHC_INTEGER).",". + $this->db_add_param($this->rt_stufe,FHC_INTEGER).",". $this->db_add_param($this->statusgrund_id, FHC_INTEGER).");"; } else diff --git a/include/studiengang.class.php b/include/studiengang.class.php index d36cd894b..eb3adbe4e 100644 --- a/include/studiengang.class.php +++ b/include/studiengang.class.php @@ -53,6 +53,8 @@ class studiengang extends basis_db public $studienplaetze; // smallint public $oe_kurzbz; // varchar(32) public $onlinebewerbung; // boolean + public $foerderrelevant; // boolean + public $standort_code; // integer public $kuerzel; // = typ + kurzbz (Bsp: BBE) public $kuerzel_arr = array(); // Array mit allen Kurzeln Index=studiengangs_kz @@ -128,6 +130,8 @@ class studiengang extends basis_db $this->moodle = $this->db_parse_bool($row->moodle); $this->mischform = $this->db_parse_bool($row->mischform); $this->projektarbeit_note_anzeige = $this->db_parse_bool($row->projektarbeit_note_anzeige); + $this->foerderrelevant = $this->db_parse_bool($row->foerderrelevant); + $this->standort_code = $row->standort_code; $this->bezeichnung_arr['German'] = $this->bezeichnung; $this->bezeichnung_arr['English'] = $this->english; @@ -201,6 +205,8 @@ class studiengang extends basis_db $stg_obj->moodle = $this->db_parse_bool($row->moodle); $stg_obj->mischform = $this->db_parse_bool($row->mischform); $stg_obj->projektarbeit_note_anzeige = $this->db_parse_bool($row->projektarbeit_note_anzeige); + $stg_obj->foerderrelevant = $this->db_parse_bool($row->foerderrelevant); + $stg_obj->standort_code = $row->standort_code; $stg_obj->bezeichnung_arr['German'] = $row->bezeichnung; $stg_obj->bezeichnung_arr['English'] = $row->english; @@ -419,6 +425,8 @@ class studiengang extends basis_db $stg_obj->moodle = $this->db_parse_bool($row->moodle); $stg_obj->mischform = $this->db_parse_bool($row->mischform); $stg_obj->projektarbeit_note_anzeige = $this->db_parse_bool($row->projektarbeit_note_anzeige); + $stg_obj->foerderrelevant = $this->db_parse_bool($row->foerderrelevant); + $stg_obj->standort_code = $row->standort_code; $stg_obj->bezeichnung_arr['German'] = $row->bezeichnung; $stg_obj->bezeichnung_arr['English'] = $row->english; @@ -519,7 +527,9 @@ class studiengang extends basis_db $this->db_add_param($this->studienplaetze).', '. $this->db_add_param($this->lgartcode).', '. $this->db_add_param($this->mischform, FHC_BOOLEAN).','. - $this->db_add_param($this->projektarbeit_note_anzeige, FHC_BOOLEAN).');'; + $this->db_add_param($this->projektarbeit_note_anzeige, FHC_BOOLEAN).','. + $this->db_add_param($this->foerderrelevant, FHC_BOOLEAN).','. + $this->db_add_param($this->standort_code).');'; } else { @@ -556,7 +566,9 @@ class studiengang extends basis_db 'testtool_sprachwahl='.$this->db_add_param($this->testtool_sprachwahl, FHC_BOOLEAN).', '. 'studienplaetze='.$this->db_add_param($this->studienplaetze).', '. 'lgartcode='.$this->db_add_param($this->lgartcode).', '. - 'mischform='.$this->db_add_param($this->mischform, FHC_BOOLEAN).' '. + 'mischform='.$this->db_add_param($this->mischform, FHC_BOOLEAN).', '. + 'foerderrelevant='.$this->db_add_param($this->foerderrelevant, FHC_BOOLEAN).', '. + 'standort_code='.$this->db_add_param($this->standort_code).' '. 'WHERE studiengang_kz='.$this->db_add_param($this->studiengang_kz, FHC_INTEGER, false).';'; } @@ -679,6 +691,8 @@ class studiengang extends basis_db $this->onlinebewerbung = $this->db_parse_bool($row->onlinebewerbung); $this->moodle = $this->db_parse_bool($row->moodle); $this->mischform = $this->db_parse_bool($row->mischform); + $this->foerderrelevant = $this->db_parse_bool($row->mischform); + $this->standort_code = $row->standort_code; $this->projektarbeit_note_anzeige = $this->db_parse_bool($row->projektarbeit_note_anzeige); $this->bezeichnung_arr['German'] = $this->bezeichnung; @@ -819,6 +833,8 @@ class studiengang extends basis_db $obj->moodle = $this->db_parse_bool($row->moodle); $obj->mischform = $this->db_parse_bool($row->mischform); $obj->projektarbeit_note_anzeige = $this->db_parse_bool($row->projektarbeit_note_anzeige); + $obj->foerderrelevant = $this->db_parse_bool($row->foerderrelevant); + $obj->standort_code = $row->standort_code; $obj->aktiv = $this->db_parse_bool($row->aktiv); $this->result[] = $obj; @@ -891,6 +907,8 @@ class studiengang extends basis_db $obj->moodle = $this->db_parse_bool($row->moodle); $obj->mischform = $this->db_parse_bool($row->mischform); $obj->projektarbeit_note_anzeige = $this->db_parse_bool($row->projektarbeit_note_anzeige); + $obj->foerderrelevant = $this->db_parse_bool($row->foerderrelevant); + $obj->standort_code = $row->standort_code; $obj->bezeichnung_arr['German'] = $obj->bezeichnung; $obj->bezeichnung_arr['English'] = $obj->english; @@ -993,6 +1011,8 @@ class studiengang extends basis_db $obj->moodle = $this->db_parse_bool($row->moodle); $obj->mischform = $this->db_parse_bool($row->mischform); $obj->projektarbeit_note_anzeige = $this->db_parse_bool($row->projektarbeit_note_anzeige); + $obj->foerderrelevant = $this->db_parse_bool($row->foerderrelevant); + $obj->standort_code = $row->standort_code; $obj->bezeichnung_arr['German'] = $obj->bezeichnung; $obj->bezeichnung_arr['English'] = $obj->english; @@ -1127,6 +1147,8 @@ class studiengang extends basis_db $obj->moodle = $this->db_parse_bool($row->moodle); $obj->mischform = $this->db_parse_bool($row->mischform); $obj->projektarbeit_note_anzeige = $this->db_parse_bool($row->projektarbeit_note_anzeige); + $obj->foerderrelevant = $this->db_parse_bool($row->foerderrelevant); + $obj->standort_code = $row->standort_code; $obj->bezeichnung_arr['German'] = $obj->bezeichnung; $obj->bezeichnung_arr['English'] = $obj->english; diff --git a/vilesci/stammdaten/studiengang_details.php b/vilesci/stammdaten/studiengang_details.php index 8ddcceb77..a99af24b7 100644 --- a/vilesci/stammdaten/studiengang_details.php +++ b/vilesci/stammdaten/studiengang_details.php @@ -89,6 +89,8 @@ $testtool_sprachwahl = false; $studienplaetze = ''; $orgform_kurzbz = ''; $lgartcode=''; +$foerderrelevant = false; +$standort_code=''; $schick = filter_input(INPUT_POST, 'schick'); $onlinebewerbung = false; @@ -149,6 +151,8 @@ if($schick) $aktiv = filter_input(INPUT_POST, 'aktiv', FILTER_VALIDATE_BOOLEAN); $onlinebewerbung = filter_input(INPUT_POST, 'onlinebewerbung', FILTER_VALIDATE_BOOLEAN); $mischform = filter_input(INPUT_POST, 'mischform', FILTER_VALIDATE_BOOLEAN); + $foerderrelevant = filter_input(INPUT_POST, 'foerderrelevant', FILTER_VALIDATE_BOOLEAN); + $standort_code = filter_input(INPUT_POST, 'standort_code'); $ext_id = filter_input(INPUT_POST, 'ext_id'); @@ -214,6 +218,8 @@ if($schick) $sg_update->studienplaetze = $studienplaetze; $sg_update->orgform_kurzbz = $orgform_kurzbz; $sg_update->lgartcode = $lgartcode; + $sg_update->foerderrelevant = $foerderrelevant; + $sg_update->standort_code = $standort_code; $sg_update->bescheidvom=$date->formatDatum($sg_update->bescheidvom,'Y-m-d'); $sg_update->titelbescheidvom=$date->formatDatum($sg_update->titelbescheidvom,'Y-m-d'); @@ -280,6 +286,8 @@ if ((isset($_REQUEST['studiengang_kz'])) && ((!isset($_REQUEST['neu'])) || ($_RE $studienplaetze = $sg->studienplaetze; $orgform_kurzbz = $sg->orgform_kurzbz; $lgartcode = $sg->lgartcode; + $foerderrelevant = $sg->foerderrelevant; + $standort_code = $sg->standort_code; } $erh = new erhalter(); @@ -430,6 +438,13 @@ if (!$erh->getAll('kurzbz')) onchange="submitable()"> + + Förderrelevant + + + onchange="submitable()"> + + @@ -555,6 +570,32 @@ if (!$erh->getAll('kurzbz')) + + Standort + + + + From 02f52f606c299bddc721688094d2529677bc5633 Mon Sep 17 00:00:00 2001 From: KarpAlex Date: Tue, 29 Jun 2021 10:05:25 +0200 Subject: [PATCH 27/74] added foerderrelevant and standort dropdown fields in FAS for editing --- content/student/studentDBDML.php | 2 + content/student/studentdetailoverlay.xul.php | 16 +++++ content/student/studentoverlay.js.php | 14 ++++ rdf/bisstandort.rdf.php | 75 ++++++++++++++++++++ rdf/student.rdf.php | 2 + 5 files changed, 109 insertions(+) create mode 100644 rdf/bisstandort.rdf.php diff --git a/content/student/studentDBDML.php b/content/student/studentDBDML.php index becb31e88..11df5240d 100644 --- a/content/student/studentDBDML.php +++ b/content/student/studentDBDML.php @@ -624,11 +624,13 @@ if(!$error) $prestudent->aufnahmeschluessel = $_POST['aufnahmeschluessel']; $prestudent->facheinschlberuf = ($_POST['facheinschlberuf']=='true'?true:false); $prestudent->bismelden = ($_POST['bismelden']=='true'?true:false); + $prestudent->foerderrelevant = ($_POST['foerderrelevant']=='true'?true:false); $prestudent->dual = ($_POST['dual']=='true'?true:false); $prestudent->anmerkung = $_POST['anmerkung']; $prestudent->mentor = $_POST['mentor']; $prestudent->gsstudientyp_kurzbz = $_POST['gsstudientyp_kurzbz']; $prestudent->priorisierung = $_POST['priorisierung']; + $prestudent->standort_code = $_POST['standort_code']; //$prestudent->insertamum = date('Y-m-d H:i:s'); //$prestudent->insertvon = $user; $prestudent->updateamum = date('Y-m-d H:i:s'); diff --git a/content/student/studentdetailoverlay.xul.php b/content/student/studentdetailoverlay.xul.php index 18e69874e..980b44333 100644 --- a/content/student/studentdetailoverlay.xul.php +++ b/content/student/studentdetailoverlay.xul.php @@ -461,6 +461,18 @@ echo ''; +
diff --git a/public/js/codex/oehbeitrag.js b/public/js/codex/oehbeitrag.js index f8fc403f0..77a98a27b 100644 --- a/public/js/codex/oehbeitrag.js +++ b/public/js/codex/oehbeitrag.js @@ -7,10 +7,10 @@ const CONTROLLER_URL = BASE_URL + "/"+CALLED_PATH; */ $(document).ready(function () { - //initialise table sorter - Oehbeitrag._addTablesorter(); + // get Öhbeiträge and show them in table + Oehbeitrag.getOehBeitraege(); - // set trigger for adding new Oehhbeitrag + // set event for adding new Oehhbeitrag $("#addNewOeh").click( function() { @@ -21,6 +21,7 @@ $(document).ready(function () let studiensemester = FHC_AjaxClient.getData(data); let nextOehbeitragId = Oehbeitrag.newBeitragId; + // add new table row let newRowHtml = ""+ ""; newRowHtml += Oehbeitrag._getStudiensemesterDropdown(Oehbeitrag.newBeitragId, 'von_studiensemester_kurzbz', studiensemester); @@ -33,7 +34,6 @@ $(document).ready(function () " "+ ""; -/* $("#saveHeading, .saveCell").show();*/ $("#oehbeitraegeTbl tbody").prepend(newRowHtml); $("#addOeh_"+Oehbeitrag.newBeitragId).click( function() @@ -55,6 +55,7 @@ $(document).ready(function () } ); + // remove html row if delete button clicked $("#delete_"+nextOehbeitragId).click( function() { @@ -62,7 +63,7 @@ $(document).ready(function () } ); - // increase counter for newly added rows + // increase counter for newly added rows id Oehbeitrag.newBeitragId++; } else @@ -72,26 +73,72 @@ $(document).ready(function () Oehbeitrag.getValidStudiensemester(callback); } ) - - // set trigger for deleting Oehhbeitrag - $(".deleteBtn").click( - function() - { - let oehbeitrag_id_prefixed = $(this).prop("id"); - let oehbeitrag_id = oehbeitrag_id_prefixed.substr(oehbeitrag_id_prefixed.lastIndexOf('_')+1); - - Oehbeitrag.deleteOehbeitrag(oehbeitrag_id); - } - ); - - // set trigger for updating Oehhbeitrag - Oehbeitrag._setUpdateEvents(); }); var Oehbeitrag = { newBeitragId: 0, // ----------------------------------------------------------------------------------------------------------------- // ajax calls + getOehBeitraege: function() + { + FHC_AjaxClient.ajaxCallGet( + CALLED_PATH + "/getOehbeitraege", + null, + { + successCallback: function(data, textStatus, jqXHR) + { + if (FHC_AjaxClient.isError(data)) + { + FHC_DialogLib.alertError(FHC_AjaxClient.getError(data)); + } + else if (FHC_AjaxClient.hasData(data)) + { + let oehbeitraege = FHC_AjaxClient.getData(data); + + let oehbeitrStr = ''; + for (let idx in oehbeitraege) + { + let oehbeitrag = oehbeitraege[idx]; + + // add Öhbeitrag row + oehbeitrStr += '' + + '' + + Oehbeitrag._formatDateToGerman(oehbeitrag.von_datum) + '/' + oehbeitrag.von_studiensemester_kurzbz + + ' '+ + '' + + '' + (oehbeitrag.bis_studiensemester_kurzbz == null ? 'unbeschränkt' : + Oehbeitrag._formatDateToGerman(oehbeitrag.bis_datum) + '/' + oehbeitrag.bis_studiensemester_kurzbz) + + ' '+ + '' + + '' + Oehbeitrag._formatDecimal(oehbeitrag.studierendenbeitrag) + + ' '+ + '' + + '' + Oehbeitrag._formatDecimal(oehbeitrag.versicherung) + + ' '+ + '' + + '' + + '' + + ' ' + + '' + + ''; + } + $("#oehbeitraegeTbl tbody").html(oehbeitrStr); + + // set events for editing, deleting etc. + Oehbeitrag._setUpdateEvents(); + + //initialise table sorter + Oehbeitrag._addTablesorter(); + } + }, + errorCallback: function() + { + FHC_DialogLib.alertError('Fehler beim Holen der Öhbeiträge'); + } + } + ); + }, + // get all Studiensemester which are valid for assignment (where no Öhbeitrag is assigned) getValidStudiensemester: function(callback, oehbeitrag_id) { let params = oehbeitrag_id ? {"oehbeitrag_id": oehbeitrag_id} : null; @@ -121,42 +168,8 @@ var Oehbeitrag = { } else if (FHC_AjaxClient.hasData(data)) { - let inserted_id = FHC_AjaxClient.getData(data); - - // refresh table row in GUI - let bis_studiensemester_kurzbz = oehbeitrag.bis_studiensemester_kurzbz == 'null' ? 'unbeschränkt' : studiensemester_von_bis.bis_semester_with_date; - - $("#input_studierendenbeitrag_"+nextOehbeitragId).parent('td').html( - Oehbeitrag._formatDecimal(oehbeitrag.studierendenbeitrag)+" " - ); - $("#input_versicherung_"+nextOehbeitragId).parent('td').html( - Oehbeitrag._formatDecimal(oehbeitrag.versicherung)+" " - ); - $("#input_von_studiensemester_kurzbz_"+nextOehbeitragId).parent('td').html( - studiensemester_von_bis.von_semester_with_date+" " - ); - $("#input_bis_studiensemester_kurzbz_"+nextOehbeitragId).parent('td').html( - bis_studiensemester_kurzbz+" " - ); - - // add delete button instead of save btn - $("#addOeh_"+nextOehbeitragId).parent('td').html(""); - - // add update and delete events - Oehbeitrag._setUpdateEvents(); - - $("#delete_"+inserted_id).click( - function() - { - let oehbeitrag_id_prefixed = $(this).prop("id"); - let oehbeitrag_id = oehbeitrag_id_prefixed.substr(oehbeitrag_id_prefixed.indexOf('_')+1); - - Oehbeitrag.deleteOehbeitrag(oehbeitrag_id); - } - ) - - // refresh tablesorter - Oehbeitrag._addTablesorter(); + // refresh Öhbeitragstable + Oehbeitrag.getOehBeitraege(); } else { @@ -170,7 +183,40 @@ var Oehbeitrag = { } ); }, - updateOehbeitrag(oehbeitrag_id, fieldname, fieldelement, inputtype) + // update whole Öhbeitrag + updateOehbeitrag: function(oehbeitrag_id, oehbeitragData) + { + FHC_AjaxClient.ajaxCallPost( + CALLED_PATH + '/updateOehbeitrag', + { + "oehbeitrag_id": oehbeitrag_id, + "data": oehbeitragData + }, + { + successCallback: function(data, textStatus, jqXHR) { + if (FHC_AjaxClient.isError(data)) + { + FHC_DialogLib.alertError(FHC_AjaxClient.getError(data)); + } + else if (FHC_AjaxClient.hasData(data)) + { + // refresh Öhbeitragstable + Oehbeitrag.getOehBeitraege(); + } + else + { + FHC_DialogLib.alertError('Fehler beim Aktualisieren des Öhbeitrags'); + } + }, + errorCallback: function() + { + FHC_DialogLib.alertError('Fehler beim Aktualisieren des Öhbeitrags'); + } + } + ); + }, + // update one field of Öhbeitrag (e.g. only semester or only Betrag) + updateOehbeitragField: function(oehbeitrag_id, fieldname, fieldelement, inputtype) { let oehbeitragdata = {}; let fieldvalue = fieldelement.val(); @@ -194,6 +240,7 @@ var Oehbeitrag = { } else if (FHC_AjaxClient.hasData(data)) { + // refresh table cell with correct value and set edit event and tablesorter if (inputtype == 'semester') fieldvalue = $(fieldelement).find("option:selected").text(); else @@ -204,7 +251,7 @@ var Oehbeitrag = { $("#edit_"+fieldname+"_"+oehbeitrag_id).click( function() { - Oehbeitrag._setUpdateEvent($(this).prop("id"), fieldname, inputtype); + Oehbeitrag._makeFieldEditable($(this).prop("id"), fieldname, inputtype, true); } ); @@ -212,12 +259,12 @@ var Oehbeitrag = { } else { - FHC_DialogLib.alertError('Fehler beim Hinzufügen des Öhbeitrags'); + FHC_DialogLib.alertError('Fehler beim Aktualisieren des Öhbeitrags'); } }, errorCallback: function() { - FHC_DialogLib.alertError('Fehler beim Hinzufügen des Öhbeitrags'); + FHC_DialogLib.alertError('Fehler beim Aktualisieren des Öhbeitrags'); } } ); @@ -248,43 +295,92 @@ var Oehbeitrag = { }, // ----------------------------------------------------------------------------------------------------------------- - // (private) methods - _setUpdateEvents() + /** + * Sets click events for updating, deleting Oehbeitrag + */ + _setUpdateEvents: function() { + // set edit event for whole row + $(".editBtn").click( + function() + { + let id = $(this).prop("id"); + let oehbeitrag_id = id.substr(id.lastIndexOf('_')+1); + Oehbeitrag._makeFieldEditable(id, 'von_studiensemester_kurzbz', 'semester'); + Oehbeitrag._makeFieldEditable(id, 'bis_studiensemester_kurzbz', 'semester'); + Oehbeitrag._makeFieldEditable(id, 'studierendenbeitrag'); + Oehbeitrag._makeFieldEditable(id, 'versicherung'); + $(this).after(" "); + $(this).remove(); + $("#delete_" + oehbeitrag_id).remove(); + + $("#save_"+oehbeitrag_id).click( + function() + { + let von_studiensemester_kurzbz = $("#input_von_studiensemester_kurzbz_"+oehbeitrag_id+" option:selected").val(); + let bis_studiensemester_kurzbz = $("#input_bis_studiensemester_kurzbz_"+oehbeitrag_id+" option:selected").val(); + let studierendenbeitrag = Oehbeitrag._formatDecimal($("#input_studierendenbeitrag_"+oehbeitrag_id).val(), '.'); + let versicherung = Oehbeitrag._formatDecimal($("#input_versicherung_"+oehbeitrag_id).val(), '.'); + + let oehbeitragData = { + "von_studiensemester_kurzbz": von_studiensemester_kurzbz, + "bis_studiensemester_kurzbz": bis_studiensemester_kurzbz, + "studierendenbeitrag": studierendenbeitrag, + "versicherung": versicherung + } + + Oehbeitrag.updateOehbeitrag(oehbeitrag_id, oehbeitragData); + } + ) + } + ); + + // set delete event for all rows + $(".deleteBtn").click( + function() + { + let oehbeitrag_id_prefixed = $(this).prop("id"); + let oehbeitrag_id = oehbeitrag_id_prefixed.substr(oehbeitrag_id_prefixed.lastIndexOf('_')+1); + + Oehbeitrag.deleteOehbeitrag(oehbeitrag_id); + } + ) + + // set edit events for single cells $(".editStudierendenbeitrag").off('click').click( function() { - Oehbeitrag._setUpdateEvent($(this).prop("id"), 'studierendenbeitrag'); + Oehbeitrag._makeFieldEditable($(this).prop("id"), 'studierendenbeitrag', null, true); } ); $(".editVersicherung").off('click').click( function() { - Oehbeitrag._setUpdateEvent($(this).prop("id"), 'versicherung'); + Oehbeitrag._makeFieldEditable($(this).prop("id"), 'versicherung', null, true); } ); $(".editBisStudiensemester").off('click').click( function() { - Oehbeitrag._setUpdateEvent($(this).prop("id"), 'bis_studiensemester_kurzbz', 'semester'); + Oehbeitrag._makeFieldEditable($(this).prop("id"), 'bis_studiensemester_kurzbz', 'semester', true); } ); $(".editVonStudiensemester").off('click').click( function() { - Oehbeitrag._setUpdateEvent($(this).prop("id"), 'von_studiensemester_kurzbz', 'semester'); + Oehbeitrag._makeFieldEditable($(this).prop("id"), 'von_studiensemester_kurzbz', 'semester', true); } ); - }, - _setUpdateEvent(oehbeitrag_id_prefixed, fieldname, inputtype) + // make Öhbeitrag field editable, i.e. show input field instead of text + _makeFieldEditable: function(oehbeitrag_id_prefixed, fieldname, inputtype, singleUpdate) { - let initElement = $("#"+oehbeitrag_id_prefixed); // clicked element triggering event let oehbeitrag_id = oehbeitrag_id_prefixed.substr(oehbeitrag_id_prefixed.lastIndexOf('_')+1); - let currFieldvalue = initElement.parent('td').text().trim(); + let initElement = $("#cell_"+fieldname+"_"+oehbeitrag_id); // clicked element triggering event + let currFieldvalue = initElement.text().trim(); let callback = function(validSemesterData) { @@ -306,19 +402,24 @@ var Oehbeitrag = { " value='"+currFieldvalue+"' placeholder='0,00'>"; } - inputHtml += " "; + if (singleUpdate === true) + inputHtml += " "; - initElement.parent('td').html(inputHtml); + initElement.html(inputHtml); - // set the update event - $("#confirm_"+fieldname+"_"+oehbeitrag_id).click( - function() - { - Oehbeitrag.updateOehbeitrag(oehbeitrag_id, fieldname, $("#input_" + fieldname + "_" + oehbeitrag_id), inputtype); - } - ); + if (singleUpdate === true) + { + // set the update event if single field update + $("#confirm_" + fieldname + "_" + oehbeitrag_id).click( + function() + { + Oehbeitrag.updateOehbeitragField(oehbeitrag_id, fieldname, $("#input_" + fieldname + "_" + oehbeitrag_id), inputtype); + } + ); + } } + // get valid Studiensemester with no Öhbeitrag assigned if (inputtype == 'semester') { Oehbeitrag.getValidStudiensemester(callback, oehbeitrag_id); @@ -379,12 +480,7 @@ var Oehbeitrag = { Tablesort.addTablesorter("oehbeitraegeTbl", [[0,1]], ["zebra"], 8, headers); }, - /** - * Formats a numeric value as a float with two decimals - * @param value - * @param decSeparator the new decimal separator - * @returns {string} formatted value - */ + // Formats a numeric value as a float with two decimals _formatDecimal: function(value, decSeparator) { let dec = null; @@ -408,6 +504,7 @@ var Oehbeitrag = { return dec; }, + // formats english date to as german _formatDateToGerman: function(date) { return date.substring(8, 10) + "." + date.substring(5, 7) + "." + date.substring(0, 4); From 367c266e2e74baa3d37515139081f01a518e88a5 Mon Sep 17 00:00:00 2001 From: KarpAlex Date: Thu, 29 Jul 2021 13:02:24 +0200 Subject: [PATCH 35/74] Zeugnisnote_model.php: added method getEctsSumsByPerson --- .../models/education/Zeugnisnote_model.php | 67 ++++++++++++++++++- 1 file changed, 66 insertions(+), 1 deletion(-) diff --git a/application/models/education/Zeugnisnote_model.php b/application/models/education/Zeugnisnote_model.php index 306f56e8c..2ccea3e53 100644 --- a/application/models/education/Zeugnisnote_model.php +++ b/application/models/education/Zeugnisnote_model.php @@ -14,7 +14,72 @@ class Zeugnisnote_model extends DB_Model } /** - * Gets Pruefungen of a person for a Studiensemester. + * Gets ECTS sums of completed courses (Zeugnisnoten) of a person for a Studiensemester. + * If no valid Noten for the course were entered, 0 ects is returned. + * @param int $person_id + * @param string $studiensemester_kurzbz + * @param bool $aktiv + * @param bool $lehre + * @param bool $offiziell + * @param bool $positiv + * @return object + */ + public function getEctsSumsByPerson($person_id, $studiensemester_kurzbz, $aktiv = true, $lehre = null, $offiziell = null, $positiv = null) + { + $params = array(); + + $qry = "SELECT DISTINCT ON (prst.prestudent_id) pers.matr_nr, stg.studiengang_kz, prst.prestudent_id, stg.erhalter_kz, + UPPER(stg.typ||stg.kurzbz) AS studiengang, stg.bezeichnung AS studiengang_bezeichnung, COALESCE(summen.summe_ects, 0) AS summe_ects + FROM public.tbl_person pers + JOIN public.tbl_prestudent prst USING (person_id) + JOIN public.tbl_prestudentstatus prstst USING (prestudent_id) + JOIN public.tbl_studiengang stg ON prst.studiengang_kz = stg.studiengang_kz + LEFT JOIN ( + SELECT zgnisnote.student_uid, prestudent_id, zgnisnote.studiensemester_kurzbz, sum(ects) AS summe_ects + FROM public.tbl_student + LEFT JOIN lehre.tbl_zeugnisnote zgnisnote USING(student_uid) + LEFT JOIN lehre.tbl_note note ON zgnisnote.note = note.note + LEFT JOIN lehre.tbl_lehrveranstaltung lv USING (lehrveranstaltung_id) + WHERE TRUE"; + + if (isset($aktiv)) + { + $qry .= ' AND (note.aktiv = ?)'; + $params[] = $aktiv; + } + + if (isset($lehre)) + { + $qry .= ' AND (note.lehre = ?)'; + $params[] = $lehre; + } + + if (isset($offiziell)) + { + $qry .= ' AND (note.offiziell = ?)'; + $params[] = $offiziell; + } + + if (isset($positiv)) + { + $qry .= ' AND (note.positiv = ?)'; + $params[] = $positiv; + } + + $qry .= " GROUP BY zgnisnote.studiensemester_kurzbz, zgnisnote.student_uid, prestudent_id + ) summen ON prst.prestudent_id = summen.prestudent_id AND prstst.studiensemester_kurzbz = summen.studiensemester_kurzbz + WHERE pers.person_id = ? + AND prstst.studiensemester_kurzbz = ? + ORDER BY prst.prestudent_id"; + + $params[] = $person_id; + $params[] = $studiensemester_kurzbz; + + return $this->execQuery($qry, $params); + } + + /** + * Gets courses (Zeugnisnoten) of a person for a Studiensemester. * @param int $person_id * @param string $studiensemester_kurzbz * @param bool $aktiv From 24a979f9f193aae95d43e35d5eae12a82dfcd73c Mon Sep 17 00:00:00 2001 From: KarpAlex Date: Wed, 18 Aug 2021 22:16:15 +0200 Subject: [PATCH 36/74] Zeugnisnote_model.php, method getByPerson: note and note bezeichnung are also selected --- .../models/education/Zeugnisnote_model.php | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/application/models/education/Zeugnisnote_model.php b/application/models/education/Zeugnisnote_model.php index 2ccea3e53..65607e252 100644 --- a/application/models/education/Zeugnisnote_model.php +++ b/application/models/education/Zeugnisnote_model.php @@ -92,18 +92,18 @@ class Zeugnisnote_model extends DB_Model { $params = array($person_id, $studiensemester_kurzbz); - $qry = ' - SELECT zgnisnote.*, pers.matr_nr, lv.ects, stg.studiengang_kz, prst.prestudent_id, stg.erhalter_kz, - UPPER(stg.typ||stg.kurzbz) AS studiengang, stg.bezeichnung AS studiengang_bezeichnung - FROM public.tbl_person pers - JOIN public.tbl_prestudent prst USING (person_id) - JOIN public.tbl_student USING (prestudent_id) - JOIN lehre.tbl_zeugnisnote zgnisnote USING (student_uid) - JOIN lehre.tbl_note note ON zgnisnote.note = note.note - JOIN lehre.tbl_lehrveranstaltung lv USING (lehrveranstaltung_id) - JOIN public.tbl_studiengang stg ON prst.studiengang_kz = stg.studiengang_kz - WHERE pers.person_id = ? - AND zgnisnote.studiensemester_kurzbz = ?'; + $qry = "SELECT zgnisnote.*, pers.matr_nr, lv.ects, stg.studiengang_kz, prst.prestudent_id, stg.erhalter_kz, + UPPER(stg.typ||stg.kurzbz) AS studiengang, stg.bezeichnung AS studiengang_bezeichnung, note.note, + note.bezeichnung AS note_bezeichnung + FROM public.tbl_person pers + JOIN public.tbl_prestudent prst USING (person_id) + JOIN public.tbl_student USING (prestudent_id) + JOIN lehre.tbl_zeugnisnote zgnisnote USING (student_uid) + JOIN lehre.tbl_note note ON zgnisnote.note = note.note + JOIN lehre.tbl_lehrveranstaltung lv USING (lehrveranstaltung_id) + JOIN public.tbl_studiengang stg ON prst.studiengang_kz = stg.studiengang_kz + WHERE pers.person_id = ? + AND zgnisnote.studiensemester_kurzbz = ?"; if (isset($aktiv)) { From 25cc8c6d49e8eabfa70ead2192c7b5cfd7ddacb6 Mon Sep 17 00:00:00 2001 From: KarpAlex Date: Mon, 30 Aug 2021 18:11:08 +0200 Subject: [PATCH 37/74] matr_aktiv field in dbupdate_3.3.php: only set to true if not NULL --- system/dbupdate_3.3.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/dbupdate_3.3.php b/system/dbupdate_3.3.php index a216ef371..9600d241f 100644 --- a/system/dbupdate_3.3.php +++ b/system/dbupdate_3.3.php @@ -4945,7 +4945,7 @@ if(!$result = @$db->db_query("SELECT matr_aktiv FROM public.tbl_person LIMIT 1") else echo '
public.tbl_person: Spalte matr_aktiv hinzugefuegt'; - $qry = "UPDATE public.tbl_person SET matr_aktiv = true;"; + $qry = "UPDATE public.tbl_person SET matr_aktiv = TRUE WHERE matr_nr IS NOT NULL;"; if(!$db->db_query($qry)) echo 'public.tbl_person: '.$db->db_last_error().'
'; From 9c84558f5fcbfce7cd0321226c01f0f03e7bbee1 Mon Sep 17 00:00:00 2001 From: Paolo Date: Tue, 7 Sep 2021 12:13:59 +0200 Subject: [PATCH 38/74] - Added requiredPermissions to the application/config/udfmasterschema.json and set them as mandatory - Removed the private method _isAllowed from application/controllers/widgets/UDF.php - Removed required permissions from views application/views/system/fas_udf.php and application/views/system/infocenter/zgvpruefungen.php - Widget views application/views/widgets/checkbox, dropdown, textarea and textfield now they print the attribute disabled - Added constant DISABLED to application/widgets/html/HTMLWidget.php - Removed private property _requiredPermissions from application/widgets/udf/UDFWidget.php - application/widgets/udf/UDFWidget.php does not check permissions anymore and does not store them anymore - Added constants PERMISSION_TYPE_READ and PERMISSION_TYPE_WRITE to application/libraries/UDFLib.php - Removed constant PERMISSION_TYPE from application/libraries/UDFLib.php - Removed public method isAllowed from application/libraries/UDFLib.php - Added private methods _readAllowed, _writeAllowed, _setRequiredPermissions and _setReadOnly to application/libraries/UDFLib.php - UDFLib->displayUDFWidget now checks if permissions are declared in the UDF JSON and if the user is allowed to read and write such UDF - UDFLib->saveUDFs now checks if the user has the permissions to write such UDF - Now the UDFs are even displayed in read only mode --- application/config/udfmasterschema.json | 16 +- application/controllers/widgets/UDF.php | 15 +- application/libraries/UDFLib.php | 267 ++++++++++++------ application/views/system/fas_udf.php | 3 +- .../views/system/infocenter/zgvpruefungen.php | 2 +- application/views/widgets/checkbox.php | 4 +- application/views/widgets/dropdown.php | 2 + application/views/widgets/textarea.php | 4 +- application/views/widgets/textfield.php | 4 +- application/widgets/html/HTMLWidget.php | 46 +-- application/widgets/udf/UDFWidget.php | 34 +-- 11 files changed, 235 insertions(+), 162 deletions(-) diff --git a/application/config/udfmasterschema.json b/application/config/udfmasterschema.json index fa06dc80d..ab3faa8c9 100644 --- a/application/config/udfmasterschema.json +++ b/application/config/udfmasterschema.json @@ -9,6 +9,13 @@ "name": { "type": "string" }, + "type": { + "type": "string", + "enum": ["checkbox", "textfield", "textarea", "date", "dropdown", "multipledropdown"] + }, + "requiredPermissions": { + "type": "array" + }, "description": { "type": "array", }, @@ -18,10 +25,6 @@ "title": { "type": "array", }, - "type": { - "type": "string", - "enum": ["checkbox", "textfield", "textarea", "date", "dropdown", "multipledropdown"] - }, "sort": { "type": "integer" }, @@ -67,5 +70,6 @@ } } }, - "required": ["type", "name"] -} \ No newline at end of file + "required": ["type", "name", "requiredPermissions"] +} + diff --git a/application/controllers/widgets/UDF.php b/application/controllers/widgets/UDF.php index 5b4c45776..3ba745a10 100644 --- a/application/controllers/widgets/UDF.php +++ b/application/controllers/widgets/UDF.php @@ -26,9 +26,6 @@ class UDF extends FHC_Controller // Loads the UDFLib with HTTP GET/POST parameters $this->_loadUDFLib(); - - // Checks if the caller is allow to use this UDF widget - $this->_isAllowed(); } //------------------------------------------------------------------------------------------------------------------ @@ -63,17 +60,6 @@ class UDF extends FHC_Controller //------------------------------------------------------------------------------------------------------------------ // Private methods - /** - * Checks if the user is allowed to use this UDFWidget - */ - private function _isAllowed() - { - if (!$this->udflib->isAllowed()) - { - $this->terminateWithJsonError('You are not allowed to access to this content'); - } - } - /** * Loads the UDFLib with the UDF_UNIQUE_ID parameter * If the parameter UDF_UNIQUE_ID is not given then the execution of the controller is terminated and @@ -105,3 +91,4 @@ class UDF extends FHC_Controller } } } + diff --git a/application/libraries/UDFLib.php b/application/libraries/UDFLib.php index f9ad7d20d..756c382dd 100644 --- a/application/libraries/UDFLib.php +++ b/application/libraries/UDFLib.php @@ -30,13 +30,14 @@ class UDFLib // ...to specify permissions that are needed to use this TableWidget const REQUIRED_PERMISSIONS_PARAMETER = 'requiredPermissions'; + const PERMISSION_TABLE_METHOD = 'UDFWidget'; // Name for fake method to be checked by the PermissionLib + const PERMISSION_TYPE_READ = 'r'; + const PERMISSION_TYPE_WRITE = 'w'; + // ...to specify the primary key name and value const PRIMARY_KEY_NAME = 'primaryKeyName'; const PRIMARY_KEY_VALUE = 'primaryKeyValue'; - const PERMISSION_TABLE_METHOD = 'UDFWidget'; // Name for fake method to be checked by the PermissionLib - const PERMISSION_TYPE = 'rw'; - // HTML components const LABEL = 'title'; const TITLE = 'description'; @@ -76,10 +77,10 @@ class UDFLib // Public methods /** - * UDFWidget - */ - public function UDFWidget($args, $htmlArgs = array()) - { + * UDFWidget + */ + public function UDFWidget($args, $htmlArgs = array()) + { if ((isset($args[self::SCHEMA_ARG_NAME]) && !isEmptyString($args[self::SCHEMA_ARG_NAME])) && (isset($args[self::TABLE_ARG_NAME]) && !isEmptyString($args[self::TABLE_ARG_NAME]))) { @@ -112,16 +113,17 @@ class UDFLib show_error(self::TABLE_ARG_NAME.' parameter is missing!'); } } - } + } - /** + /** * It renders the HTML of the UDF * * NOTE: When this method is called $widgetData contains different data from * parameter $args in the constructor */ - public function displayUDFWidget(&$widgetData) + public function displayUDFWidget(&$widgetData) { + $field = null; $schema = $widgetData[self::SCHEMA_ARG_NAME]; // schema attribute $table = $widgetData[self::TABLE_ARG_NAME]; // table attribute @@ -155,7 +157,7 @@ class UDFLib $found = false; // used to check if the field is found or not in the json schema $this->_sortJsonSchemas($jsonSchemasArray); // Sort the list of UDF by sort property - + // Loops through json schemas foreach ($jsonSchemasArray as $jsonSchema) { @@ -169,21 +171,37 @@ class UDFLib { show_error(sprintf('%s.%s: Attribute "name" not present in the json schema', $schema, $table)); } + // If the requiredPermissions property is not present then show an error + if (!isset($jsonSchema->{self::REQUIRED_PERMISSIONS_PARAMETER})) + { + show_error(sprintf('%s.%s: Attribute "requiredPermissions" not present in the json schema', $schema, $table)); + } + + // Set the required permissions for this UDF + $this->_setRequiredPermissions($jsonSchema->{self::NAME}, $jsonSchema->{self::REQUIRED_PERMISSIONS_PARAMETER}); // If a UDF is specified and is present in the json schemas list or no UDF is specified if ((isset($field) && $field == $jsonSchema->{self::NAME}) || !isset($field)) { - // Set attributes using phrases - $this->_setAttributesWithPhrases($jsonSchema, $widgetData[HTMLWidget::HTML_ARG_NAME]); + // If the user has the permissions to read this field + if ($this->_readAllowed($jsonSchema->{self::REQUIRED_PERMISSIONS_PARAMETER})) + { + // Set attributes using phrases + $this->_setAttributesWithPhrases($jsonSchema, $widgetData[HTMLWidget::HTML_ARG_NAME]); - // Set validation attributes - $this->_setValidationAttributes($jsonSchema, $widgetData[HTMLWidget::HTML_ARG_NAME]); + // Set validation attributes + $this->_setValidationAttributes($jsonSchema, $widgetData[HTMLWidget::HTML_ARG_NAME]); - // Set name and id attributes - $this->_setNameAndId($jsonSchema, $widgetData[HTMLWidget::HTML_ARG_NAME]); + // Set name and id attributes + $this->_setNameAndId($jsonSchema, $widgetData[HTMLWidget::HTML_ARG_NAME]); - // Render the HTML for this UDF - $this->_render($jsonSchema, $widgetData); + // Set if the field is in read only mode + $this->_setReadOnly($jsonSchema, $widgetData[HTMLWidget::HTML_ARG_NAME]); + + // Render the HTML for this UDF + $this->_render($jsonSchema, $widgetData); + } + // otherwise the UDF is not displayed // If a UDf is specified and it was found then stop looking through this list if (isset($field) && $field == $jsonSchema->{self::NAME}) @@ -213,7 +231,7 @@ class UDFLib show_error(sprintf('%s.%s: Does not contain "jsons" field', $schema, $table)); } } - } + } /** * Manage UDFs @@ -249,6 +267,22 @@ class UDFLib { $decodedUDFDefinition = $decodedUDFDefinitions[$i]; // Definition of a single UDF + // Checks if the requiredPermissions is available and it is a valid array or a valid string + if (isset($decodedUDFDefinition->{self::REQUIRED_PERMISSIONS_PARAMETER}) + && (!isEmptyArray($decodedUDFDefinition->{self::REQUIRED_PERMISSIONS_PARAMETER}) + || !isEmptyString($decodedUDFDefinition->{self::REQUIRED_PERMISSIONS_PARAMETER}))) + { + // Then check if the user has the permissions to write such UDF + if (!$this->_writeAllowed($decodedUDFDefinition->{self::REQUIRED_PERMISSIONS_PARAMETER})) + { + $notValidUDFsArray[] = error('Writing not allowed for UDF: '.$decodedUDFDefinition->{self::NAME}); + } + } + else + { + $notValidUDFsArray[] = error('Writing permissions not defined for UDF: '.$decodedUDFDefinition->{self::NAME}); + } + // Loops through the UDFs values that should be stored foreach ($udfsParameters as $key => $val) { @@ -468,12 +502,32 @@ class UDFLib */ public function saveUDFs($udfUniqueId, $udfs) { + $udfToBewritten = array(); // UDFs to be written into database + // Read the all session for this udf widget $session = $this->getSession(); // If session is empty then return an error if ($session == null) return error('No UDFWidget loaded'); + // Get the required permission from the session + $requiredPermissions = $session[self::REQUIRED_PERMISSIONS_PARAMETER]; + + // For each UDF that is trying to save + foreach ($udfs as $udfName => $udfValue) + { + // If the UDFs exists in the requiredPermissions array + if (array_key_exists($udfName, $requiredPermissions)) + { + // Then check if the user has the permissions to write such UDF + if ($this->_writeAllowed($requiredPermissions[$udfName])) + { + // If allowed then save the UDF name and value to be stored later into the database + $udfToBewritten[$udfName] = $udfValue; + } + } + } + // Workaround to load CI $this->_ci->load->model('system/UDF_model', 'UDFModel'); @@ -490,30 +544,56 @@ class UDFLib // Returns the result of the database update operation to save UDFs return $dbModel->update( array($session[self::PRIMARY_KEY_NAME] => $session[self::PRIMARY_KEY_VALUE]), - (array)$udfs + $udfToBewritten ); } - /** - * Checks if at least one of the permissions given as parameter (requiredPermissions) belongs - * to the authenticated user, if confirmed then is allowed to use this UDFWidget. - * If the parameter requiredPermissions is NOT given or is not present in the session, - * then NO one is allow to use this UDFWidget - * Wrapper method to permissionlib->hasAtLeastOne - */ - public function isAllowed($requiredPermissions = null) - { - $this->_ci->load->library('PermissionLib'); // Load permission library - - // Gets the required permissions from the session if they are not provided as parameter - $rq = $requiredPermissions; - if ($rq == null) $rq = $this->getSessionElement(self::REQUIRED_PERMISSIONS_PARAMETER); - - return $this->_ci->permissionlib->hasAtLeastOne($rq, self::PERMISSION_TABLE_METHOD, self::PERMISSION_TYPE); - } - // ------------------------------------------------------------------------------------------------- // Private methods + // + + /** + * Checks if at least one of the permissions given as parameter belongs to the authenticated user in read mode + * Wrapper method to permissionlib->hasAtLeastOne + */ + private function _readAllowed($requiredPermissions) + { + $this->_ci->load->library('PermissionLib'); // Load permission library + + return $this->_ci->permissionlib->hasAtLeastOne($requiredPermissions, self::PERMISSION_TABLE_METHOD, self::PERMISSION_TYPE_READ); + } + + /** + * Checks if at least one of the permissions given as parameter belongs to the authenticated user in write mode + * Wrapper method to permissionlib->hasAtLeastOne + */ + private function _writeAllowed($requiredPermissions) + { + $this->_ci->load->library('PermissionLib'); // Load permission library + + return $this->_ci->permissionlib->hasAtLeastOne($requiredPermissions, self::PERMISSION_TABLE_METHOD, self::PERMISSION_TYPE_WRITE); + } + + /** + * Set an array of required permissions for a UDF into the session + */ + private function _setRequiredPermissions($udfName, $permissions) + { + // Get the session for this UDFWidget + $session = $this->getSession(); + + // If does _not_ exist yet in the session + if (!isset($session[self::REQUIRED_PERMISSIONS_PARAMETER])) + { + $session[self::REQUIRED_PERMISSIONS_PARAMETER] = array(); + } + + // Set the required permission in the session for this UDFWidget + $session[self::REQUIRED_PERMISSIONS_PARAMETER][$udfName] = $permissions; + + // Write into the session + $this->setSession($session); + } /** * Print the block for UDFs @@ -654,20 +734,36 @@ class UDFLib return $returnArrayValidation; } - /** - * Set the name and id attribute of the HTML element - */ - private function _setNameAndId($jsonSchema, &$htmlParameters) - { + /** + * Disable the HTML element if in read only mode + */ + private function _setReadOnly($jsonSchema, &$htmlParameters) + { + // If write permissions _not_ exist then set the field as disabled + if (!$this->_writeAllowed($jsonSchema->{self::REQUIRED_PERMISSIONS_PARAMETER})) + { + $htmlParameters[HTMLWidget::DISABLED] = HTMLWidget::DISABLED; // any values is fine + } + else // otherwise restore to default + { + if (isset($htmlParameters[HTMLWidget::DISABLED])) unset($htmlParameters[HTMLWidget::DISABLED]); + } + } + + /** + * Set the name and id attribute of the HTML element + */ + private function _setNameAndId($jsonSchema, &$htmlParameters) + { $htmlParameters[HTMLWidget::HTML_ID] = $jsonSchema->{self::NAME}; $htmlParameters[HTMLWidget::HTML_NAME] = $jsonSchema->{self::NAME}; - } - - /** - * Sort the list of UDF by sort property - */ - private function _sortJsonSchemas(&$jsonSchemasArray) - { + } + + /** + * Sort the list of UDF by sort property + */ + private function _sortJsonSchemas(&$jsonSchemasArray) + { usort($jsonSchemasArray, function ($a, $b) { if (!isset($a->{self::SORT})) { @@ -684,13 +780,13 @@ class UDFLib return ($a->{self::SORT} < $b->{self::SORT}) ? -1 : 1; }); - } - - /** - * Loads the UDF description by the given schema and table - */ - private function _loadUDF($schema, $table) - { + } + + /** + * Loads the UDF description by the given schema and table + */ + private function _loadUDF($schema, $table) + { // Loads UDF model $this->_ci->load->model('system/UDF_model', 'UDFModel'); @@ -722,13 +818,13 @@ class UDFLib } return $udfResults; - } + } - /** - * Render the HTML for the UDF - */ - private function _render($jsonSchema, &$widgetData) - { + /** + * Render the HTML for the UDF + */ + private function _render($jsonSchema, &$widgetData) + { // Checkbox if ($jsonSchema->{self::TYPE} == 'checkbox') { @@ -759,11 +855,11 @@ class UDFLib { $this->_renderDropdown($jsonSchema, $widgetData, true); } - } + } - /** - * Renders a dropdown element - */ + /** + * Renders a dropdown element + */ private function _renderDropdown($jsonSchema, &$widgetData, $multiple = false) { // Selected element/s @@ -805,8 +901,8 @@ class UDFLib } /** - * Renders a textarea element - */ + * Renders a textarea element + */ private function _renderTextarea($jsonSchema, &$widgetData) { $text = null; // text value @@ -823,8 +919,8 @@ class UDFLib } /** - * Renders an input text element - */ + * Renders an input text element + */ private function _renderTextfield($jsonSchema, &$widgetData) { $text = null; // text value @@ -841,8 +937,8 @@ class UDFLib } /** - * Renders a checkbox element - */ + * Renders a checkbox element + */ private function _renderCheckbox($jsonSchema, &$widgetData) { // Set checkbox value if present in the DB @@ -861,11 +957,11 @@ class UDFLib $checkboxWidgetUDF->render(); } - /** - * Sets the attributes of the HTML element using the phrases system - */ - private function _setAttributesWithPhrases($jsonSchema, &$htmlParameters) - { + /** + * Sets the attributes of the HTML element using the phrases system + */ + private function _setAttributesWithPhrases($jsonSchema, &$htmlParameters) + { // By default set to null all the attributes $htmlParameters[HTMLWidget::LABEL] = null; $htmlParameters[HTMLWidget::TITLE] = null; @@ -933,13 +1029,13 @@ class UDFLib } } } - } + } - /** - * Sets the validation attributes of the HTML element using the configuration inside the json schema - */ - private function _setValidationAttributes($jsonSchema, &$htmlParameters) - { + /** + * Sets the validation attributes of the HTML element using the configuration inside the json schema + */ + private function _setValidationAttributes($jsonSchema, &$htmlParameters) + { // Validation attributes set by default to null $htmlParameters[HTMLWidget::REGEX] = null; $htmlParameters[HTMLWidget::REQUIRED] = null; @@ -998,3 +1094,4 @@ class UDFLib } } } + diff --git a/application/views/system/fas_udf.php b/application/views/system/fas_udf.php index 8a1200b6a..e6fa396cf 100644 --- a/application/views/system/fas_udf.php +++ b/application/views/system/fas_udf.php @@ -45,7 +45,6 @@ echo $this->udflib->UDFWidget( array( UDFLib::UDF_UNIQUE_ID => 'fasPersonUDFs', - UDFLib::REQUIRED_PERMISSIONS_PARAMETER => 'basis/person', UDFLib::SCHEMA_ARG_NAME => 'public', UDFLib::TABLE_ARG_NAME => 'tbl_person', UDFLib::PRIMARY_KEY_NAME => 'person_id', @@ -70,7 +69,6 @@ echo $this->udflib->UDFWidget( array( UDFLib::UDF_UNIQUE_ID => 'fasPrestudentUDFs', - UDFLib::REQUIRED_PERMISSIONS_PARAMETER => 'basis/person', UDFLib::SCHEMA_ARG_NAME => 'public', UDFLib::TABLE_ARG_NAME => 'tbl_prestudent', UDFLib::PRIMARY_KEY_NAME => 'prestudent_id', @@ -109,3 +107,4 @@ load->view("templates/footer"); ?> + diff --git a/application/views/system/infocenter/zgvpruefungen.php b/application/views/system/infocenter/zgvpruefungen.php index 05c94c384..2b08dada3 100644 --- a/application/views/system/infocenter/zgvpruefungen.php +++ b/application/views/system/infocenter/zgvpruefungen.php @@ -341,7 +341,6 @@ echo $this->udflib->UDFWidget( array( UDFLib::UDF_UNIQUE_ID => 'infocenterPrestudentUDFs_'.$zgvpruefung->prestudent_id, - UDFLib::REQUIRED_PERMISSIONS_PARAMETER => 'infocenter', UDFLib::SCHEMA_ARG_NAME => 'public', UDFLib::TABLE_ARG_NAME => 'tbl_prestudent', UDFLib::PRIMARY_KEY_NAME => 'prestudent_id', @@ -553,3 +552,4 @@ endforeach; // end foreach zgvpruefungen ?>
+ diff --git a/application/views/widgets/checkbox.php b/application/views/widgets/checkbox.php index 6debb2afd..811e3c682 100644 --- a/application/views/widgets/checkbox.php +++ b/application/views/widgets/checkbox.php @@ -24,6 +24,7 @@ +
- \ No newline at end of file + + diff --git a/application/views/widgets/dropdown.php b/application/views/widgets/dropdown.php index d9faf1978..51db6d536 100644 --- a/application/views/widgets/dropdown.php +++ b/application/views/widgets/dropdown.php @@ -33,6 +33,7 @@ + > + diff --git a/application/views/widgets/textarea.php b/application/views/widgets/textarea.php index c72b52658..5346fefa8 100644 --- a/application/views/widgets/textarea.php +++ b/application/views/widgets/textarea.php @@ -29,9 +29,11 @@ + >
- \ No newline at end of file + + diff --git a/application/views/widgets/textfield.php b/application/views/widgets/textfield.php index 73b1daa1b..c5ba81710 100644 --- a/application/views/widgets/textfield.php +++ b/application/views/widgets/textfield.php @@ -31,10 +31,12 @@ + value="" > - \ No newline at end of file + + diff --git a/application/widgets/html/HTMLWidget.php b/application/widgets/html/HTMLWidget.php index 9639890ea..0034edfd9 100644 --- a/application/widgets/html/HTMLWidget.php +++ b/application/widgets/html/HTMLWidget.php @@ -6,18 +6,18 @@ class HTMLWidget extends Widget { // The name of the array present in the data array given to the view that will render this widget - const HTML_ARG_NAME = 'HTML'; + const HTML_ARG_NAME = 'HTML'; const HTML_DEFAULT_VALUE = ''; // Default value of the html element - const HTML_NAME = 'name'; // HTML name attribute - const HTML_ID = 'id'; // HTML id attribute - - // External block definition - const EXTERNAL_BLOCK = 'externalBlock'; // External block name - const EXTERNAL_START_BLOCK_HTML_TAG = '
'; // External block start tag - const EXTERNAL_END_BLOCK_HTML_TAG = '
'; // External block end tag - - // HTML attributes - const LABEL = 'title'; + const HTML_NAME = 'name'; // HTML name attribute + const HTML_ID = 'id'; // HTML id attribute + + // External block definition + const EXTERNAL_BLOCK = 'externalBlock'; // External block name + const EXTERNAL_START_BLOCK_HTML_TAG = '
'; // External block start tag + const EXTERNAL_END_BLOCK_HTML_TAG = '
'; // External block end tag + + // HTML attributes + const LABEL = 'title'; const REGEX = 'regex'; const TITLE = 'description'; const REQUIRED = 'required-field'; @@ -26,11 +26,12 @@ class HTMLWidget extends Widget const MAX_LENGTH = 'max-length'; const MIN_LENGTH = 'min-length'; const PLACEHOLDER = 'placeholder'; + const DISABLED = 'disabled'; - /** - * It gets also the htmlArgs array as parameter, it will be used to set the HTML properties - */ - public function __construct($name, $args = array(), $htmlArgs = array()) + /** + * It gets also the htmlArgs array as parameter, it will be used to set the HTML properties + */ + public function __construct($name, $args = array(), $htmlArgs = array()) { parent::__construct($name, $args); @@ -38,11 +39,11 @@ class HTMLWidget extends Widget $this->_setHtmlProperties($htmlArgs); } - /** - * Initialising html properties, such as the id and name attributes of the HTML element - */ - private function _setHtmlProperties($htmlArgs) - { + /** + * Initialising html properties, such as the id and name attributes of the HTML element + */ + private function _setHtmlProperties($htmlArgs) + { // If $htmlArgs wasn't already stored in $this->_args if (!isset($this->_args[HTMLWidget::HTML_ARG_NAME])) { @@ -58,9 +59,9 @@ class HTMLWidget extends Widget $this->_args[HTMLWidget::HTML_ARG_NAME][$argName] = $argValue; } } - } + } - /** + /** * Prints an attribute name and eventually also the value extracted from $htmlArgs * Set $isValuePresent to false the value should not be displayed */ @@ -113,3 +114,4 @@ class HTMLWidget extends Widget } } } + diff --git a/application/widgets/udf/UDFWidget.php b/application/widgets/udf/UDFWidget.php index 7af3dd926..abbbab022 100644 --- a/application/widgets/udf/UDFWidget.php +++ b/application/widgets/udf/UDFWidget.php @@ -6,8 +6,6 @@ */ class UDFWidget extends HTMLWidget { - private $_requiredPermissions; // The required permissions to use this UDF widget - private $_schema; // Schema name private $_table; // Table name private $_primaryKeyName; // Primary key name @@ -26,26 +24,16 @@ class UDFWidget extends HTMLWidget $this->_initUDFWidget($args); // checks parameters and initialize properties - // Let's start if it's allowed - // NOTE: If it is NOT allowed then no data are loaded - if ($this->udflib->isAllowed($this->_requiredPermissions)) - { - $this->_startUDFWidget($args[UDFLib::UDF_UNIQUE_ID]); - } + $this->_startUDFWidget($args[UDFLib::UDF_UNIQUE_ID]); } /** * Called by the WidgetLib, it renders the HTML of the UDF */ - public function display($widgetData) + public function display($widgetData) { - // Let's start if it's allowed - // NOTE: If it is NOT allowed then no data are loaded - if ($this->_ci->udflib->isAllowed($this->_requiredPermissions)) - { - $this->_ci->udflib->displayUDFWidget($widgetData); - } - } + $this->_ci->udflib->displayUDFWidget($widgetData); + } //------------------------------------------------------------------------------------------------------------------ // Private methods @@ -60,18 +48,11 @@ class UDFWidget extends HTMLWidget // If here then everything is ok // Initialize class properties - $this->_requiredPermissions = null; $this->_schema = null; $this->_table = null; $this->_primaryKeyName = null; $this->_primaryKeyValue = null; - // Retrieved the required permissions parameter if present - if (isset($args[UDFLib::REQUIRED_PERMISSIONS_PARAMETER])) - { - $this->_requiredPermissions = $args[UDFLib::REQUIRED_PERMISSIONS_PARAMETER]; - } - // Retrieved the if (isset($args[UDFLib::SCHEMA_ARG_NAME])) { @@ -113,11 +94,6 @@ class UDFWidget extends HTMLWidget show_error('The parameter "'.UDFLib::UDF_UNIQUE_ID.'" must be specified'); } - if (!isset($args[UDFLib::REQUIRED_PERMISSIONS_PARAMETER])) - { - show_error('The parameter "'.UDFLib::REQUIRED_PERMISSIONS_PARAMETER.'" must be specified'); - } - if (!isset($args[UDFLib::SCHEMA_ARG_NAME])) { show_error('The parameter "'.UDFLib::SCHEMA_ARG_NAME.'" must be specified'); @@ -149,7 +125,6 @@ class UDFWidget extends HTMLWidget $this->udflib->setSession( array( UDFLib::UDF_UNIQUE_ID => $udfUniqueId, // table unique id - UDFLib::REQUIRED_PERMISSIONS_PARAMETER => $this->_requiredPermissions, // UDFLib::SCHEMA_ARG_NAME => $this->_schema, // UDFLib::TABLE_ARG_NAME => $this->_table, // UDFLib::PRIMARY_KEY_NAME => $this->_primaryKeyName, // @@ -158,3 +133,4 @@ class UDFWidget extends HTMLWidget ); } } + From 30dc43644237e826a54057f473e169e7a4778c05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20=C3=96sterreicher?= Date: Wed, 15 Sep 2021 13:49:20 +0200 Subject: [PATCH 39/74] =?UTF-8?q?Berechtigung=20f=C3=BCr=20basis/gemeinde?= =?UTF-8?q?=20hinzugef=C3=BCgt=20Pfade=20korrigiert?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- system/dbupdate_3.3.php | 14 ++++++++++++++ vilesci/stammdaten/set_gemeinde.php | 20 ++++++++++---------- 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/system/dbupdate_3.3.php b/system/dbupdate_3.3.php index 3aef03b4d..a75b648fa 100644 --- a/system/dbupdate_3.3.php +++ b/system/dbupdate_3.3.php @@ -4962,6 +4962,20 @@ if(!@$db->db_query("SELECT statusgrund_kurzbz FROM public.tbl_status_grund LIMIT echo '
Neue Spalte statusgrund_kurzbz zu Tabelle public.tbl_status_grund hinzugefügt'; } +// Add permission to set gemeinde +if($result = @$db->db_query("SELECT 1 FROM system.tbl_berechtigung WHERE berechtigung_kurzbz = 'basis/gemeinde';")) +{ + if($db->db_num_rows($result) == 0) + { + $qry = "INSERT INTO system.tbl_berechtigung(berechtigung_kurzbz, beschreibung) VALUES('basis/gemeinde', 'Gemeindedaten pflegen');"; + + if(!$db->db_query($qry)) + echo 'system.tbl_berechtigung '.$db->db_last_error().'
'; + else + echo ' system.tbl_berechtigung: Added permission for basis/gemeinde
'; + } +} + // *** Pruefung und hinzufuegen der neuen Attribute und Tabellen echo '

Pruefe Tabellen und Attribute!

'; diff --git a/vilesci/stammdaten/set_gemeinde.php b/vilesci/stammdaten/set_gemeinde.php index 5cc2f0097..c59e3264b 100644 --- a/vilesci/stammdaten/set_gemeinde.php +++ b/vilesci/stammdaten/set_gemeinde.php @@ -28,10 +28,10 @@ Datei wird eingelesen und in die DB gespeichert. */ require_once('../../config/system.config.inc.php'); -require_once(DOC_ROOT.'include/functions.inc.php'); -require_once(DOC_ROOT.'include/benutzerberechtigung.class.php'); -require_once(DOC_ROOT.'include/gemeinde.class.php'); -require_once(DOC_ROOT.'include/benutzerberechtigung.class.php'); +require_once(dirname(__FILE__).'/../../include/functions.inc.php'); +require_once(dirname(__FILE__).'/../../include/benutzerberechtigung.class.php'); +require_once(dirname(__FILE__).'/../../include/gemeinde.class.php'); +require_once(dirname(__FILE__).'/../../include/benutzerberechtigung.class.php'); $user = get_uid(); @@ -55,13 +55,13 @@ if(isset($_FILES['parsefile']) && $_FILES['parsefile']['error'] == 0) { } foreach ($data as $gemeinde_details) { - + //Wenn nicht gültig dann überspringen if ($gemeinde_details['Gültig'] == 'Nein') continue; - + //es können mehrere plz in einer zeile stehen $plzs = explode(' ', trim($gemeinde_details['PLZ'])); - + foreach ($plzs as $plz) { $tmp_obj_gemeinde = null; $tmp_obj_gemeinde = new gemeinde(); @@ -72,7 +72,7 @@ if(isset($_FILES['parsefile']) && $_FILES['parsefile']['error'] == 0) { $tmp_obj_gemeinde->bulacode = $gemeinde_details['BULA_Code']; $tmp_obj_gemeinde->bulabez = $gemeinde_details['BULA_Bez']; $tmp_obj_gemeinde->kennziffer = $gemeinde_details['Gemeindekennziffer']; - + //print_r($tmp_obj_gemeinde); $tmp_obj_gemeinde->save(); $tmp_gemeinde_ar[] = $tmp_obj_gemeinde; @@ -156,9 +156,9 @@ if(isset($_FILES['parsefile']) && $_FILES['parsefile']['error'] == 0) {
-				
 			
From 8075ba3a8484da34a95156aefb39e1e51b5fb6fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20=C3=96sterreicher?= Date: Wed, 15 Sep 2021 15:57:15 +0200 Subject: [PATCH 40/74] =?UTF-8?q?Menueeintrag=20hinzugef=C3=BCgt=20f=C3=BC?= =?UTF-8?q?r=20Gemeinde?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/tw/vilesci_menu_main.inc.php | 1 + vilesci/stammdaten/set_gemeinde.php | 45 +++++++++++----------------- 2 files changed, 19 insertions(+), 27 deletions(-) diff --git a/include/tw/vilesci_menu_main.inc.php b/include/tw/vilesci_menu_main.inc.php index d465eba28..34f44ec66 100644 --- a/include/tw/vilesci_menu_main.inc.php +++ b/include/tw/vilesci_menu_main.inc.php @@ -190,6 +190,7 @@ $menu=array 'StudienplanZuteilung'=>array('name'=>'Studienplan Zuteilung', 'link'=>'lehre/studienplan_zuteilung.php', 'target'=>'main','permissions'=>array('assistenz')), 'lv_merge'=>array('name'=>'LVs zusammenlegen', 'link'=>'lehre/lv_merge.php', 'target'=>'main','permissions'=>array('lehre/lehrveranstaltung')), 'akteupdate'=>array('name'=>'Akten überschreiben', 'link'=>'personen/akteupdate.php', 'target'=>'main','permissions'=>array('admin')), + 'gemeindeupdate'=>array('name'=>'Gemeinden aktualisieren', 'link'=>'stammdaten/set_gemeinde.php', 'target'=>'main','permissions'=>array('basis/gemeinde')), ), 'Auswertung'=> array ( diff --git a/vilesci/stammdaten/set_gemeinde.php b/vilesci/stammdaten/set_gemeinde.php index c59e3264b..e461c7872 100644 --- a/vilesci/stammdaten/set_gemeinde.php +++ b/vilesci/stammdaten/set_gemeinde.php @@ -26,35 +26,37 @@ Die Tabelle bis.tbl_gemeinde löschen. -> delete from bis.tbl_gemeinde; Skript aufrufen, csv auswählen und hochladen. Datei wird eingelesen und in die DB gespeichert. */ - require_once('../../config/system.config.inc.php'); require_once(dirname(__FILE__).'/../../include/functions.inc.php'); require_once(dirname(__FILE__).'/../../include/benutzerberechtigung.class.php'); require_once(dirname(__FILE__).'/../../include/gemeinde.class.php'); require_once(dirname(__FILE__).'/../../include/benutzerberechtigung.class.php'); - $user = get_uid(); $rechte = new benutzerberechtigung(); $rechte->getBerechtigungen($user); -if(!$rechte->isBerechtigt('basis/gemeinde')) { +if (!$rechte->isBerechtigt('basis/gemeinde')) +{ die('Sie haben keine Berechtigung fuer diese Seite'); } $tmp_gemeinde_ar = array(); -if(isset($_FILES['parsefile']) && $_FILES['parsefile']['error'] == 0) { +if (isset($_FILES['parsefile']) && $_FILES['parsefile']['error'] == 0) +{ - $rows = array_map('str_getcsv', file( $_FILES['parsefile']['tmp_name'] )); + $rows = array_map('str_getcsv', file( $_FILES['parsefile']['tmp_name'] )); $header = array_shift($rows); - $data = array(); - foreach($rows as $row) { + $data = array(); + foreach ($rows as $row) + { $data[] = array_combine($header, $row); } - foreach ($data as $gemeinde_details) { + foreach ($data as $gemeinde_details) + { //Wenn nicht gültig dann überspringen if ($gemeinde_details['Gültig'] == 'Nein') continue; @@ -62,7 +64,8 @@ if(isset($_FILES['parsefile']) && $_FILES['parsefile']['error'] == 0) { //es können mehrere plz in einer zeile stehen $plzs = explode(' ', trim($gemeinde_details['PLZ'])); - foreach ($plzs as $plz) { + foreach ($plzs as $plz) + { $tmp_obj_gemeinde = null; $tmp_obj_gemeinde = new gemeinde(); $tmp_obj_gemeinde->plz = $plz; @@ -73,35 +76,22 @@ if(isset($_FILES['parsefile']) && $_FILES['parsefile']['error'] == 0) { $tmp_obj_gemeinde->bulabez = $gemeinde_details['BULA_Bez']; $tmp_obj_gemeinde->kennziffer = $gemeinde_details['Gemeindekennziffer']; - //print_r($tmp_obj_gemeinde); $tmp_obj_gemeinde->save(); $tmp_gemeinde_ar[] = $tmp_obj_gemeinde; - // if ($tmp_obj_gemeinde->save()) { - // echo "
"; - // echo "gemeinde save true"; - // echo "
"; - // print_r($tmp_obj_gemeinde); - // echo "
"; - // } else { - // echo "
"; - // echo "gemeinde save false"; - // echo "
"; - // print_r($tmp_obj_gemeinde); - // echo "
"; - // } } } } ?> - - set gemeinde skript + Set Gemeinde + -
+

Gemeinden aktualisieren

+ Diese Seite dient dazu die Gemeinde Kodex Tabelle zu aktualisieren.

Filesyntax:(Standard xlsx-File von https://www.bis.ac.at/BISSuite, gespeichert als csv! erste Zeile ist Header (alles was oberhalb ist kann entfernt werden) -> dann Daten)

@@ -157,7 +147,8 @@ if(isset($_FILES['parsefile']) && $_FILES['parsefile']['error'] == 0) {
 				

From 4c21d5364c282d158f143efbbecd084fa8910ef7 Mon Sep 17 00:00:00 2001
From: KarpAlex 
Date: Tue, 21 Sep 2021 00:58:29 +0200
Subject: [PATCH 41/74] - added issue management functionality - adding, and
 displaying issues with filter widget.

---
 application/config/navigation.php             |   7 +
 .../controllers/system/issues/Issues.php      | 120 +++++++
 application/libraries/IssuesLib.php           | 231 +++++++++++++
 application/models/system/Fehler_model.php    |  14 +
 application/models/system/Issue_model.php     |  51 +++
 application/views/system/issues/issues.php    |  48 +++
 .../views/system/issues/issuesData.php        | 161 +++++++++
 public/css/issues/issuesDataset.css           |   8 +
 public/js/issues/issuesDataset.js             | 151 ++++++++
 system/dbupdate_3.3.php                       | 322 +++++++++++++++---
 system/filtersupdate.php                      |  37 +-
 11 files changed, 1102 insertions(+), 48 deletions(-)
 create mode 100644 application/controllers/system/issues/Issues.php
 create mode 100644 application/libraries/IssuesLib.php
 create mode 100644 application/models/system/Fehler_model.php
 create mode 100644 application/models/system/Issue_model.php
 create mode 100644 application/views/system/issues/issues.php
 create mode 100644 application/views/system/issues/issuesData.php
 create mode 100644 public/css/issues/issuesDataset.css
 create mode 100644 public/js/issues/issuesDataset.js

diff --git a/application/config/navigation.php b/application/config/navigation.php
index 42d9b94e1..b788dc40c 100644
--- a/application/config/navigation.php
+++ b/application/config/navigation.php
@@ -133,6 +133,13 @@ $config['navigation_header'] = array(
 					'expand' => true,
 					'sort' => 20,
 					'requiredPermissions' => 'system/developer:r'
+				),
+				'errormonitoring' => array(
+					'link' => site_url('system/issues/Issues'),
+					'description' => 'Fehler Monitoring',
+					'expand' => true,
+					'sort' => 20,
+					'requiredPermissions' => 'system/issues_verwalten:r'
 				)
 			)
 		)
diff --git a/application/controllers/system/issues/Issues.php b/application/controllers/system/issues/Issues.php
new file mode 100644
index 000000000..9ae390418
--- /dev/null
+++ b/application/controllers/system/issues/Issues.php
@@ -0,0 +1,120 @@
+ array(self::BERECHTIGUNG_KURZBZ.':r'),
+				'changeIssueStatus' => array(self::BERECHTIGUNG_KURZBZ.':r')
+			)
+		);
+
+		// Load libraries
+		$this->load->library('IssuesLib');
+		$this->load->library('PermissionLib');
+		$this->load->library('WidgetLib');
+
+		$this->loadPhrases(
+			array(
+				'global',
+				'ui',
+				'filter'
+			)
+		);
+
+		// Load models
+		$this->load->model('person/Benutzerfunktion_model', 'BenutzerfunktionModel');
+
+		$this->_setAuthUID(); // sets property uid
+	}
+
+	public function index()
+	{
+		$oes_for_issues = $this->_getOesForIssues();
+
+		$this->load->view(
+			'system/issues/issues',
+			$oes_for_issues
+		);
+	}
+
+	/**
+	 * Initializes issues status change
+	 */
+	public function changeIssueStatus()
+	{
+		$issue_ids = $this->input->post('issue_ids');
+		$status_kurzbz = $this->input->post('status_kurzbz');
+		$verarbeitetvon = $this->_uid;
+
+		$errors = array();
+		foreach ($issue_ids as $issue_id)
+		{
+			$issueRes = $this->issueslib->changeIssueStatus($issue_id, $status_kurzbz, $verarbeitetvon);
+
+			if (isError($issueRes))
+				$errors[] = getError($issueRes);
+		}
+
+		if (!isEmptyArray($errors))
+			$this->outputJsonError(implode(", ", $errors));
+		else
+			$this->outputJsonSuccess("Status erfolgreich aktualisiert");
+	}
+
+	/**
+	 * Retrieve the UID of the logged user and checks if it is valid
+	 */
+	private function _setAuthUID()
+	{
+		$this->_uid = getAuthUID();
+
+		if (!$this->_uid) show_error('User authentification failed');
+	}
+
+	/**
+	 * Gets oes of logged in user, which are needed to display issues of the user.
+	 * This includes oes assigned by a funktio and as the issue permission.
+	 * @return array
+	 */
+	private function _getOesForIssues()
+	{
+		// get oes of uid for which there is a current funktion
+		$all_oe_kurzbz_with_funktionen = array();
+		$oe_kurzbz_for_funktion = array();
+		$benutzerfunktionRes = $this->BenutzerfunktionModel->getBenutzerFunktionByUid($this->_uid, null, date('Y-m-d'), date('Y-m-d'));
+
+		if (isError($benutzerfunktionRes))
+			show_error(getError($benutzerfunktionRes));
+
+		if (hasData($benutzerfunktionRes))
+		{
+			foreach (getData($benutzerfunktionRes) as $benutzerfunktion)
+			{
+				$all_oe_kurzbz_with_funktionen[$benutzerfunktion->oe_kurzbz][] = $benutzerfunktion->funktion_kurzbz;
+				if ($benutzerfunktion->funktion_kurzbz == self::FUNKTION_KURZBZ) // separate oes for the funktion needed for displaying issues
+					$oe_kurzbz_for_funktion[] = $benutzerfunktion->oe_kurzbz;
+			}
+		}
+
+		// add oes for which there is the issues_verwalten Berechtigung
+		if (!$oe_kurzbz_berechtigt = $this->permissionlib->getOE_isEntitledFor(self::BERECHTIGUNG_KURZBZ))
+			show_error('Keine Berechtigung oder Fehler bei Berechtigungsprüfung');
+
+		$all_oe_kurzbz_berechtigt = array_unique(array_merge($oe_kurzbz_for_funktion, $oe_kurzbz_berechtigt));
+
+		return array(
+			'all_oe_kurzbz_with_funktionen' => $all_oe_kurzbz_with_funktionen,
+			'all_oe_kurzbz_berechtigt' => $all_oe_kurzbz_berechtigt
+		);
+	}
+}
diff --git a/application/libraries/IssuesLib.php b/application/libraries/IssuesLib.php
new file mode 100644
index 000000000..ade2c6078
--- /dev/null
+++ b/application/libraries/IssuesLib.php
@@ -0,0 +1,231 @@
+_ci =& get_instance();
+
+		// Properties default values
+		$this->_app = 'core';
+		$this->_insertvon = 'system';
+		$this->_fallbackFehlercode = 'UNKNOWN_ERROR';
+
+		// If parameters are given then overwrite the default values
+		if (!isEmptyArray($params)) $this->setConfigs($params);
+
+		// load models
+		$this->_ci->load->model('system/Issue_model', 'IssueModel');
+		$this->_ci->load->model('system/Fehler_model', 'FehlerModel');
+	}
+
+	// --------------------------------------------------------------------------------------------------------------
+	// Public methods
+
+	/**
+	 * Store configuration parameters for this lib
+	 */
+	public function setConfigs($params)
+	{
+		// If parameters are given then overwrite the default values
+		if (!isEmptyArray($params))
+		{
+			if (isset($params[self::APP_INDEX])) $this->_app = $params[self::APP_INDEX];
+			if (isset($params[self::INSERTVON_INDEX])) $this->_insertvon = $params[self::INSERTVON_INDEX];
+			if (isset($params[self::FALLBACK_FEHLERCODE_INDEX])) $this->_fallbackFehlercode = $params[self::FALLBACK_FEHLERCODE_INDEX];
+		}
+	}
+
+	/**
+	 * Adds an Fhc issue, i.e. an internal, self-defined issue.
+	 * @param string $fehler_kurzbz short unique text name of the issue
+	 * @param int $person_id
+	 * @param string $oe_kurzbz
+	 * @param array $fehlertext_params params for sprint replace of error text in system.tbl_fehler
+	 * @return object success or error
+	 */
+	public function addFhcIssue($fehler_kurzbz, $person_id = null, $oe_kurzbz = null, $fehlertext_params = null)
+	{
+		$fehlerRes = $this->_ci->FehlerModel->loadWhere(array('fehler_kurzbz' => $fehler_kurzbz));
+
+		if (hasData($fehlerRes))
+		{
+			$fehlercode = getData($fehlerRes)[0]->fehlercode;
+			return $this->_addIssue($fehlercode, $person_id, $oe_kurzbz, $fehlertext_params);
+		}
+		else
+			return error("Fehler nicht gefunden");
+	}
+
+	/**
+	 * Adds an external issue, already defined externally by another system.
+	 * @param string $fehlercode_extern the error code in the external system
+	 * @param string $inhalt_extern error text in external system
+	 * @param int $person_id
+	 * @param int $oe_kurzbz
+	 * @param array $fehlertext_params params for sprint replace of error text in system.tbl_fehler
+	 * @return object success or error
+	 */
+	public function addExternalIssue($fehlercode_extern, $inhalt_extern, $person_id = null, $oe_kurzbz = null, $fehlertext_params = null)
+	{
+		if (isEmptyString($fehlercode_extern))
+			return error("fehlercode_extern fehlt");
+
+		// get external fehlercode (unique for each app)
+		$this->_ci->FehlerModel->addSelect('fehlercode');
+		$fehlerRes = $this->_ci->FehlerModel->loadWhere(array('fehlercode_extern' => $fehlercode_extern, 'app' => $this->_app));
+
+		if (isError($fehlerRes))
+			return $fehlerRes;
+
+		// check if there is a predefined custom error for the external issue
+		if (hasData($fehlerRes))
+		{
+			// if found, use the code
+			$fehlercode = getData($fehlerRes)[0]->fehlercode;
+		}
+		else
+		{
+			// if predefined error is not found, insert with fallback code
+			$fehlercode = $this->_fallbackFehlercode;
+		}
+
+		// add external issue
+		return $this->_addIssue($fehlercode, $person_id, $oe_kurzbz, $fehlertext_params, $fehlercode_extern, $inhalt_extern);
+	}
+
+	/**
+	 * Changes status of an issue.
+	 * @param int $issue_id
+	 * @param string $status_kurzbz the new status
+	 * @param string $verarbeitetvon uid of person changing the status (needed for in Bearbeitung and behoben)
+	 * @return success or error
+	 */
+	public function changeIssueStatus($issue_id, $status_kurzbz, $verarbeitetvon = null)
+	{
+		if (!isset($issue_id) || !is_numeric($issue_id))
+			return error("Issue Id muss korrekt gesetzt sein.");
+
+		// check if given status is same as existing
+		$this->_ci->IssueModel->addSelect('status_kurzbz');
+		$currStatus = $this->_ci->IssueModel->load($issue_id);
+
+		if (hasData($currStatus))
+		{
+			if (getData($currStatus)[0]->status_kurzbz == $status_kurzbz)
+				return success("Gleicher Status bereits gesetzt");
+		}
+		else
+			return error("Fehler beim Holen des Status");
+
+		$data = array(
+			'status_kurzbz' => $status_kurzbz,
+			'updatevon' => $verarbeitetvon,
+			'updateamum' => date('Y-m-d H:i:s')
+		);
+
+		if ($status_kurzbz == self::STATUS_NEU)
+		{
+
+			$data['verarbeitetvon'] = null;
+		}
+
+		if ($status_kurzbz == self::STATUS_NEU || $status_kurzbz == self::STATUS_IN_BEARBEITUNG)
+		{
+			$data['verarbeitetamum'] = null;
+		}
+
+		if ($status_kurzbz == self::STATUS_IN_BEARBEITUNG || $status_kurzbz == self::STATUS_BEHOBEN)
+		{
+			if (isset($verarbeitetvon))
+				$data['verarbeitetvon'] = $verarbeitetvon;
+			else
+				return error("Verarbeitetvon nicht gesetzt");
+		}
+
+		if ($status_kurzbz == self::STATUS_BEHOBEN)
+			$data['verarbeitetamum'] = date('Y-m-d H:i:s');
+
+		return $this->_ci->IssueModel->update(
+			array(
+				'issue_id' => $issue_id
+			),
+			$data
+		);
+	}
+
+	/**
+	 * Adds an issue.
+	 * @param $fehlercode
+	 * @param int $person_id
+	 * @param string $oe_kurzbz
+	 * @param array $fehlertext_params
+	 * @param string $fehlercode_extern
+	 * @param string $inhalt_extern
+	 * @return array|stdClass
+	 */
+	private function _addIssue($fehlercode, $person_id = null, $oe_kurzbz = null, $fehlertext_params = null, $fehlercode_extern = null, $inhalt_extern = null)
+	{
+		if (isEmptyString($person_id) && isEmptyString($oe_kurzbz))
+			return error("Person_id oder oe_kurzbz muss gesetzt sein.");
+
+		// get fehlertextVorlage and replace it with params
+		$fehlerRes = $this->_ci->FehlerModel->load($fehlercode);
+
+		if (hasData($fehlerRes))
+		{
+			$fehlertextVorlage = getData($fehlerRes)[0]->fehlertext;
+			$fehlertext = isEmptyArray($fehlertext_params) ? $fehlertextVorlage : vsprintf($fehlertextVorlage, $fehlertext_params);
+
+			$openIssuesCountRes = $this->_ci->IssueModel->getOpenIssueCount($fehlercode, $person_id, $oe_kurzbz, $fehlercode_extern);
+
+			if (hasData($openIssuesCountRes))
+			{
+				// don't insert if issue is already open
+				// already open - status new with same fehlercode or same fehlercode-extern (if set)
+				$openIssueCount = getData($openIssuesCountRes)[0]->anzahl_open_issues;
+
+				if ($openIssueCount == 0)
+				{
+					return $this->_ci->IssueModel->insert(
+						array(
+							'fehlercode' => $fehlercode,
+							'fehlercode_extern' => $fehlercode_extern,
+							'inhalt' => $fehlertext,
+							'inhalt_extern' => $inhalt_extern,
+							'person_id' => $person_id,
+							'oe_kurzbz' => $oe_kurzbz,
+							'datum' => date('Y-m-d H:i:s'),
+							'status_kurzbz' => self::STATUS_NEU,
+							'insertvon' => $this->_insertvon
+						)
+					);
+				}
+				else
+					return success($openIssueCount);
+			}
+			else
+				return error("Anzahl offener Issues konnte nicht ermittelt werden.");
+		}
+		else
+			return error("Fehler nicht gefunden");
+	}
+}
diff --git a/application/models/system/Fehler_model.php b/application/models/system/Fehler_model.php
new file mode 100644
index 000000000..28618f6d9
--- /dev/null
+++ b/application/models/system/Fehler_model.php
@@ -0,0 +1,14 @@
+dbTable = 'system.tbl_fehler';
+		$this->pk = 'fehlercode';
+	}
+}
diff --git a/application/models/system/Issue_model.php b/application/models/system/Issue_model.php
new file mode 100644
index 000000000..5dac85066
--- /dev/null
+++ b/application/models/system/Issue_model.php
@@ -0,0 +1,51 @@
+dbTable = 'system.tbl_issue';
+		$this->pk = 'issue_id';
+	}
+
+	/**
+	 * Gets number of open (non-resolved) issues.
+	 * @param string $fehlercode unique error code
+	 * @param int $person_id if provided, only issues with this person_id are counted.
+	 * @param string $oe_kurzbz if provided, only issues with this oe_kurzbz are counted.
+	 * @param string $fehlercode_extern if provided, only issues with this external fehlercode are counted (for identifying issues from external systems).
+	 * @return Object success with number of issues or error
+	 */
+	public function getOpenIssueCount($fehlercode, $person_id = null, $oe_kurzbz = null, $fehlercode_extern = null)
+	{
+		$params = array($fehlercode);
+		// issue exists for a fehlercode (or fehlercode_extern), person_id, oe_kurzbz, if not verarbeitet yet
+		$qry = 'SELECT count(*) as anzahl_open_issues FROM system.tbl_issue
+				WHERE fehlercode = ?
+				AND verarbeitetamum IS NULL';
+
+		if (!isEmptyString($fehlercode_extern))
+		{
+			$qry .= ' AND fehlercode_extern = ?';
+			$params[] = $fehlercode_extern;
+		}
+
+		if (isset($person_id))
+		{
+			$qry .= ' AND person_id = ?';
+			$params[] = $person_id;
+		}
+
+		if (isset($oe_kurzbz))
+		{
+			$qry .= ' AND oe_kurzbz = ?';
+			$params[] = $oe_kurzbz;
+		}
+
+		return $this->execQuery($qry, $params);
+	}
+}
diff --git a/application/views/system/issues/issues.php b/application/views/system/issues/issues.php
new file mode 100644
index 000000000..ebe92012d
--- /dev/null
+++ b/application/views/system/issues/issues.php
@@ -0,0 +1,48 @@
+load->view(
+	'templates/FHC-Header',
+	array(
+		'title' => 'Fehler Monitoring',
+		'jquery' => true,
+		'jqueryui' => true,
+		'jquerycheckboxes' => true,
+		'bootstrap' => true,
+		'fontawesome' => true,
+		'sbadmintemplate' => true,
+		'tablesorter' => true,
+		'ajaxlib' => true,
+		'filterwidget' => true,
+		'navigationwidget' => true,
+		'dialoglib' => true,
+		'phrases' => array(
+			'ui' => array('bitteEintragWaehlen')
+		),
+		'customCSSs' => array('public/css/issues/issuesDataset.css', 'public/css/sbadmin2/tablesort_bootstrap.css'),
+		'customJSs' => array('public/js/issues/issuesDataset.js', 'public/js/bootstrapper.js')
+	)
+);
+?>
+
+
+
+ + widgetlib->widget('NavigationWidget'); ?> + +
+
+
+
+ +
+
+
+ load->view('system/issues/issuesData.php'); ?> +
+
+
+
+ + +load->view('templates/FHC-Footer'); ?> diff --git a/application/views/system/issues/issuesData.php b/application/views/system/issues/issuesData.php new file mode 100644 index 000000000..82e6fa409 --- /dev/null +++ b/application/views/system/issues/issuesData.php @@ -0,0 +1,161 @@ + $funktionen_kurzbz) + { + foreach ($funktionen_kurzbz as $funktion_kurzbz) + { + $query .= " OR (oe_kurzbz = '$oe_kurzbz' AND funktion_kurzbz = '$funktion_kurzbz')"; + } + } +} + +$query .= "))"; // close AND of exists, and exists + +// show issue if it is assigend to oe of uid or to student of oe of uid +if (!isEmptyArray($all_oe_kurzbz_berechtigt)) +{ + $query .= " OR oe_kurzbz IN $ALL_OE_KURZBZ_BERECHTIGT /* if error is for studiengang oe */"; + + $query .= " OR (oe_kurzbz IS NULL AND EXISTS ( /* if person_id of error is a student of studiengang oe */ + SELECT 1 FROM public.tbl_prestudent ps + JOIN public.tbl_prestudentstatus pss USING (prestudent_id) + JOIN public.tbl_studiengang stg USING (studiengang_kz) + WHERE person_id = iss.person_id + AND stg.oe_kurzbz IN $ALL_OE_KURZBZ_BERECHTIGT + AND pss.status_kurzbz IN $RELEVANT_PRESTUDENT_STATUS + AND NOT EXISTS (SELECT 1 + FROM public.tbl_prestudentstatus ps_finished + WHERE prestudent_id = ps.prestudent_id /* irrelevant if already finished studies and studied a while ago */ + AND status_kurzbz IN ('Absolvent','Abbrecher','Abgewiesener') + AND datum::date + interval '2 months' < NOW() + AND EXISTS (SELECT 1 FROM public.tbl_prestudent /* if more recent prestudent exists, their oe should get the issue */ + JOIN public.tbl_prestudentstatus USING (prestudent_id) + WHERE tbl_prestudentstatus.status_kurzbz IN $RELEVANT_PRESTUDENT_STATUS + AND person_id = ps.person_id + AND prestudent_id <> ps_finished.prestudent_id + AND datum::date >= ps_finished.datum::date) + ) + ) + )"; +} + +$query .= " ORDER BY CASE + WHEN iss.status_kurzbz = '".IssuesLib::STATUS_NEU."' THEN 0 + WHEN iss.status_kurzbz = '".IssuesLib::STATUS_IN_BEARBEITUNG."' THEN 1 + ELSE 2 + END, datum DESC, fehlercode, issue_id DESC"; + +$filterWidgetArray = array( + 'query' => $query, + 'app' => 'core', + 'datasetName' => 'issues', + 'filter_id' => $this->input->get('filter_id'), + 'tableUniqueId' => 'issues', + 'requiredPermissions' => 'admin', + 'datasetRepresentation' => 'tablesorter', + 'checkboxes' => 'issue_id', + 'columnsAliases' => array( + 'ID', + 'Fehlercode', + 'Fehlercode extern', + 'Datum', + 'Inhalt', + 'Inhalt extern', + 'PersonId', + 'OE', + 'Fehlertyp', + 'Fehlerstatus', + 'Verarbeitet von', + 'Verarbeitet am', + 'Applikation', + 'Fehlertypcode', + 'Statuscode', + ), + 'formatRow' => function($datasetRaw) { + + if ($datasetRaw->{'Fehlercode extern'} == null) + { + $datasetRaw->{'Fehlercode extern'} = '-'; + } + + if ($datasetRaw->{'Inhalt'} == null) + { + $datasetRaw->{'Inhalt'} = '-'; + } + + if ($datasetRaw->{'Inhalt extern'} == null) + { + $datasetRaw->{'Inhalt extern'} = '-'; + } + + if ($datasetRaw->{'PersonId'} == null) + { + $datasetRaw->{'PersonId'} = '-'; + } + + if ($datasetRaw->{'OE'} == null) + { + $datasetRaw->{'OE'} = '-'; + } + + if ($datasetRaw->{'Verarbeitet am'} == null) + { + $datasetRaw->{'Verarbeitet am'} = '-'; + } + + if ($datasetRaw->{'Verarbeitet von'} == null) + { + $datasetRaw->{'Verarbeitet von'} = '-'; + } + + return $datasetRaw; + }, + 'markRow' => function($datasetRaw) { + + $mark = ''; + + if ($datasetRaw->Statuscode == IssuesLib::STATUS_BEHOBEN) + $mark = "text-success"; + elseif ($datasetRaw->Statuscode == IssuesLib::STATUS_NEU || $datasetRaw->Statuscode == IssuesLib::STATUS_IN_BEARBEITUNG) + { + if ($datasetRaw->Fehlertypcode == IssuesLib::ERRORTYPE_CODE) + { + $mark = "text-danger"; + } + elseif ($datasetRaw->Fehlertypcode == IssuesLib::WARNINGTYPE_CODE) + { + $mark = "text-warning"; + } + } + + return $mark; + } +); + +echo $this->widgetlib->widget('FilterWidget', $filterWidgetArray); diff --git a/public/css/issues/issuesDataset.css b/public/css/issues/issuesDataset.css new file mode 100644 index 000000000..f05066b96 --- /dev/null +++ b/public/css/issues/issuesDataset.css @@ -0,0 +1,8 @@ +.datasetActionsTopBottomText { + padding-top: 1em; +} + +.datasetActionsHorizontalLine { + margin-top: 5px; + margin-bottom: 5px; +} \ No newline at end of file diff --git a/public/js/issues/issuesDataset.js b/public/js/issues/issuesDataset.js new file mode 100644 index 000000000..385a1d0ed --- /dev/null +++ b/public/js/issues/issuesDataset.js @@ -0,0 +1,151 @@ +/** + * Javascript file for issues overview page + */ + +var IssuesDataset = { + + /** + * adds person table additional actions html (above and beneath it) + */ + appendTableActionsHtml: function() + { + let auswahlStatus = + '
' + + '' + + '' + + '' + + '' + + '
'; + + let selectAllHtml = + '' + + ' Alle  ' + + '' + + ' Keinen    '; + + let issuescount = 0; + + FHC_AjaxClient.ajaxCallGet( + 'widgets/Filters/rowNumber', + { + filterUniqueId: FHC_FilterWidget.getFilterUniqueIdPrefix() + }, + { + successCallback: function(data, textStatus, jqXHR) { + if (FHC_AjaxClient.hasData(data)) + { + issuescount = FHC_AjaxClient.getData(data); + + if (issuescount > 0) + { + var countHtml = issuescount + " Fehler"; + + // Count Records after Filtering + $("#filterTableDataset").bind("filterEnd", function() { + var cnt = $("#filterTableDataset tr:visible").length - 2; + $(".filterTableDatasetCntFiltered").html(cnt + ' / '); + }); + + $("#datasetActionsTop, #datasetActionsBottom").append( + "
"+ + "
" + selectAllHtml + "
"+ + "
" + auswahlStatus + "
"+ + "
" + + "" + + countHtml + "
"+ + "
"+ + "
"+ + "
"+ + "
" + ); + $("#datasetActionsBottom").append("

"); + + IssuesDataset.setTableActions(); + } + } + }, + errorCallback: function(jqXHR, textStatus, errorThrown) { + FHC_DialogLib.alertError(textStatus); + } + } + ); + }, + + /** + * sets functionality for the actions above and beneath the person table + */ + setTableActions: function() + { + $(".setStatus").click(function() + { + let status_kurzbz = $(".auswahlStatus").val(); + let issue_ids_sel = $("#filterTableDataset input:checked[name=issue_id\\[\\]]"); + + if(status_kurzbz.length <= 0) + return FHC_DialogLib.alertInfo("Bitte wählen Sie den Status aus."); + + if(issue_ids_sel.length <= 0) + return FHC_DialogLib.alertInfo("Bitte wählen Sie die Fehler aus."); + + let issue_ids = []; + + for (let i = 0; i < issue_ids_sel.length; i++) + { + issue_ids.push($(issue_ids_sel[i]).val()); + } + + FHC_AjaxClient.ajaxCallPost( + 'system/issues/Issues/changeIssueStatus', + { + "issue_ids": issue_ids, + "status_kurzbz": status_kurzbz + }, + { + successCallback: function(data, textStatus, jqXHR) { + if (FHC_AjaxClient.isError(data)) + FHC_DialogLib.alertError("Fehler beim Status Ändern: " + FHC_AjaxClient.getError(data)); + else if (FHC_AjaxClient.hasData(data)) + { + FHC_FilterWidget.reloadDataset(); + FHC_DialogLib.alertSuccess(FHC_AjaxClient.getData(data)); + } + else + FHC_DialogLib.alertError("Unbekannter Fehler beim Status Ändern"); + }, + errorCallback: function(jqXHR, textStatus, errorThrown) { + FHC_DialogLib.alertError("Fehler beim Status Ändern: " + textStatus); + } + } + ); + } + ); + + $(".selectAll").click(function() + { + //select only trs if not filtered by tablesorter + var trs = $("#filterTableDataset tbody tr").not(".filtered"); + trs.find("input[name=issue_id\\[\\]]").prop("checked", true); + } + ); + + $(".unselectAll").click(function() + { + var trs = $("#filterTableDataset tbody tr").not(".filtered"); + trs.find("input[name=issue_id\\[\\]]").prop("checked", false); + } + ); + } +}; + +/** + * When JQuery is up + */ +$(document).ready(function() { + + IssuesDataset.appendTableActionsHtml(); + +}); diff --git a/system/dbupdate_3.3.php b/system/dbupdate_3.3.php index 415c00e65..7707a22a5 100644 --- a/system/dbupdate_3.3.php +++ b/system/dbupdate_3.3.php @@ -5076,67 +5076,291 @@ if (!$result = @$db->db_query("SELECT foerderrelevant, standort_code FROM public echo '
public.tbl_prestudent: Neue Spalten foerderrelevant, standort_code hinzugefuegt.'; } -// Add table issues -if(!$result = @$db->db_query("SELECT 1 FROM system.tbl_issues LIMIT 1;")) +// App 'dvuh' hinzufügen +if($result = $db->db_query("SELECT 1 FROM system.tbl_app WHERE app='dvuh'")) { - $qry = "CREATE TABLE system.tbl_issues ( - id integer NOT NULL, - app character varying(32), - inhalt text, - datum timestamp without time zone NOT NULL, - verarbeitetvon character varying(32), - verarbeitetamum timestamp without time zone, - fehlercode character varying(64) NOT NULL, - person_id integer, - oe_kurzbz character varying(32), - status character varying(32) NOT NULL, - schweregrad character varying(32) NOT NULL, - insertvon character varying(32), - insertamum timestamp without time zone DEFAULT now(), - updatevon character varying(32), - updateamum timestamp without time zone + if($db->db_num_rows($result)==0) + { + $qry = "INSERT INTO system.tbl_app(app) VALUES('dvuh');"; + + if(!$db->db_query($qry)) + echo 'App: '.$db->db_last_error().'
'; + else + echo ' Neue App dvuh in system.tbl_app hinzugefügt
'; + } +} + +// Add table issue_status +if(!$result = @$db->db_query("SELECT 1 FROM system.tbl_issue_status LIMIT 1;")) +{ + $qry = "CREATE TABLE system.tbl_issue_status ( + status_kurzbz character varying(32), + bezeichnung_mehrsprachig varchar(32)[] + ); + + COMMENT ON TABLE system.tbl_issue_status IS 'Tabelle zur Pflege von Bearbeitungsstatus von issues.'; + + ALTER TABLE system.tbl_issue_status ADD CONSTRAINT pk_tbl_issue_status PRIMARY KEY (status_kurzbz); + + INSERT INTO system.tbl_issue_status (status_kurzbz, bezeichnung_mehrsprachig) VALUES('new', '{\"neu\",\"new\"}'); + INSERT INTO system.tbl_issue_status (status_kurzbz, bezeichnung_mehrsprachig) VALUES('inProgress', '{\"in Bearbeitung\",\"in progress\"}'); + INSERT INTO system.tbl_issue_status (status_kurzbz, bezeichnung_mehrsprachig) VALUES('resolved', '{\"behoben\",\"resolved\"}');"; + + if(!$db->db_query($qry)) + echo 'system.tbl_issue_status: '.$db->db_last_error().'
'; + else + echo '
system.tbl_issue_status: Tabelle hinzugefuegt'; + + // GRANT SELECT ON TABLE bis.tbl_bisstandort TO web; + $qry = 'GRANT SELECT ON TABLE system.tbl_issue_status TO web;'; + if (!$db->db_query($qry)) + echo 'system.tbl_issue_status '.$db->db_last_error().'
'; + else + echo '
Granted privileges to web on system.tbl_issue_status'; + + // GRANT SELECT, UPDATE, INSERT, DELETE ON TABLE bis.tbl_issue_status TO vilesci; + $qry = 'GRANT SELECT, UPDATE, INSERT, DELETE ON TABLE system.tbl_issue_status TO vilesci;'; + if (!$db->db_query($qry)) + echo 'system.tbl_issue_status '.$db->db_last_error().'
'; + else + echo '
Granted privileges to vilesci on system.tbl_issue_status'; +} + +// Add table fehlertyp +if(!$result = @$db->db_query("SELECT 1 FROM system.tbl_fehlertyp LIMIT 1;")) +{ + $qry = "CREATE TABLE system.tbl_fehlertyp ( + fehlertyp_kurzbz character varying(32), + bezeichnung_mehrsprachig varchar(32)[] ); - COMMENT ON TABLE system.tbl_issues IS 'Tabelle zur Verfolgung von Problemen/Fehlern von verschiedenen Systemen'; - COMMENT ON COLUMN system.tbl_issues.id IS 'Primärschlüssel'; - COMMENT ON COLUMN system.tbl_issues.app IS 'Ursprungsapp des Problems'; - COMMENT ON COLUMN system.tbl_issues.inhalt IS 'Beschreibungstext, Fehlertext'; - COMMENT ON COLUMN system.tbl_issues.datum IS 'Tag und Zeit des Auftritts des Problems'; - COMMENT ON COLUMN system.tbl_issues.verarbeitetvon IS 'uid des Nutzers, der das Problem verarbeitet hat'; - COMMENT ON COLUMN system.tbl_issues.verarbeitetamum IS 'Tag und Zeit der Problemverarbeitung'; - COMMENT ON COLUMN system.tbl_issues.fehlercode IS 'Identifikationscode des Problems/Fehlers, kann von anderem System kommen oder eigens definiert sein'; - COMMENT ON COLUMN system.tbl_issues.person_id IS 'Id der betreffenden Person'; - COMMENT ON COLUMN system.tbl_issues.oe_kurzbz IS 'Betroffene Organisationseinheit'; - COMMENT ON COLUMN system.tbl_issues.status IS 'Verarbeitsungsstatus'; + COMMENT ON TABLE system.tbl_fehlertyp IS 'Tabelle mit fehlertyp für tbl_fehler'; + + ALTER TABLE system.tbl_fehlertyp ADD CONSTRAINT pk_tbl_fehlertyp PRIMARY KEY (fehlertyp_kurzbz); - CREATE SEQUENCE system.seq_issues_id + INSERT INTO system.tbl_fehlertyp (fehlertyp_kurzbz, bezeichnung_mehrsprachig) VALUES('warning', '{\"warnung\",\"warning\"}'); + INSERT INTO system.tbl_fehlertyp (fehlertyp_kurzbz, bezeichnung_mehrsprachig) VALUES('error', '{\"fehler\",\"error\"}'); + INSERT INTO system.tbl_fehlertyp (fehlertyp_kurzbz, bezeichnung_mehrsprachig) VALUES('info', '{\"info\",\"info\"}');"; + + if(!$db->db_query($qry)) + echo 'system.tbl_fehlertyp: '.$db->db_last_error().'
'; + else + echo '
system.tbl_fehlertyp: Tabelle hinzugefuegt'; + + // GRANT SELECT ON TABLE bis.tbl_bisstandort TO web; + $qry = 'GRANT SELECT ON TABLE system.tbl_fehlertyp TO web;'; + if (!$db->db_query($qry)) + echo 'system.tbl_fehlertyp '.$db->db_last_error().'
'; + else + echo '
Granted privileges to web on system.tbl_fehlertyp'; + + // GRANT SELECT, UPDATE, INSERT, DELETE ON TABLE bis.tbl_bisstandort TO vilesci; + $qry = 'GRANT SELECT, UPDATE, INSERT, DELETE ON TABLE system.tbl_fehlertyp TO vilesci;'; + if (!$db->db_query($qry)) + echo 'system.tbl_fehlertyp '.$db->db_last_error().'
'; + else + echo '
Granted privileges to vilesci on system.tbl_fehlertyp'; +} + +// Add table fehler +if(!$result = @$db->db_query("SELECT 1 FROM system.tbl_fehler LIMIT 1;")) +{ + $qry = "CREATE TABLE system.tbl_fehler ( + fehlercode character varying(64), + fehler_kurzbz character varying(64) UNIQUE, + fehlercode_extern character varying(64), + fehlertext text, + fehlertyp_kurzbz character varying(32) NOT NULL, + app character varying(32) NOT NULL + ); + + COMMENT ON TABLE system.tbl_fehler IS 'Tabelle zur Pflege von Fehlerfällen'; + COMMENT ON COLUMN system.tbl_fehler.fehlercode IS 'Eindeutiger interner Fehlercode'; + COMMENT ON COLUMN system.tbl_fehler.fehler_kurzbz IS 'Eindeutige Kurzbezeichnung für den Fehler'; + COMMENT ON COLUMN system.tbl_fehler.fehlercode_extern IS 'Code für von vordefinierte, von externen Systemen produzierte Fehler'; + COMMENT ON COLUMN system.tbl_fehler.fehlertext IS 'Interner, eigens definierter Fehlertext mit Platzhaltern für Parameter'; + COMMENT ON COLUMN system.tbl_fehler.fehlertyp_kurzbz IS 'Typ bzw Schweregrad (z.B. warnung, fehler)'; + COMMENT ON COLUMN system.tbl_fehler.app IS 'Ursprungsapp des Fehlers'; + + ALTER TABLE system.tbl_fehler ADD CONSTRAINT pk_tbl_fehler PRIMARY KEY (fehlercode); + ALTER TABLE system.tbl_fehler ADD CONSTRAINT fk_tbl_fehler_fehlertyp_kurzbz FOREIGN KEY (fehlertyp_kurzbz) REFERENCES system.tbl_fehlertyp(fehlertyp_kurzbz) ON UPDATE CASCADE ON DELETE RESTRICT; + ALTER TABLE system.tbl_fehler ADD CONSTRAINT fk_tbl_fehler_app FOREIGN KEY (app) REFERENCES system.tbl_app(app) ON UPDATE CASCADE ON DELETE RESTRICT; + ALTER TABLE system.tbl_fehler ADD CONSTRAINT uk_tbl_fehler_fehlercode_fehler_kurzbz UNIQUE (fehlercode, fehler_kurzbz); -- for upsert ON CONFLICT + ALTER TABLE system.tbl_fehler ADD CONSTRAINT uk_tbl_fehler_fehlercode_extern_app UNIQUE (fehlercode_extern, app); -- for recognizing external errors + + INSERT INTO system.tbl_fehler (fehlercode, fehlertext, fehlertyp_kurzbz, app) VALUES ('UNKNOWN_ERROR', 'Fehler ist aufgetreten', 'error', 'core'); + "; + + + if(!$db->db_query($qry)) + echo 'system.tbl_fehler: '.$db->db_last_error().'
'; + else + echo '
system.tbl_fehler: Tabelle hinzugefuegt'; + + // GRANT SELECT ON TABLE bis.tbl_issue TO web; + $qry = 'GRANT SELECT, UPDATE ON TABLE system.tbl_fehler TO web;'; + if (!$db->db_query($qry)) + echo 'system.tbl_fehler '.$db->db_last_error().'
'; + else + echo '
Granted privileges to web on system.tbl_fehler'; + + // GRANT SELECT, UPDATE, INSERT, DELETE ON TABLE bis.tbl_issue TO vilesci; + $qry = 'GRANT SELECT, UPDATE, INSERT, DELETE ON TABLE system.tbl_fehler TO vilesci;'; + if (!$db->db_query($qry)) + echo 'system.tbl_fehler '.$db->db_last_error().'
'; + else + echo '
Granted privileges to vilesci on system.tbl_fehler'; +} + +// Add table fehler_zustaendigkeiten +if(!$result = @$db->db_query("SELECT 1 FROM system.tbl_fehler_zustaendigkeiten LIMIT 1;")) +{ + $qry = "CREATE TABLE system.tbl_fehler_zustaendigkeiten ( + fehlerzustaendigkeiten_id character varying(64) NOT NULL, + fehlercode character varying(64), + person_id integer, + oe_kurzbz character varying(32), + funktion_kurzbz character varying(16) + ); + + COMMENT ON TABLE system.tbl_fehler_zustaendigkeiten IS 'Tabelle zum Hinzufügen für Zuständigkeiten für einzelne Fehler'; + COMMENT ON COLUMN system.tbl_fehler_zustaendigkeiten.fehlercode IS 'Eindeutiger interner Fehlercode'; + COMMENT ON COLUMN system.tbl_fehler_zustaendigkeiten.person_id IS 'person_id der zuständigen Person'; + COMMENT ON COLUMN system.tbl_fehler_zustaendigkeiten.oe_kurzbz IS 'Zuständigkeit für einen fehlercode für eine ganze OE'; + COMMENT ON COLUMN system.tbl_fehler_zustaendigkeiten.funktion_kurzbz IS 'Zusätzliche Einschränkung der OE Zuständigkeit nach funktion'; + + + CREATE SEQUENCE system.seq_fehlerzustaendigkeiten_id START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; - ALTER TABLE ONLY system.tbl_issues ALTER COLUMN id SET DEFAULT nextval('system.seq_jobsqueue_jobid'::regclass); + ALTER TABLE ONLY system.tbl_fehler_zustaendigkeiten ALTER COLUMN fehlerzustaendigkeiten_id SET DEFAULT nextval('system.seq_fehlerzustaendigkeiten_id'::regclass); - GRANT SELECT, UPDATE ON SEQUENCE system.seq_issues_id TO vilesci; - GRANT SELECT, UPDATE ON SEQUENCE system.seq_issues_id TO fhcomplete; - - ALTER TABLE system.tbl_issues ADD CONSTRAINT pk_issues PRIMARY KEY (id); - - ALTER TABLE system.tbl_issues ADD CONSTRAINT fk_issues_app FOREIGN KEY (app) REFERENCES system.tbl_app(app) ON UPDATE CASCADE ON DELETE RESTRICT; - ALTER TABLE system.tbl_issues ADD CONSTRAINT fk_issues_verarbeitetvon FOREIGN KEY (verarbeitetvon) REFERENCES public.tbl_benutzer(uid) ON UPDATE CASCADE ON DELETE RESTRICT; - ALTER TABLE system.tbl_issues ADD CONSTRAINT fk_issues_person_id FOREIGN KEY (person_id) REFERENCES public.tbl_person(person_id) ON UPDATE CASCADE ON DELETE RESTRICT; - ALTER TABLE system.tbl_issues ADD CONSTRAINT fk_issues_oe_kurzbz FOREIGN KEY (oe_kurzbz) REFERENCES public.tbl_organisationseinheit(oe_kurzbz) ON UPDATE CASCADE ON DELETE RESTRICT; - - ALTER TABLE system.tbl_issues ADD CONSTRAINT chk_issues_person_id_oe_kurzbz CHECK (person_id IS NOT NULL OR oe_kurzbz IS NOT NULL); + GRANT SELECT, UPDATE ON SEQUENCE system.seq_fehlerzustaendigkeiten_id TO vilesci; + GRANT SELECT, UPDATE ON SEQUENCE system.seq_fehlerzustaendigkeiten_id TO fhcomplete; - CREATE INDEX idx_tbl_issues_person_id ON system.tbl_issues USING btree (person_id); - CREATE INDEX idx_tbl_issues_oe_kurzbz ON system.tbl_issues USING btree (oe_kurzbz);"; + ALTER TABLE system.tbl_fehler_zustaendigkeiten ADD CONSTRAINT pk_tbl_fehler_zustaendigkeiten PRIMARY KEY (fehlerzustaendigkeiten_id); + ALTER TABLE system.tbl_fehler_zustaendigkeiten ADD CONSTRAINT fk_tbl_fehler_zustaendigkeiten_fehlercode FOREIGN KEY (fehlercode) REFERENCES system.tbl_fehler(fehlercode) ON UPDATE CASCADE ON DELETE RESTRICT; + ALTER TABLE system.tbl_fehler_zustaendigkeiten ADD CONSTRAINT fk_tbl_fehler_zustaendigkeiten_person_id FOREIGN KEY (person_id) REFERENCES public.tbl_person(person_id) ON UPDATE CASCADE ON DELETE RESTRICT; + ALTER TABLE system.tbl_fehler_zustaendigkeiten ADD CONSTRAINT fk_tbl_fehler_zustaendigkeiten_oe_kurzbz FOREIGN KEY (oe_kurzbz) REFERENCES public.tbl_organisationseinheit(oe_kurzbz) ON UPDATE CASCADE ON DELETE RESTRICT; + ALTER TABLE system.tbl_fehler_zustaendigkeiten ADD CONSTRAINT fk_tbl_fehler_zustaendigkeiten_funktion_kurzbz FOREIGN KEY (funktion_kurzbz) REFERENCES public.tbl_funktion(funktion_kurzbz) ON UPDATE CASCADE ON DELETE RESTRICT; + + ALTER TABLE system.tbl_fehler_zustaendigkeiten ADD CONSTRAINT uk_tbl_fehler_zustaendigkeiten_fehlercode_person_id UNIQUE (fehlercode, person_id); + ALTER TABLE system.tbl_fehler_zustaendigkeiten ADD CONSTRAINT uk_tbl_fehler_zustaendigkeiten_fehlercode_oe_kurzbz_funktion_kurzbz UNIQUE (fehlercode, oe_kurzbz, funktion_kurzbz);"; if(!$db->db_query($qry)) - echo 'system.tbl_issues: '.$db->db_last_error().'
'; + echo 'system.tbl_fehler_zustaendigkeiten: '.$db->db_last_error().'
'; else - echo ' system.tbl_issues: Tabelle hinzugefuegt
'; + echo '
system.tbl_fehler_zustaendigkeiten: Tabelle hinzugefuegt'; + + // GRANT SELECT ON TABLE bis.tbl_issue TO web; + $qry = 'GRANT SELECT ON TABLE system.tbl_fehler_zustaendigkeiten TO web;'; + if (!$db->db_query($qry)) + echo 'system.tbl_fehler_zustaendigkeiten '.$db->db_last_error().'
'; + else + echo '
Granted privileges to web on system.tbl_fehler_zustaendigkeiten'; + + // GRANT SELECT, UPDATE, INSERT, DELETE ON TABLE bis.tbl_issue TO vilesci; + $qry = 'GRANT SELECT, UPDATE, INSERT, DELETE ON TABLE system.tbl_fehler_zustaendigkeiten TO vilesci;'; + if (!$db->db_query($qry)) + echo 'system.tbl_fehler_zustaendigkeiten '.$db->db_last_error().'
'; + else + echo '
Granted privileges to vilesci on system.tbl_fehler_zustaendigkeiten'; +} + +// Add table issue +if(!$result = @$db->db_query("SELECT 1 FROM system.tbl_issue LIMIT 1;")) +{ + $qry = "CREATE TABLE system.tbl_issue ( + issue_id integer, + fehlercode character varying(64) NOT NULL, + inhalt text, + fehlercode_extern character varying(64), + inhalt_extern text, + person_id integer, + oe_kurzbz character varying(32), + datum timestamp without time zone NOT NULL, + verarbeitetvon character varying(32), + verarbeitetamum timestamp without time zone, + status_kurzbz character varying(32) NOT NULL, + insertvon character varying(32), + insertamum timestamp without time zone DEFAULT now(), + updatevon character varying(32), + updateamum timestamp without time zone + ); + + COMMENT ON TABLE system.tbl_issue IS 'Tabelle zur Verfolgung von Problemen/Fehlern von verschiedenen Systemen'; + COMMENT ON COLUMN system.tbl_issue.issue_id IS 'Primärschlüssel'; + COMMENT ON COLUMN system.tbl_issue.fehlercode IS 'Identifikationscode des Problems/Fehlers, kann von anderem System kommen oder eigens definiert sein'; + COMMENT ON COLUMN system.tbl_issue.inhalt IS 'Fehlertext'; + COMMENT ON COLUMN system.tbl_issue.fehlercode_extern IS 'Externer, von App geschriebener Fehlercode. Zum Auseinanderhalten der externen Fehler, die nicht in tbl_fehler definiert sind.'; + COMMENT ON COLUMN system.tbl_issue.inhalt_extern IS 'von externem System kommender Fehlermeldungstext'; + COMMENT ON COLUMN system.tbl_issue.datum IS 'Tag und Zeit des Auftritts des Problems'; + COMMENT ON COLUMN system.tbl_issue.verarbeitetvon IS 'uid des Nutzers, der das Problem verarbeitet hat'; + COMMENT ON COLUMN system.tbl_issue.verarbeitetamum IS 'Tag und Zeit der Problemverarbeitung'; + COMMENT ON COLUMN system.tbl_issue.person_id IS 'Id der Person, für welche das issue besteht'; + COMMENT ON COLUMN system.tbl_issue.oe_kurzbz IS 'Betroffene Organisationseinheit'; + COMMENT ON COLUMN system.tbl_issue.status_kurzbz IS 'Verarbeitsungsstatus'; + + CREATE SEQUENCE system.seq_issue_id + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + ALTER TABLE ONLY system.tbl_issue ALTER COLUMN issue_id SET DEFAULT nextval('system.seq_issue_id'::regclass); + + GRANT SELECT, UPDATE ON SEQUENCE system.seq_issue_id TO vilesci; + GRANT SELECT, UPDATE ON SEQUENCE system.seq_issue_id TO fhcomplete; + + ALTER TABLE system.tbl_issue ADD CONSTRAINT pk_tbl_issue PRIMARY KEY (issue_id); + + ALTER TABLE system.tbl_issue ADD CONSTRAINT fk_tbl_issue_fehlercode FOREIGN KEY (fehlercode) REFERENCES system.tbl_fehler(fehlercode) ON UPDATE CASCADE ON DELETE RESTRICT; + ALTER TABLE system.tbl_issue ADD CONSTRAINT fk_tbl_issue_verarbeitetvon FOREIGN KEY (verarbeitetvon) REFERENCES public.tbl_benutzer(uid) ON UPDATE CASCADE ON DELETE RESTRICT; + ALTER TABLE system.tbl_issue ADD CONSTRAINT fk_tbl_issue_person_id FOREIGN KEY (person_id) REFERENCES public.tbl_person(person_id) ON UPDATE CASCADE ON DELETE RESTRICT; + ALTER TABLE system.tbl_issue ADD CONSTRAINT fk_tbl_issue_oe_kurzbz FOREIGN KEY (oe_kurzbz) REFERENCES public.tbl_organisationseinheit(oe_kurzbz) ON UPDATE CASCADE ON DELETE RESTRICT; + + ALTER TABLE system.tbl_issue ADD CONSTRAINT chk_tbl_issue_person_id_oe_kurzbz CHECK (person_id IS NOT NULL OR oe_kurzbz IS NOT NULL); + + CREATE INDEX idx_tbl_issue_person_id ON system.tbl_issue USING btree (person_id); + CREATE INDEX idx_tbl_issue_oe_kurzbz ON system.tbl_issue USING btree (oe_kurzbz);"; + + if(!$db->db_query($qry)) + echo 'system.tbl_issue: '.$db->db_last_error().'
'; + else + echo '
system.tbl_issue: Tabelle hinzugefuegt'; + + // GRANT SELECT ON TABLE bis.tbl_issue TO web; + $qry = 'GRANT SELECT, UPDATE ON TABLE system.tbl_issue TO web;'; + if (!$db->db_query($qry)) + echo 'system.tbl_issue '.$db->db_last_error().'
'; + else + echo '
Granted privileges to web on system.tbl_issue'; + + // GRANT SELECT, UPDATE, INSERT, DELETE ON TABLE bis.tbl_issue TO vilesci; + $qry = 'GRANT SELECT, UPDATE, INSERT, DELETE ON TABLE system.tbl_issue TO vilesci;'; + if (!$db->db_query($qry)) + echo 'system.tbl_issue '.$db->db_last_error().'
'; + else + echo '
Granted privileges to vilesci on system.tbl_issue'; +} + +// Add permission to manage issues +if($result = @$db->db_query("SELECT 1 FROM system.tbl_berechtigung WHERE berechtigung_kurzbz = 'system/issues_verwalten';")) +{ + if($db->db_num_rows($result) == 0) + { + $qry = "INSERT INTO system.tbl_berechtigung(berechtigung_kurzbz, beschreibung) VALUES('system/issues_verwalten', 'Issues verwalten');"; + + if(!$db->db_query($qry)) + echo 'system.tbl_berechtigung '.$db->db_last_error().'
'; + else + echo '
system.tbl_berechtigung: Added permission for system/issues_verwalten'; + } } // *** Pruefung und hinzufuegen der neuen Attribute und Tabellen @@ -5400,7 +5624,11 @@ $tabellen=array( "system.tbl_benutzerrolle" => array("benutzerberechtigung_id","rolle_kurzbz","berechtigung_kurzbz","uid","funktion_kurzbz","oe_kurzbz","art","studiensemester_kurzbz","start","ende","negativ","updateamum", "updatevon","insertamum","insertvon","kostenstelle_id","anmerkung"), "system.tbl_berechtigung" => array("berechtigung_kurzbz","beschreibung"), "system.tbl_extensions" => array("extension_id","name","version","description","license","url","core_version","dependencies","enabled"), - "system.tbl_issues" => array("id","app","inhalt","datum","verarbeitetvon","verarbeitetamum","fehlercode","person_id","oe_kurzbz","status","insertvon","insertamum","updatevon","updateamum"), + "system.tbl_fehler" => array("fehlercode","fehler_kurzbz","fehlercode_extern","fehlertext","fehlertyp_kurzbz","app"), + "system.tbl_fehlertyp" => array("fehlertyp_kurzbz","bezeichnung_mehrsprachig"), + "system.tbl_fehler_zustaendigkeiten" => array("fehlerzustaendigkeiten_id","fehlercode","person_id","oe_kurzbz","funktion_kurzbz"), + "system.tbl_issue" => array("issue_id","fehlercode","fehlercode_extern","inhalt","inhalt_extern","person_id","oe_kurzbz","datum","verarbeitetvon","verarbeitetamum","status_kurzbz","insertvon","insertamum","updatevon","updateamum"), + "system.tbl_issue_status" => array("status_kurzbz","bezeichnung_mehrsprachig"), "system.tbl_log" => array("log_id","person_id","zeitpunkt","app","oe_kurzbz","logtype_kurzbz","logdata","insertvon","taetigkeit_kurzbz"), "system.tbl_logtype" => array("logtype_kurzbz", "data_schema"), "system.tbl_filters" => array("filter_id","app","dataset_name","filter_kurzbz","person_id","description","sort","default_filter","filter","oe_kurzbz","statistik_kurzbz"), diff --git a/system/filtersupdate.php b/system/filtersupdate.php index 77e0c3e3a..037d303eb 100644 --- a/system/filtersupdate.php +++ b/system/filtersupdate.php @@ -856,7 +856,42 @@ $filters = array( } ', 'oe_kurzbz' => null, - ) + ), + array( + 'app' => 'core', + 'dataset_name' => 'issues', + 'filter_kurzbz' => 'last7Days', + 'description' => '{Fehler letzte 7 Tage}', + 'sort' => 1, + 'default_filter' => true, + 'filter' => ' + { + "name": "Alle in den letzten 7 Tagen aufgetretenen Fehler ", + "columns": [ + {"name": "Fehlercode"}, + {"name": "Fehlercode extern"}, + {"name": "Datum"}, + {"name": "Inhalt"}, + {"name": "Inhalt extern"}, + {"name": "PersonId"}, + {"name": "OE"}, + {"name": "Fehlertyp"}, + {"name": "Fehlerstatus"}, + {"name": "Verarbeitet von"}, + {"name": "Verarbeitet am"} + ], + "filters": [ + { + "name": "Datum", + "operation": "lt", + "condition": "7", + "option": "days" + } + ] + } + ', + 'oe_kurzbz' => null, + ), ); // Loop through the filters array From 76f3afdda55282009e18bad627191c8cb3a5d91b Mon Sep 17 00:00:00 2001 From: KarpAlex Date: Tue, 28 Sep 2021 15:52:17 +0200 Subject: [PATCH 42/74] Person_model.php getPersonStammdaten method: - added sorting order for contacts (by insertamum descending) - rewrote old ->retval to new isError, hasData etc. functions --- application/models/person/Person_model.php | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/application/models/person/Person_model.php b/application/models/person/Person_model.php index 2c7fc113e..085c3f826 100644 --- a/application/models/person/Person_model.php +++ b/application/models/person/Person_model.php @@ -159,28 +159,29 @@ class Person_model extends DB_Model $person = $this->load($person_id); - if($person->error) return $person; + if (isError($person)) return $person; //return null if not found - if(count($person->retval) < 1) + if (!hasData($person)) return success(null); - $this->KontaktModel->addDistinct(); $this->KontaktModel->addSelect('kontakttyp, anmerkung, kontakt, zustellung'); $this->KontaktModel->addOrder('kontakttyp'); + $this->KontaktModel->addOrder('insertamum', 'DESC'); $where = $zustellung_only === true ? array('person_id' => $person_id, 'zustellung' => true) : array('person_id' => $person_id); $kontakte = $this->KontaktModel->loadWhere($where); - if($kontakte->error) return $kontakte; + if (isError($kontakte)) return $kontakte; $where = $zustellung_only === true ? array('person_id' => $person_id, 'zustelladresse' => true) : array('person_id' => $person_id); $this->AdresseModel->addSelect('public.tbl_adresse.*, bis.tbl_nation.kurztext AS nationkurztext'); $this->AdresseModel->addJoin('bis.tbl_nation', 'tbl_adresse.nation = tbl_nation.nation_code', 'LEFT'); + $this->AdresseModel->addOrder('insertamum', 'DESC'); $adressen = $this->AdresseModel->loadWhere($where); - if($adressen->error) return $adressen; + if (isError($adressen)) return $adressen; - $stammdaten = $person->retval[0]; - $stammdaten->kontakte = $kontakte->retval; - $stammdaten->adressen = $adressen->retval; + $stammdaten = getData($person)[0]; + $stammdaten->kontakte = hasData($kontakte) ? getData($kontakte) : array(); + $stammdaten->adressen = hasData($adressen) ? getData($adressen) : array(); return success($stammdaten); } From cb3f3723ae95f03715e01fca8dc460398193ea63 Mon Sep 17 00:00:00 2001 From: KarpAlex Date: Tue, 28 Sep 2021 15:57:27 +0200 Subject: [PATCH 43/74] issues table dataset: - made more readable for assistance (added vorname, nachname, removed some fields) - added default filters (all new, last 7 days...) - issues displayed for children oes of permitted arrays as well - query: more exact check for prestudents future status by using studiensemester start date - typo fixes --- .../controllers/system/issues/Issues.php | 25 +++++- application/libraries/IssuesLib.php | 27 ++++-- .../views/system/issues/issuesData.php | 28 +++++-- public/js/issues/issuesDataset.js | 2 +- system/filtersupdate.php | 82 ++++++++++++++++--- 5 files changed, 135 insertions(+), 29 deletions(-) diff --git a/application/controllers/system/issues/Issues.php b/application/controllers/system/issues/Issues.php index 9ae390418..98787f703 100644 --- a/application/controllers/system/issues/Issues.php +++ b/application/controllers/system/issues/Issues.php @@ -14,7 +14,7 @@ class Issues extends Auth_Controller parent::__construct( array( 'index' => array(self::BERECHTIGUNG_KURZBZ.':r'), - 'changeIssueStatus' => array(self::BERECHTIGUNG_KURZBZ.':r') + 'changeIssueStatus' => array(self::BERECHTIGUNG_KURZBZ.':rw') ) ); @@ -33,6 +33,7 @@ class Issues extends Auth_Controller // Load models $this->load->model('person/Benutzerfunktion_model', 'BenutzerfunktionModel'); + $this->load->model('organisation/Organisationseinheit_model', 'OrganisationseinheitModel'); $this->_setAuthUID(); // sets property uid } @@ -101,8 +102,28 @@ class Issues extends Auth_Controller foreach (getData($benutzerfunktionRes) as $benutzerfunktion) { $all_oe_kurzbz_with_funktionen[$benutzerfunktion->oe_kurzbz][] = $benutzerfunktion->funktion_kurzbz; - if ($benutzerfunktion->funktion_kurzbz == self::FUNKTION_KURZBZ) // separate oes for the funktion needed for displaying issues + + // separate oes for the funktion needed for displaying issues + if ($benutzerfunktion->funktion_kurzbz == self::FUNKTION_KURZBZ) + { $oe_kurzbz_for_funktion[] = $benutzerfunktion->oe_kurzbz; + + $childOesFunktionRes = $this->OrganisationseinheitModel->getChilds($benutzerfunktion->oe_kurzbz); + + if (isError($childOesFunktionRes)) + show_error(getError($childOesFunktionRes)); + + if (hasData($childOesFunktionRes)) + { + $childOesFunktion = getData($childOesFunktionRes); + + foreach ($childOesFunktion as $childOeFunktion) + { + if (!in_array($childOeFunktion->oe_kurzbz, $oe_kurzbz_for_funktion)) + $oe_kurzbz_for_funktion[] = $childOeFunktion->oe_kurzbz; + } + } + } } } diff --git a/application/libraries/IssuesLib.php b/application/libraries/IssuesLib.php index ade2c6078..1b06db333 100644 --- a/application/libraries/IssuesLib.php +++ b/application/libraries/IssuesLib.php @@ -72,7 +72,7 @@ class IssuesLib return $this->_addIssue($fehlercode, $person_id, $oe_kurzbz, $fehlertext_params); } else - return error("Fehler nicht gefunden"); + return error("Fehler $fehler_kurzbz nicht gefunden"); } /** @@ -81,26 +81,39 @@ class IssuesLib * @param string $inhalt_extern error text in external system * @param int $person_id * @param int $oe_kurzbz - * @param array $fehlertext_params params for sprint replace of error text in system.tbl_fehler + * @param array $fehlertext_params params for replacement of parts of error text + * @param bool $force_predefined if true, only predefined external issues are added * @return object success or error */ - public function addExternalIssue($fehlercode_extern, $inhalt_extern, $person_id = null, $oe_kurzbz = null, $fehlertext_params = null) + public function addExternalIssue($fehlercode_extern, $inhalt_extern, $person_id = null, $oe_kurzbz = null, $fehlertext_params = null, $force_predefined = false) { if (isEmptyString($fehlercode_extern)) return error("fehlercode_extern fehlt"); // get external fehlercode (unique for each app) $this->_ci->FehlerModel->addSelect('fehlercode'); - $fehlerRes = $this->_ci->FehlerModel->loadWhere(array('fehlercode_extern' => $fehlercode_extern, 'app' => $this->_app)); + $fehlerRes = $this->_ci->FehlerModel->loadWhere( + array( + 'fehlercode_extern' => $fehlercode_extern, + 'app' => $this->_app + ) + ); if (isError($fehlerRes)) return $fehlerRes; + $fehlerData = getData($fehlerRes)[0]; + // check if there is a predefined custom error for the external issue if (hasData($fehlerRes)) { // if found, use the code - $fehlercode = getData($fehlerRes)[0]->fehlercode; + $fehlercode = $fehlerData->fehlercode; + } + elseif ($force_predefined === true) + { + // only added if predefined + return success("No definition found - not added"); } else { @@ -180,7 +193,7 @@ class IssuesLib * @param array $fehlertext_params * @param string $fehlercode_extern * @param string $inhalt_extern - * @return array|stdClass + * @return object success or error */ private function _addIssue($fehlercode, $person_id = null, $oe_kurzbz = null, $fehlertext_params = null, $fehlercode_extern = null, $inhalt_extern = null) { @@ -226,6 +239,6 @@ class IssuesLib return error("Anzahl offener Issues konnte nicht ermittelt werden."); } else - return error("Fehler nicht gefunden"); + return error("Fehler $fehlercode nicht gefunden"); } } diff --git a/application/views/system/issues/issuesData.php b/application/views/system/issues/issuesData.php index 82e6fa409..2b4551603 100644 --- a/application/views/system/issues/issuesData.php +++ b/application/views/system/issues/issuesData.php @@ -10,27 +10,29 @@ $query = "SELECT issue_id, fehlercode AS \"Fehlercode\", iss.fehlercode_extern A inhalt AS \"Inhalt\", inhalt_extern AS \"Inhalt extern\", iss.person_id AS \"PersonId\", iss.oe_kurzbz AS \"OE\", ftyp.bezeichnung_mehrsprachig[1] AS \"Fehlertyp\", stat.bezeichnung_mehrsprachig[1] AS \"Fehlerstatus\", verarbeitetvon AS \"Verarbeitet von\",verarbeitetamum AS \"Verarbeitet am\", fr.app AS \"Applikation\", - fr.fehlertyp_kurzbz as \"Fehlertypcode\", iss.status_kurzbz AS \"Statuscode\" + fr.fehlertyp_kurzbz as \"Fehlertypcode\", iss.status_kurzbz AS \"Statuscode\", + pers.vorname AS \"Vorname\", pers.nachname AS \"Nachname\" FROM system.tbl_issue iss JOIN system.tbl_fehler fr USING (fehlercode) JOIN system.tbl_fehlertyp ftyp USING (fehlertyp_kurzbz) JOIN system.tbl_issue_status stat USING (status_kurzbz) + LEFT JOIN public.tbl_person pers ON iss.person_id = pers.person_id WHERE EXISTS ( - SELECT 1 FROM system.tbl_fehler_zustaendigkeiten + SELECT 1 FROM system.tbl_fehler_zustaendigkeiten zst WHERE fehlercode = iss.fehlercode AND ( person_id = ".$PERSON_ID." /* person_id in fehler_zustaendigkeit for individual persons */"; if (!isEmptyArray($all_oe_kurzbz_with_funktionen)) { - $query .= " OR (oe_kurzbz IN $ALL_OE_KURZBZ AND funktion_kurzbz IS NULL) /* if oe is specified in fehler_zustaendigkeiten */"; + $query .= " OR (zst.oe_kurzbz IN $ALL_OE_KURZBZ AND zst.funktion_kurzbz IS NULL) /* if oe is specified in fehler_zustaendigkeiten */"; // check for each oe for each function if zustaendig foreach ($all_oe_kurzbz_with_funktionen as $oe_kurzbz => $funktionen_kurzbz) { foreach ($funktionen_kurzbz as $funktion_kurzbz) { - $query .= " OR (oe_kurzbz = '$oe_kurzbz' AND funktion_kurzbz = '$funktion_kurzbz')"; + $query .= " OR (zst.oe_kurzbz = '$oe_kurzbz' AND zst.funktion_kurzbz = '$funktion_kurzbz')"; } } } @@ -40,9 +42,9 @@ $query .= "))"; // close AND of exists, and exists // show issue if it is assigend to oe of uid or to student of oe of uid if (!isEmptyArray($all_oe_kurzbz_berechtigt)) { - $query .= " OR oe_kurzbz IN $ALL_OE_KURZBZ_BERECHTIGT /* if error is for studiengang oe */"; + $query .= " OR iss.oe_kurzbz IN $ALL_OE_KURZBZ_BERECHTIGT /* if error is for studiengang oe */"; - $query .= " OR (oe_kurzbz IS NULL AND EXISTS ( /* if person_id of error is a student of studiengang oe */ + $query .= " OR (iss.oe_kurzbz IS NULL AND EXISTS ( /* if person_id of error is a student of studiengang oe */ SELECT 1 FROM public.tbl_prestudent ps JOIN public.tbl_prestudentstatus pss USING (prestudent_id) JOIN public.tbl_studiengang stg USING (studiengang_kz) @@ -51,15 +53,17 @@ if (!isEmptyArray($all_oe_kurzbz_berechtigt)) AND pss.status_kurzbz IN $RELEVANT_PRESTUDENT_STATUS AND NOT EXISTS (SELECT 1 FROM public.tbl_prestudentstatus ps_finished + JOIN public.tbl_studiensemester sem_finished USING (studiensemester_kurzbz) WHERE prestudent_id = ps.prestudent_id /* irrelevant if already finished studies and studied a while ago */ AND status_kurzbz IN ('Absolvent','Abbrecher','Abgewiesener') AND datum::date + interval '2 months' < NOW() AND EXISTS (SELECT 1 FROM public.tbl_prestudent /* if more recent prestudent exists, their oe should get the issue */ JOIN public.tbl_prestudentstatus USING (prestudent_id) + JOIN public.tbl_studiensemester USING (studiensemester_kurzbz) WHERE tbl_prestudentstatus.status_kurzbz IN $RELEVANT_PRESTUDENT_STATUS AND person_id = ps.person_id AND prestudent_id <> ps_finished.prestudent_id - AND datum::date >= ps_finished.datum::date) + AND tbl_studiensemester.start::date > sem_finished.start::date) ) ) )"; @@ -69,7 +73,13 @@ $query .= " ORDER BY CASE WHEN iss.status_kurzbz = '".IssuesLib::STATUS_NEU."' THEN 0 WHEN iss.status_kurzbz = '".IssuesLib::STATUS_IN_BEARBEITUNG."' THEN 1 ELSE 2 - END, datum DESC, fehlercode, issue_id DESC"; + END, + CASE + WHEN fehlertyp_kurzbz = '".IssuesLib::ERRORTYPE_CODE."' THEN 0 + WHEN fehlertyp_kurzbz = '".IssuesLib::WARNINGTYPE_CODE."' THEN 1 + ELSE 2 + END, + datum DESC, fehlercode, issue_id DESC"; $filterWidgetArray = array( 'query' => $query, @@ -96,6 +106,8 @@ $filterWidgetArray = array( 'Applikation', 'Fehlertypcode', 'Statuscode', + 'Vorname', + 'Nachname' ), 'formatRow' => function($datasetRaw) { diff --git a/public/js/issues/issuesDataset.js b/public/js/issues/issuesDataset.js index 385a1d0ed..b102a3f96 100644 --- a/public/js/issues/issuesDataset.js +++ b/public/js/issues/issuesDataset.js @@ -17,7 +17,7 @@ var IssuesDataset = { '' + '' + '' + - '' + + '' + '' + '
'; diff --git a/system/filtersupdate.php b/system/filtersupdate.php index b5662492c..2998640ed 100644 --- a/system/filtersupdate.php +++ b/system/filtersupdate.php @@ -860,25 +860,49 @@ $filters = array( array( 'app' => 'core', 'dataset_name' => 'issues', - 'filter_kurzbz' => 'last7Days', - 'description' => '{Fehler letzte 7 Tage}', + 'filter_kurzbz' => 'offeneFehler', + 'description' => '{Alle offenen}', 'sort' => 1, 'default_filter' => true, 'filter' => ' { - "name": "Alle in den letzten 7 Tagen aufgetretenen Fehler ", + "name": "Alle offenen Fehler", "columns": [ - {"name": "Fehlercode"}, - {"name": "Fehlercode extern"}, {"name": "Datum"}, {"name": "Inhalt"}, - {"name": "Inhalt extern"}, + {"name": "Vorname"}, + {"name": "Nachname"}, {"name": "PersonId"}, - {"name": "OE"}, - {"name": "Fehlertyp"}, - {"name": "Fehlerstatus"}, - {"name": "Verarbeitet von"}, - {"name": "Verarbeitet am"} + {"name": "Fehlerstatus"} + ], + "filters": [ + { + "name": "Fehlerstatus", + "operation": "ncontains", + "condition": "behoben" + } + ] + } + ', + 'oe_kurzbz' => null, + ), + array( + 'app' => 'core', + 'dataset_name' => 'issues', + 'filter_kurzbz' => 'FehlerLetze7Tage', + 'description' => '{Letzten 7 Tage}', + 'sort' => 2, + 'default_filter' => false, + 'filter' => ' + { + "name": "Alle in den letzten 7 Tagen aufgetretenen Fehler", + "columns": [ + {"name": "Datum"}, + {"name": "Inhalt"}, + {"name": "Vorname"}, + {"name": "Nachname"}, + {"name": "PersonId"}, + {"name": "Fehlerstatus"} ], "filters": [ { @@ -892,6 +916,42 @@ $filters = array( ', 'oe_kurzbz' => null, ), + array( + 'app' => 'core', + 'dataset_name' => 'issues', + 'filter_kurzbz' => 'FehlerLetzte7TageBearbeitet', + 'description' => '{Letzten 7 Tage bearbeitet}', + 'sort' => 3, + 'default_filter' => false, + 'filter' => ' + { + "name": "Alle in den letzten 7 Tagen bearbeiteten Fehler", + "columns": [ + {"name": "Datum"}, + {"name": "Inhalt"}, + {"name": "Vorname"}, + {"name": "Nachname"}, + {"name": "PersonId"}, + {"name": "Fehlerstatus"}, + {"name": "Verarbeitet von"} + ], + "filters": [ + { + "name": "Verarbeitet am", + "operation": "lt", + "condition": "7", + "option": "days" + }, + { + "name": "Fehlerstatus", + "operation": "contains", + "condition": "behoben" + } + ] + } + ', + 'oe_kurzbz' => null, + ) ); // Loop through the filters array From cb25efceca4e26a50b2800d23bea78e0037155d4 Mon Sep 17 00:00:00 2001 From: KarpAlex Date: Wed, 29 Sep 2021 21:11:52 +0200 Subject: [PATCH 44/74] added NOT NULL constraint to fehlercode field of tbl_fehler_zustaendigkeiten --- system/dbupdate_3.3.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/system/dbupdate_3.3.php b/system/dbupdate_3.3.php index 461f6b6a7..8e60cd243 100644 --- a/system/dbupdate_3.3.php +++ b/system/dbupdate_3.3.php @@ -5282,7 +5282,7 @@ if(!$result = @$db->db_query("SELECT 1 FROM system.tbl_fehler_zustaendigkeiten L { $qry = "CREATE TABLE system.tbl_fehler_zustaendigkeiten ( fehlerzustaendigkeiten_id character varying(64) NOT NULL, - fehlercode character varying(64), + fehlercode character varying(64) NOT NULL, person_id integer, oe_kurzbz character varying(32), funktion_kurzbz character varying(16) @@ -5293,7 +5293,6 @@ if(!$result = @$db->db_query("SELECT 1 FROM system.tbl_fehler_zustaendigkeiten L COMMENT ON COLUMN system.tbl_fehler_zustaendigkeiten.person_id IS 'person_id der zuständigen Person'; COMMENT ON COLUMN system.tbl_fehler_zustaendigkeiten.oe_kurzbz IS 'Zuständigkeit für einen fehlercode für eine ganze OE'; COMMENT ON COLUMN system.tbl_fehler_zustaendigkeiten.funktion_kurzbz IS 'Zusätzliche Einschränkung der OE Zuständigkeit nach funktion'; - CREATE SEQUENCE system.seq_fehlerzustaendigkeiten_id START WITH 1 From 1b07cbde72b2a01ef5e36af765e841b063356da9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20=C3=96sterreicher?= Date: Fri, 1 Oct 2021 09:42:59 +0200 Subject: [PATCH 45/74] Fixed generation of Diplomasupplement if Outgoing University includes Special chars --- rdf/diplomasupplement.xml.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rdf/diplomasupplement.xml.php b/rdf/diplomasupplement.xml.php index 14352a3c3..d55187c6c 100644 --- a/rdf/diplomasupplement.xml.php +++ b/rdf/diplomasupplement.xml.php @@ -389,7 +389,7 @@ if (isset($_REQUEST["xmlformat"]) && $_REQUEST["xmlformat"] == "xml") echo "".$datum->convertISODate($row1->bis).""; echo "$row1->zweck"; echo "$row1->ort"; - echo "$row1->universitaet"; + echo "universitaet]]>"; echo ""; } echo ""; From dfc55a8f95ad83a6713cf84fe460fa3fab375ea2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20=C3=96sterreicher?= Date: Fri, 1 Oct 2021 14:20:15 +0200 Subject: [PATCH 46/74] =?UTF-8?q?Time=20Limit=20f=C3=BCr=20Statistiken=20e?= =?UTF-8?q?rh=C3=B6ht?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/statistik.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/include/statistik.class.php b/include/statistik.class.php index 12ab530fb..7d34a04a0 100644 --- a/include/statistik.class.php +++ b/include/statistik.class.php @@ -510,6 +510,7 @@ class statistik extends basis_db $this->html=''; $this->csv=''; $this->json=array(); + set_time_limit(60); if($this->sql!='') { From 226a674e7b4ae0e9247f202bff443740d5a8769f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20=C3=96sterreicher?= Date: Fri, 1 Oct 2021 15:43:40 +0200 Subject: [PATCH 47/74] Projektzeitenexport ohne Projekte im Zeitraum zeigt nun eine entsprechende Fehlermeldung statt PHP Error --- cis/private/tools/zeitaufzeichnung_projektliste.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cis/private/tools/zeitaufzeichnung_projektliste.php b/cis/private/tools/zeitaufzeichnung_projektliste.php index 4621c4a66..177f1f8aa 100644 --- a/cis/private/tools/zeitaufzeichnung_projektliste.php +++ b/cis/private/tools/zeitaufzeichnung_projektliste.php @@ -559,9 +559,11 @@ $totalworktimewidth = 13; $worktimewidth = 14; $timecolumnswidth = 2 * $daywidth + $totalworktimewidth + $worktimewidth; -if ($nrProjects < 1)//no projekts - merge all cells and write notice +if ($nrProjects < 1) //no projekts - write notice { - $projektnames[] = "Keine Projekte vorhanden"; + $worksheet =& $workbook->addWorksheet('Tabelle'); + $worksheet->setInputEncoding('utf-8'); + $worksheet->write(0,0,'Für diesen Zeitraum sind keine Projekte zugeordnet'); } foreach ($projektnames as $projektname) From 97818781b12990eba2ae4b8593ec2289a49f4291 Mon Sep 17 00:00:00 2001 From: Manfred Kindl Date: Fri, 1 Oct 2021 23:26:25 +0200 Subject: [PATCH 48/74] =?UTF-8?q?Admins=20k=C3=B6nnen=20Maximalstunden=20?= =?UTF-8?q?=C3=BCberschreiben?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Phrasenkorrektur Lektoren auf Lehrende --- content/lvplanung/lehrveranstaltungDBDML.php | 4 ++-- content/lvplanung/lehrveranstaltungoverlay.xul.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/content/lvplanung/lehrveranstaltungDBDML.php b/content/lvplanung/lehrveranstaltungDBDML.php index f764545a6..438844071 100644 --- a/content/lvplanung/lehrveranstaltungDBDML.php +++ b/content/lvplanung/lehrveranstaltungDBDML.php @@ -365,7 +365,7 @@ if(!$error) { if($row->summe>$max_stunden) { - if(!$fixangestellt) + if(!$fixangestellt && !$rechte->isBerechtigt('admin')) { if(!LehrauftragAufFirma($lem->mitarbeiter_uid)) { @@ -624,7 +624,7 @@ if(!$error) if($row_std = $db->db_fetch_object($result_std)) { //Grenze ueberschritten - if($row_std->summe>=$max_stunden) + if($row_std->summe>=$max_stunden && !$rechte->isBerechtigt('admin')) { $return = false; $error = true; diff --git a/content/lvplanung/lehrveranstaltungoverlay.xul.php b/content/lvplanung/lehrveranstaltungoverlay.xul.php index cbe9b89ec..f2cc27b2d 100644 --- a/content/lvplanung/lehrveranstaltungoverlay.xul.php +++ b/content/lvplanung/lehrveranstaltungoverlay.xul.php @@ -159,7 +159,7 @@ echo ' - + + + + @@ -1088,6 +1109,7 @@ function drawAllVersions($id) + @@ -1102,6 +1124,7 @@ function drawAllVersions($id) + + + + + From 45bb2881271216624ad47bc00398bf449a481839 Mon Sep 17 00:00:00 2001 From: KarpAlex Date: Wed, 13 Oct 2021 08:53:12 +0200 Subject: [PATCH 63/74] error monitoring (issues): renamded variables, improved comments --- .../controllers/system/issues/Issues.php | 9 +++++---- .../views/system/issues/issuesData.php | 20 +++++++++---------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/application/controllers/system/issues/Issues.php b/application/controllers/system/issues/Issues.php index 98787f703..f942b50d9 100644 --- a/application/controllers/system/issues/Issues.php +++ b/application/controllers/system/issues/Issues.php @@ -90,7 +90,7 @@ class Issues extends Auth_Controller private function _getOesForIssues() { // get oes of uid for which there is a current funktion - $all_oe_kurzbz_with_funktionen = array(); + $all_funktionen_oe_kurzbz = array(); $oe_kurzbz_for_funktion = array(); $benutzerfunktionRes = $this->BenutzerfunktionModel->getBenutzerFunktionByUid($this->_uid, null, date('Y-m-d'), date('Y-m-d')); @@ -101,13 +101,14 @@ class Issues extends Auth_Controller { foreach (getData($benutzerfunktionRes) as $benutzerfunktion) { - $all_oe_kurzbz_with_funktionen[$benutzerfunktion->oe_kurzbz][] = $benutzerfunktion->funktion_kurzbz; + $all_funktionen_oe_kurzbz[$benutzerfunktion->oe_kurzbz][] = $benutzerfunktion->funktion_kurzbz; // separate oes for the funktion needed for displaying issues if ($benutzerfunktion->funktion_kurzbz == self::FUNKTION_KURZBZ) { $oe_kurzbz_for_funktion[] = $benutzerfunktion->oe_kurzbz; + // permission also for all oes under the oe for which funktion is assigend $childOesFunktionRes = $this->OrganisationseinheitModel->getChilds($benutzerfunktion->oe_kurzbz); if (isError($childOesFunktionRes)) @@ -127,14 +128,14 @@ class Issues extends Auth_Controller } } - // add oes for which there is the issues_verwalten Berechtigung + // add oes for which there is the "manage issues" Berechtigung if (!$oe_kurzbz_berechtigt = $this->permissionlib->getOE_isEntitledFor(self::BERECHTIGUNG_KURZBZ)) show_error('Keine Berechtigung oder Fehler bei Berechtigungsprüfung'); $all_oe_kurzbz_berechtigt = array_unique(array_merge($oe_kurzbz_for_funktion, $oe_kurzbz_berechtigt)); return array( - 'all_oe_kurzbz_with_funktionen' => $all_oe_kurzbz_with_funktionen, + 'all_funktionen_oe_kurzbz' => $all_funktionen_oe_kurzbz, 'all_oe_kurzbz_berechtigt' => $all_oe_kurzbz_berechtigt ); } diff --git a/application/views/system/issues/issuesData.php b/application/views/system/issues/issuesData.php index 2b4551603..1f0bf12b0 100644 --- a/application/views/system/issues/issuesData.php +++ b/application/views/system/issues/issuesData.php @@ -1,7 +1,7 @@ $funktionen_kurzbz) + foreach ($all_funktionen_oe_kurzbz as $oe_kurzbz => $funktionen_kurzbz) { foreach ($funktionen_kurzbz as $funktion_kurzbz) { @@ -39,25 +39,25 @@ if (!isEmptyArray($all_oe_kurzbz_with_funktionen)) $query .= "))"; // close AND of exists, and exists -// show issue if it is assigend to oe of uid or to student of oe of uid +// show issue if it is assigend to oe of logged in user or to student of oe of logged in user if (!isEmptyArray($all_oe_kurzbz_berechtigt)) { - $query .= " OR iss.oe_kurzbz IN $ALL_OE_KURZBZ_BERECHTIGT /* if error is for studiengang oe */"; + $query .= " OR iss.oe_kurzbz IN $ALL_OE_KURZBZ_BERECHTIGT /* if issue is for oe */"; - $query .= " OR (iss.oe_kurzbz IS NULL AND EXISTS ( /* if person_id of error is a student of studiengang oe */ + $query .= " OR (iss.oe_kurzbz IS NULL AND EXISTS ( /* if person_id of issue is a student of studiengang oe */ SELECT 1 FROM public.tbl_prestudent ps JOIN public.tbl_prestudentstatus pss USING (prestudent_id) JOIN public.tbl_studiengang stg USING (studiengang_kz) WHERE person_id = iss.person_id AND stg.oe_kurzbz IN $ALL_OE_KURZBZ_BERECHTIGT AND pss.status_kurzbz IN $RELEVANT_PRESTUDENT_STATUS - AND NOT EXISTS (SELECT 1 + AND NOT EXISTS (SELECT 1 /* irrelevant if already finished studies and studied a while ago */ FROM public.tbl_prestudentstatus ps_finished JOIN public.tbl_studiensemester sem_finished USING (studiensemester_kurzbz) - WHERE prestudent_id = ps.prestudent_id /* irrelevant if already finished studies and studied a while ago */ + WHERE prestudent_id = ps.prestudent_id AND status_kurzbz IN ('Absolvent','Abbrecher','Abgewiesener') AND datum::date + interval '2 months' < NOW() - AND EXISTS (SELECT 1 FROM public.tbl_prestudent /* if more recent prestudent exists, their oe should get the issue */ + AND EXISTS (SELECT 1 FROM public.tbl_prestudent /* if more recent prestudent exists, still display the issue */ JOIN public.tbl_prestudentstatus USING (prestudent_id) JOIN public.tbl_studiensemester USING (studiensemester_kurzbz) WHERE tbl_prestudentstatus.status_kurzbz IN $RELEVANT_PRESTUDENT_STATUS From 4777c0414fd7094aaecc5503320dcecf993fae2b Mon Sep 17 00:00:00 2001 From: KarpAlex Date: Wed, 13 Oct 2021 09:15:58 +0200 Subject: [PATCH 64/74] dbupdate_3.3.php: fixed line break --- system/dbupdate_3.3.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/dbupdate_3.3.php b/system/dbupdate_3.3.php index b2d21c356..6652da78e 100644 --- a/system/dbupdate_3.3.php +++ b/system/dbupdate_3.3.php @@ -5203,7 +5203,7 @@ if($result = $db->db_query("SELECT 1 FROM system.tbl_app WHERE app='dvuh'")) if(!$db->db_query($qry)) echo 'App: '.$db->db_last_error().'
'; else - echo ' Neue App dvuh in system.tbl_app hinzugefügt
'; + echo '
Neue App dvuh in system.tbl_app hinzugefügt'; } } From bd3ed4952bec8edee90d9ac846c1a0fb2c3d831a Mon Sep 17 00:00:00 2001 From: Harald Bamberger Date: Wed, 13 Oct 2021 12:26:03 +0200 Subject: [PATCH 65/74] add phrases for eucovidqr errormsgs --- system/phrasesupdate.php | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/system/phrasesupdate.php b/system/phrasesupdate.php index 6e24987c1..bf40b28cf 100644 --- a/system/phrasesupdate.php +++ b/system/phrasesupdate.php @@ -12732,6 +12732,46 @@ array( ) ) ), + array( + 'app' => 'core', + 'category' => 'eucovidqr', + 'phrase' => 'FehlerBeimSpeichernDesGueltigkeitsdatums', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => "Fehler beim Speichern des Gültigkeitsdatum", + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => "error saving valid date", + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), + array( + 'app' => 'core', + 'category' => 'eucovidqr', + 'phrase' => 'PersondatenInFH-CompleteStimmenNichtMitDemZertifikatUeberein', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => "Personendaten aus dem Zertifikat stimmen nicht dem angemeldeten Benutzer überein", + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => "person data from certificate does not match the logged in user", + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), ); From 2bb357ccbdb97da39bf50eca038a7a9fcc797efa Mon Sep 17 00:00:00 2001 From: Harald Bamberger Date: Wed, 13 Oct 2021 15:14:13 +0200 Subject: [PATCH 66/74] remove 3G from phrases --- system/phrasesupdate.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/system/phrasesupdate.php b/system/phrasesupdate.php index bf40b28cf..005d1a8a4 100644 --- a/system/phrasesupdate.php +++ b/system/phrasesupdate.php @@ -12500,13 +12500,13 @@ array( 'phrases' => array( array( 'sprache' => 'German', - 'text' => "3G Nachweis", + 'text' => "Zertifikat hochladen", 'description' => '', 'insertvon' => 'system' ), array( 'sprache' => 'English', - 'text' => "3G evidence", + 'text' => "upload certificate", 'description' => '', 'insertvon' => 'system' ) From 0e5e6866690cdeb41a2e626a93bb880c37d7ce06 Mon Sep 17 00:00:00 2001 From: FHBGLD <33415881+FHBGLD@users.noreply.github.com> Date: Thu, 14 Oct 2021 14:33:55 +0200 Subject: [PATCH 67/74] =?UTF-8?q?=C3=84nderungen=20bez=C3=BCglich=20genera?= =?UTF-8?q?teMatrikelnummer?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Hallo liebes Technikum Team, wie besprochen die Änderungen bezüglich generateMatrikelnummer. Als erstes die Erweiterung der Unterscheidung von Lehrgang und Studiengang. Weiters die Aufteilung von unseren AO Studiengängen zwischen 90010 bis 90019. Hoffe das dies für alle FH's so passt. Bitte um check ob dieser Code so übernommen werden kann. Danke und liebe Grüße Thomas und Michael --- content/student/studentDBDML.php | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/content/student/studentDBDML.php b/content/student/studentDBDML.php index e411dbaad..31da28b8a 100644 --- a/content/student/studentDBDML.php +++ b/content/student/studentDBDML.php @@ -109,12 +109,23 @@ if(!$rechte->isBerechtigt('admin') && !$rechte->isBerechtigt('assistenz') && !$r function generateMatrikelnummer($studiengang_kz, $studiensemester_kurzbz) { $db = new basis_db(); - + + + $studiengang_details = new studiengang(); + $studiengang_details->load($studiengang_kz); + + if (!isset($studiengang_details->studiengang_kz)) { + //wenn es diesen Studiengang nicht gibt (übergabeparamter falsch) + //wie müsste hier ein error handle gemacht werden? + } + $jahr = substr($studiensemester_kurzbz, 4); $art = substr($studiensemester_kurzbz, 0, 2); - if($studiengang_kz<0) - { + if( ($studiengang_kz < 0) + || ( isset($studiengang_details->typ) + && ($studiengang_details->typ == 'l')) + ) { $studiengang_kz=abs($studiengang_kz); //Lehrgang switch($art) @@ -136,8 +147,16 @@ function generateMatrikelnummer($studiengang_kz, $studiensemester_kurzbz) } if($art=='2' || $art=='4') $jahr = $jahr-1; - $matrikelnummer = sprintf("%02d",$jahr).$art.sprintf("%04d",$studiengang_kz); - + + + //FH-Burgenland - weil leider die AO Studiengänge aufgeteilt sind (AO sind normal 9+erhalter Nummer, matrikelnr/personenkz wird auch im DVUH Extension berücksichtigt) + if ($studiengang_kz >= 90010 && $studiengang_kz <= 90019) { + $matrikelnummer = sprintf("%02d",$jahr).$art.substr($studiengang_kz, 0, 4); + } else { + $matrikelnummer = sprintf("%02d",$jahr).$art.sprintf("%04d",$studiengang_kz); + } + + $qry = null; $qry = "SELECT matrikelnr FROM public.tbl_student WHERE matrikelnr LIKE '$matrikelnummer%' ORDER BY matrikelnr DESC LIMIT 1"; if($result = $db->db_query($qry)) From 19548bf5f9b276476d580b5126614c378c28d599 Mon Sep 17 00:00:00 2001 From: FHBGLD <33415881+FHBGLD@users.noreply.github.com> Date: Thu, 14 Oct 2021 14:36:58 +0200 Subject: [PATCH 68/74] Update studentDBDML.php --- content/student/studentDBDML.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/content/student/studentDBDML.php b/content/student/studentDBDML.php index 31da28b8a..df841115d 100644 --- a/content/student/studentDBDML.php +++ b/content/student/studentDBDML.php @@ -148,7 +148,6 @@ function generateMatrikelnummer($studiengang_kz, $studiensemester_kurzbz) if($art=='2' || $art=='4') $jahr = $jahr-1; - //FH-Burgenland - weil leider die AO Studiengänge aufgeteilt sind (AO sind normal 9+erhalter Nummer, matrikelnr/personenkz wird auch im DVUH Extension berücksichtigt) if ($studiengang_kz >= 90010 && $studiengang_kz <= 90019) { $matrikelnummer = sprintf("%02d",$jahr).$art.substr($studiengang_kz, 0, 4); @@ -156,7 +155,6 @@ function generateMatrikelnummer($studiengang_kz, $studiensemester_kurzbz) $matrikelnummer = sprintf("%02d",$jahr).$art.sprintf("%04d",$studiengang_kz); } - $qry = null; $qry = "SELECT matrikelnr FROM public.tbl_student WHERE matrikelnr LIKE '$matrikelnummer%' ORDER BY matrikelnr DESC LIMIT 1"; if($result = $db->db_query($qry)) From 1c7bd4986a18f1cbb9d6af6e34d17f24e3a46268 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20=C3=96sterreicher?= Date: Fri, 15 Oct 2021 15:12:23 +0200 Subject: [PATCH 69/74] =?UTF-8?q?Fehler=20beim=20Anlegen=20von=20neuen=20S?= =?UTF-8?q?tudieng=C3=A4ngen=20behoben?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/studiengang.class.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/include/studiengang.class.php b/include/studiengang.class.php index 08d6e1f13..530b072c0 100644 --- a/include/studiengang.class.php +++ b/include/studiengang.class.php @@ -500,7 +500,8 @@ class studiengang extends basis_db $qry = 'INSERT INTO public.tbl_studiengang (studiengang_kz, kurzbz, kurzbzlang, bezeichnung, english, typ, farbe, email, telefon, max_verband, max_semester, max_gruppe, erhalter_kz, bescheid, bescheidbgbl1, bescheidbgbl2, bescheidgz, bescheidvom, titelbescheidvom, aktiv, onlinebewerbung, orgform_kurzbz, zusatzinfo_html, - oe_kurzbz, moodle, sprache, testtool_sprachwahl, studienplaetze, lgartcode, mischform,projektarbeit_note_anzeige) VALUES ('. + oe_kurzbz, moodle, sprache, testtool_sprachwahl, studienplaetze, lgartcode, mischform,projektarbeit_note_anzeige, + melderelevant, foerderrelevant, standort_code) VALUES ('. $this->db_add_param($this->studiengang_kz, FHC_INTEGER).', '. $this->db_add_param($this->kurzbz).', '. $this->db_add_param($this->kurzbzlang).', '. @@ -1103,7 +1104,7 @@ class studiengang extends basis_db return false; } } - + /** * Laedt die Studiengänge die vom übergeben Typ sind * @param string $typ @@ -1118,13 +1119,13 @@ class studiengang extends basis_db tbl_studiengang.typ=".$this->db_add_param($typ)." ORDER BY kurzbz"; - + if($this->db_query($qry)) { while($row = $this->db_fetch_object()) { $obj = new studiengang(); - + $obj->studiengang_kz = $row->studiengang_kz; $obj->kurzbz = $row->kurzbz; $obj->kurzbzlang = $row->kurzbzlang; @@ -1160,10 +1161,10 @@ class studiengang extends basis_db $obj->melderelevant = $this->db_parse_bool($row->melderelevant); $obj->foerderrelevant = $this->db_parse_bool($row->foerderrelevant); $obj->standort_code = $row->standort_code; - + $obj->bezeichnung_arr['German'] = $obj->bezeichnung; $obj->bezeichnung_arr['English'] = $obj->english; - + $this->result[] = $obj; } return true; From 2bcf422d7ab5bcc6216bd36111b53fc9322f97c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20=C3=96sterreicher?= Date: Fri, 15 Oct 2021 16:01:52 +0200 Subject: [PATCH 70/74] Fixed Coding Guidelines --- content/student/studentDBDML.php | 33 ++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/content/student/studentDBDML.php b/content/student/studentDBDML.php index df841115d..dd3525d1d 100644 --- a/content/student/studentDBDML.php +++ b/content/student/studentDBDML.php @@ -109,23 +109,20 @@ if(!$rechte->isBerechtigt('admin') && !$rechte->isBerechtigt('assistenz') && !$r function generateMatrikelnummer($studiengang_kz, $studiensemester_kurzbz) { $db = new basis_db(); - - + $studiengang_details = new studiengang(); $studiengang_details->load($studiengang_kz); - - if (!isset($studiengang_details->studiengang_kz)) { - //wenn es diesen Studiengang nicht gibt (übergabeparamter falsch) - //wie müsste hier ein error handle gemacht werden? + + if (!isset($studiengang_details->studiengang_kz)) + { + return false; } - + $jahr = substr($studiensemester_kurzbz, 4); $art = substr($studiensemester_kurzbz, 0, 2); - if( ($studiengang_kz < 0) - || ( isset($studiengang_details->typ) - && ($studiengang_details->typ == 'l')) - ) { + if (($studiengang_kz < 0) || (isset($studiengang_details->typ) && ($studiengang_details->typ == 'l'))) + { $studiengang_kz=abs($studiengang_kz); //Lehrgang switch($art) @@ -147,14 +144,18 @@ function generateMatrikelnummer($studiengang_kz, $studiensemester_kurzbz) } if($art=='2' || $art=='4') $jahr = $jahr-1; - - //FH-Burgenland - weil leider die AO Studiengänge aufgeteilt sind (AO sind normal 9+erhalter Nummer, matrikelnr/personenkz wird auch im DVUH Extension berücksichtigt) - if ($studiengang_kz >= 90010 && $studiengang_kz <= 90019) { + + //FH-Burgenland - weil leider die AO Studiengänge aufgeteilt sind + //(AO sind normal 9+erhalter Nummer, matrikelnr/personenkz wird auch im DVUH Extension berücksichtigt) + if ($studiengang_kz >= 90010 && $studiengang_kz <= 90019) + { $matrikelnummer = sprintf("%02d",$jahr).$art.substr($studiengang_kz, 0, 4); - } else { + } + else + { $matrikelnummer = sprintf("%02d",$jahr).$art.sprintf("%04d",$studiengang_kz); } - + $qry = "SELECT matrikelnr FROM public.tbl_student WHERE matrikelnr LIKE '$matrikelnummer%' ORDER BY matrikelnr DESC LIMIT 1"; if($result = $db->db_query($qry)) From 7c81f5a64c2b10228670401ce1ac8b67ceb19d5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20=C3=96sterreicher?= Date: Fri, 15 Oct 2021 17:21:05 +0200 Subject: [PATCH 71/74] =?UTF-8?q?Gemeinde=20Update=20Infotext=20erg=C3=A4n?= =?UTF-8?q?zt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vilesci/stammdaten/set_gemeinde.php | 1 + 1 file changed, 1 insertion(+) diff --git a/vilesci/stammdaten/set_gemeinde.php b/vilesci/stammdaten/set_gemeinde.php index e461c7872..075f2c910 100644 --- a/vilesci/stammdaten/set_gemeinde.php +++ b/vilesci/stammdaten/set_gemeinde.php @@ -92,6 +92,7 @@ if (isset($_FILES['parsefile']) && $_FILES['parsefile']['error'] == 0)

Gemeinden aktualisieren

Diese Seite dient dazu die Gemeinde Kodex Tabelle zu aktualisieren.

+ Die Gemeinde Tabelle muss zuvor manuell geleert werden
Filesyntax:(Standard xlsx-File von https://www.bis.ac.at/BISSuite, gespeichert als csv! erste Zeile ist Header (alles was oberhalb ist kann entfernt werden) -> dann Daten)

Schlagworte
(Semikolon getrennt)
Mimetype
CIS-Suche CIS-Suche Kategorie Filename internMimetype Datum User
'.($dms_help->cis_suche == 'true'?'Ja':'Nein').' '.$dms_help->kategorie_kurzbz.' '.$dms_help->filename.''.$dms_help->mimetype.' '.$dms_help->insertamum.' '.$dms_help->insertvon.' @@ -1568,6 +1591,10 @@ function drawRenameForm($dms_id, $version, $page = NULL, $dpp = NULL, $searching Schlagworte
(Semikolon getrennt):
Mimetype
CIS-Suche: cis_suche == 'true'?'checked="checked"':'').'>
From 44c1e65011394e59db842e7bb617d7d17cd76f50 Mon Sep 17 00:00:00 2001 From: Harald Bamberger Date: Wed, 20 Oct 2021 15:48:34 +0200 Subject: [PATCH 72/74] getBetriebsmittel add parameter to only retrieve aktive users --- .../models/ressource/Betriebsmittelperson_model.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/application/models/ressource/Betriebsmittelperson_model.php b/application/models/ressource/Betriebsmittelperson_model.php index 87915cfa8..1a97d9e38 100644 --- a/application/models/ressource/Betriebsmittelperson_model.php +++ b/application/models/ressource/Betriebsmittelperson_model.php @@ -18,7 +18,7 @@ class Betriebsmittelperson_model extends DB_Model * @param bool $isRetourniert False to retrieve only active Betriebsmittel. * @return array|bool */ - public function getBetriebsmittel($person_id, $betriebsmitteltyp = null, $isRetourniert = null) + public function getBetriebsmittel($person_id, $betriebsmitteltyp = null, $isRetourniert = null, $onlyAktiveBenutzer=false) { if (!is_numeric($person_id)) { @@ -28,8 +28,12 @@ class Betriebsmittelperson_model extends DB_Model $this->addJoin('wawi.tbl_betriebsmittel', 'betriebsmittel_id'); + if( $onlyAktiveBenutzer ) { + $this->addJoin('public.tbl_benutzer b', 'b.uid = wawi.tbl_betriebsmittelperson.uid AND b.aktiv = \'t\''); + } + $condition = ' - person_id = '. $this->escape($person_id). ' + wawi.tbl_betriebsmittelperson.person_id = '. $this->escape($person_id). ' '; if (is_string($betriebsmitteltyp)) { From 860ca5df53ce5af110d4e47106bfab1ef0a6c118 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20=C3=96sterreicher?= Date: Wed, 20 Oct 2021 18:49:39 +0200 Subject: [PATCH 73/74] Spalte Wunschlektor umbenannt --- content/statistik/lvplanung.xls.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/statistik/lvplanung.xls.php b/content/statistik/lvplanung.xls.php index ff6faa508..970e66899 100644 --- a/content/statistik/lvplanung.xls.php +++ b/content/statistik/lvplanung.xls.php @@ -237,7 +237,7 @@ $worksheet->write($zeile,++$spalte,"Fixangestellt", $format_bold); $maxlength[$spalte]=10; $worksheet->write($zeile,++$spalte,"Vorjahrslektor", $format_bold); $maxlength[$spalte]=12; -$worksheet->write($zeile,++$spalte,"Wunschlektor", $format_bold); +$worksheet->write($zeile,++$spalte,"Lektor*in bestätigt", $format_bold); $maxlength[$spalte]=12; $worksheet->write($zeile,++$spalte,"Bezeichnung", $format_bold); $maxlength[$spalte]=25; From b0571e0a26de36198b438197e4e1318fcaecd39f Mon Sep 17 00:00:00 2001 From: Harald Bamberger Date: Thu, 21 Oct 2021 08:18:04 +0200 Subject: [PATCH 74/74] additional phrases for eucovidqr --- system/phrasesupdate.php | 48 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 44 insertions(+), 4 deletions(-) diff --git a/system/phrasesupdate.php b/system/phrasesupdate.php index 005d1a8a4..b7b2ed2e1 100644 --- a/system/phrasesupdate.php +++ b/system/phrasesupdate.php @@ -12560,13 +12560,13 @@ array( 'phrases' => array( array( 'sprache' => 'German', - 'text' => "Zertifikat als PDF hochladen", + 'text' => "Zertifikat als PDF hochladen (nur mit QR-Code, kein gescanntes Zertifikat)", 'description' => '', 'insertvon' => 'system' ), array( 'sprache' => 'English', - 'text' => "upload certificate pdf", + 'text' => "upload certificate pdf (only with qrcode, no scanned certificate)", 'description' => '', 'insertvon' => 'system' ) @@ -12580,13 +12580,13 @@ array( 'phrases' => array( array( 'sprache' => 'German', - 'text' => "Validierungsergebnis / aktuelles Gültigkeitsdatum", + 'text' => "Validierungsergebnis / gespeichertes Gültigkeitsdatum", 'description' => '', 'insertvon' => 'system' ), array( 'sprache' => 'English', - 'text' => "validation result / current valid date", + 'text' => "validation result / stored valid date", 'description' => '', 'insertvon' => 'system' ) @@ -12772,6 +12772,46 @@ array( ) ) ), + array( + 'app' => 'core', + 'category' => 'eucovidqr', + 'phrase' => 'UploadSuccessful', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => "Das Gültigkeitsdatum wurde erfolgreich gespeichert.", + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => "validity date has been successfully stored.", + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), + array( + 'app' => 'core', + 'category' => 'eucovidqr', + 'phrase' => 'UploadFailed', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => "Es wurde kein Gültigkeitsdatum gespeichert.", + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => "validity date has not been stored.", + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), );