Code Quality

This commit is contained in:
cgfhtw
2025-06-24 15:01:26 +02:00
parent cc40fd4393
commit 7b627484c2
4 changed files with 40 additions and 10 deletions
+9 -2
View File
@@ -516,7 +516,10 @@ $config['unassigned_employee']['prepare'] = "unassigned_employee AS (
WHERE tbl_benutzerfunktion.bezeichnung IS NULL
)";
$config['unassigned_employee']['table'] = "unassigned_employee";
$config['unassigned_employee']['searchfields']['tel']['join']['on'] = "kontakttyp = 'telefon' AND tbl_kontakt.standort_id = unassigned_employee.standort_id";
$config['unassigned_employee']['searchfields']['tel']['join']['on'] = "
kontakttyp = 'telefon'
AND tbl_kontakt.standort_id = unassigned_employee.standort_id
";
$config['organisationunit'] = [
'alias' => ['ou', 'organisationseinheit', 'oe'],
@@ -722,7 +725,11 @@ $config['cms'] = [
'content' => [
'alias' => ['inhalt'],
'comparison' => "vector",
'field' => "(setweight(to_tsvector('simple', COALESCE(titel, '')), 'A') || setweight(to_tsvector('simple', COALESCE(content, '')::text), 'B'))"
'field' => "(
setweight(to_tsvector('simple', COALESCE(titel, '')), 'A')
||
setweight(to_tsvector('simple', COALESCE(content, '')::text), 'B')
)"
],
'content_id' => [
'alias' => ['id'],
+2 -2
View File
@@ -131,7 +131,7 @@ export default {
</form>
`,
watch:{
'searchsettings.searchstr': function (newSearchValue, oldSearchValue) {
'searchsettings.searchstr': function (newSearchValue) {
if(this.searchoptions.origin){
sessionStorage.setItem(`${this.searchoptions.origin}_searchstr`,newSearchValue);
}
@@ -159,7 +159,7 @@ export default {
.catch(this.$fhcAlert.handleSystemError);
},
beforeMount: function() {
this.$watch('searchsettings.types', (newValue, oldValue) => {
this.$watch('searchsettings.types', newValue => {
if (Array.isArray(newValue) && newValue.length === 0){
this.searchsettings.types = this.allSearchTypes();
}
+26 -5
View File
@@ -37,9 +37,15 @@ if (!$db->db_num_rows(@$db->db_query("SELECT 1 FROM pg_proc WHERE proname = 'tr_
$$
BEGIN
IF TG_TABLE_NAME = 'tbl_organisationseinheit' THEN
NEW.fts_bezeichnung := to_tsvector('simple', COALESCE((SELECT bezeichnung FROM public.tbl_organisationseinheittyp WHERE organisationseinheittyp_kurzbz = NEW.organisationseinheittyp_kurzbz), '') || ' ' || COALESCE(NEW.bezeichnung, ''));
NEW.fts_bezeichnung := to_tsvector('simple', COALESCE((
SELECT bezeichnung
FROM public.tbl_organisationseinheittyp
WHERE organisationseinheittyp_kurzbz = NEW.organisationseinheittyp_kurzbz
), '') || ' ' || COALESCE(NEW.bezeichnung, ''));
ELSIF TG_TABLE_NAME = 'tbl_organisationseinheittyp' THEN
UPDATE public.tbl_organisationseinheit SET fts_bezeichnung = to_tsvector('simple', COALESCE(NEW.bezeichnung, '') || ' ' || COALESCE(bezeichnung, '')) WHERE organisationseinheittyp_kurzbz = NEW.organisationseinheittyp_kurzbz;
UPDATE public.tbl_organisationseinheit
SET fts_bezeichnung = to_tsvector('simple', COALESCE(NEW.bezeichnung, '') || ' ' || COALESCE(bezeichnung, ''))
WHERE organisationseinheittyp_kurzbz = NEW.organisationseinheittyp_kurzbz;
END IF;
RETURN NEW;
END;
@@ -53,7 +59,13 @@ if (!$db->db_num_rows(@$db->db_query("SELECT 1 FROM pg_proc WHERE proname = 'tr_
$update_column = false;
// Add trigger tr_organisationseinheit_update_organisationseinheittyp_kurzbz to public.tbl_organisationseinheit
if (!$db->db_num_rows(@$db->db_query("SELECT 1 FROM information_schema.triggers WHERE event_object_table ='tbl_organisationseinheit' AND trigger_name = 'tr_organisationseinheit_update_organisationseinheittyp_kurzbz' LIMIT 1;")))
if (!$db->db_num_rows(@$db->db_query("
SELECT 1
FROM information_schema.triggers
WHERE event_object_table ='tbl_organisationseinheit'
AND trigger_name = 'tr_organisationseinheit_update_organisationseinheittyp_kurzbz'
LIMIT 1;
")))
{
$qry = "CREATE TRIGGER tr_organisationseinheit_update_organisationseinheittyp_kurzbz
BEFORE UPDATE OF organisationseinheittyp_kurzbz OR INSERT
@@ -70,7 +82,13 @@ if (!$db->db_num_rows(@$db->db_query("SELECT 1 FROM information_schema.triggers
}
// Add trigger tr_organisationseinheittyp_update_bezeichnung to public.tbl_organisationseinheittyp
if (!$db->db_num_rows(@$db->db_query("SELECT 1 FROM information_schema.triggers WHERE event_object_table ='tbl_organisationseinheittyp' AND trigger_name = 'tr_organisationseinheittyp_update_bezeichnung' LIMIT 1;")))
if (!$db->db_num_rows(@$db->db_query("
SELECT 1
FROM information_schema.triggers
WHERE event_object_table ='tbl_organisationseinheittyp'
AND trigger_name = 'tr_organisationseinheittyp_update_bezeichnung'
LIMIT 1;
")))
{
$qry = "CREATE TRIGGER tr_organisationseinheittyp_update_bezeichnung
BEFORE UPDATE OF bezeichnung
@@ -176,7 +194,10 @@ FROM pg_indexes WHERE indexname = 'idx_tbl_contentsprache_fts_titel_content_vect
$qry = "
CREATE INDEX idx_tbl_contentsprache_fts_titel_content_vector
ON campus.tbl_contentsprache
USING GIN ((setweight(to_tsvector('simple', COALESCE(titel, '')), 'A') || setweight(to_tsvector('simple', COALESCE(content, '')::text), 'B')));
USING GIN ((
setweight(to_tsvector('simple', COALESCE(titel, '')), 'A')
|| setweight(to_tsvector('simple', COALESCE(content, '')::text), 'B')
));
";
if (!$db->db_query($qry))
+3 -1
View File
@@ -42565,7 +42565,9 @@ and represent the current state of research on the topic. The prescribed citatio
'phrases' => array(
array(
'sprache' => 'German',
'text' => 'Such-Konfiguration $config["{type}"]["searchfields"]["{searchfield}"] ist ungültig: Feld "{field}" fehlt oder ist unglültig.',
'text' => 'Such-Konfiguration ' .
'$config["{type}"]["searchfields"]["{searchfield}"] ' .
'ist ungültig: Feld "{field}" fehlt oder ist unglültig.',
'description' => '',
'insertvon' => 'system'
),