--
-- $Id$
--
-- View voor qr codes
--
DEFINE thisfile = 'UWVA#64269.sql'
DEFINE dbuser   = 'UWVA'

SET ECHO ON
SET DEFINE ON
COLUMN fcltlogfile NEW_VALUE fcltlogfile NOPRINT;
COLUMN fcltcusterr NEW_VALUE fcltcusterr NOPRINT;
WHENEVER SQLERROR CONTINUE;
SELECT adm.getscriptspoolfile('&thisfile') AS fcltlogfile FROM DUAL;
SPOOL &fcltlogfile
WHENEVER SQLERROR EXIT;
SELECT adm.checkscriptcust('&dbuser') AS fcltcusterr FROM DUAL;
WHENEVER SQLERROR CONTINUE;
PROMPT &fcltcusterr
SET DEFINE OFF

------ payload begin ------

CREATE OR REPLACE VIEW uwva_v_ins_qrc_mld
(
   hide_f_sort,
   fclt_3d_locatie_key,
   fclt_f_locatie,
   alg_gebouw_key,
   fclt_f_gebouw,
   fclt_f_verdieping,
   alg_ruimte_key,
   alg_ruimte_nr,
   mld_stdmelding_key,
   melding,
   fclt_3d_discipline_key,
   alg_srtruimte_key,
   fclt_f_soort_ruimte,
   hide_f_bookmark_id,
   url
)
AS
   SELECT l.alg_ruimte_aanduiding || '-' || sm.mld_stdmelding_omschrijving
             hide_f_sort,
          l.alg_locatie_key fclt_3d_locatie_key,
          l.alg_locatie_code || ' ' || l.alg_locatie_omschrijving
             fclt_f_locatie,
          l.alg_gebouw_key,
          l.alg_gebouw_omschrijving fclt_f_gebouw,
          l.alg_verdieping_code fclt_f_verdieping,
          l.alg_ruimte_key,
          l.alg_ruimte_nr,
          sm.mld_stdmelding_key,
          sm.mld_stdmelding_omschrijving,
          sm.mld_ins_discipline_key fclt_3d_discipline_key,
          l.alg_srtruimte_key fclt_f_soort_ruimte,
          l.alg_srtruimte_omschrijving,
          b.fac_bookmark_id hide_f_bookmark_id,
          (   fac.getsetting ('fclt_web_url')
           || '/?u='
           || b.fac_bookmark_id
           || '&'
           || 'ruimte_key='
           || l.alg_ruimte_key
           || '&'
           || 'disc_key='
           || sm.mld_ins_discipline_key
           || '&'
           || 'stdm_key='
           || sm.mld_stdmelding_key)
             url
     FROM alg_v_ruimte_gegevens l, fac_bookmark b, mld_stdmelding sm
    WHERE b.fac_bookmark_naam = 'Storingsmeldingen'
          AND (b.fac_bookmark_expire IS NULL
               OR b.fac_bookmark_expire > SYSDATE);
			   
------ payload end   ------

SET DEFINE OFF
BEGIN adm.systrackscriptId ('$Id$', 1); END;
/

COMMIT;
SET ECHO OFF
SPOOL OFF
SET DEFINE ON
PROMPT Logfile of this upgrade is: &fcltlogfile
