LPNL#82185 -- Autorisatiegroepen voor flexplekken automatisch toekennen

svn path=/Customer/trunk/; revision=63477
This commit is contained in:
Arthur Egberink
2024-02-06 11:39:48 +00:00
parent 8dfa76889c
commit 2b5fb286f9

View File

@@ -464,6 +464,14 @@ IS
WHERE prs_perslid_verwijder IS NULL
AND p.prs_afdeling_key = a.prs_afdeling_key);
CURSOR c_aut IS
SELECT p.prs_perslid_naam,
p.prs_perslid_key,
a.prs_afdeling_key,
a.prs_afdeling_naam
FROM prs_perslid p, prs_afdeling a
WHERE prs_perslid_verwijder IS NULL AND p.prs_afdeling_key = a.prs_afdeling_key;
v_bedrijf_key NUMBER (10);
v_afdeling_key1 NUMBER (10);
v_afdeling_key2 NUMBER (10);
@@ -472,6 +480,7 @@ IS
v_count_mandaat NUMBER (10);
v_count_man_prs NUMBER (10) := 0;
v_afdeling_key NUMBER;
v_group_key NUMBER;
v_aanduiding VARCHAR2 (100);
v_errorhint VARCHAR2 (1000);
@@ -548,8 +557,41 @@ BEGIN
END;
END LOOP;
-- We gaan alle personen koppelen aan de flexwerkplek autorisatiegroep zoals deze bij de afdeling in een kenmerk is aangegeven.
-- Oudere flex autorisatiegroepen worden verwijderd.
FOR rec IN c_aut
LOOP
BEGIN
v_group_key :=
flx.getflex ('PRS',
1080, -- Standaard autorisatiegroep
rec.prs_afdeling_key,
'A');
IF v_group_key IS NOT NULL
THEN
INSERT INTO fac_gebruikersgroep (prs_perslid_key, fac_groep_key)
SELECT rec.prs_perslid_key, v_group_key
FROM DUAL
WHERE NOT EXISTS
(SELECT 1
FROM fac_gebruikersgroep gg
WHERE gg.prs_perslid_key = rec.prs_perslid_key AND gg.fac_groep_key = v_group_key);
END IF;
DELETE fac_gebruikersgroep
WHERE fac_gebruikersgroep_key IN
(SELECT fac_gebruikersgroep_key
FROM fac_gebruikersgroep gg, fac_groep g
WHERE gg.fac_groep_key = g.fac_groep_key
AND UPPER(g.fac_groep_omschrijving) LIKE 'FLEX%'
AND gg.prs_perslid_key = rec.prs_perslid_key
AND g.fac_groep_key <> v_group_key);
END;
END LOOP;
-- Zorg ervoor dat er geen persoonsgegevens achterblijven in de import tabel.
-- DELETE fac_imp_perslid;
DELETE fac_imp_perslid;
COMMIT;
EXCEPTION
WHEN OTHERS
@@ -580,6 +622,14 @@ END;
/
-- View om een autorsatiegroep voor flexplekken te koppelen aan een afdeling (kenmerk 1080). Tijdens de import
-- worden mensen van deze afdeling automatisch gekoppeld aan deze autorisatiegroep.
CREATE OR REPLACE VIEW lpnl_v_autorisatie_wp
AS
SELECT fac_groep_key, fac_groep_omschrijving
FROM fac_groep
WHERE fac_groep_upper LIKE 'FLEX%';
-- View om via een rapport je collega te vinden die ook een werkplek gereserveerd heeft
CREATE OR REPLACE VIEW lpnl_v_rap_find_collega_wp
AS