IF NOT EXISTS(SELECT * FROM [dbo].[REF_CUSTOM_CONTROL] WHERE [TableName] = 'DT_PERSON' AND [FieldName] = 'USR_StatusNone') BEGIN INSERT INTO [dbo].[REF_CUSTOM_CONTROL] ([TableName], [FieldName], [CustomisationID], [Caption], [Enabled], [ControlTop], [ControlLeft], [ControlWidth], [ControlHeight], [Mask], [DefaultValue], [ControlType], [Compulsory], [LookupID], [ToolTipText], [ControlBackColor], [FontColor], [FontStyle], [FontBold], [FontItalic], [FontUnderline], [FontSize], [Visible], [MaximumLength], [CharacterTable], [Characters], [ShowCodesInCombo], [Justification], [MinValue], [MaxValue], [IntDigits], [DecDigits], [ValidateMask], [ShowZero], [fmtThousands], [EntityUnique], [TreatZeroAsBlank], [ObjectChooserTable], [OverideComboTextField], [MiscSelectorTable], [WidthOffset], [DisplayInHeader], [KeyField], [LabelAbove], [HideLabelOnFrame], [ImageMode], [ImageFilePattern], [ScaleImage], [MaintainAspect], [MiscSelectorSortFields], [MailMergeReport], [NULLDisplayField], [DisplayTab], [SecurityIdentifier], [ExcelTextOutput], [Hidden], [DataProtectionTrigger]) VALUES (N'DT_PERSON', N'USR_StatusNone', 0, N'Usr statusnone', 1, 0, 0, 4, 1, N'', NULL, 0, 0, NULL, N'Usr statusnone', -2147483633, -2147483630, N'Calibri', 0, 0, 0, 9, 1, 0, N'', -1, 0, 0, NULL, NULL, NULL, NULL, 0, 1, N',', 0, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, 0, N'', 0, 0, NULL, NULL, NULL, NULL, NULL, 0, 0, 1) INSERT INTO [dbo].[REF_CUSTOM_CONTROL] ([TableName], [FieldName], [CustomisationID], [Caption], [Enabled], [ControlTop], [ControlLeft], [ControlWidth], [ControlHeight], [Mask], [DefaultValue], [ControlType], [Compulsory], [LookupID], [ToolTipText], [ControlBackColor], [FontColor], [FontStyle], [FontBold], [FontItalic], [FontUnderline], [FontSize], [Visible], [MaximumLength], [CharacterTable], [Characters], [ShowCodesInCombo], [Justification], [MinValue], [MaxValue], [IntDigits], [DecDigits], [ValidateMask], [ShowZero], [fmtThousands], [EntityUnique], [TreatZeroAsBlank], [ObjectChooserTable], [OverideComboTextField], [MiscSelectorTable], [WidthOffset], [DisplayInHeader], [KeyField], [LabelAbove], [HideLabelOnFrame], [ImageMode], [ImageFilePattern], [ScaleImage], [MaintainAspect], [MiscSelectorSortFields], [MailMergeReport], [NULLDisplayField], [DisplayTab], [SecurityIdentifier], [ExcelTextOutput], [Hidden], [DataProtectionTrigger]) VALUES (N'DT_PERSON', N'USR_StatusNone', 999, N'Status None', 0, 0, 0, 4, 1, N'', NULL, 2, 0, NULL, N'Status None', -2147483633, -2147483630, N'Calibri', 0, 0, 0, 9, 1, 0, N'', -1, 0, 0, NULL, NULL, NULL, NULL, 0, 1, N',', 0, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, 0, N'', 0, 0, NULL, NULL, NULL, NULL, NULL, 0, 0, 1) INSERT INTO [dbo].[REF_SQLFIELDS] ([Table_Name], [Field_Name], [CustomisationID], [Version], [Code], [OnByDefault], [InLine]) VALUES (N'DT_PERSON', N'USR_StatusNone', 0, 1, N'CASE WHEN (NOT EXISTS (SELECT * FROM LNK_EMPLOYEE_PERSON a WHERE a.Right_Join = RT.Entity_Id) AND NOT EXISTS (SELECT * FROM LNK_PERSON_APPLICATION a WHERE a.Left_Join = RT.Entity_Id)) THEN DATEADD(dd, -2, GETDATE()) ELSE NULL END', 0, 1) END