-- Customer specific once-script GRKL5.
-- (c) 2016 Facilitor bv
--
-- Support: +31 53 4800700
DEFINE thisfile = 'GRKL5.SQL'
DEFINE dbuser   = '^GRKL'
DEFINE custid   = 'GRKL'

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

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

UPDATE mld_kenmerk
   SET mld_kenmerk_toonbaar = 1
 WHERE     mld_kenmerk_verwijder IS NULL
       AND mld_kenmerk_toonbaar IS NULL
       AND mld_kenmerk_key BETWEEN 541 AND 680;

-- CUST01-notificatie(job) naar melder=leidingevende van 'Afmelden ICT & Fac.'-melding.
INSERT INTO fac_srtnotificatie (fac_srtnotificatie_code,
                                fac_srtnotificatie_mode,
                                fac_srtnotificatie_oms,
                                fac_srtnotificatie_xmlnode,
                                fac_srtnotificatie_url,
                                fac_srtnotificatie_groep)
   SELECT 'CUST01',
          0,
          'Reminder: Innemen middelen afgemelde medewerker',
          'melding',
          NULL,
          0
     FROM DUAL
    WHERE NOT EXISTS (SELECT 1
                        FROM fac_srtnotificatie
                       WHERE fac_srtnotificatie_code = 'CUST01');

INSERT INTO fac_notificatie_job (fac_notificatie_job_view,
                                 fac_notificatie_job_oms,
                                 fac_notificatie_job_mode,
                                 fac_notificatie_job_interval,
                                 fac_notificatie_job_nextrun,
                                 fac_notificatie_job_flags)
   SELECT 'GRKL_V_NOTI_LEIDINGGEVENDE',
          'Berichtgeving naar leidinggevende na afmelden medewerker',
          0,
          1,
          NULL,
          0
     FROM DUAL
    WHERE NOT EXISTS
             (SELECT 1
                FROM fac_notificatie_job
               WHERE fac_notificatie_job_view = 'GRKL_V_NOTI_LEIDINGGEVENDE');

COMMIT;

------ payload end   ------

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

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

@@&custid
