__IF_EXISTS__
SELECT 1
  FROM CI_UT_INSTL_DTL
WHERE SCRIPT_FILE_NAME = 'FW45001_POSTDATA_UGBUPD-10268.SQL'
   AND END_DTTM IS NOT NULL
/
__THEN__
__EXIT__
__ENDIF__

UPDATE CI_MD_MENU_L SET DESCR50 = MENU_NAME WHERE OWNER_FLG = 'CM' AND DESCR50 = ' '
/

UPDATE CI_MD_MENU_ITEM MI
SET (MI.APP_SVC_ID, MI.ACCESS_MODE) = (select ACC.APP_SVC_ID, 'A' ACCESS_MODE from CI_NAV_OPT B, CI_MD_MO_OPT C, CI_MD_MO MO, CI_MD_SVC SVC, CI_APP_SVC_ACC ACC
WHERE MI.NAV_OPT_CD = B.NAV_OPT_CD 
AND B.SCR_CD > ' '
AND RTRIM(B.SCR_CD) = RTRIM(C.MAINT_OBJ_OPT_VAL)
AND C.MAINT_OBJ_OPT_FLG = 'F1MB'
AND C.MAINT_OBJ_CD = MO.MAINT_OBJ_CD
AND MO.SVC_NAME = SVC.SVC_NAME
AND SVC.APP_SVC_ID = ACC.APP_SVC_ID
AND ACC.ACCESS_MODE = 'A')
WHERE UPPER(MI.NAV_OPT_CD) NOT LIKE 'ZZ%'
AND MI.OWNER_FLG <> 'CM'
AND MI.NAV_OPT_CD IN (SELECT NAV_OPT_CD FROM CI_NAV_OPT WHERE SCR_CD > ' ')
AND MI.MENU_LINE_ID IN (SELECT MENU_LINE_ID FROM CI_MD_MENU_LINE WHERE MENU_NAME NOT LIKE 'ZZ%')
AND MI.APP_SVC_ID IS NULL
AND 1 = (select count(*) from CI_NAV_OPT B, CI_MD_MO_OPT C, CI_MD_MO MO
WHERE MI.NAV_OPT_CD = B.NAV_OPT_CD AND B.SCR_CD > ' ' AND RTRIM(B.SCR_CD) = RTRIM(C.MAINT_OBJ_OPT_VAL) AND C.MAINT_OBJ_OPT_FLG = 'F1MB'
AND C.MAINT_OBJ_CD = MO.MAINT_OBJ_CD)
/

UPDATE CI_MD_MENU_ITEM MI 
SET (MI.APP_SVC_ID, MI.ACCESS_MODE) = (select DISTINCT(ACC.APP_SVC_ID), 'A' ACCESS_MODE from CI_NAV_OPT B, F1_BUS_OBJ_OPT C, F1_BUS_OBJ BO, CI_APP_SVC_ACC ACC
WHERE MI.NAV_OPT_CD = B.NAV_OPT_CD AND B.SCR_CD > ' ' AND RTRIM(B.SCR_CD) = RTRIM(C.BUS_OBJ_OPT_VAL) AND C.BUS_OBJ_OPT_FLG = 'F1MB' AND C.BUS_OBJ_CD = BO.BUS_OBJ_CD
AND BO.APP_SVC_ID = ACC.APP_SVC_ID AND ACC.ACCESS_MODE = 'A')
WHERE UPPER(MI.NAV_OPT_CD) NOT LIKE 'ZZ%' AND MI.OWNER_FLG <> 'CM' AND MI.NAV_OPT_CD IN (SELECT NAV_OPT_CD FROM CI_NAV_OPT WHERE SCR_CD > ' ')
AND MI.MENU_LINE_ID IN (SELECT MENU_LINE_ID FROM CI_MD_MENU_LINE WHERE MENU_NAME NOT LIKE 'ZZ%')
AND MI.APP_SVC_ID IS NULL
AND 1 = (SELECT count(distinct d.app_svc_id) FROM CI_NAV_OPT B, F1_BUS_OBJ_OPT C, F1_BUS_OBJ D WHERE B.NAV_OPT_CD = MI.NAV_OPT_CD AND B.SCR_CD > ' '
AND RTRIM(B.SCR_CD) = RTRIM(C.BUS_OBJ_OPT_VAL) AND C.BUS_OBJ_OPT_FLG = 'F1MB' AND C.BUS_OBJ_CD = D.BUS_OBJ_CD)
/

UPDATE CI_MD_MENU_ITEM SET APP_SVC_ID = 'F1LCAMRP', ACCESS_MODE = 'A' WHERE MENU_ITEM_ID = 'F112144540' AND APP_SVC_ID IS NULL
/
UPDATE CI_MD_MENU_ITEM SET APP_SVC_ID = 'F1MIGRDS', ACCESS_MODE = 'A' WHERE MENU_ITEM_ID = 'F118914801' AND APP_SVC_ID IS NULL
/
UPDATE CI_MD_MENU_ITEM SET APP_SVC_ID = 'F1MIGRDS', ACCESS_MODE = 'A' WHERE MENU_ITEM_ID = 'F122031321' AND APP_SVC_ID IS NULL
/
UPDATE CI_MD_MENU_ITEM SET APP_SVC_ID = 'F1-WEBSVCCAT', ACCESS_MODE = 'A' WHERE MENU_ITEM_ID = 'F129356864' AND APP_SVC_ID IS NULL
/
UPDATE CI_MD_MENU_ITEM SET APP_SVC_ID = 'F1ATTACHMENT', ACCESS_MODE = 'R' WHERE MENU_ITEM_ID = 'F158538306' AND APP_SVC_ID IS NULL
/
UPDATE CI_MD_MENU_ITEM SET APP_SVC_ID = 'F1MIGRDS', ACCESS_MODE = 'A' WHERE MENU_ITEM_ID = 'F184395004' AND APP_SVC_ID IS NULL
/
UPDATE CI_MD_MENU_ITEM SET APP_SVC_ID = 'F1ATTACHMENT', ACCESS_MODE = 'R' WHERE MENU_ITEM_ID = 'F185194113' AND APP_SVC_ID IS NULL
/
UPDATE CI_MD_MENU_ITEM SET APP_SVC_ID = 'F1LCAMRP', ACCESS_MODE = 'A' WHERE MENU_ITEM_ID = 'F191424011' AND APP_SVC_ID IS NULL
/
UPDATE CI_MD_MENU_ITEM SET APP_SVC_ID = 'F1MIGRDS', ACCESS_MODE = 'A' WHERE MENU_ITEM_ID = 'F192404056' AND APP_SVC_ID IS NULL
/
UPDATE CI_MD_MENU_ITEM SET APP_SVC_ID = 'F1-WEBSVCCAT', ACCESS_MODE = 'A' WHERE MENU_ITEM_ID = 'F199117119' AND APP_SVC_ID IS NULL
/