diff --git a/application/config/search.php b/application/config/search.php index e4876ec8f..bf98d3e93 100644 --- a/application/config/search.php +++ b/application/config/search.php @@ -209,6 +209,20 @@ $config['student'] = [ JOIN public.tbl_person p USING(person_id)" ]; +$config['studentcis'] = $config['student']; +unset($config['studentcis']['fields']['email']); +$config['studentcis']['resultfields'] = [ + "s.student_uid AS uid", + "s.matrikelnr", + "p.person_id", + "(p.vorname || ' ' || p.nachname) AS name", + "ARRAY[s.student_uid || '@' || '" . DOMAIN . "'] AS email", + "CASE + WHEN p.foto IS NOT NULL THEN 'data:image/jpeg' || CONVERT_FROM(DECODE('3b','hex'), 'UTF8') || 'base64,' || p.foto + ELSE NULL END + AS photo_url" +]; + $config['prestudent'] = [ 'primarykey' => 'prestudent_id', 'table' => 'public.tbl_prestudent', @@ -652,6 +666,11 @@ $config['organisationunit'] = [ ON (oe_parent.organisationseinheittyp_kurzbz = type_parent.organisationseinheittyp_kurzbz)" ]; +$config['active_organisationunit'] = $config['organisationunit']; +$config['active_organisationunit']['alias'] = ['aou', 'aktive organisationseinheit', 'aoe']; +$config['active_organisationunit']['prepare'] = 'active_organisationseinheit AS (SELECT * FROM public.tbl_organisationseinheit WHERE aktiv = true)'; +$config['active_organisationunit']['table'] = 'active_organisationseinheit'; + $config['room'] = [ 'alias' => ['raum'], 'primarykey' => 'ort_kurzbz', diff --git a/application/libraries/SearchLib.php b/application/libraries/SearchLib.php index f48bf7e2e..0c942c436 100644 --- a/application/libraries/SearchLib.php +++ b/application/libraries/SearchLib.php @@ -668,8 +668,9 @@ class SearchLib SELECT " . $this->_formatPrimarykeys($table_config['primarykey']) . ", rank / " . $count . " AS rank FROM " . $current_select; } - if ($or_with[0] === "RECURSIVE") { - if ($sqlWith[0] !== "RECURSIVE") + if ($or_with[0] === "RECURSIVE") + { + if (empty($sqlWith) || $sqlWith[0] !== "RECURSIVE") array_unshift($sqlWith, "RECURSIVE"); array_shift($or_with); } diff --git a/public/js/apps/Cis.js b/public/js/apps/Cis.js index 29784b225..994efbec8 100644 --- a/public/js/apps/Cis.js +++ b/public/js/apps/Cis.js @@ -17,9 +17,9 @@ const app = Vue.createApp({ calcheightonly: true, types: [ "employee", - "student", + "studentcis", "room", - "organisationunit" + "active_organisationunit" ], actions: { employee: { diff --git a/public/js/components/searchbar/searchbar.js b/public/js/components/searchbar/searchbar.js index 4acdf0288..ec08dd178 100644 --- a/public/js/components/searchbar/searchbar.js +++ b/public/js/components/searchbar/searchbar.js @@ -98,12 +98,12 @@ export default {