From 625b3c74c42a6a2299156abeae0a13f52e4d3265 Mon Sep 17 00:00:00 2001 From: ma0068 Date: Wed, 7 Sep 2022 09:22:06 +0200 Subject: [PATCH 1/6] =?UTF-8?q?Bewerbungstool:=20keine=20ZGV=20bei=20Abbre?= =?UTF-8?q?chern,=20Ber=C3=BCcksichtigung=20studentstatus=20f=C3=BCr=20Dok?= =?UTF-8?q?umenthandling?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/prestudent.class.php | 63 +++++++++++++++++++++++++++++++++--- 1 file changed, 59 insertions(+), 4 deletions(-) diff --git a/include/prestudent.class.php b/include/prestudent.class.php index a958120cb..f5d59fd73 100644 --- a/include/prestudent.class.php +++ b/include/prestudent.class.php @@ -588,7 +588,7 @@ class prestudent extends person AND status_kurzbz = 'Interessent' - AND + AND NOT EXISTS ( SELECT 1 FROM public.tbl_prestudentstatus WHERE prestudent_id=tbl_prestudent.prestudent_id AND status_kurzbz='Abgewiesener' )"; @@ -2335,15 +2335,18 @@ class prestudent extends person return false; } - - $qry = "SELECT count(*) as anzahl FROM public.tbl_prestudent + $qry = "SELECT count(*) as anzahl + FROM public.tbl_prestudent pt JOIN public.tbl_prestudentstatus USING (prestudent_id) JOIN public.tbl_studiengang USING (studiengang_kz) WHERE person_id = ".$this->db_add_param($person_id, FHC_INTEGER)." + AND NOT EXISTS + (SELECT * FROM public.tbl_prestudentstatus ps + WHERE ps.prestudent_id = pt.prestudent_id + AND status_kurzbz not in ('Abbrecher')) AND status_kurzbz in ('Absolvent','Diplomand','Unterbrecher','Student') AND typ in ('b','m','d')"; - if ($this->db_query($qry)) { if ($row = $this->db_fetch_object()) @@ -2372,6 +2375,58 @@ class prestudent extends person } } + /** + * Prueft, ob eine Person bereits einmal auf der FHTW Studierend war + * @param int $person_id ID der zu überprüfenden Person. + * @return true wenn vorhanden + * false wenn nicht vorhanden + * false und errormsg wenn Fehler aufgetreten ist + */ +public function isPastStudent($person_id) +{ + if (!is_numeric($person_id)) + { + $this->errormsg = 'Person_id muss eine gueltige Zahl sein'; + return false; + } + + $qry = "SELECT count(*) as anzahl + FROM public.tbl_prestudent pt + JOIN public.tbl_prestudentstatus USING (prestudent_id) + JOIN public.tbl_studiengang USING (studiengang_kz) + WHERE person_id = ".$this->db_add_param($person_id, FHC_INTEGER)." + AND status_kurzbz in ('Student') + AND typ in ('b','m','d') + "; + + if ($this->db_query($qry)) + { + if ($row = $this->db_fetch_object()) + { + if ($row->anzahl > 0) + { + $this->errormsg = ''; + return true; + } + else + { + $this->errormsg = ''; + return false; + } + } + else + { + $this->errormsg = 'Fehler beim Laden der Daten'; + return false; + } + } + else + { + $this->errormsg = 'Fehler beim Laden der Daten'; + return false; + } +} + /** * Befüllt MasterZGV-Felder: Nation mit Österreich und MasterZGV-code mit FH-Bachelor(I) * @param int $person_id Personenkennzeichen. From 604592cdd1d485498e6a0601b9cb2c1535dbf462 Mon Sep 17 00:00:00 2001 From: ma0068 Date: Wed, 7 Sep 2022 15:27:47 +0200 Subject: [PATCH 2/6] Bewerbungstool: neue Funktion isPastAbbrecher() --- include/prestudent.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/prestudent.class.php b/include/prestudent.class.php index f5d59fd73..cc48cd17d 100644 --- a/include/prestudent.class.php +++ b/include/prestudent.class.php @@ -2376,13 +2376,13 @@ class prestudent extends person } /** - * Prueft, ob eine Person bereits einmal auf der FHTW Studierend war + * Prueft, ob eine Person Abbrecher war * @param int $person_id ID der zu überprüfenden Person. * @return true wenn vorhanden * false wenn nicht vorhanden * false und errormsg wenn Fehler aufgetreten ist */ -public function isPastStudent($person_id) +public function isPastAbbrecher($person_id) { if (!is_numeric($person_id)) { @@ -2395,7 +2395,7 @@ public function isPastStudent($person_id) JOIN public.tbl_prestudentstatus USING (prestudent_id) JOIN public.tbl_studiengang USING (studiengang_kz) WHERE person_id = ".$this->db_add_param($person_id, FHC_INTEGER)." - AND status_kurzbz in ('Student') + AND status_kurzbz in ('Abbrecher') AND typ in ('b','m','d') "; From 3570b2c04dd80e222ebc0e77454db999fbd262bc Mon Sep 17 00:00:00 2001 From: ma0068 Date: Wed, 21 Sep 2022 12:54:41 +0200 Subject: [PATCH 3/6] =?UTF-8?q?BT:=20Adaptierung=20Pr=C3=BCfung=20auf=20Ab?= =?UTF-8?q?brecher=20auf=20aktuellen=20Prestudentstatus?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/prestudent.class.php | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/include/prestudent.class.php b/include/prestudent.class.php index cc48cd17d..9ba52dccd 100644 --- a/include/prestudent.class.php +++ b/include/prestudent.class.php @@ -2336,15 +2336,10 @@ class prestudent extends person } $qry = "SELECT count(*) as anzahl - FROM public.tbl_prestudent pt + FROM public.tbl_prestudent JOIN public.tbl_prestudentstatus USING (prestudent_id) JOIN public.tbl_studiengang USING (studiengang_kz) WHERE person_id = ".$this->db_add_param($person_id, FHC_INTEGER)." - AND NOT EXISTS - (SELECT * FROM public.tbl_prestudentstatus ps - WHERE ps.prestudent_id = pt.prestudent_id - AND status_kurzbz not in ('Abbrecher')) - AND status_kurzbz in ('Absolvent','Diplomand','Unterbrecher','Student') AND typ in ('b','m','d')"; if ($this->db_query($qry)) @@ -2378,11 +2373,11 @@ class prestudent extends person /** * Prueft, ob eine Person Abbrecher war * @param int $person_id ID der zu überprüfenden Person. - * @return true wenn vorhanden + * @return true wenn letzter Status Abbrecher und nicht Student ist * false wenn nicht vorhanden * false und errormsg wenn Fehler aufgetreten ist */ -public function isPastAbbrecher($person_id) +public function isAbbrecher($person_id) { if (!is_numeric($person_id)) { @@ -2390,20 +2385,22 @@ public function isPastAbbrecher($person_id) return false; } - $qry = "SELECT count(*) as anzahl - FROM public.tbl_prestudent pt - JOIN public.tbl_prestudentstatus USING (prestudent_id) - JOIN public.tbl_studiengang USING (studiengang_kz) - WHERE person_id = ".$this->db_add_param($person_id, FHC_INTEGER)." - AND status_kurzbz in ('Abbrecher') - AND typ in ('b','m','d') + $qry = "SELECT s.status_kurzbz + FROM public.tbl_prestudent + JOIN public.tbl_prestudentstatus s USING (prestudent_id) + JOIN public.tbl_studiengang USING (studiengang_kz) + WHERE person_id = ".$this->db_add_param($person_id)." + AND status_kurzbz in ('Abbrecher','Student') + AND typ in ('b','m','d') + ORDER BY s.bestaetigtam DESC NULLS LAST, s.insertamum DESC + LIMIT 1 "; if ($this->db_query($qry)) { if ($row = $this->db_fetch_object()) { - if ($row->anzahl > 0) + if ($row->status_kurzbz == 'Abbrecher') { $this->errormsg = ''; return true; From 382da823e4e22f3464bca656c425eee0643850cd Mon Sep 17 00:00:00 2001 From: ma0068 Date: Fri, 14 Oct 2022 16:12:41 +0200 Subject: [PATCH 4/6] Erweiterung Funktion existsZGV um LastStatusPrestudent --- include/prestudent.class.php | 113 +++++++++++------------------------ 1 file changed, 34 insertions(+), 79 deletions(-) diff --git a/include/prestudent.class.php b/include/prestudent.class.php index 9ba52dccd..cd7eece35 100644 --- a/include/prestudent.class.php +++ b/include/prestudent.class.php @@ -2335,94 +2335,49 @@ class prestudent extends person return false; } - $qry = "SELECT count(*) as anzahl - FROM public.tbl_prestudent - JOIN public.tbl_prestudentstatus USING (prestudent_id) - JOIN public.tbl_studiengang USING (studiengang_kz) - WHERE person_id = ".$this->db_add_param($person_id, FHC_INTEGER)." - AND typ in ('b','m','d')"; - if ($this->db_query($qry)) - { - if ($row = $this->db_fetch_object()) - { - if ($row->anzahl > 0) + echo $qry = " + SELECT t.prestudent_id, t.status_kurzbz, t.bestaetigtam FROM + ( + SELECT prestudent_id, status_kurzbz, bestaetigtam, + RANK() OVER (PARTITION BY prestudent_id ORDER BY bestaetigtam DESC) stat_rank + FROM public.tbl_prestudent + JOIN public.tbl_prestudentstatus USING (prestudent_id) + WHERE person_id= ".$this->db_add_param($person_id, FHC_INTEGER)." + AND bestaetigtam is not NULL + AND status_kurzbz in ('Absolvent','Diplomand','Unterbrecher','Student','Abbrecher') + ) as t + WHERE stat_rank = 1"; + + $db = new basis_db(); + $arrayPrestudents = array(); + + if ($db->db_query($qry)) { - $this->errormsg = ''; - return true; + $num_rows = $db->db_num_rows(); + + if ($num_rows > 0) + { + while ($row = $db->db_fetch_object()) + { + if ($row->status_kurzbz != 'Abbrecher') + $arrayPrestudents[] = $row->status_kurzbz; + } + if ($arrayPrestudents) + { + return true; + } + } + else + return false; } else { - $this->errormsg = ''; + $this->errormsg = 'Fehler beim Laden der Daten'; return false; } - } - else - { - $this->errormsg = 'Fehler beim Laden der Daten'; - return false; - } - } - else - { - $this->errormsg = 'Fehler beim Laden der Daten'; - return false; - } } - /** - * Prueft, ob eine Person Abbrecher war - * @param int $person_id ID der zu überprüfenden Person. - * @return true wenn letzter Status Abbrecher und nicht Student ist - * false wenn nicht vorhanden - * false und errormsg wenn Fehler aufgetreten ist - */ -public function isAbbrecher($person_id) -{ - if (!is_numeric($person_id)) - { - $this->errormsg = 'Person_id muss eine gueltige Zahl sein'; - return false; - } - - $qry = "SELECT s.status_kurzbz - FROM public.tbl_prestudent - JOIN public.tbl_prestudentstatus s USING (prestudent_id) - JOIN public.tbl_studiengang USING (studiengang_kz) - WHERE person_id = ".$this->db_add_param($person_id)." - AND status_kurzbz in ('Abbrecher','Student') - AND typ in ('b','m','d') - ORDER BY s.bestaetigtam DESC NULLS LAST, s.insertamum DESC - LIMIT 1 - "; - - if ($this->db_query($qry)) - { - if ($row = $this->db_fetch_object()) - { - if ($row->status_kurzbz == 'Abbrecher') - { - $this->errormsg = ''; - return true; - } - else - { - $this->errormsg = ''; - return false; - } - } - else - { - $this->errormsg = 'Fehler beim Laden der Daten'; - return false; - } - } - else - { - $this->errormsg = 'Fehler beim Laden der Daten'; - return false; - } -} /** * Befüllt MasterZGV-Felder: Nation mit Österreich und MasterZGV-code mit FH-Bachelor(I) From 458117fced68fa5106f0025dd35fccf166ad1595 Mon Sep 17 00:00:00 2001 From: ma0068 Date: Fri, 14 Oct 2022 16:24:45 +0200 Subject: [PATCH 5/6] =?UTF-8?q?Funktion=20existsZGV:=20prestudents=20mit?= =?UTF-8?q?=20Last=20Status=20Abbrecher=20werden=20nicht=20ber=C3=BCcksich?= =?UTF-8?q?tigt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/prestudent.class.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/include/prestudent.class.php b/include/prestudent.class.php index cd7eece35..b9909306c 100644 --- a/include/prestudent.class.php +++ b/include/prestudent.class.php @@ -2345,7 +2345,7 @@ class prestudent extends person JOIN public.tbl_prestudentstatus USING (prestudent_id) WHERE person_id= ".$this->db_add_param($person_id, FHC_INTEGER)." AND bestaetigtam is not NULL - AND status_kurzbz in ('Absolvent','Diplomand','Unterbrecher','Student','Abbrecher') + AND status_kurzbz in ('Absolvent','Diplomand','Unterbrecher','Student') ) as t WHERE stat_rank = 1"; @@ -2360,7 +2360,6 @@ class prestudent extends person { while ($row = $db->db_fetch_object()) { - if ($row->status_kurzbz != 'Abbrecher') $arrayPrestudents[] = $row->status_kurzbz; } if ($arrayPrestudents) From 4f71a274e21d036a659da1796af3b7a619fcc6fe Mon Sep 17 00:00:00 2001 From: ma0068 Date: Mon, 17 Oct 2022 08:36:36 +0200 Subject: [PATCH 6/6] =?UTF-8?q?Update=20=C3=9Cberpr=C3=BCfungen=20ZGV=20mi?= =?UTF-8?q?t=20get=5Frolle=5Fprestudent()?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/prestudent.class.php | 88 +++++++++++++++++------------------- 1 file changed, 41 insertions(+), 47 deletions(-) diff --git a/include/prestudent.class.php b/include/prestudent.class.php index b9909306c..31d5f69ef 100644 --- a/include/prestudent.class.php +++ b/include/prestudent.class.php @@ -2327,55 +2327,49 @@ class prestudent extends person * false wenn nicht vorhanden * false und errormsg wenn Fehler aufgetreten ist */ - public function existsZGVIntern($person_id) - { - if (!is_numeric($person_id)) - { - $this->errormsg = 'Person_id muss eine gueltige Zahl sein'; - return false; - } + public function existsZGVIntern($person_id) + { + if (!is_numeric($person_id)) + { + $this->errormsg = 'Person_id muss eine gueltige Zahl sein'; + return false; + } + $qry = "SELECT count(*) as anzahl FROM public.tbl_prestudent + JOIN public.tbl_prestudentstatus USING (prestudent_id) + JOIN public.tbl_studiengang USING (studiengang_kz) + WHERE person_id = ".$this->db_add_param($person_id, FHC_INTEGER)." + AND status_kurzbz in ('Absolvent','Diplomand','Unterbrecher','Student') + AND typ = 'b' + AND get_rolle_prestudent(prestudent_id, null) != 'Abbrecher';"; - echo $qry = " - SELECT t.prestudent_id, t.status_kurzbz, t.bestaetigtam FROM - ( - SELECT prestudent_id, status_kurzbz, bestaetigtam, - RANK() OVER (PARTITION BY prestudent_id ORDER BY bestaetigtam DESC) stat_rank - FROM public.tbl_prestudent - JOIN public.tbl_prestudentstatus USING (prestudent_id) - WHERE person_id= ".$this->db_add_param($person_id, FHC_INTEGER)." - AND bestaetigtam is not NULL - AND status_kurzbz in ('Absolvent','Diplomand','Unterbrecher','Student') - ) as t - WHERE stat_rank = 1"; - - $db = new basis_db(); - $arrayPrestudents = array(); - - if ($db->db_query($qry)) - { - $num_rows = $db->db_num_rows(); - - if ($num_rows > 0) - { - while ($row = $db->db_fetch_object()) - { - $arrayPrestudents[] = $row->status_kurzbz; - } - if ($arrayPrestudents) - { - return true; - } - } - else - return false; - } - else - { - $this->errormsg = 'Fehler beim Laden der Daten'; - return false; - } - } + if ($this->db_query($qry)) + { + if ($row = $this->db_fetch_object()) + { + if ($row->anzahl > 0) + { + $this->errormsg = ''; + return true; + } + else + { + $this->errormsg = ''; + return false; + } + } + else + { + $this->errormsg = 'Fehler beim Laden der Daten'; + return false; + } + } + else + { + $this->errormsg = 'Fehler beim Laden der Daten'; + return false; + } + } /**