BLOS#62336 -- Procedure werkplekkoppelingen robuuster + noti-job
svn path=/Customer/trunk/; revision=47362
This commit is contained in:
109
BLOS/blos.sql
109
BLOS/blos.sql
@@ -39,6 +39,8 @@ AS
|
||||
v_melding_key NUMBER (10);
|
||||
v_folder_kkey NUMBER (10);
|
||||
v_count NUMBER (10);
|
||||
v_count_wp NUMBER (10);
|
||||
|
||||
BEGIN
|
||||
CASE
|
||||
WHEN UPPER (pto) LIKE 'SERVICEDESK@%'
|
||||
@@ -46,12 +48,21 @@ BEGIN
|
||||
-- Bepaal de melder/noteur op basis van e-mail adres zoals in pfrom?
|
||||
----- Voor BLOS nog inpassen = KOSTENPLAATS van het GEBOUW!!!!
|
||||
v_errormsg := 'Fout bepalen melder ' || COALESCE (pfrom, '???');
|
||||
SELECT COUNT (*)
|
||||
INTO v_count
|
||||
SELECT COUNT (*), max(prs_perslid_key)
|
||||
INTO v_count, v_perslid_key
|
||||
FROM prs_v_aanwezigperslid
|
||||
WHERE UPPER (prs_perslid_email) LIKE UPPER (pfrom) || '%';
|
||||
|
||||
-- Als er persoon gevonden is, dan ff checken of er ook werkplekkoppelingen onder zijn aangemaakt
|
||||
IF v_count = 1
|
||||
THEN
|
||||
SELECT COUNT (*)
|
||||
INTO v_count_wp
|
||||
FROM prs_perslidwerkplek
|
||||
WHERE prs_perslid_key = v_perslid_key;
|
||||
END IF;
|
||||
|
||||
IF v_count = 1 AND v_count_wp > 0
|
||||
THEN
|
||||
SELECT p.prs_perslid_key, a.prs_kostenplaats_key, MIN (wpg.alg_locatie_key)
|
||||
INTO v_perslid_key, v_kostenplaats_key, v_locatie_key
|
||||
@@ -69,7 +80,7 @@ BEGIN
|
||||
AND p.prs_perslid_key = pw.prs_perslid_key(+)
|
||||
AND pw.prs_werkplek_key = wpg.prs_werkplek_key(+)
|
||||
GROUP BY p.prs_perslid_key, a.prs_kostenplaats_key;
|
||||
ELSE -- Melder kan niet 1-duidig worden bepaald, dus Onbekend en 21= Iepenhoeve Hoofdkantoor!
|
||||
ELSE -- Melder + Werkplek kan niet 1-duidig worden bepaald, dus Onbekend en 21= Iepenhoeve Hoofdkantoor!
|
||||
SELECT p.prs_perslid_key, a.prs_kostenplaats_key, 36
|
||||
INTO v_perslid_key, v_kostenplaats_key, v_locatie_key
|
||||
FROM prs_v_aanwezigperslid p, prs_afdeling a
|
||||
@@ -238,7 +249,8 @@ CREATE OR REPLACE VIEW blos_v_cluster_locaties
|
||||
ALG_LOCATIE_CODE,
|
||||
ALG_LOCATIE_OMSCHRIJVING,
|
||||
CLUSTER_CODE,
|
||||
TYPE_LOCATIE
|
||||
TYPE_LOCATIE,
|
||||
RUIMTE_KEY
|
||||
)
|
||||
AS
|
||||
SELECT l.alg_locatie_key,
|
||||
@@ -263,7 +275,11 @@ SELECT l.alg_locatie_key,
|
||||
AND fac.safe_to_number (km.alg_onrgoedkenmerk_waarde) =
|
||||
ud.fac_usrdata_key
|
||||
AND ud.fac_usrtab_key = 2)
|
||||
AS type_locatie
|
||||
AS type_locatie,
|
||||
(SELECT min(alg_ruimte_key)
|
||||
FROM alg_v_allonrgoed_gegevens v
|
||||
WHERE v.alg_locatie_key = l.alg_locatie_key and v.alg_type ='R')
|
||||
AS ruimte_key
|
||||
FROM alg_locatie l -- , alg_onrgoedkenmerk km -- , fac_usrdata ud
|
||||
WHERE l.alg_locatie_verwijder IS NULL;
|
||||
|
||||
@@ -321,7 +337,7 @@ CREATE OR REPLACE PROCEDURE blos_export_wpcluster (
|
||||
AS
|
||||
CURSOR c_nieuw
|
||||
IS
|
||||
SELECT cp.prs_perslid_key, cl.alg_locatie_key, cl.alg_locatie_code,cl.alg_locatie_omschrijving,cl.cluster_code
|
||||
SELECT cp.prs_perslid_key, cp.prs_perslid_volledigenaam, cl.alg_locatie_key, cl.alg_locatie_code,cl.alg_locatie_omschrijving,cl.cluster_code
|
||||
FROM blos_v_cluster_locaties cl, blos_v_cluster_personen cp
|
||||
WHERE cl.cluster_code = cp.prs_afdeling_upper
|
||||
AND NOT EXISTS
|
||||
@@ -360,13 +376,15 @@ AS
|
||||
v_prs_werkplek_volgnr NUMBER;
|
||||
v_prs_werkplek_key NUMBER ;
|
||||
|
||||
v_errormsg VARCHAR (200);
|
||||
v_errorhint VARCHAR (200);
|
||||
oracle_err_mes VARCHAR2 (150);
|
||||
v_errormsg VARCHAR2 (1000);
|
||||
v_errorhint VARCHAR2 (1000);
|
||||
oracle_err_mes VARCHAR2 (200);
|
||||
oracle_err_num NUMBER;
|
||||
currentversion fac_module.fac_module_version%TYPE;
|
||||
v_aanduiding VARCHAR (100);
|
||||
v_aanduiding VARCHAR2 (1000);
|
||||
v_count NUMBER;
|
||||
|
||||
|
||||
BEGIN
|
||||
v_count:=0;
|
||||
|
||||
@@ -374,8 +392,8 @@ BEGIN
|
||||
LOOP
|
||||
|
||||
v_aanduiding :=
|
||||
'Werkplekkoppeling gemaakt - betreft: ' || rec.alg_locatie_code || ' (' || rec.cluster_code || ')' ;
|
||||
v_errorhint := 'nieuwe werkplekkoppeling maken';
|
||||
'Werkplekkoppeling: ' || rec.alg_locatie_code || ' (' || rec.cluster_code || ')' ;
|
||||
v_errormsg := 'Fout bij aanmaken werkplekkoppeling';
|
||||
|
||||
-- Ruimte_key ophalen van desbetreffende locatie_keten
|
||||
SELECT min(alg_ruimte_key)
|
||||
@@ -383,6 +401,18 @@ BEGIN
|
||||
FROM alg_v_allonrgoed_gegevens v
|
||||
WHERE v.alg_locatie_key = rec.alg_locatie_key and v.alg_type ='R' ;
|
||||
|
||||
IF v_ruimte_key IS NULL THEN
|
||||
|
||||
fac.writelog (p_applname,
|
||||
'W',
|
||||
v_errormsg || ' Locatie wordt overgeslagen:',
|
||||
v_aanduiding);
|
||||
END IF;
|
||||
|
||||
v_errorhint := 'INSERT clusterkoppeling bij persoon: ' || rec.alg_locatie_code || ' / ' || rec.prs_perslid_volledigenaam;
|
||||
|
||||
IF v_ruimte_key IS NOT NULL THEN
|
||||
|
||||
-- Volgnr werkplek
|
||||
SELECT COALESCE(MIN (prs_werkplek_volgnr + 1),1)
|
||||
INTO v_prs_werkplek_volgnr
|
||||
@@ -409,6 +439,8 @@ BEGIN
|
||||
SYSDATE,
|
||||
v_aanduiding);
|
||||
|
||||
END IF;
|
||||
|
||||
END LOOP;
|
||||
|
||||
FOR rec IN c_del
|
||||
@@ -430,6 +462,20 @@ BEGIN
|
||||
|
||||
END LOOP;
|
||||
|
||||
EXCEPTION
|
||||
WHEN OTHERS
|
||||
THEN
|
||||
|
||||
oracle_err_num := SQLCODE;
|
||||
oracle_err_mes := SUBSTR (SQLERRM, 1, 100);
|
||||
v_errormsg :=
|
||||
'OTHERS (error ' || oracle_err_num || '/' || oracle_err_mes;
|
||||
fac.writelog (p_applname,
|
||||
'E',
|
||||
v_errormsg,
|
||||
v_errorhint);
|
||||
|
||||
|
||||
END;
|
||||
/
|
||||
|
||||
@@ -442,6 +488,45 @@ BEGIN
|
||||
END;
|
||||
/
|
||||
|
||||
-- Ivm clusterkoppeling is het belangrijk dat locaties goed zijn vastgelegd.
|
||||
-- Omdat in de praktijk dit paar keer niet goed is gegaan een noti-job om applicatiebeheer hierop netjes te attenderen
|
||||
CREATE OR REPLACE VIEW blos_v_noti_locatiebeheer
|
||||
(
|
||||
sender,
|
||||
receiver,
|
||||
text,
|
||||
code,
|
||||
key,
|
||||
xkey
|
||||
)
|
||||
AS
|
||||
SELECT NULL,
|
||||
m.prs_perslid_key,
|
||||
'Locatie onvolledig vastgelegd: '
|
||||
|| v.alg_locatie_code
|
||||
|| ' - '
|
||||
|| v.alg_locatie_omschrijving
|
||||
|| ' van '
|
||||
|| v.cluster_code,
|
||||
'CUST01',
|
||||
v.alg_locatie_key,
|
||||
NULL
|
||||
FROM
|
||||
blos_v_cluster_locaties v,
|
||||
(SELECT g.fac_groep_key,
|
||||
p.prs_perslid_key,
|
||||
p.prs_perslid_email AS email
|
||||
FROM fac_groep g, fac_gebruikersgroep ge, prs_perslid p
|
||||
WHERE g.fac_groep_key = 22 -- Applicatiebeheer
|
||||
AND g.fac_groep_key = ge.fac_groep_key
|
||||
AND ge.prs_perslid_key = p.prs_perslid_key
|
||||
AND p.prs_perslid_email IS NOT NULL
|
||||
AND p.prs_perslid_verwijder IS NULL) m
|
||||
WHERE
|
||||
v.ruimte_key IS NULL
|
||||
and v.cluster_code IS NOT NULL ;
|
||||
|
||||
|
||||
CREATE OR REPLACE VIEW blos_v_rap_opdrachten_intern
|
||||
(
|
||||
mld_opdr_key,
|
||||
|
||||
Reference in New Issue
Block a user