mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-20 00:12:15 +00:00
defined new searchbar endpoint searchPV which uses searchbar config searchPV.php -> mostly just curated imports of the actually adapted base search.php config, since the main point of this story was enabling phonenumber lookup. basically works everywhere, unless deliberately unset like in searchcis.php config; also added personalnummer searchfield for employees; adapted phonenumber lookup to be the old version where type needs to be 'telefon' AND the standort_id needs to match, or type is a whider range of options including 'firmenhandy' and 'mobil' but is only matched via person_id; fixed unassigned_employee config by letting the config check for benutzerfunktion.uid instead of benutzerfunktion.bezeichnung after the left join, so the results are actually only employees without kostenstellen or oezuordnung, not all mitarbeiter with empty benutzerfunktion bezeichnungen;
This commit is contained in:
@@ -45,7 +45,7 @@ $config['person'] = [
|
||||
'field' => 'kontakt',
|
||||
'join' => [
|
||||
'table' => "public.tbl_kontakt",
|
||||
'on' => "kontakttyp IN ('telefon', 'so.tel', 'mobil') AND tbl_kontakt.person_id = tbl_person.person_id"
|
||||
'on' => "kontakttyp IN ('telefon', 'so.tel', 'mobil', 'firmenhandy') AND tbl_kontakt.person_id = tbl_person.person_id"
|
||||
],
|
||||
"1-n" => true
|
||||
],
|
||||
@@ -360,6 +360,10 @@ $config['employee'] = [
|
||||
'comparison' => 'equals',
|
||||
'field' => "mitarbeiter_uid"
|
||||
],
|
||||
'personalnummer' => [
|
||||
'comparison' => 'equal-int',
|
||||
'field' => "personalnummer"
|
||||
],
|
||||
'vorname' => [
|
||||
'alias' => ['firstname'],
|
||||
'comparison' => 'similar',
|
||||
@@ -415,12 +419,27 @@ $config['employee'] = [
|
||||
'tel' => [
|
||||
'alias' => ['phone', 'telefon'],
|
||||
'comparison' => 'similar',
|
||||
'field' => "TRIM(COALESCE(kontakt, '') || ' ' || COALESCE(telefonklappe, ''))",
|
||||
'field' => 'kontakt',
|
||||
'prepare' => "employee_tel (mitarbeiter_uid, kontakt) AS (
|
||||
SELECT m.mitarbeiter_uid,
|
||||
TRIM(COALESCE(k.kontakt, '') || ' ' || COALESCE(m.telefonklappe, ''))
|
||||
FROM public.tbl_mitarbeiter m
|
||||
LEFT JOIN public.tbl_kontakt k
|
||||
ON k.standort_id = m.standort_id
|
||||
AND k.kontakttyp = 'telefon'
|
||||
UNION
|
||||
SELECT m.mitarbeiter_uid, k.kontakt
|
||||
FROM public.tbl_mitarbeiter m
|
||||
JOIN public.tbl_benutzer b ON b.uid = m.mitarbeiter_uid
|
||||
JOIN public.tbl_kontakt k
|
||||
ON k.person_id = b.person_id
|
||||
AND k.kontakttyp IN ('telefon', 'so.tel', 'mobil', 'firmenhandy')
|
||||
)",
|
||||
'join' => [
|
||||
'table' => "public.tbl_kontakt",
|
||||
'on' => "kontakttyp = 'telefon' AND tbl_kontakt.standort_id = tbl_mitarbeiter.standort_id"
|
||||
'table' => "employee_tel",
|
||||
'using' => "mitarbeiter_uid"
|
||||
],
|
||||
"1-n" => true
|
||||
'1-n' => true
|
||||
],
|
||||
'pid' => [
|
||||
'alias' => ['person_id'],
|
||||
@@ -471,6 +490,7 @@ $config['employee'] = [
|
||||
],
|
||||
'resultfields' => [
|
||||
"b.uid",
|
||||
"m.personalnummer",
|
||||
"p.person_id",
|
||||
"(p.vorname || ' ' || p.nachname) AS name",
|
||||
"ARRAY(
|
||||
@@ -512,7 +532,6 @@ $config['employee'] = [
|
||||
) k ON (k.standort_id = m.standort_id)"
|
||||
];
|
||||
|
||||
// TODO(chris): move to searchpv21.php
|
||||
$config['unassigned_employee'] = $config['employee'];
|
||||
$config['unassigned_employee']['alias'] = ['mitarbeiter_ohne_zuordnung'];
|
||||
$config['unassigned_employee']['prepare'] = "unassigned_employee AS (
|
||||
@@ -524,7 +543,7 @@ $config['unassigned_employee']['prepare'] = "unassigned_employee AS (
|
||||
AND (datum_von IS NULL OR datum_von <= NOW())
|
||||
AND (datum_bis IS NULL OR datum_bis >= NOW())
|
||||
)
|
||||
WHERE tbl_benutzerfunktion.bezeichnung IS NULL
|
||||
WHERE tbl_benutzerfunktion.uid IS NULL
|
||||
UNION
|
||||
SELECT tbl_mitarbeiter.*
|
||||
FROM public.tbl_mitarbeiter
|
||||
@@ -534,10 +553,10 @@ $config['unassigned_employee']['prepare'] = "unassigned_employee AS (
|
||||
AND (datum_von IS NULL OR datum_von <= NOW())
|
||||
AND (datum_bis IS NULL OR datum_bis >= NOW())
|
||||
)
|
||||
WHERE tbl_benutzerfunktion.bezeichnung IS NULL
|
||||
WHERE tbl_benutzerfunktion.uid IS NULL
|
||||
)";
|
||||
$config['unassigned_employee']['table'] = "unassigned_employee";
|
||||
$config['unassigned_employee']['searchfields']['tel']['join']['on'] = "
|
||||
$config['unassigned_employee']['searchfields']['tel'] = "
|
||||
kontakttyp = 'telefon'
|
||||
AND tbl_kontakt.standort_id = unassigned_employee.standort_id
|
||||
";
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
|
||||
$CI =& get_instance();
|
||||
|
||||
$config['person'] = $CI->config->item('person', 'search');
|
||||
|
||||
$config['employee'] = $CI->config->item('employee', 'search');
|
||||
$config['employee']['resultjoin'] = "
|
||||
JOIN public.tbl_mitarbeiter m USING (mitarbeiter_uid)
|
||||
JOIN public.tbl_benutzer b ON (b.uid = m.mitarbeiter_uid AND b.aktiv = true)
|
||||
JOIN public.tbl_person p USING(person_id)
|
||||
LEFT JOIN (
|
||||
SELECT kontakt, standort_id
|
||||
FROM public.tbl_kontakt
|
||||
WHERE kontakttyp = 'telefon'
|
||||
) k ON (k.standort_id = m.standort_id)";
|
||||
|
||||
$config['unassigned_employee'] = $CI->config->item('unassigned_employee', 'search');
|
||||
$config['unassigned_employee']['resultjoin'] = "
|
||||
JOIN public.tbl_mitarbeiter m USING (mitarbeiter_uid)
|
||||
JOIN public.tbl_benutzer b ON (b.uid = m.mitarbeiter_uid AND b.aktiv = true)
|
||||
JOIN public.tbl_person p USING(person_id)
|
||||
LEFT JOIN (
|
||||
SELECT kontakt, standort_id
|
||||
FROM public.tbl_kontakt
|
||||
WHERE kontakttyp = 'telefon'
|
||||
) k ON (k.standort_id = m.standort_id)";
|
||||
|
||||
$config['room'] = $CI->config->item('room', 'search');
|
||||
|
||||
$config['organisationunit'] = $CI->config->item('organisationunit', 'search');
|
||||
@@ -7,6 +7,7 @@ $CI =& get_instance();
|
||||
|
||||
|
||||
$config['employee'] = $CI->config->item('employee', 'search');
|
||||
unset($config['employee']['searchfields']['tel']);
|
||||
$config['employee']['resultjoin'] = "
|
||||
JOIN public.tbl_mitarbeiter m USING (mitarbeiter_uid)
|
||||
JOIN public.tbl_benutzer b ON (b.uid = m.mitarbeiter_uid AND b.aktiv = true)
|
||||
|
||||
@@ -37,7 +37,8 @@ class Searchbar extends FHCAPI_Controller
|
||||
parent::__construct([
|
||||
'search' => self::PERM_LOGGED,
|
||||
'searchCis' => self::PERM_LOGGED,
|
||||
'searchStv' => self::PERM_LOGGED
|
||||
'searchStv' => self::PERM_LOGGED,
|
||||
'searchPV' => self::PERM_LOGGED
|
||||
]);
|
||||
|
||||
$this->load->model('system/Webservicelog_model', 'WebservicelogModel');
|
||||
@@ -87,6 +88,15 @@ class Searchbar extends FHCAPI_Controller
|
||||
return $this->searchAdvanced([ 'config' => 'searchstv' ]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a JSON body via HTTP POST and provides the parameters
|
||||
*/
|
||||
public function searchPV()
|
||||
{
|
||||
return $this->searchAdvanced([ 'config' => 'searchPV' ]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets a JSON body via HTTP POST and provides the parameters
|
||||
*/
|
||||
|
||||
@@ -36,5 +36,12 @@ export default {
|
||||
url: '/api/frontend/v1/searchbar/searchStv',
|
||||
params
|
||||
};
|
||||
},
|
||||
searchPV(params) {
|
||||
return {
|
||||
method: 'post',
|
||||
url: '/api/frontend/v1/searchbar/searchPV',
|
||||
params
|
||||
};
|
||||
}
|
||||
};
|
||||
@@ -53762,6 +53762,26 @@ and represent the current state of research on the topic. The prescribed citatio
|
||||
)
|
||||
)
|
||||
),
|
||||
array(
|
||||
'app' => 'core',
|
||||
'category' => 'search',
|
||||
'phrase' => 'type_unassigned_employee',
|
||||
'insertvon' => 'system',
|
||||
'phrases' => array(
|
||||
array(
|
||||
'sprache' => 'German',
|
||||
'text' => 'Mitarbeiter ohne Zuordnung',
|
||||
'description' => '',
|
||||
'insertvon' => 'system'
|
||||
),
|
||||
array(
|
||||
'sprache' => 'English',
|
||||
'text' => 'unassigned employee',
|
||||
'description' => '',
|
||||
'insertvon' => 'system'
|
||||
)
|
||||
)
|
||||
),
|
||||
array(
|
||||
'app' => 'core',
|
||||
'category' => 'search',
|
||||
|
||||
Reference in New Issue
Block a user