--
-- $Id$
--
-- Script tbv naamswijziging AAFM (AAFM->Heyday)

DEFINE thisfile = 'AAXX#51309.SQL'
DEFINE dbuser   = '^AA|^ASMS|^GULU|^NMMS|^RABO|^ZKHM'

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 fac_locale_xsl
   SET fac_locale_xsl_cust = REPLACE (fac_locale_xsl_cust, 'AAFM', 'HEYDAY')
 WHERE fac_locale_xsl_cust IS NOT NULL
       AND UPPER (fac_locale_xsl_cust) LIKE '%AAFM%';

UPDATE prs_perslid
   SET prs_perslid_email =
          REPLACE (prs_perslid_email, 'AA-FM.COM', 'HEYDAYFM.NL')
 WHERE prs_perslid_verwijder IS NULL AND prs_perslid_email LIKE '%AA-FM.COM';

 UPDATE prs_perslid
   SET prs_perslid_email =
          REPLACE (prs_perslid_email, 'aa-fm.com', 'heydayfm.nl')
 WHERE prs_perslid_verwijder IS NULL AND prs_perslid_email LIKE '%aa-fm.com';

UPDATE fac_setting
   SET fac_setting_pvalue =
          REPLACE (fac_setting_pvalue, 'aa-fm.com', 'heydayfm.nl')
 WHERE LOWER (fac_setting_pvalue) LIKE '%aa-fm.com%';

UPDATE prs_bedrijf
   SET prs_bedrijf_email =
          REPLACE (prs_bedrijf_email, 'aa-fm.com', 'heydayfm.nl')
 WHERE prs_bedrijf_email LIKE '%aa-fm.com%' AND prs_bedrijf_verwijder IS NULL;

 UPDATE   mld_srtkenmerk
   SET   mld_srtkenmerk_omschrijving =
            REPLACE (mld_srtkenmerk_omschrijving, 'AAFM', 'HEYDAY')
 WHERE   mld_srtkenmerk_omschrijving LIKE '%AAFM%';

UPDATE fac_usrdata
   SET fac_usrdata_code = REPLACE (fac_usrdata_code, 'AAFM', 'HEYDAY')
 WHERE UPPER (fac_usrdata_code) LIKE '%AAFM%';

UPDATE fac_usrdata
   SET fac_usrdata_omschr = REPLACE (fac_usrdata_omschr, 'AAFM', 'HEYDAY')
 WHERE fac_usrdata_omschr LIKE '%AAFM%';

 UPDATE fac_usrdata
   SET fac_usrdata_omschr = REPLACE (fac_usrdata_omschr, 'aafm', 'heyday')
 WHERE  fac_usrdata_omschr LIKE '%aafm%';

UPDATE fac_menu
   SET fac_menu_altlabel = REPLACE (fac_menu_altlabel, 'AAFM', 'HEYDAY')
 WHERE fac_menu_altlabel LIKE '%AAFM%';

UPDATE prs_bedrijf
   SET prs_bedrijf_naam = REPLACE (prs_bedrijf_naam, 'AAFM', 'HEYDAY')
 WHERE prs_bedrijf_naam LIKE '%AAFM%' AND prs_bedrijf_verwijder IS NULL
   AND prs_bedrijf_intern IS NULL;

UPDATE prs_bedrijfadres
   SET prs_bedrijfadres_url =
          REPLACE (prs_bedrijfadres_url, 'aa-fm.com', 'heydayfm.nl')
 WHERE prs_bedrijfadres_url LIKE 'mailto:%aa-fm.com%';

------ 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