From 36beb927f19c510505ee914caa204340eef2eee1 Mon Sep 17 00:00:00 2001 From: ma0048 Date: Mon, 16 Mar 2026 09:51:08 +0100 Subject: [PATCH 1/3] rt login zusaetzlicher check, ob die anmeldung mit dem prestudent studienplan uebereinstimmt --- cis/testtool/login.php | 13 +++++++++++-- include/pruefling.class.php | 26 ++++++++++++++++++++++++++ locale/de-AT/testtool.php | 1 + locale/en-US/testtool.php | 1 + 4 files changed, 39 insertions(+), 2 deletions(-) diff --git a/cis/testtool/login.php b/cis/testtool/login.php index cfc1ba63b..c909bcd4f 100644 --- a/cis/testtool/login.php +++ b/cis/testtool/login.php @@ -142,7 +142,9 @@ if (isset($_REQUEST['prestudent'])) } if ($reihungstest_id != '' && $rt->load($reihungstest_id)) { - if ($rt->freigeschaltet) + $pruefling_registered = new Pruefling(); + $registered = $pruefling_registered->personRegisteredRT($ps->person_id, $rt->reihungstest_id, $ps->prestudent_id); + if ($rt->freigeschaltet && $registered) { // regenerate Session ID after Login session_regenerate_id(); @@ -282,7 +284,14 @@ if (isset($_REQUEST['prestudent'])) } else { - $alertmsg .= '
'.$p->t('testtool/reihungstestNichtFreigeschalten').'
'; + if (!$registered) + { + $alertmsg .= '
'.$p->t('testtool/reihungstestNichtRegistriert').'
'; + } + else + { + $alertmsg .= '
'.$p->t('testtool/reihungstestNichtFreigeschalten').'
'; + } } } else diff --git a/include/pruefling.class.php b/include/pruefling.class.php index efe660ca9..4ba2153fd 100644 --- a/include/pruefling.class.php +++ b/include/pruefling.class.php @@ -597,5 +597,31 @@ class pruefling extends basis_db return false; } } + + public function personRegisteredRT($person_id, $reihungstest_id, $prestudent_id) + { + $qry = "SELECT tbl_prestudent.prestudent_id + FROM public.tbl_rt_person + JOIN public.tbl_prestudent ON tbl_prestudent.person_id = tbl_rt_person.person_id + JOIN public.tbl_prestudentstatus ON tbl_prestudent.prestudent_id = tbl_prestudentstatus.prestudent_id AND status_kurzbz = 'Bewerber' + AND tbl_prestudentstatus.studienplan_id = tbl_rt_person.studienplan_id + WHERE tbl_rt_person.person_id = " . $this->db_add_param($person_id) . " + AND tbl_rt_person.rt_id = " . $this->db_add_param($reihungstest_id) . " + AND tbl_prestudent.prestudent_id = " . $this->db_add_param($prestudent_id) . " + LIMIT 1"; + + if($result = $this->db_query($qry)) + { + if ($this->db_num_rows($result) == 0) + return false; + else + return true; + } + else + { + $this->errormsg = 'Fehler bei einer Abfrage'; + return false; + } + } } ?> diff --git a/locale/de-AT/testtool.php b/locale/de-AT/testtool.php index 33c46b0a7..cf7f27cba 100644 --- a/locale/de-AT/testtool.php +++ b/locale/de-AT/testtool.php @@ -17,6 +17,7 @@ $this->phrasen['testtool/basic']='Basic'; $this->phrasen['testtool/basisgebiete']='Basisgebiete'; $this->phrasen['testtool/semester']='Semester'; $this->phrasen['testtool/reihungstestNichtFreigeschalten']='Der zuteilte Reihungstest ist noch nicht freigeschaltet'; +$this->phrasen['testtool/reihungstestNichtRegistriert']='Sie sind für den Reihungstest nicht registriert'; $this->phrasen['testtool/reihungstestKannNichtGeladenWerden']='Der Reihungstest dem Sie zugeteilt sind, kann nicht geladen werden. Melden Sie sich bitte bei der Reihungstestaufsicht.'; $this->phrasen['testtool/geburtsdatumStimmtNichtUeberein']='Ihr Geburtsdatum stimmt nicht mit unseren Daten überein. Bitte wenden Sie sich an die Aufsichtsperson'; $this->phrasen['testtool/home']='Home'; diff --git a/locale/en-US/testtool.php b/locale/en-US/testtool.php index 260b5ceea..4d63c1438 100644 --- a/locale/en-US/testtool.php +++ b/locale/en-US/testtool.php @@ -17,6 +17,7 @@ $this->phrasen['testtool/basic']='Basic'; $this->phrasen['testtool/basisgebiete']='Basic test'; $this->phrasen['testtool/semester']='Semester'; $this->phrasen['testtool/reihungstestNichtFreigeschalten']='The entrance examination assigned has not yet been activated.'; +$this->phrasen['testtool/reihungstestNichtRegistriert']='You are not registered for the placement test.'; $this->phrasen['testtool/reihungstestKannNichtGeladenWerden']='The placement test you are assigned to could not be loaded. Please contact the placement test supervisior.'; $this->phrasen['testtool/geburtsdatumStimmtNichtUeberein']='Your date of birth does not correspond to the data we have. Please speak to the supervisor. '; $this->phrasen['testtool/home']='Home'; From 13e8a1a9f61edd616cc229ee42926c033cb3ded3 Mon Sep 17 00:00:00 2001 From: ma0048 Date: Thu, 16 Apr 2026 14:21:02 +0200 Subject: [PATCH 2/3] bug fixed + infocenter performance --- .../views/system/infocenter/infocenterData.php | 13 +++---------- .../views/system/infocenter/onboardingData.php | 15 ++++----------- cis/testtool/login.php | 8 ++++---- include/pruefling.class.php | 5 ++--- system/dbupdate_3.4.php | 1 + .../75888_reihungstest_mehrfachdurchfuehrung.php | 15 +++++++++++++++ 6 files changed, 29 insertions(+), 28 deletions(-) create mode 100644 system/dbupdate_3.4/75888_reihungstest_mehrfachdurchfuehrung.php diff --git a/application/views/system/infocenter/infocenterData.php b/application/views/system/infocenter/infocenterData.php index ebfd1db37..d1ce87422 100644 --- a/application/views/system/infocenter/infocenterData.php +++ b/application/views/system/infocenter/infocenterData.php @@ -315,22 +315,15 @@ WHERE tpl.app = '.$APP.' ) pl USING(person_id) LEFT JOIN ( - SELECT + SELECT DISTINCT ON (tbl_rueckstellung.person_id) tbl_rueckstellung.person_id, tbl_rueckstellung.datum_bis, tbl_rueckstellung.status_kurzbz, array_to_json(bezeichnung_mehrsprachig::varchar[])->>0 as bezeichnung FROM public.tbl_rueckstellung JOIN public.tbl_rueckstellung_status USING(status_kurzbz) - JOIN public.tbl_person sp ON tbl_rueckstellung.person_id = sp.person_id - WHERE tbl_rueckstellung.rueckstellung_id = - ( - SELECT srueck.rueckstellung_id - FROM public.tbl_rueckstellung srueck - WHERE srueck.person_id = tbl_rueckstellung.person_id - AND datum_bis >= NOW() - ORDER BY srueck.datum_bis DESC LIMIT 1 - ) + WHERE tbl_rueckstellung.datum_bis >= NOW() + ORDER BY tbl_rueckstellung.person_id, tbl_rueckstellung.datum_bis DESC ) rueck ON rueck.person_id = p.person_id WHERE EXISTS ( diff --git a/application/views/system/infocenter/onboardingData.php b/application/views/system/infocenter/onboardingData.php index 5ee66fdde..bf126f283 100644 --- a/application/views/system/infocenter/onboardingData.php +++ b/application/views/system/infocenter/onboardingData.php @@ -24,22 +24,15 @@ $query = ' WHERE tpl.app = '.$APP.' ) pl ON p.person_id = pl.person_id LEFT JOIN ( - SELECT + SELECT DISTINCT ON (tbl_rueckstellung.person_id) tbl_rueckstellung.person_id, tbl_rueckstellung.datum_bis, tbl_rueckstellung.status_kurzbz, array_to_json(bezeichnung_mehrsprachig::varchar[])->>0 as bezeichnung FROM public.tbl_rueckstellung - JOIN public.tbl_rueckstellung_status USING(status_kurzbz) - JOIN public.tbl_person sp ON tbl_rueckstellung.person_id = sp.person_id - WHERE tbl_rueckstellung.rueckstellung_id = - ( - SELECT srueck.rueckstellung_id - FROM public.tbl_rueckstellung srueck - WHERE srueck.person_id = tbl_rueckstellung.person_id - AND datum_bis >= NOW() - ORDER BY srueck.datum_bis DESC LIMIT 1 - ) + JOIN public.tbl_rueckstellung_status USING(status_kurzbz) + WHERE tbl_rueckstellung.datum_bis >= NOW() + ORDER BY tbl_rueckstellung.person_id, tbl_rueckstellung.datum_bis DESC ) rueck ON rueck.person_id = p.person_id WHERE p.person_id NOT IN (SELECT person_id FROM public.tbl_prestudent)'; diff --git a/cis/testtool/login.php b/cis/testtool/login.php index c909bcd4f..60447ee52 100644 --- a/cis/testtool/login.php +++ b/cis/testtool/login.php @@ -142,9 +142,9 @@ if (isset($_REQUEST['prestudent'])) } if ($reihungstest_id != '' && $rt->load($reihungstest_id)) { - $pruefling_registered = new Pruefling(); - $registered = $pruefling_registered->personRegisteredRT($ps->person_id, $rt->reihungstest_id, $ps->prestudent_id); - if ($rt->freigeschaltet && $registered) + $pruefling_exist = new Pruefling(); + $alreadyInRT = $pruefling_exist->personAlreadyInRT($ps->person_id, $rt->reihungstest_id, $ps->prestudent_id); + if ($rt->freigeschaltet && !$alreadyInRT) { // regenerate Session ID after Login session_regenerate_id(); @@ -284,7 +284,7 @@ if (isset($_REQUEST['prestudent'])) } else { - if (!$registered) + if ($alreadyInRT) { $alertmsg .= '
'.$p->t('testtool/reihungstestNichtRegistriert').'
'; } diff --git a/include/pruefling.class.php b/include/pruefling.class.php index 4ba2153fd..1f2e05785 100644 --- a/include/pruefling.class.php +++ b/include/pruefling.class.php @@ -597,8 +597,7 @@ class pruefling extends basis_db return false; } } - - public function personRegisteredRT($person_id, $reihungstest_id, $prestudent_id) + public function personAlreadyInRT($person_id, $reihungstest_id, $prestudent_id) { $qry = "SELECT tbl_prestudent.prestudent_id FROM public.tbl_rt_person @@ -607,7 +606,7 @@ class pruefling extends basis_db AND tbl_prestudentstatus.studienplan_id = tbl_rt_person.studienplan_id WHERE tbl_rt_person.person_id = " . $this->db_add_param($person_id) . " AND tbl_rt_person.rt_id = " . $this->db_add_param($reihungstest_id) . " - AND tbl_prestudent.prestudent_id = " . $this->db_add_param($prestudent_id) . " + AND tbl_prestudent.prestudent_id != " . $this->db_add_param($prestudent_id) . " LIMIT 1"; if($result = $this->db_query($qry)) diff --git a/system/dbupdate_3.4.php b/system/dbupdate_3.4.php index 4ddb38203..04d07c36b 100644 --- a/system/dbupdate_3.4.php +++ b/system/dbupdate_3.4.php @@ -92,6 +92,7 @@ require_once('dbupdate_3.4/68744_StV_settings.php'); require_once('dbupdate_3.4/62889_reihungstest_ueberwachung_mit_constructor.php'); require_once('dbupdate_3.4/71399_dashboard_update_widget_paths.php'); require_once('dbupdate_3.4/71645_studvw_messagetab_ladezeit.php'); +require_once('dbupdate_3.4/75888_reihungstest_mehrfachdurchfuehrung.php'); // *** Pruefung und hinzufuegen der neuen Attribute und Tabellen echo '

Pruefe Tabellen und Attribute!

'; diff --git a/system/dbupdate_3.4/75888_reihungstest_mehrfachdurchfuehrung.php b/system/dbupdate_3.4/75888_reihungstest_mehrfachdurchfuehrung.php new file mode 100644 index 000000000..97c44d57d --- /dev/null +++ b/system/dbupdate_3.4/75888_reihungstest_mehrfachdurchfuehrung.php @@ -0,0 +1,15 @@ +db_query("SELECT * FROM pg_class WHERE relname='idx_tbl_benutzerfunktion_uid'")) +{ + if ($db->db_num_rows($result) == 0) + { + $qry = "CREATE INDEX idx_tbl_benutzerfunktion_uid ON public.tbl_benutzerfunktion USING btree (uid)"; + + if (! $db->db_query($qry)) + echo 'idx_tbl_benutzerfunktion_uid: ' . $db->db_last_error() . '
'; + else + echo 'Index idx_tbl_benutzerfunktion_uid angelegt
'; + } +} From bf5ab6b7dd14fc36d2eeca5d46afdde9d0d77d8c Mon Sep 17 00:00:00 2001 From: ma0048 Date: Tue, 5 May 2026 15:19:57 +0200 Subject: [PATCH 3/3] nur prestudent mit dem bewerber status beruecksichtigen --- include/pruefling.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/include/pruefling.class.php b/include/pruefling.class.php index 1f2e05785..698624c73 100644 --- a/include/pruefling.class.php +++ b/include/pruefling.class.php @@ -607,6 +607,7 @@ class pruefling extends basis_db WHERE tbl_rt_person.person_id = " . $this->db_add_param($person_id) . " AND tbl_rt_person.rt_id = " . $this->db_add_param($reihungstest_id) . " AND tbl_prestudent.prestudent_id != " . $this->db_add_param($prestudent_id) . " + AND get_rolle_prestudent(tbl_prestudent.prestudent_id, NULL) = 'Bewerber' LIMIT 1"; if($result = $this->db_query($qry))