--Allow Edit WR Date in Mobile
--1 = Default, allow to edit WO Origination and Due Date
--0 = Not allow to edit WO Origination and Due Date
IF NOT EXISTS (
    SELECT * 
    FROM sys.columns 
    WHERE object_id = OBJECT_ID('dft_mst') 
    AND name = 'dft_mst_edit_wr_date'
)
BEGIN
    ALTER TABLE dft_mst
    ADD dft_mst_edit_wr_date varchar(1) NULL
END
GO

DELETE	cf_label
WHERE	table_name = 'dft_mst'
AND 	column_name = 'dft_mst_edit_wr_date'
GO

INSERT 	cf_label (language_cd, table_name, column_name, 
		default_label,
		customize_label, 
		default_header, 
		customize_header, 
		cfr_flag, cf_label_required, audit_user, audit_date ) 
SELECT 	language_cd, 'dft_mst', 'dft_mst_edit_wr_date', 
		'Edit Mobile WR Date:', 
		'Edit Mobile WR Date:', 
		'Edit Mobile WR Date', 
		'Edit Mobile WR Date', 
		'0', '0', 'admin', getdate() 
FROM	cf_language 
GO

update dft_mst set dft_mst_edit_wr_date = '1' where dft_mst_edit_wr_date IS NULL

--Allow Edit WO Date in Mobile
--1 = Default, allow to edit WO Origination and Due Date
--0 = Not allow to edit WO Origination and Due Date
IF NOT EXISTS (
    SELECT * 
    FROM sys.columns 
    WHERE object_id = OBJECT_ID('dft_mst') 
    AND name = 'dft_mst_edit_wo_date'
)
BEGIN
    ALTER TABLE dft_mst
    ADD dft_mst_edit_wo_date varchar(1) NULL
END
GO


DELETE	cf_label
WHERE	table_name = 'dft_mst'
AND 	column_name = 'dft_mst_edit_wo_date'
GO

INSERT 	cf_label (language_cd, table_name, column_name, 
		default_label,
		customize_label, 
		default_header, 
		customize_header, 
		cfr_flag, cf_label_required, audit_user, audit_date ) 
SELECT 	language_cd, 'dft_mst', 'dft_mst_edit_wo_date', 
		'Edit Mobile WO Date:', 
		'Edit Mobile WO Date:', 
		'Edit Mobile WO Date', 
		'Edit Mobile WO Date', 
		'0', '0', 'admin', getdate() 
FROM	cf_language 
GO

update dft_mst set dft_mst_edit_wo_date = '1' where dft_mst_edit_wo_date IS NULL


--Mobile Single Login Only
--1 = Only 1 session per login ID
--0 = Default, allow multiple session per login ID
IF NOT EXISTS (
    SELECT * 
    FROM sys.columns 
    WHERE object_id = OBJECT_ID('dft_mst') 
    AND name = 'dft_mst_mbl_single_login'
)
BEGIN
    ALTER TABLE dft_mst
    ADD dft_mst_mbl_single_login varchar(1) NULL
END
GO


DELETE	cf_label
WHERE	table_name = 'dft_mst'
AND 	column_name = 'dft_mst_mbl_single_login'
GO

INSERT 	cf_label (language_cd, table_name, column_name, 
		default_label,
		customize_label, 
		default_header, 
		customize_header, 
		cfr_flag, cf_label_required, audit_user, audit_date ) 
SELECT 	language_cd, 'dft_mst', 'dft_mst_mbl_single_login', 
		'Single Login Session:', 
		'Single Login Session:', 
		'Single Login Session', 
		'Single Login Session', 
		'0', '0', 'admin', getdate() 
FROM	cf_language 
GO

update dft_mst set dft_mst_mbl_single_login = '0' where dft_mst_mbl_single_login IS NULL
GO