509 lines
23 KiB
SQL
509 lines
23 KiB
SQL
--
|
|
-- $Id$
|
|
--
|
|
-- Script containing customer specific sql statements for the FACILITOR database
|
|
-- Voor dbuser invullen: - indien script voor 1 klant is: 'AADS' (de klantcode, zoals vermeld in fac_version_cust)
|
|
-- - script is voor meerdere klanten: 'AAXX' (de groepcode, zoals vermeld in fac_version_group)
|
|
-- - script is voor meerdere klanten met naam volgens een bepaald patroon: '^AA|^ASMS|^GULU|^NMMS|^RABO|^ZKHM'
|
|
-- Ook als het script gedraaid wordt voor de verkeerde cust wordt er een logfile gemaakt.
|
|
-- (dit in tegenstelling tot sample_xxxx.sql)
|
|
|
|
DEFINE thisfile = 'SGSF.SQL'
|
|
DEFINE dbuser = 'SGSF'
|
|
|
|
SET ECHO ON
|
|
SET DEFINE ON
|
|
COLUMN fcltlogfile NEW_VALUE fcltlogfile NOPRINT;
|
|
COLUMN fcltcusttxt NEW_VALUE fcltcusttxt NOPRINT;
|
|
WHENEVER SQLERROR CONTINUE;
|
|
SELECT adm.getscriptspoolfile('&thisfile') AS fcltlogfile FROM DUAL;
|
|
SPOOL &fcltlogfile
|
|
WHENEVER SQLERROR EXIT;
|
|
SELECT adm.checkscriptcust('&dbuser') AS fcltcusttxt FROM DUAL;
|
|
WHENEVER SQLERROR CONTINUE;
|
|
---------------------------------------
|
|
PROMPT &fcltcusttxt
|
|
---------------------------------------
|
|
SET DEFINE OFF
|
|
|
|
------ payload begin ------
|
|
|
|
-- Notificatie bij resreveringen in gebouwen
|
|
-- SGS Amsterdam, Nieuw Zeelandweg 5B-1 (NLD18-0025)
|
|
-- SGS Schiphol-Rijk - Douglassingel (NLD18-0008)
|
|
-- SGS Sittard (NLD18-0010)
|
|
-- SGS Waardenburg (NLD23-0104)
|
|
-- naar email adres van gebouw gebouw bij
|
|
CREATE OR REPLACE VIEW SGSF_V_RES_GEBOUW
|
|
(
|
|
xkey,
|
|
key,
|
|
code,
|
|
sender,
|
|
receiver,
|
|
text,
|
|
xemail,
|
|
xmobile
|
|
)
|
|
AS
|
|
SELECT distinct rrr.res_rsv_ruimte_key xkey,
|
|
rrr.res_reservering_key key,
|
|
'CUST05' code,
|
|
NULL sender,
|
|
NULL receiver,
|
|
'Reservering SGS Amsterdam, Nieuw Zeelandweg 5B-1 (NLD18-0025) '||res_reservering_key||'/'||rrr.res_rsv_ruimte_volgnr||'.' text,
|
|
g.alg_gebouw_email xemail,
|
|
NULL xmobile
|
|
FROM res_rsv_ruimte rrr,
|
|
res_ruimte_opstelling rro,
|
|
res_ruimte rr,
|
|
res_alg_ruimte rar,
|
|
alg_v_onroerendgoed_gegevens a,
|
|
alg_gebouw g,
|
|
fac_notificatie_job fnj
|
|
WHERE rrr.res_ruimte_opstel_key = rro.res_ruimte_opstel_key
|
|
AND rr.res_ruimte_key = rro.res_ruimte_key
|
|
AND rar.res_ruimte_key = rr.res_ruimte_key
|
|
AND a.alg_ruimte_key = rar.alg_ruimte_key
|
|
AND g.alg_gebouw_key = a.alg_gebouw_key
|
|
AND g.alg_gebouw_email IS NOT NULL
|
|
AND g.alg_gebouw_key=221 -- Locatie SGS Amsterdam, Nieuw Zeelandweg 5B-1 (NLD18-0025)
|
|
AND rrr.res_status_fo_key=2
|
|
AND rrr.res_rsv_ruimte_verwijder IS NULL
|
|
AND rrr.res_rsv_ruimte_dirtlevel=0
|
|
AND fnj.fac_notificatie_job_view='SGSF_V_RES_GEBOUW'
|
|
AND rrr.res_rsv_ruimte_aanmaak > COALESCE(fnj.fac_notificatie_job_lastrun,SYSDATE)
|
|
UNION ALL
|
|
SELECT distinct rrr.res_rsv_ruimte_key xkey,
|
|
rrr.res_reservering_key key,
|
|
'CUST05' code,
|
|
NULL sender,
|
|
NULL receiver,
|
|
'Reservering SGS Schiphol-Rijk - Douglassingel (NLD18-0008) '||res_reservering_key||'/'||rrr.res_rsv_ruimte_volgnr||'.' text,
|
|
g.alg_gebouw_email xemail,
|
|
NULL xmobile
|
|
FROM res_rsv_ruimte rrr,
|
|
res_ruimte_opstelling rro,
|
|
res_ruimte rr,
|
|
res_alg_ruimte rar,
|
|
alg_v_onroerendgoed_gegevens a,
|
|
alg_gebouw g,
|
|
fac_notificatie_job fnj
|
|
WHERE rrr.res_ruimte_opstel_key = rro.res_ruimte_opstel_key
|
|
AND rr.res_ruimte_key = rro.res_ruimte_key
|
|
AND rar.res_ruimte_key = rr.res_ruimte_key
|
|
AND a.alg_ruimte_key = rar.alg_ruimte_key
|
|
AND g.alg_gebouw_key = a.alg_gebouw_key
|
|
AND g.alg_gebouw_email IS NOT NULL
|
|
AND g.alg_gebouw_key=220 -- Locatie SGS Schiphol-Rijk - Douglassingel (NLD18-0008)
|
|
AND rrr.res_status_fo_key=2
|
|
AND rrr.res_rsv_ruimte_verwijder IS NULL
|
|
AND rrr.res_rsv_ruimte_dirtlevel=0
|
|
AND fnj.fac_notificatie_job_view='SGSF_V_RES_GEBOUW'
|
|
AND rrr.res_rsv_ruimte_aanmaak > COALESCE(fnj.fac_notificatie_job_lastrun,SYSDATE)
|
|
UNION ALL
|
|
SELECT distinct rrr.res_rsv_ruimte_key xkey,
|
|
rrr.res_reservering_key key,
|
|
'CUST05' code,
|
|
NULL sender,
|
|
NULL receiver,
|
|
'Reservering SGS Sittard (NLD18-0010) '||res_reservering_key||'/'||rrr.res_rsv_ruimte_volgnr||'.' text,
|
|
g.alg_gebouw_email xemail,
|
|
NULL xmobile
|
|
FROM res_rsv_ruimte rrr,
|
|
res_ruimte_opstelling rro,
|
|
res_ruimte rr,
|
|
res_alg_ruimte rar,
|
|
alg_v_onroerendgoed_gegevens a,
|
|
alg_gebouw g,
|
|
fac_notificatie_job fnj
|
|
WHERE rrr.res_ruimte_opstel_key = rro.res_ruimte_opstel_key
|
|
AND rr.res_ruimte_key = rro.res_ruimte_key
|
|
AND rar.res_ruimte_key = rr.res_ruimte_key
|
|
AND a.alg_ruimte_key = rar.alg_ruimte_key
|
|
AND g.alg_gebouw_key = a.alg_gebouw_key
|
|
AND g.alg_gebouw_email IS NOT NULL
|
|
AND g.alg_gebouw_key=209 -- Locatie SGS Sittard (NLD18-0010)
|
|
AND rrr.res_status_fo_key=2
|
|
AND rrr.res_rsv_ruimte_verwijder IS NULL
|
|
AND rrr.res_rsv_ruimte_dirtlevel=0
|
|
AND fnj.fac_notificatie_job_view='SGSF_V_RES_GEBOUW'
|
|
AND rrr.res_rsv_ruimte_aanmaak > COALESCE(fnj.fac_notificatie_job_lastrun,SYSDATE)
|
|
UNION ALL
|
|
SELECT distinct rrr.res_rsv_ruimte_key xkey,
|
|
rrr.res_reservering_key key,
|
|
'CUST05' code,
|
|
NULL sender,
|
|
NULL receiver,
|
|
'Reservering SGS Waardenburg (NLD23-0104) '||res_reservering_key||'/'||rrr.res_rsv_ruimte_volgnr||'.' text,
|
|
g.alg_gebouw_email xemail,
|
|
NULL xmobile
|
|
FROM res_rsv_ruimte rrr,
|
|
res_ruimte_opstelling rro,
|
|
res_ruimte rr,
|
|
res_alg_ruimte rar,
|
|
alg_v_onroerendgoed_gegevens a,
|
|
alg_gebouw g,
|
|
fac_notificatie_job fnj
|
|
WHERE rrr.res_ruimte_opstel_key = rro.res_ruimte_opstel_key
|
|
AND rr.res_ruimte_key = rro.res_ruimte_key
|
|
AND rar.res_ruimte_key = rr.res_ruimte_key
|
|
AND a.alg_ruimte_key = rar.alg_ruimte_key
|
|
AND g.alg_gebouw_key = a.alg_gebouw_key
|
|
AND g.alg_gebouw_email IS NOT NULL
|
|
AND g.alg_gebouw_key=206 -- Locatie SGS Waardenburg (NLD23-0104)
|
|
AND rrr.res_status_fo_key=2
|
|
AND rrr.res_rsv_ruimte_verwijder IS NULL
|
|
AND rrr.res_rsv_ruimte_dirtlevel=0
|
|
AND fnj.fac_notificatie_job_view='SGSF_V_RES_GEBOUW'
|
|
AND rrr.res_rsv_ruimte_aanmaak > COALESCE(fnj.fac_notificatie_job_lastrun,SYSDATE);
|
|
|
|
|
|
|
|
|
|
-- Notificatie als er reservereing met catering wordt aangemaakt of gemuteerd
|
|
|
|
CREATE OR REPLACE VIEW SGSF_V_CATERING_NOTI
|
|
(
|
|
xkey,
|
|
key,
|
|
code,
|
|
sender,
|
|
receiver,
|
|
text,
|
|
xemail,
|
|
xmobile
|
|
)
|
|
AS
|
|
SELECT distinct rrr.res_rsv_ruimte_key xkey,
|
|
rrr.res_reservering_key key,
|
|
'CUST01' code,
|
|
NULL sender,
|
|
NULL receiver,
|
|
'Catering voor reservering '||res_reservering_key||'/'||rrr.res_rsv_ruimte_volgnr||'.' text,
|
|
g.alg_gebouw_email xemail,
|
|
NULL xmobile
|
|
FROM res_rsv_ruimte rrr,
|
|
res_rsv_artikel rra,
|
|
res_artikel ra,
|
|
res_ruimte_opstelling rro,
|
|
res_ruimte rr,
|
|
res_alg_ruimte rar,
|
|
alg_v_onroerendgoed_gegevens a,
|
|
alg_gebouw g,
|
|
fac_notificatie_job fnj
|
|
WHERE rrr.res_rsv_ruimte_key = rra.res_rsv_ruimte_key
|
|
AND ra.res_artikel_key = rra.res_artikel_key
|
|
AND rrr.res_ruimte_opstel_key = rro.res_ruimte_opstel_key
|
|
AND rr.res_ruimte_key = rro.res_ruimte_key
|
|
AND rar.res_ruimte_key = rr.res_ruimte_key
|
|
AND a.alg_ruimte_key = rar.alg_ruimte_key
|
|
AND g.alg_gebouw_key = a.alg_gebouw_key
|
|
AND g.alg_gebouw_email IS NOT NULL
|
|
AND rrr.res_status_fo_key=2
|
|
AND rrr.res_rsv_ruimte_verwijder IS NULL
|
|
AND rrr.res_rsv_ruimte_dirtlevel=0
|
|
AND fnj.fac_notificatie_job_view='SGSF_V_CATERING_NOTI'
|
|
AND COALESCE(rra.res_rsv_artikel_mutatie, rra.res_rsv_artikel_aanmaak) > fnj.fac_notificatie_job_lastrun;
|
|
|
|
-- Notificatie naar gebouw als reservereing inclusief catering is verplaatst van ruimte
|
|
CREATE OR REPLACE VIEW SGSF_V_CATERING_RUIMTEMUT
|
|
(
|
|
xkey,
|
|
key,
|
|
code,
|
|
sender,
|
|
receiver,
|
|
text,
|
|
xemail,
|
|
xmobile
|
|
)
|
|
AS
|
|
SELECT distinct rrr.res_rsv_ruimte_key xkey,
|
|
rrr.res_reservering_key key,
|
|
'CUST10' code,
|
|
NULL sender,
|
|
NULL receiver,
|
|
'Ruimte voor reservering '||res_reservering_key||'/'||rrr.res_rsv_ruimte_volgnr||' is gewijzigd naar ruimte '||rr.res_ruimte_nr text,
|
|
g.alg_gebouw_email xemail,
|
|
NULL xmobile
|
|
FROM res_rsv_ruimte rrr,
|
|
res_rsv_artikel rra,
|
|
res_artikel ra,
|
|
res_ruimte_opstelling rro,
|
|
res_ruimte rr,
|
|
res_alg_ruimte rar,
|
|
alg_v_onroerendgoed_gegevens a,
|
|
alg_gebouw g,
|
|
fac_tracking ft,
|
|
fac_notificatie_job fnj
|
|
WHERE rrr.res_rsv_ruimte_key = rra.res_rsv_ruimte_key
|
|
AND ra.res_artikel_key = rra.res_artikel_key
|
|
AND rrr.res_ruimte_opstel_key = rro.res_ruimte_opstel_key
|
|
AND rr.res_ruimte_key = rro.res_ruimte_key
|
|
AND rar.res_ruimte_key = rr.res_ruimte_key
|
|
AND a.alg_ruimte_key = rar.alg_ruimte_key
|
|
AND g.alg_gebouw_key = a.alg_gebouw_key
|
|
AND g.alg_gebouw_email IS NOT NULL
|
|
AND rrr.res_status_fo_key=2
|
|
AND rrr.res_rsv_ruimte_verwijder IS NULL
|
|
AND rrr.res_rsv_ruimte_dirtlevel=0
|
|
AND fnj.fac_notificatie_job_view='SGSF_V_CATERING_RUIMTEMUT'
|
|
AND ft.fac_tracking_refkey=rrr.res_rsv_ruimte_key
|
|
AND LOWER(ft.fac_tracking_oms) like '%gewijzigd%ruimte%'
|
|
AND ft.fac_srtnotificatie_key=119
|
|
AND ft.fac_tracking_datum > COALESCE(fnj.fac_notificatie_job_lastrun,SYSDATE-1);
|
|
|
|
|
|
|
|
-- Notificatie als er reservereing met catering wordt verwijderd
|
|
|
|
CREATE OR REPLACE VIEW SGSF_V_CATERING_DELETE
|
|
(
|
|
xkey,
|
|
key,
|
|
code,
|
|
sender,
|
|
receiver,
|
|
text,
|
|
xemail,
|
|
xmobile
|
|
)
|
|
AS
|
|
SELECT distinct rrr.res_rsv_ruimte_key xkey,
|
|
rrr.res_reservering_key key,
|
|
'CUST04' code,
|
|
NULL sender,
|
|
NULL receiver,
|
|
'Reservering '||res_reservering_key||'/'||rrr.res_rsv_ruimte_volgnr||' met catering is verwijderd.' text,
|
|
g.alg_gebouw_email xemail,
|
|
NULL xmobile
|
|
FROM res_rsv_ruimte rrr,
|
|
res_rsv_artikel rra,
|
|
res_artikel ra,
|
|
res_ruimte_opstelling rro,
|
|
res_ruimte rr,
|
|
res_alg_ruimte rar,
|
|
alg_v_onroerendgoed_gegevens a,
|
|
alg_gebouw g,
|
|
fac_notificatie_job fnj
|
|
WHERE rrr.res_rsv_ruimte_key = rra.res_rsv_ruimte_key
|
|
AND ra.res_artikel_key = rra.res_artikel_key
|
|
AND rrr.res_ruimte_opstel_key = rro.res_ruimte_opstel_key
|
|
AND rr.res_ruimte_key = rro.res_ruimte_key
|
|
AND rar.res_ruimte_key = rr.res_ruimte_key
|
|
AND a.alg_ruimte_key = rar.alg_ruimte_key
|
|
AND g.alg_gebouw_key = a.alg_gebouw_key
|
|
AND g.alg_gebouw_email IS NOT NULL
|
|
AND rrr.res_rsv_ruimte_verwijder IS NOT NULL
|
|
AND rrr.res_rsv_ruimte_verwijder < rrr.RES_RSV_RUIMTE_VAN -- Soms verwijderen mensen ook hun afsrpaak uit de outlook agenda na de afspraak en deze wil je niet notificeren
|
|
AND fnj.fac_notificatie_job_view='SGSF_V_CATERING_DELETE'
|
|
AND COALESCE (fnj.fac_notificatie_job_lastrun, SYSDATE) < rrr.res_rsv_ruimte_verwijder;
|
|
|
|
-- Notificatie als er reservereing van koppelzaal in NL wordt gedaan
|
|
|
|
|
|
CREATE OR REPLACE VIEW SGSF_V_KOPPELZALEN_NL
|
|
(
|
|
key,
|
|
xkey,
|
|
code,
|
|
sender,
|
|
receiver,
|
|
text,
|
|
xemail,
|
|
xmobile
|
|
)
|
|
AS
|
|
SELECT DISTINCT zaal_1.res_reservering_key key,
|
|
zaal_1.res_rsv_ruimte_key xkey,
|
|
'CUST02' code,
|
|
NULL sender,
|
|
NULL receiver,
|
|
'Koppelzaal voor reservering '||zaal_1.res_reservering_key text,
|
|
zaal_1.email xemail,
|
|
NULL xmobile
|
|
FROM (SELECT rrr.*, g.alg_gebouw_email email
|
|
FROM res_rsv_ruimte rrr,
|
|
res_ruimte_opstelling rro,
|
|
res_ruimte rr,
|
|
res_alg_ruimte rar,
|
|
alg_v_onroerendgoed_gegevens a,
|
|
alg_gebouw g
|
|
WHERE rrr.res_ruimte_opstel_key = rro.res_ruimte_opstel_key
|
|
AND rr.res_ruimte_key = rro.res_ruimte_key
|
|
AND rr.res_ruimte_nr = 'Spijkenisse gebouw 1 - 3.05'
|
|
AND rrr.res_status_fo_key = 2
|
|
AND rrr.res_rsv_ruimte_verwijder IS NULL
|
|
AND rrr.res_rsv_ruimte_dirtlevel = 0
|
|
AND rar.res_ruimte_key= rr.res_ruimte_key
|
|
AND a.alg_ruimte_key = rar.alg_ruimte_key
|
|
AND g.alg_gebouw_key = a.alg_gebouw_key
|
|
AND g.alg_gebouw_email IS NOT NULL) zaal_1,
|
|
(SELECT rrr.*, g.alg_gebouw_email email
|
|
FROM res_rsv_ruimte rrr,
|
|
res_ruimte_opstelling rro,
|
|
res_ruimte rr,
|
|
res_alg_ruimte rar,
|
|
alg_v_onroerendgoed_gegevens a,
|
|
alg_gebouw g
|
|
WHERE rrr.res_ruimte_opstel_key = rro.res_ruimte_opstel_key
|
|
AND rr.res_ruimte_key = rro.res_ruimte_key
|
|
AND rr.res_ruimte_nr = 'Spijkenisse gebouw 1 - 3.03'
|
|
AND rrr.res_status_fo_key = 2
|
|
AND rrr.res_rsv_ruimte_verwijder IS NULL
|
|
AND rrr.res_rsv_ruimte_dirtlevel = 0
|
|
AND rar.res_ruimte_key= rr.res_ruimte_key
|
|
AND a.alg_ruimte_key = rar.alg_ruimte_key
|
|
AND g.alg_gebouw_key = a.alg_gebouw_key
|
|
AND g.alg_gebouw_email IS NOT NULL) zaal_2
|
|
WHERE zaal_1.res_rsv_ruimte_van = zaal_2.res_rsv_ruimte_van
|
|
AND zaal_1.res_rsv_ruimte_tot = zaal_2.res_rsv_ruimte_tot
|
|
AND zaal_1.res_rsv_ruimte_host_key = zaal_2.res_rsv_ruimte_host_key
|
|
AND TRUNC(zaal_1.res_rsv_ruimte_van) BETWEEN TRUNC(SYSDATE)
|
|
AND TRUNC(SYSDATE+1);
|
|
|
|
|
|
|
|
|
|
-- Notificatie als er reservereing van koppelzaal in BE wordt gedaan
|
|
|
|
CREATE OR REPLACE VIEW SGSF_V_KOPPELZALEN_BE
|
|
(
|
|
key,
|
|
xkey,
|
|
code,
|
|
sender,
|
|
receiver,
|
|
text,
|
|
xemail,
|
|
xmobile
|
|
)
|
|
AS
|
|
SELECT DISTINCT zaal_1.res_reservering_key key,
|
|
zaal_1.res_rsv_ruimte_key xkey,
|
|
'CUST03' code,
|
|
NULL sender,
|
|
NULL receiver,
|
|
'Koppelzaal voor reservering '||zaal_1.res_reservering_key tekst,
|
|
zaal_1.email xemail,
|
|
NULL xmobile
|
|
FROM (SELECT rrr.*, g.alg_gebouw_email email
|
|
FROM res_rsv_ruimte rrr, res_ruimte_opstelling rro, res_ruimte rr, res_alg_ruimte rar, alg_v_onroerendgoed_gegevens a, alg_gebouw g
|
|
WHERE rrr.res_ruimte_opstel_key = rro.res_ruimte_opstel_key
|
|
AND rr.res_ruimte_key = rro.res_ruimte_key
|
|
AND rr.res_ruimte_nr = 'SGS Noorderlaan 87, vergaderzaal G3'
|
|
AND rrr.res_status_fo_key = 2
|
|
AND rrr.res_rsv_ruimte_verwijder IS NULL
|
|
AND rrr.res_rsv_ruimte_dirtlevel = 0
|
|
AND rar.res_ruimte_key= rr.res_ruimte_key
|
|
AND a.alg_ruimte_key = rar.alg_ruimte_key
|
|
AND g.alg_gebouw_key = a.alg_gebouw_key
|
|
AND g.alg_gebouw_email IS NOT NULL) zaal_1,
|
|
(SELECT rrr.*, g.alg_gebouw_email email
|
|
FROM res_rsv_ruimte rrr, res_ruimte_opstelling rro, res_ruimte rr, res_alg_ruimte rar, alg_v_onroerendgoed_gegevens a, alg_gebouw g
|
|
WHERE rrr.res_ruimte_opstel_key = rro.res_ruimte_opstel_key
|
|
AND rr.res_ruimte_key = rro.res_ruimte_key
|
|
AND rr.res_ruimte_nr = 'SGS Noorderlaan 87, vergaderzaal G4'
|
|
AND rrr.res_status_fo_key = 2
|
|
AND rrr.res_rsv_ruimte_verwijder IS NULL
|
|
AND rrr.res_rsv_ruimte_dirtlevel = 0
|
|
AND rar.res_ruimte_key= rr.res_ruimte_key
|
|
AND a.alg_ruimte_key = rar.alg_ruimte_key
|
|
AND g.alg_gebouw_key = a.alg_gebouw_key
|
|
AND g.alg_gebouw_email IS NOT NULL) zaal_2
|
|
WHERE zaal_1.res_rsv_ruimte_van = zaal_2.res_rsv_ruimte_van
|
|
AND zaal_1.res_rsv_ruimte_tot = zaal_2.res_rsv_ruimte_tot
|
|
AND zaal_1.res_rsv_ruimte_host_key = zaal_2.res_rsv_ruimte_host_key
|
|
AND TRUNC(zaal_1.res_rsv_ruimte_van) BETWEEN TRUNC(SYSDATE)
|
|
AND TRUNC(SYSDATE+1)
|
|
UNION ALL
|
|
SELECT DISTINCT zaal_1.res_reservering_key key,
|
|
zaal_1.res_rsv_ruimte_key xkey,
|
|
'CUST03' code,
|
|
NULL sender,
|
|
NULL receiver,
|
|
'Koppelzaal voor reservering '||zaal_1.res_reservering_key tekst,
|
|
zaal_1.email xemail,
|
|
NULL xmobile
|
|
FROM (SELECT rrr.*, g.alg_gebouw_email email
|
|
FROM res_rsv_ruimte rrr, res_ruimte_opstelling rro, res_ruimte rr, res_alg_ruimte rar, alg_v_onroerendgoed_gegevens a, alg_gebouw g
|
|
WHERE rrr.res_ruimte_opstel_key = rro.res_ruimte_opstel_key
|
|
AND rr.res_ruimte_key = rro.res_ruimte_key
|
|
AND rr.res_ruimte_nr = 'SGS Polderdijkweg 16, Vergaderzaal G'
|
|
AND rrr.res_status_fo_key = 2
|
|
AND rrr.res_rsv_ruimte_verwijder IS NULL
|
|
AND rrr.res_rsv_ruimte_dirtlevel = 0
|
|
AND rar.res_ruimte_key= rr.res_ruimte_key
|
|
AND a.alg_ruimte_key = rar.alg_ruimte_key
|
|
AND g.alg_gebouw_key = a.alg_gebouw_key) zaal_1,
|
|
(SELECT rrr.*, g.alg_gebouw_email email
|
|
FROM res_rsv_ruimte rrr, res_ruimte_opstelling rro, res_ruimte rr, res_alg_ruimte rar, alg_v_onroerendgoed_gegevens a, alg_gebouw g
|
|
WHERE rrr.res_ruimte_opstel_key = rro.res_ruimte_opstel_key
|
|
AND rr.res_ruimte_key = rro.res_ruimte_key
|
|
AND rr.res_ruimte_nr = 'SGS Polderdijkweg 16, Vergaderzaal H'
|
|
AND rrr.res_status_fo_key = 2
|
|
AND rrr.res_rsv_ruimte_verwijder IS NULL
|
|
AND rrr.res_rsv_ruimte_dirtlevel = 0
|
|
AND rar.res_ruimte_key= rr.res_ruimte_key
|
|
AND a.alg_ruimte_key = rar.alg_ruimte_key
|
|
AND g.alg_gebouw_key = a.alg_gebouw_key) zaal_2
|
|
WHERE zaal_1.res_rsv_ruimte_van = zaal_2.res_rsv_ruimte_van
|
|
AND zaal_1.res_rsv_ruimte_tot = zaal_2.res_rsv_ruimte_tot
|
|
AND zaal_1.res_rsv_ruimte_host_key = zaal_2.res_rsv_ruimte_host_key
|
|
AND TRUNC(zaal_1.res_rsv_ruimte_van) BETWEEN TRUNC(SYSDATE)
|
|
AND TRUNC(SYSDATE+1);
|
|
|
|
|
|
|
|
|
|
-- Notificatie naar deelnmers aan een reservering aangemaakt vanuit Facilitor
|
|
CREATE OR REPLACE VIEW SGSF_V_DEELNEMER_RES
|
|
(
|
|
key,
|
|
xkey,
|
|
code,
|
|
sender,
|
|
receiver,
|
|
text,
|
|
xemail,
|
|
xmobile
|
|
)
|
|
|
|
AS
|
|
|
|
SELECT a.bez_afspraak_key,
|
|
rrr.res_rsv_ruimte_key,
|
|
'CUST06',
|
|
NULL,
|
|
NULL,
|
|
'Afspraak bevestiging',
|
|
b.bez_bezoekers_email,
|
|
NULL
|
|
FROM res_rsv_ruimte rrr,
|
|
fac_tracking ft,
|
|
bez_afspraak a,
|
|
bez_bezoekers b,
|
|
fac_notificatie_job fn
|
|
WHERE ft.fac_tracking_refkey = rrr.res_rsv_ruimte_key
|
|
AND ft.fac_srtnotificatie_key = 118
|
|
AND ft.prs_perslid_key IS NOT NULL -- Alleen de reserveringen die niet uit Outlook komen
|
|
AND rrr.res_rsv_ruimte_verwijder IS NULL
|
|
AND a.res_rsv_ruimte_key = rrr.res_rsv_ruimte_key
|
|
AND b.bez_afspraak_key = a.bez_afspraak_key
|
|
AND b.bez_bezoekers_email IS NOT NULL
|
|
AND fn.fac_notificatie_job_view='SGSF_V_DEELNEMER_RES'
|
|
AND b.bez_bezoekers_aanmaak> COALESCE(fn.fac_notificatie_job_lastrun, SYSDATE);
|
|
|
|
------ payload end ------
|
|
|
|
SET DEFINE OFF
|
|
BEGIN adm.systrackscriptId ('$Id$', 0); END;
|
|
/
|
|
|
|
COMMIT;
|
|
SET ECHO OFF
|
|
SPOOL OFF
|
|
SET DEFINE ON
|
|
PROMPT Logfile of this upgrade is: &fcltlogfile
|