10480 lines
787 KiB
Transact-SQL
10480 lines
787 KiB
Transact-SQL
USE [master]
|
|
GO
|
|
/****** Object: Database [site_fuchs] Script Date: 23.04.2021 14:34:49 ******/
|
|
CREATE DATABASE [site_fuchs]
|
|
CONTAINMENT = NONE
|
|
ON PRIMARY
|
|
( NAME = N'site_fuchs', FILENAME = N'C:\DATA\MSSQL14.SQL\MSSQL\DATA\site_fuchs.mdf' , SIZE = 251904KB , MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB )
|
|
LOG ON
|
|
( NAME = N'site_fuchs_log', FILENAME = N'C:\DATA\MSSQL14.SQL\MSSQL\DATA\site_fuchs_log.ldf' , SIZE = 470144KB , MAXSIZE = 2048GB , FILEGROWTH = 10%)
|
|
GO
|
|
ALTER DATABASE [site_fuchs] SET COMPATIBILITY_LEVEL = 140
|
|
GO
|
|
IF (1 = FULLTEXTSERVICEPROPERTY('IsFullTextInstalled'))
|
|
begin
|
|
EXEC [site_fuchs].[dbo].[sp_fulltext_database] @action = 'enable'
|
|
end
|
|
GO
|
|
ALTER DATABASE [site_fuchs] SET ANSI_NULL_DEFAULT OFF
|
|
GO
|
|
ALTER DATABASE [site_fuchs] SET ANSI_NULLS OFF
|
|
GO
|
|
ALTER DATABASE [site_fuchs] SET ANSI_PADDING OFF
|
|
GO
|
|
ALTER DATABASE [site_fuchs] SET ANSI_WARNINGS OFF
|
|
GO
|
|
ALTER DATABASE [site_fuchs] SET ARITHABORT OFF
|
|
GO
|
|
ALTER DATABASE [site_fuchs] SET AUTO_CLOSE OFF
|
|
GO
|
|
ALTER DATABASE [site_fuchs] SET AUTO_SHRINK OFF
|
|
GO
|
|
ALTER DATABASE [site_fuchs] SET AUTO_UPDATE_STATISTICS ON
|
|
GO
|
|
ALTER DATABASE [site_fuchs] SET CURSOR_CLOSE_ON_COMMIT OFF
|
|
GO
|
|
ALTER DATABASE [site_fuchs] SET CURSOR_DEFAULT GLOBAL
|
|
GO
|
|
ALTER DATABASE [site_fuchs] SET CONCAT_NULL_YIELDS_NULL OFF
|
|
GO
|
|
ALTER DATABASE [site_fuchs] SET NUMERIC_ROUNDABORT OFF
|
|
GO
|
|
ALTER DATABASE [site_fuchs] SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
ALTER DATABASE [site_fuchs] SET RECURSIVE_TRIGGERS OFF
|
|
GO
|
|
ALTER DATABASE [site_fuchs] SET DISABLE_BROKER
|
|
GO
|
|
ALTER DATABASE [site_fuchs] SET AUTO_UPDATE_STATISTICS_ASYNC OFF
|
|
GO
|
|
ALTER DATABASE [site_fuchs] SET DATE_CORRELATION_OPTIMIZATION OFF
|
|
GO
|
|
ALTER DATABASE [site_fuchs] SET TRUSTWORTHY OFF
|
|
GO
|
|
ALTER DATABASE [site_fuchs] SET ALLOW_SNAPSHOT_ISOLATION OFF
|
|
GO
|
|
ALTER DATABASE [site_fuchs] SET PARAMETERIZATION SIMPLE
|
|
GO
|
|
ALTER DATABASE [site_fuchs] SET READ_COMMITTED_SNAPSHOT OFF
|
|
GO
|
|
ALTER DATABASE [site_fuchs] SET HONOR_BROKER_PRIORITY OFF
|
|
GO
|
|
ALTER DATABASE [site_fuchs] SET RECOVERY FULL
|
|
GO
|
|
ALTER DATABASE [site_fuchs] SET MULTI_USER
|
|
GO
|
|
ALTER DATABASE [site_fuchs] SET PAGE_VERIFY CHECKSUM
|
|
GO
|
|
ALTER DATABASE [site_fuchs] SET DB_CHAINING OFF
|
|
GO
|
|
ALTER DATABASE [site_fuchs] SET FILESTREAM( NON_TRANSACTED_ACCESS = OFF )
|
|
GO
|
|
ALTER DATABASE [site_fuchs] SET TARGET_RECOVERY_TIME = 0 SECONDS
|
|
GO
|
|
ALTER DATABASE [site_fuchs] SET DELAYED_DURABILITY = DISABLED
|
|
GO
|
|
ALTER DATABASE [site_fuchs] SET QUERY_STORE = OFF
|
|
GO
|
|
USE [site_fuchs]
|
|
GO
|
|
/****** Object: User [fuchs_web] Script Date: 23.04.2021 14:34:50 ******/
|
|
CREATE USER [fuchs_web] FOR LOGIN [fuchs_web] WITH DEFAULT_SCHEMA=[dbo]
|
|
GO
|
|
/****** Object: User [fuchs_fds] Script Date: 23.04.2021 14:34:50 ******/
|
|
CREATE USER [fuchs_fds] FOR LOGIN [fuchs_fds] WITH DEFAULT_SCHEMA=[dbo]
|
|
GO
|
|
/****** Object: DatabaseRole [ocms_rwe] Script Date: 23.04.2021 14:34:50 ******/
|
|
CREATE ROLE [ocms_rwe]
|
|
GO
|
|
/****** Object: DatabaseRole [fuchs_rwe] Script Date: 23.04.2021 14:34:50 ******/
|
|
CREATE ROLE [fuchs_rwe]
|
|
GO
|
|
/****** Object: DatabaseRole [fds_rwe] Script Date: 23.04.2021 14:34:50 ******/
|
|
CREATE ROLE [fds_rwe]
|
|
GO
|
|
ALTER ROLE [ocms_rwe] ADD MEMBER [fuchs_web]
|
|
GO
|
|
ALTER ROLE [fuchs_rwe] ADD MEMBER [fuchs_web]
|
|
GO
|
|
ALTER ROLE [fds_rwe] ADD MEMBER [fuchs_fds]
|
|
GO
|
|
/****** Object: UserDefinedTableType [dbo].[mfr__tt__#customvalues] Script Date: 23.04.2021 14:34:50 ******/
|
|
CREATE TYPE [dbo].[mfr__tt__#customvalues] AS TABLE(
|
|
[setid] [varchar](5) NULL,
|
|
[Id] [bigint] NOT NULL,
|
|
[EntityId] [bigint] NOT NULL,
|
|
[Property] [varchar](255) NOT NULL,
|
|
[Meta] [varchar](255) NOT NULL,
|
|
[Value] [varchar](1000) NULL
|
|
)
|
|
GO
|
|
/****** Object: UserDefinedTableType [dbo].[mfr__tt__#locations] Script Date: 23.04.2021 14:34:50 ******/
|
|
CREATE TYPE [dbo].[mfr__tt__#locations] AS TABLE(
|
|
[setid] [varchar](5) NULL,
|
|
[Id] [bigint] NOT NULL,
|
|
[EntityId] [bigint] NULL,
|
|
[Property] [varchar](255) NOT NULL,
|
|
[Version] [int] NOT NULL,
|
|
[AddressString] [nvarchar](255) NULL,
|
|
[Postal] [nvarchar](255) NULL,
|
|
[City] [nvarchar](255) NULL,
|
|
[State] [nvarchar](255) NULL,
|
|
[Country] [varchar](15) NULL,
|
|
[Longitude] [float] NOT NULL,
|
|
[Latitude] [float] NOT NULL,
|
|
[IsValidLocation] [bit] NOT NULL
|
|
)
|
|
GO
|
|
/****** Object: UserDefinedTableType [dbo].[mfr__tt__*PartnerSet] Script Date: 23.04.2021 14:34:50 ******/
|
|
CREATE TYPE [dbo].[mfr__tt__*PartnerSet] AS TABLE(
|
|
[setid] [varchar](5) NULL,
|
|
[Property] [varchar](50) NOT NULL,
|
|
[PartnerType] [varchar](25) NOT NULL,
|
|
[PartnerId] [bigint] NOT NULL,
|
|
[EntityId] [bigint] NOT NULL
|
|
)
|
|
GO
|
|
/****** Object: UserDefinedTableType [dbo].[mfr__tt__appointments] Script Date: 23.04.2021 14:34:50 ******/
|
|
CREATE TYPE [dbo].[mfr__tt__appointments] AS TABLE(
|
|
[setid] [varchar](5) NULL,
|
|
[Id] [bigint] NOT NULL,
|
|
[Version] [int] NOT NULL,
|
|
[State] [nvarchar](255) NULL,
|
|
[Type] [nvarchar](255) NULL,
|
|
[EndDateTime] [datetime] NULL,
|
|
[StartDateTime] [datetime] NOT NULL,
|
|
[DrivingDistanceFrom] [int] NULL,
|
|
[DrivingDistanceTo] [int] NULL,
|
|
[WasReadOnClientSide] [bit] NOT NULL,
|
|
[ContactIds] [varchar](max) NULL,
|
|
[ServiceRequestId] [bigint] NOT NULL,
|
|
[ContactId] [bigint] NOT NULL,
|
|
[Note] [nvarchar](255) NULL
|
|
)
|
|
GO
|
|
/****** Object: UserDefinedTableType [dbo].[mfr__tt__attachments] Script Date: 23.04.2021 14:34:50 ******/
|
|
CREATE TYPE [dbo].[mfr__tt__attachments] AS TABLE(
|
|
[setid] [varchar](5) NULL,
|
|
[Id] [bigint] NOT NULL,
|
|
[Version] [int] NOT NULL,
|
|
[URI] [nvarchar](255) NULL,
|
|
[StepId] [bigint] NOT NULL
|
|
)
|
|
GO
|
|
/****** Object: UserDefinedTableType [dbo].[mfr__tt__comments] Script Date: 23.04.2021 14:34:50 ******/
|
|
CREATE TYPE [dbo].[mfr__tt__comments] AS TABLE(
|
|
[setid] [varchar](5) NULL,
|
|
[Id] [bigint] NOT NULL,
|
|
[Version] [int] NOT NULL,
|
|
[DateOfCreation] [datetime] NOT NULL,
|
|
[IsInternal] [bit] NOT NULL,
|
|
[ServiceRequestId] [bigint] NOT NULL,
|
|
[CompanyId] [bigint] NOT NULL,
|
|
[Content] [nvarchar](255) NULL
|
|
)
|
|
GO
|
|
/****** Object: UserDefinedTableType [dbo].[mfr__tt__companies] Script Date: 23.04.2021 14:34:50 ******/
|
|
CREATE TYPE [dbo].[mfr__tt__companies] AS TABLE(
|
|
[setid] [varchar](5) NULL,
|
|
[Id] [bigint] NOT NULL,
|
|
[Location#ID] [bigint] NULL,
|
|
[Version] [int] NOT NULL,
|
|
[IsPhysicalPerson] [bit] NOT NULL,
|
|
[IsOwner] [bit] NOT NULL,
|
|
[IsEmailInvoicingActive] [bit] NOT NULL,
|
|
[IsSupplier] [bit] NOT NULL,
|
|
[MappingId] [nvarchar](255) NULL,
|
|
[ExternalId] [nvarchar](255) NULL,
|
|
[Name] [nvarchar](255) NULL,
|
|
[Note] [nvarchar](255) NULL,
|
|
[SupportTelephone] [nvarchar](255) NULL,
|
|
[SupportFax] [nvarchar](255) NULL,
|
|
[SupportMail] [nvarchar](255) NULL,
|
|
[QuickSearch] [nvarchar](255) NULL,
|
|
[DateModified] [datetime] NOT NULL,
|
|
[CustomValues] [nvarchar](max) NOT NULL,
|
|
[MainContactId] [bigint] NOT NULL
|
|
)
|
|
GO
|
|
/****** Object: UserDefinedTableType [dbo].[mfr__tt__contacts] Script Date: 23.04.2021 14:34:50 ******/
|
|
CREATE TYPE [dbo].[mfr__tt__contacts] AS TABLE(
|
|
[setid] [varchar](5) NULL,
|
|
[Id] [bigint] NOT NULL,
|
|
[CustomValues] [nvarchar](max) NOT NULL,
|
|
[FirstName] [nvarchar](255) NULL,
|
|
[LastName] [nvarchar](255) NULL,
|
|
[Email] [nvarchar](255) NULL,
|
|
[JobTitle] [nvarchar](255) NULL,
|
|
[MobilePhone] [nvarchar](255) NULL,
|
|
[Telephone] [nvarchar](255) NULL,
|
|
[Fax] [nvarchar](255) NULL,
|
|
[Note] [nvarchar](255) NULL,
|
|
[DateModified] [datetime] NOT NULL,
|
|
[Version] [int] NOT NULL,
|
|
[CompanyId] [bigint] NOT NULL,
|
|
[IsUser] [bit] NOT NULL,
|
|
[ExternalId] [nvarchar](255) NULL,
|
|
[Gender] [nvarchar](255) NULL,
|
|
[UserId] [bigint] NOT NULL
|
|
)
|
|
GO
|
|
/****** Object: UserDefinedTableType [dbo].[mfr__tt__costcenters] Script Date: 23.04.2021 14:34:50 ******/
|
|
CREATE TYPE [dbo].[mfr__tt__costcenters] AS TABLE(
|
|
[setid] [varchar](5) NULL,
|
|
[Id] [bigint] NOT NULL,
|
|
[Version] [int] NOT NULL,
|
|
[Name] [nvarchar](255) NULL
|
|
)
|
|
GO
|
|
/****** Object: UserDefinedTableType [dbo].[mfr__tt__documents] Script Date: 23.04.2021 14:34:50 ******/
|
|
CREATE TYPE [dbo].[mfr__tt__documents] AS TABLE(
|
|
[setid] [varchar](5) NULL,
|
|
[Id] [bigint] NOT NULL,
|
|
[CustomValues] [nvarchar](max) NOT NULL,
|
|
[Version] [int] NOT NULL,
|
|
[State] [nvarchar](255) NULL,
|
|
[ExternalId] [nvarchar](255) NULL,
|
|
[URI] [nvarchar](255) NULL,
|
|
[IsGlobal] [bit] NOT NULL,
|
|
[StartDateTime] [datetime] NULL,
|
|
[EndDateTime] [datetime] NULL,
|
|
[FileName] [nvarchar](255) NULL,
|
|
[DateModified] [datetime] NOT NULL,
|
|
[UploadDate] [datetime] NOT NULL,
|
|
[IsLink] [bit] NOT NULL,
|
|
[ContentType] [nvarchar](255) NULL,
|
|
[HTMLCode] [nvarchar](255) NULL,
|
|
[ServiceRequestId] [bigint] NOT NULL,
|
|
[Note] [nvarchar](255) NULL
|
|
)
|
|
GO
|
|
/****** Object: UserDefinedTableType [dbo].[mfr__tt__items] Script Date: 23.04.2021 14:34:50 ******/
|
|
CREATE TYPE [dbo].[mfr__tt__items] AS TABLE(
|
|
[setid] [varchar](5) NULL,
|
|
[Id] [bigint] NOT NULL,
|
|
[Version] [int] NOT NULL,
|
|
[QuantityHours] [float] NOT NULL,
|
|
[PlannedQuantityHours] [float] NOT NULL,
|
|
[ItemTypeId] [bigint] NULL,
|
|
[ItemNumber] [nvarchar](255) NULL,
|
|
[TrackingId] [nvarchar](255) NULL,
|
|
[Manufacture] [nvarchar](255) NULL,
|
|
[Price] [float] NOT NULL,
|
|
[Costs] [float] NULL,
|
|
[NameOrNumber] [nvarchar](255) NULL,
|
|
[CustomValues] [nvarchar](max) NULL,
|
|
[Note] [nvarchar](max) NULL,
|
|
[ExternalId] [nvarchar](255) NULL,
|
|
[Discount] [float] NOT NULL,
|
|
[VAT] [float] NOT NULL,
|
|
[IsManual] [bit] NOT NULL,
|
|
[SortOrder] [int] NOT NULL,
|
|
[Type] [nvarchar](255) NULL,
|
|
[ServiceRequestId] [bigint] NOT NULL,
|
|
[ServiceObjectId] [bigint] NOT NULL,
|
|
[CreatorId] [bigint] NOT NULL,
|
|
[UnitId] [bigint] NULL,
|
|
[UnitString] [nvarchar](255) NULL
|
|
)
|
|
GO
|
|
/****** Object: UserDefinedTableType [dbo].[mfr__tt__itemtypes] Script Date: 23.04.2021 14:34:50 ******/
|
|
CREATE TYPE [dbo].[mfr__tt__itemtypes] AS TABLE(
|
|
[setid] [varchar](5) NULL,
|
|
[Id] [bigint] NOT NULL,
|
|
[CustomValues] [nvarchar](max) NOT NULL,
|
|
[Version] [int] NOT NULL,
|
|
[Costs] [float] NOT NULL,
|
|
[Description] [nvarchar](max) NULL,
|
|
[ListPrice] [float] NOT NULL,
|
|
[Manufacture] [nvarchar](255) NULL,
|
|
[ExternalId] [nvarchar](255) NULL,
|
|
[ItemNumber] [nvarchar](255) NULL,
|
|
[NameOrNumber] [nvarchar](1000) NULL,
|
|
[GlobalTradeItemNr] [nvarchar](255) NULL,
|
|
[Type] [nvarchar](255) NULL,
|
|
[Price] [float] NOT NULL,
|
|
[VAT] [float] NOT NULL,
|
|
[IsPortalOnly] [bit] NOT NULL,
|
|
[Discount] [float] NOT NULL,
|
|
[DateModified] [datetime] NOT NULL,
|
|
[IsDiscontinued] [bit] NOT NULL,
|
|
[IsWarehouse] [bit] NOT NULL,
|
|
[UnitId] [bigint] NULL,
|
|
[UnitString] [nvarchar](255) NULL
|
|
)
|
|
GO
|
|
/****** Object: UserDefinedTableType [dbo].[mfr__tt__itemunits] Script Date: 23.04.2021 14:34:50 ******/
|
|
CREATE TYPE [dbo].[mfr__tt__itemunits] AS TABLE(
|
|
[setid] [varchar](5) NULL,
|
|
[Id] [bigint] NOT NULL,
|
|
[Version] [int] NOT NULL,
|
|
[Name] [nvarchar](255) NULL
|
|
)
|
|
GO
|
|
/****** Object: UserDefinedTableType [dbo].[mfr__tt__products] Script Date: 23.04.2021 14:34:50 ******/
|
|
CREATE TYPE [dbo].[mfr__tt__products] AS TABLE(
|
|
[setid] [varchar](5) NULL,
|
|
[Id] [bigint] NOT NULL,
|
|
[Version] [int] NOT NULL,
|
|
[Name] [nvarchar](255) NULL,
|
|
[SubKey] [nvarchar](255) NULL,
|
|
[Description] [nvarchar](255) NULL,
|
|
[DateModified] [datetime] NOT NULL,
|
|
[MappingId] [nvarchar](255) NULL,
|
|
[CustomValueStepTemplateId] [bigint] NOT NULL
|
|
)
|
|
GO
|
|
/****** Object: UserDefinedTableType [dbo].[mfr__tt__qualifications] Script Date: 23.04.2021 14:34:50 ******/
|
|
CREATE TYPE [dbo].[mfr__tt__qualifications] AS TABLE(
|
|
[setid] [varchar](5) NULL,
|
|
[Id] [bigint] NOT NULL,
|
|
[Version] [int] NOT NULL,
|
|
[Name] [nvarchar](255) NULL
|
|
)
|
|
GO
|
|
/****** Object: UserDefinedTableType [dbo].[mfr__tt__reports] Script Date: 23.04.2021 14:34:50 ******/
|
|
CREATE TYPE [dbo].[mfr__tt__reports] AS TABLE(
|
|
[setid] [varchar](5) NULL,
|
|
[Id] [bigint] NOT NULL,
|
|
[Version] [int] NOT NULL,
|
|
[DateOfCreation] [datetime] NOT NULL,
|
|
[URI] [nvarchar](255) NULL,
|
|
[DocumentName] [nvarchar](255) NULL,
|
|
[FileTypeString] [nvarchar](255) NULL,
|
|
[ReportDefinitionCode] [nvarchar](255) NULL,
|
|
[ServiceObjectId] [bigint] NOT NULL,
|
|
[CanBeDeleted] [bit] NOT NULL,
|
|
[InvoiceBalance] [float] NOT NULL,
|
|
[InvoiceId] [nvarchar](255) NULL,
|
|
[DueDate] [datetime] NOT NULL,
|
|
[IsPayed] [bit] NOT NULL,
|
|
[IsInvoice] [bit] NOT NULL,
|
|
[IsCanceled] [bit] NOT NULL,
|
|
[CustomValues] [nvarchar](max) NOT NULL
|
|
)
|
|
GO
|
|
/****** Object: UserDefinedTableType [dbo].[mfr__tt__serviceobjects] Script Date: 23.04.2021 14:34:50 ******/
|
|
CREATE TYPE [dbo].[mfr__tt__serviceobjects] AS TABLE(
|
|
[setid] [varchar](5) NULL,
|
|
[Id] [bigint] NOT NULL,
|
|
[Location#ID] [bigint] NULL,
|
|
[Name] [nvarchar](255) NULL,
|
|
[Note] [nvarchar](255) NULL,
|
|
[CustomValues] [nvarchar](max) NOT NULL,
|
|
[DateModified] [datetime] NOT NULL,
|
|
[ExternalId] [nvarchar](255) NULL,
|
|
[MappingId] [nvarchar](255) NULL,
|
|
[QuickSearch] [nvarchar](255) NULL,
|
|
[Version] [int] NOT NULL,
|
|
[CreateGeoLocation] [bit] NOT NULL,
|
|
[IsWarehouse] [bit] NOT NULL,
|
|
[ParentServiceObjectId] [bigint] NOT NULL,
|
|
[CompanyId] [bigint] NOT NULL,
|
|
[ProductId] [bigint] NOT NULL
|
|
)
|
|
GO
|
|
/****** Object: UserDefinedTableType [dbo].[mfr__tt__servicerequests] Script Date: 23.04.2021 14:34:50 ******/
|
|
CREATE TYPE [dbo].[mfr__tt__servicerequests] AS TABLE(
|
|
[setid] [varchar](5) NULL,
|
|
[Id] [bigint] NOT NULL,
|
|
[Name] [nvarchar](255) NULL,
|
|
[ExternalId] [nvarchar](255) NULL,
|
|
[InvoiceId] [nvarchar](255) NULL,
|
|
[ClosedAt] [datetime] NULL,
|
|
[ReleasedAt] [datetime] NULL,
|
|
[WorkDoneAt] [datetime] NULL,
|
|
[TargetTimeInMinutes] [bigint] NOT NULL,
|
|
[DateModified] [datetime] NULL,
|
|
[DateOfCreation] [datetime] NULL,
|
|
[DueDateRangeStart] [datetime] NULL,
|
|
[DueDateRangeEnd] [datetime] NULL,
|
|
[PortalLink] [nvarchar](255) NULL,
|
|
[CostCenterId] [bigint] NULL,
|
|
[Description] [nvarchar](max) NULL,
|
|
[State] [nvarchar](255) NULL,
|
|
[CustomValues] [nvarchar](max) NOT NULL,
|
|
[CurrentOwnerId] [bigint] NULL,
|
|
[CustomerId] [bigint] NULL,
|
|
[ParentServiceRequestId] [bigint] NULL,
|
|
[Location#ID] [bigint] NULL,
|
|
[Version] [int] NOT NULL,
|
|
[IsTemplate] [bit] NOT NULL,
|
|
[IsTemplateMobile] [bit] NOT NULL,
|
|
[CreateFromServiceRequestTemplateId] [bigint] NOT NULL,
|
|
[Type] [nvarchar](255) NULL
|
|
)
|
|
GO
|
|
/****** Object: UserDefinedTableType [dbo].[mfr__tt__steplisttemplateinstances] Script Date: 23.04.2021 14:34:50 ******/
|
|
CREATE TYPE [dbo].[mfr__tt__steplisttemplateinstances] AS TABLE(
|
|
[setid] [varchar](5) NULL,
|
|
[Id] [bigint] NOT NULL,
|
|
[Version] [int] NOT NULL,
|
|
[Name] [nvarchar](255) NULL,
|
|
[ServiceRequestId] [bigint] NULL,
|
|
[TemplateId] [bigint] NULL
|
|
)
|
|
GO
|
|
/****** Object: UserDefinedTableType [dbo].[mfr__tt__steplisttemplates] Script Date: 23.04.2021 14:34:50 ******/
|
|
CREATE TYPE [dbo].[mfr__tt__steplisttemplates] AS TABLE(
|
|
[setid] [varchar](5) NULL,
|
|
[Id] [bigint] NOT NULL,
|
|
[Version] [int] NOT NULL,
|
|
[Name] [nvarchar](255) NULL,
|
|
[MappingId] [nvarchar](255) NULL,
|
|
[DateModified] [datetime] NOT NULL,
|
|
[IsReleased] [bit] NOT NULL,
|
|
[IsDurable] [bit] NOT NULL
|
|
)
|
|
GO
|
|
/****** Object: UserDefinedTableType [dbo].[mfr__tt__steps] Script Date: 23.04.2021 14:34:50 ******/
|
|
CREATE TYPE [dbo].[mfr__tt__steps] AS TABLE(
|
|
[setid] [varchar](5) NULL,
|
|
[Id] [bigint] NOT NULL,
|
|
[MobileId] [bigint] NULL,
|
|
[Version] [int] NOT NULL,
|
|
[Name] [nvarchar](255) NULL,
|
|
[IsDone] [bit] NOT NULL,
|
|
[HasError] [bit] NOT NULL,
|
|
[TrackingId] [nvarchar](255) NULL,
|
|
[Type] [nvarchar](255) NULL,
|
|
[SortOrder] [int] NOT NULL,
|
|
[Data] [nvarchar](max) NULL,
|
|
[DateModifiedOffline] [datetime] NULL,
|
|
[ServiceRequestId] [bigint] NULL,
|
|
[Description] [nvarchar](max) NULL,
|
|
[Comment] [nvarchar](max) NULL,
|
|
[InternalComment] [nvarchar](max) NULL,
|
|
[ServiceObjectId] [bigint] NULL,
|
|
[StepListTemplateId] [bigint] NULL,
|
|
[ParentId] [bigint] NULL
|
|
)
|
|
GO
|
|
/****** Object: UserDefinedTableType [dbo].[mfr__tt__stockmovements] Script Date: 23.04.2021 14:34:50 ******/
|
|
CREATE TYPE [dbo].[mfr__tt__stockmovements] AS TABLE(
|
|
[setid] [varchar](5) NULL,
|
|
[Id] [bigint] NOT NULL,
|
|
[Version] [int] NOT NULL,
|
|
[Amount] [float] NOT NULL,
|
|
[AmountReceived] [float] NOT NULL,
|
|
[ExternalId] [varchar](255) NULL,
|
|
[ItemId] [bigint] NULL,
|
|
[ItemTypeId] [bigint] NULL,
|
|
[StockMovementType] [varchar](255) NULL,
|
|
[State] [varchar](255) NULL,
|
|
[ServiceRequestId] [bigint] NOT NULL,
|
|
[WarehouseId] [bigint] NOT NULL,
|
|
[DateOfCreation] [datetime] NOT NULL,
|
|
[DateModified] [datetime] NOT NULL,
|
|
[TargetDate] [datetime] NOT NULL,
|
|
[CreatedById] [bigint] NOT NULL,
|
|
[ConfirmedById] [bigint] NOT NULL
|
|
)
|
|
GO
|
|
/****** Object: UserDefinedTableType [dbo].[mfr__tt__tags] Script Date: 23.04.2021 14:34:50 ******/
|
|
CREATE TYPE [dbo].[mfr__tt__tags] AS TABLE(
|
|
[setid] [varchar](5) NULL,
|
|
[Id] [bigint] NOT NULL,
|
|
[Version] [int] NOT NULL,
|
|
[Name] [nvarchar](255) NULL,
|
|
[ColorDefinition] [nvarchar](255) NULL,
|
|
[Type] [nvarchar](255) NOT NULL
|
|
)
|
|
GO
|
|
/****** Object: UserDefinedTableType [dbo].[mfr__tt__timeevents] Script Date: 23.04.2021 14:34:50 ******/
|
|
CREATE TYPE [dbo].[mfr__tt__timeevents] AS TABLE(
|
|
[setid] [varchar](5) NULL,
|
|
[Id] [bigint] NOT NULL,
|
|
[Version] [int] NOT NULL,
|
|
[State] [nvarchar](255) NULL,
|
|
[IsApproved] [bit] NOT NULL,
|
|
[TimeEventType] [nvarchar](255) NULL,
|
|
[ExternalId] [nvarchar](255) NULL,
|
|
[DateModified] [datetime] NOT NULL,
|
|
[StartDateTime] [datetime] NOT NULL,
|
|
[EndDateTime] [datetime] NOT NULL,
|
|
[ProposedDrivingDistance] [int] NOT NULL,
|
|
[ContactId] [bigint] NOT NULL,
|
|
[ServiceRequestId] [bigint] NOT NULL,
|
|
[Description] [nvarchar](255) NULL
|
|
)
|
|
GO
|
|
/****** Object: UserDefinedTableType [dbo].[mfr__tt__users] Script Date: 23.04.2021 14:34:50 ******/
|
|
CREATE TYPE [dbo].[mfr__tt__users] AS TABLE(
|
|
[setid] [varchar](5) NULL,
|
|
[Id] [bigint] NOT NULL,
|
|
[Version] [int] NOT NULL,
|
|
[UserName] [nvarchar](255) NULL,
|
|
[IsSystem] [bit] NOT NULL,
|
|
[CreationDate] [datetime] NOT NULL,
|
|
[IsApproved] [bit] NOT NULL,
|
|
[ContactId] [bigint] NOT NULL,
|
|
[PreferedLanguage] [nvarchar](255) NULL,
|
|
[EmailChannelEnabled] [bit] NOT NULL,
|
|
[HasFullScreenPreference] [bit] NOT NULL,
|
|
[TimeZone] [int] NOT NULL,
|
|
[PreferedCulture] [nvarchar](255) NULL,
|
|
[IsActive] [bit] NOT NULL,
|
|
[IsMobile] [bit] NOT NULL,
|
|
[LastLoginDate] [datetime] NULL,
|
|
[UserGuideProgress] [nvarchar](255) NULL,
|
|
[DashboardSettings] [nvarchar](4000) NULL
|
|
)
|
|
GO
|
|
/****** Object: UserDefinedTableType [dbo].[ocms_type_itemtree] Script Date: 23.04.2021 14:34:50 ******/
|
|
CREATE TYPE [dbo].[ocms_type_itemtree] AS TABLE(
|
|
[ocms_iid] [bigint] NOT NULL,
|
|
[parent_iid] [bigint] NULL,
|
|
[ocms_pid] [bigint] NULL,
|
|
[name] [nvarchar](255) NULL,
|
|
[view] [bit] NOT NULL,
|
|
[template_id] [bigint] NULL,
|
|
[hide] [bit] NOT NULL,
|
|
[order] [int] NOT NULL,
|
|
[DateCreated] [datetime] NULL,
|
|
[DateModified] [datetime] NULL,
|
|
[level] [int] NULL,
|
|
[sub] [bit] NULL,
|
|
[sitepropsub] [bit] NULL,
|
|
[focus] [bit] NULL,
|
|
[new_order] [int] NULL
|
|
)
|
|
GO
|
|
/****** Object: UserDefinedTableType [dbo].[ocms_type_navigation_base] Script Date: 23.04.2021 14:34:50 ******/
|
|
CREATE TYPE [dbo].[ocms_type_navigation_base] AS TABLE(
|
|
[ocms_iid] [bigint] NOT NULL,
|
|
[locale] [varchar](5) NOT NULL,
|
|
[alias] [varchar](25) NULL
|
|
)
|
|
GO
|
|
/****** Object: UserDefinedTableType [dbo].[ocms_type_properties_base] Script Date: 23.04.2021 14:34:50 ******/
|
|
CREATE TYPE [dbo].[ocms_type_properties_base] AS TABLE(
|
|
[ocms_iid] [bigint] NOT NULL,
|
|
[key] [varchar](50) NULL,
|
|
[value] [nvarchar](max) NOT NULL,
|
|
[locale] [varchar](5) NULL
|
|
)
|
|
GO
|
|
/****** Object: UserDefinedTableType [dbo].[ocms_type_viewtree_full] Script Date: 23.04.2021 14:34:50 ******/
|
|
CREATE TYPE [dbo].[ocms_type_viewtree_full] AS TABLE(
|
|
[ocms_iid] [bigint] NOT NULL,
|
|
[parent_iid] [bigint] NULL,
|
|
[ocms_pid] [bigint] NULL,
|
|
[name] [nvarchar](255) NULL,
|
|
[view] [bit] NOT NULL,
|
|
[template_id] [bigint] NULL,
|
|
[hide] [bit] NOT NULL,
|
|
[order] [int] NOT NULL,
|
|
[DateCreated] [datetime] NULL,
|
|
[DateModified] [datetime] NULL,
|
|
[locale] [varchar](5) NOT NULL,
|
|
[alias] [varchar](25) NULL,
|
|
[path] [varchar](2000) NULL,
|
|
[level] [int] NULL,
|
|
[sub] [bit] NULL,
|
|
[focus] [bit] NULL,
|
|
[nav] [bit] NULL,
|
|
[new_order] [int] NULL
|
|
)
|
|
GO
|
|
/****** Object: UserDefinedFunction [dbo].[fds__getUpdateableTables] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE FUNCTION [dbo].[fds__getUpdateableTables]
|
|
(
|
|
)
|
|
RETURNS @RET TABLE
|
|
(
|
|
[entity_name] varchar(255)
|
|
,[table_name] varchar(255)
|
|
,[proc_name] varchar(255)
|
|
,[locked] bit
|
|
,[locked_reset] bit
|
|
,[updateneed] tinyint
|
|
)
|
|
AS
|
|
BEGIN
|
|
DECLARE @threshold_minutes_full int = 60, @threshold_minutes_short int = 8;
|
|
|
|
DECLARE @utcnow datetime = GETUTCDATE();
|
|
DECLARE @UTCTimeInMinutes int = DATEDIFF(MINUTE, CAST(CAST(@utcnow as date) as datetime), @utcnow);
|
|
|
|
DECLARe @AS XML = [dbo].[mfr__schema]();
|
|
|
|
DECLARE @EntityTypes TABLE([#] int, [typ] varchar(50), [name] varchar(255), [set] varchar(255), [EntitySet] varchar(255), [tablename] varchar(255), [url] varchar(500), [DateColumn] varchar(25));
|
|
WITH XMLNAMESPACES
|
|
(
|
|
'http://schemas.microsoft.com/ado/2007/06/edmx' as edmx,
|
|
'http://schemas.microsoft.com/ado/2007/08/dataservices/metadata' as m
|
|
), et as (
|
|
SELECT ROW_NUMBER() OVER(ORDER BY (SELECT NULL)) as '#'
|
|
, xD.value('local-name(.)', 'varchar(50)') as [type]
|
|
, xD.value('@Name', 'varchar(255)') as [EntityType] --, xD.query('.') as 'q'
|
|
, xS.value('@Name', 'varchar(255)') as [Set]
|
|
, o.[name] as [tablename]
|
|
from @as.nodes('/Schema[1]/EntityType') as xm(xD)
|
|
JOIN @as.nodes('/Schema/EntityContainer/EntitySet') as xn(xS) ON (xS.value('@EntityType', 'varchar(255)')) like ('MFR.%[.]' + (xD.value('@Name', 'varchar(255)')))
|
|
JOIN sys.objects as o ON o.[name] like ('mfr__' + (LOWER(xS.value('@Name', 'varchar(255)'))))
|
|
union
|
|
SELECT ROW_NUMBER() OVER(ORDER BY (SELECT NULL)) as '#'
|
|
, xD.value('local-name(.)', 'varchar(50)') as [type]
|
|
, xD.value('@Name', 'varchar(255)') as [EntityType] --, xD.query('.') as 'q'
|
|
, '' as [Set]
|
|
, o.[name] as [tablename]
|
|
from @as.nodes('/Schema[1]/ComplexType') as xm(xD)
|
|
JOIN sys.objects as o ON o.[name] like ('mfr__[#]' + (LOWER(xD.value('@Name', 'varchar(255)'))) + 's')
|
|
)
|
|
INSERT INTO @EntityTypes SELECT [#],[type],[EntityType],[set] = LOWER([set]), [EntitySet] = [set], [tablename], null, null FROM et;
|
|
|
|
WITH tbl as(
|
|
SELECT
|
|
--QUOTENAME(SCHEMA_NAME(sOBJ.schema_id)) + '.' + QUOTENAME(sOBJ.[name]) AS [TABLE_NAME]
|
|
sOBJ.[name] AS [TABLE_NAME]
|
|
, SUM(sPTN.Rows) AS [RowCount]
|
|
,sOBJ.[create_date]
|
|
FROM
|
|
sys.objects AS sOBJ
|
|
INNER JOIN sys.partitions AS sPTN
|
|
ON sOBJ.object_id = sPTN.object_id
|
|
AND sOBJ.[name] like 'mfr__%'
|
|
WHERE
|
|
sOBJ.[type] = 'U'
|
|
AND sOBJ.is_ms_shipped = 0x0
|
|
AND index_id < 2 -- 0:Heap, 1:Clustered
|
|
GROUP BY
|
|
sOBJ.schema_id
|
|
, sOBJ.name
|
|
, sObj.[create_date]
|
|
), pro as (SELECT *
|
|
FROM sys.procedures WHERE LEFT([name], 11) = 'mfr__updt__')
|
|
, lu as (SELECT [table], MAX([timestamp]) as 'lu' FROM [dbo].[fds__status] WHERE [action] like 'update%' group by [table])
|
|
, luf as (SELECT [table], MAX([timestamp]) as 'luf' FROM [dbo].[fds__status] WHERE [action] like 'update_full' group by [table])
|
|
, lur as (SELECT [table], MAX([timestamp]) as 'lur' FROM [dbo].[fds__status] WHERE [action] like 'update_reset' group by [table])
|
|
, luc as (SELECT lu.[table], [lu], [luf], [lur]
|
|
, DATEDIFF(MINUTE, [lu], @utcnow) as [dlu]
|
|
, DATEDIFF(MINUTE, [lur], @utcnow) as [dlr]
|
|
, DATEDIFF(MINUTE, [luf], @utcnow) as [dluf]
|
|
, CASE --WHEN [dbo].[ctm__getUpdateLockStatus] () = Cast(1 as bit) THEN 0
|
|
WHEN [lu] is null then 5
|
|
--WHEN DATEDIFF(MINUTE, [lu], @utcnow) > @threshold_minutes_full
|
|
-- OR DATEDIFF(MINUTE, [luf], @utcnow) > @threshold_minutes_full
|
|
-- THEN 2
|
|
WHEN DATEDIFF(MINUTE, [lu], @utcnow) > @threshold_minutes_short THEN 1
|
|
ELSE 0
|
|
END as 'need'
|
|
from lu LEFT JOIN luf on lu.[table] = luf.[table] LEFT JOIN lur on lu.[table] = lur.[table]
|
|
), cols as (SELECT DISTINCT [TABLE_NAME] FROM INFORMATION_SCHEMA.COLUMNS
|
|
WHERE LEFT(TABLE_NAME, 5) = N'mfr__' AND ([column_name] COLLATE Latin1_General_CI_AS in ('DateModified', 'DateCreated')))
|
|
INSERT INTO @RET
|
|
SELECT DISTINCT [entity_name] = et.[name]
|
|
, 'table_name' = tbl.[table_name]
|
|
, 'temp_table' = pro.[name]
|
|
, 'locked' = 0 --ISNULL([dbo].[ctm__getUpdateLockStatus_tbl](REPLACE(tbl.[TABLE_NAME], 'mfr__', '')), 0)
|
|
, 'locked_reset' = 0 --ISNULL([dbo].[ctm__getUpdateLockStatus_reset_tbl](REPLACE(tbl.[TABLE_NAME], 'mfr__', '')), 0)
|
|
, 'updateneed' = CASE
|
|
--WHEN [dbo].[ctm__getUpdateLockStatus_tbl](REPLACE(tbl.[TABLE_NAME], 'mfr__', '')) = Cast(1 as bit) THEN 0
|
|
WHEN et.[name] COLLATE Latin1_General_CI_AS IN ('Attachment','Comment','Item','StepListTemplateInstance') THEN 0
|
|
WHEN tbl.[RowCount] = 0 THEN 5
|
|
WHEN NOT EXISTS (SELECT * FROM cols WHERE tbl.[TABLE_NAME] = cols.[TABLE_NAME]) THEN 0
|
|
WHEN luc.need is null then 5
|
|
WHEN tbl.[TABLE_NAME] COLLATE Latin1_General_CI_AS in ('') AND ISNULL(luc.[dlr], 1440) >= 720 AND @UTCTimeInMinutes BETWEEN 45 AND 90 THEN 5 -- once every day, between 02:45 and 03:30 in the morning
|
|
ELSE luc.[need]--ISNULL(luc.[need], 0)
|
|
END
|
|
FROM tbl
|
|
JOIN @EntityTypes as et on tbl.[TABLE_NAME] = et.[tablename]
|
|
JOIN pro on REPLACE(pro.[name], 'mfr__updt__', 'mfr__') = tbl.[TABLE_NAME]
|
|
LEFT JOIN luc on tbl.[table_name] = luc.[table];
|
|
|
|
RETURN
|
|
END
|
|
GO
|
|
/****** Object: UserDefinedFunction [dbo].[fds__updateNeed] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE FUNCTION [dbo].[fds__updateNeed]
|
|
(
|
|
@threshold_minutes_full int
|
|
,@threshold_minutes_short int
|
|
)
|
|
RETURNS tinyint
|
|
AS
|
|
BEGIN
|
|
|
|
--[Reset] = 5
|
|
-- [Full] = 2
|
|
-- [Short] = 1
|
|
-- [None] = 0
|
|
|
|
|
|
|
|
SET @threshold_minutes_full = 60;
|
|
SET @threshold_minutes_short = 8;
|
|
|
|
DECLARE @RET tinyint = 1
|
|
DECLARE @UpDate datetime
|
|
DECLARE @UpDateFull datetime
|
|
|
|
RETURN @RET;
|
|
END
|
|
GO
|
|
/****** Object: UserDefinedFunction [dbo].[mfr__schema] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date, ,>
|
|
-- Description: <Description, ,>
|
|
-- =============================================
|
|
CREATE FUNCTION [dbo].[mfr__schema]
|
|
(
|
|
|
|
)
|
|
RETURNS XML
|
|
AS
|
|
BEGIN
|
|
DECLARe @AS XML;
|
|
SET @AS = N'
|
|
<Schema>
|
|
<EntityType Name="ItemType">
|
|
<Key>
|
|
<PropertyRef Name="Id" />
|
|
</Key>
|
|
<Property Name="Id" Type="Edm.Int64" Nullable="false" />
|
|
<Property Name="CustomValues" Type="Collection(MFR.Domain.Api.Documents.CustomValue)" Nullable="false" />
|
|
<Property Name="Version" Type="Edm.Int32" Nullable="false" />
|
|
<Property Name="Costs" Type="Edm.Decimal" Nullable="false" />
|
|
<Property Name="Description" Type="Edm.String" />
|
|
<Property Name="ListPrice" Type="Edm.Decimal" Nullable="false" />
|
|
<Property Name="Manufacture" Type="Edm.String" />
|
|
<Property Name="ExternalId" Type="Edm.String" />
|
|
<Property Name="ItemNumber" Type="Edm.String" />
|
|
<Property Name="NameOrNumber" Type="Edm.String" />
|
|
<Property Name="GlobalTradeItemNr" Type="Edm.String" />
|
|
<Property Name="Type" Type="Edm.String" />
|
|
<Property Name="Price" Type="Edm.Decimal" Nullable="false" />
|
|
<Property Name="VAT" Type="Edm.Decimal" Nullable="false" />
|
|
<Property Name="IsPortalOnly" Type="Edm.Boolean" Nullable="false" />
|
|
<Property Name="Discount" Type="Edm.Decimal" Nullable="false" />
|
|
<Property Name="DateModified" Type="Edm.DateTime" Nullable="false" />
|
|
<Property Name="IsDiscontinued" Type="Edm.Boolean" Nullable="false" />
|
|
<Property Name="IsWarehouse" Type="Edm.Boolean" Nullable="false" />
|
|
<Property Name="UnitId" Type="Edm.Int64" />
|
|
<Property Name="UnitString" Type="Edm.String" />
|
|
<NavigationProperty Name="Unit" Relationship="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_ItemType_Unit_MFR_Domain_Api_Documents_ItemUnit_UnitPartner" ToRole="Unit" FromRole="UnitPartner" />
|
|
</EntityType>
|
|
<ComplexType Name="CustomValue">
|
|
<Property Name="Meta" Type="Edm.String" />
|
|
<Property Name="Value" Type="Edm.String" />
|
|
</ComplexType>
|
|
<EntityType Name="ServiceRequest">
|
|
<Key>
|
|
<PropertyRef Name="Id" />
|
|
</Key>
|
|
<Property Name="Id" Type="Edm.Int64" Nullable="false" />
|
|
<Property Name="Name" Type="Edm.String" />
|
|
<Property Name="ExternalId" Type="Edm.String" />
|
|
<Property Name="InvoiceId" Type="Edm.String" />
|
|
<Property Name="ClosedAt" Type="Edm.DateTime" />
|
|
<Property Name="ReleasedAt" Type="Edm.DateTime" />
|
|
<Property Name="WorkDoneAt" Type="Edm.DateTime" />
|
|
<Property Name="TargetTimeInMinutes" Type="Edm.Int64" Nullable="false" />
|
|
<Property Name="DateModified" Type="Edm.DateTime" />
|
|
<Property Name="DateOfCreation" Type="Edm.DateTime" />
|
|
<Property Name="DueDateRangeStart" Type="Edm.DateTime" />
|
|
<Property Name="DueDateRangeEnd" Type="Edm.DateTime" />
|
|
<Property Name="PortalLink" Type="Edm.String" />
|
|
<Property Name="CostCenterId" Type="Edm.Int64" />
|
|
<Property Name="Description" Type="Edm.String" />
|
|
<Property Name="State" Type="Edm.String" />
|
|
<Property Name="CustomValues" Type="Collection(MFR.Domain.Api.Documents.CustomValue)" Nullable="false" />
|
|
<Property Name="CurrentOwnerId" Type="Edm.Int64" />
|
|
<Property Name="CustomerId" Type="Edm.Int64" />
|
|
<Property Name="ParentServiceRequestId" Type="Edm.Int64" />
|
|
<Property Name="Location" Type="MFR.Domain.Api.Documents.Location" />
|
|
<Property Name="Version" Type="Edm.Int32" Nullable="false" />
|
|
<Property Name="IsTemplate" Type="Edm.Boolean" Nullable="false" />
|
|
<Property Name="IsTemplateMobile" Type="Edm.Boolean" Nullable="false" />
|
|
<Property Name="CreateFromServiceRequestTemplateId" Type="Edm.Int64" Nullable="false" />
|
|
<Property Name="Type" Type="Edm.String" />
|
|
<NavigationProperty Name="CreatedBy" Relationship="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_ServiceRequest_CreatedBy_MFR_Domain_Api_Documents_Contact_CreatedByPartner" ToRole="CreatedBy" FromRole="CreatedByPartner" />
|
|
<NavigationProperty Name="ClosedBy" Relationship="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_ServiceRequest_ClosedBy_MFR_Domain_Api_Documents_User_ClosedByPartner" ToRole="ClosedBy" FromRole="ClosedByPartner" />
|
|
<NavigationProperty Name="ReleasedBy" Relationship="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_ServiceRequest_ReleasedBy_MFR_Domain_Api_Documents_User_ReleasedByPartner" ToRole="ReleasedBy" FromRole="ReleasedByPartner" />
|
|
<NavigationProperty Name="CostCenter" Relationship="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_ServiceRequest_CostCenter_MFR_Domain_Api_Documents_CostCenter_CostCenterPartner" ToRole="CostCenter" FromRole="CostCenterPartner" />
|
|
<NavigationProperty Name="Appointments" Relationship="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_ServiceRequest_Appointments_MFR_Domain_Api_Documents_Appointment_AppointmentsPartner" ToRole="Appointments" FromRole="AppointmentsPartner" />
|
|
<NavigationProperty Name="Items" Relationship="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_ServiceRequest_Items_MFR_Domain_Api_Documents_Item_ItemsPartner" ToRole="Items" FromRole="ItemsPartner" />
|
|
<NavigationProperty Name="Documents" Relationship="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_ServiceRequest_Documents_MFR_Domain_Api_Documents_Document_DocumentsPartner" ToRole="Documents" FromRole="DocumentsPartner" />
|
|
<NavigationProperty Name="Reports" Relationship="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_ServiceRequest_Reports_MFR_Domain_Api_Documents_Report_ReportsPartner" ToRole="Reports" FromRole="ReportsPartner" />
|
|
<NavigationProperty Name="Contacts" Relationship="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_ServiceRequest_Contacts_MFR_Domain_Api_Documents_Contact_ContactsPartner" ToRole="Contacts" FromRole="ContactsPartner" />
|
|
<NavigationProperty Name="StepListTemplates" Relationship="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_ServiceRequest_StepListTemplates_MFR_Domain_Api_Documents_StepListTemplate_StepListTemplatesPartner" ToRole="StepListTemplates" FromRole="StepListTemplatesPartner" />
|
|
<NavigationProperty Name="ServiceObjects" Relationship="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_ServiceRequest_ServiceObjects_MFR_Domain_Api_Documents_ServiceObject_ServiceObjectsPartner" ToRole="ServiceObjects" FromRole="ServiceObjectsPartner" />
|
|
<NavigationProperty Name="TimeEvents" Relationship="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_ServiceRequest_TimeEvents_MFR_Domain_Api_Documents_TimeEvent_TimeEventsPartner" ToRole="TimeEvents" FromRole="TimeEventsPartner" />
|
|
<NavigationProperty Name="Comments" Relationship="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_ServiceRequest_Comments_MFR_Domain_Api_Documents_Comment_CommentsPartner" ToRole="Comments" FromRole="CommentsPartner" />
|
|
<NavigationProperty Name="CurrentOwner" Relationship="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_ServiceRequest_CurrentOwner_MFR_Domain_Api_Documents_Contact_CurrentOwnerPartner" ToRole="CurrentOwner" FromRole="CurrentOwnerPartner" />
|
|
<NavigationProperty Name="Customer" Relationship="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_ServiceRequest_Customer_MFR_Domain_Api_Documents_Company_CustomerPartner" ToRole="Customer" FromRole="CustomerPartner" />
|
|
<NavigationProperty Name="Tags" Relationship="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_ServiceRequest_Tags_MFR_Domain_Api_Documents_Tag_TagsPartner" ToRole="Tags" FromRole="TagsPartner" />
|
|
<NavigationProperty Name="Steps" Relationship="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_ServiceRequest_Steps_MFR_Domain_Api_Documents_Step_StepsPartner" ToRole="Steps" FromRole="StepsPartner" />
|
|
<NavigationProperty Name="StockMovements" Relationship="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_ServiceRequest_StockMovements_MFR_Domain_Api_Documents_StockMovement_StockMovementsPartner" ToRole="StockMovements" FromRole="StockMovementsPartner" />
|
|
<NavigationProperty Name="Qualifications" Relationship="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_ServiceRequest_Qualifications_MFR_Domain_Api_Documents_Qualification_QualificationsPartner" ToRole="Qualifications" FromRole="QualificationsPartner" />
|
|
</EntityType>
|
|
<EntityType Name="Item">
|
|
<Key>
|
|
<PropertyRef Name="Id" />
|
|
</Key>
|
|
<Property Name="Id" Type="Edm.Int64" Nullable="false" />
|
|
<Property Name="Version" Type="Edm.Int32" Nullable="false" />
|
|
<Property Name="QuantityHours" Type="Edm.Decimal" Nullable="false" />
|
|
<Property Name="PlannedQuantityHours" Type="Edm.Decimal" Nullable="false" />
|
|
<Property Name="ItemTypeId" Type="Edm.Int64" />
|
|
<Property Name="ItemNumber" Type="Edm.String" />
|
|
<Property Name="TrackingId" Type="Edm.String" />
|
|
<Property Name="Manufacture" Type="Edm.String" />
|
|
<Property Name="Price" Type="Edm.Decimal" Nullable="false" />
|
|
<Property Name="Costs" Type="Edm.Decimal" />
|
|
<Property Name="NameOrNumber" Type="Edm.String" />
|
|
<Property Name="CustomValues" Type="Collection(MFR.Domain.Api.Documents.CustomValue)" Nullable="false" />
|
|
<Property Name="Note" Type="Edm.String" />
|
|
<Property Name="ExternalId" Type="Edm.String" />
|
|
<Property Name="Discount" Type="Edm.Decimal" Nullable="false" />
|
|
<Property Name="VAT" Type="Edm.Decimal" Nullable="false" />
|
|
<Property Name="IsManual" Type="Edm.Boolean" Nullable="false" />
|
|
<Property Name="SortOrder" Type="Edm.Int32" Nullable="false" />
|
|
<Property Name="Type" Type="Edm.String" />
|
|
<Property Name="ServiceRequestId" Type="Edm.Int64" Nullable="false" />
|
|
<Property Name="ServiceObjectId" Type="Edm.Int64" Nullable="false" />
|
|
<Property Name="CreatorId" Type="Edm.Int64" Nullable="false" />
|
|
<Property Name="UnitId" Type="Edm.Int64" />
|
|
<Property Name="UnitString" Type="Edm.String" />
|
|
<NavigationProperty Name="ItemType" Relationship="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_Item_ItemType_MFR_Domain_Api_Documents_ItemType_ItemTypePartner" ToRole="ItemType" FromRole="ItemTypePartner" />
|
|
<NavigationProperty Name="ServiceRequest" Relationship="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_Item_ServiceRequest_MFR_Domain_Api_Documents_ServiceRequest_ServiceRequestPartner" ToRole="ServiceRequest" FromRole="ServiceRequestPartner" />
|
|
<NavigationProperty Name="ServiceObject" Relationship="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_Item_ServiceObject_MFR_Domain_Api_Documents_ServiceObject_ServiceObjectPartner" ToRole="ServiceObject" FromRole="ServiceObjectPartner" />
|
|
<NavigationProperty Name="Creator" Relationship="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_Item_Creator_MFR_Domain_Api_Documents_Contact_CreatorPartner" ToRole="Creator" FromRole="CreatorPartner" />
|
|
<NavigationProperty Name="Unit" Relationship="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_Item_Unit_MFR_Domain_Api_Documents_ItemUnit_UnitPartner" ToRole="Unit" FromRole="UnitPartner" />
|
|
</EntityType>
|
|
<EntityType Name="StockMovement">
|
|
<Key>
|
|
<PropertyRef Name="Id" />
|
|
</Key>
|
|
<Property Name="Id" Type="Edm.Int64" Nullable="false" />
|
|
<Property Name="Version" Type="Edm.Int32" Nullable="false" />
|
|
<Property Name="Amount" Type="Edm.Decimal" Nullable="false" />
|
|
<Property Name="AmountReceived" Type="Edm.Decimal" Nullable="false" />
|
|
<Property Name="ExternalId" Type="Edm.String" />
|
|
<Property Name="ItemId" Type="Edm.Int64" />
|
|
<Property Name="ItemTypeId" Type="Edm.Int64" />
|
|
<Property Name="StockMovementType" Type="Edm.String" />
|
|
<Property Name="State" Type="Edm.String" />
|
|
<Property Name="ServiceRequestId" Type="Edm.Int64" Nullable="false" />
|
|
<Property Name="WarehouseId" Type="Edm.Int64" Nullable="false" />
|
|
<Property Name="DateOfCreation" Type="Edm.DateTime" Nullable="false" />
|
|
<Property Name="DateModified" Type="Edm.DateTime" Nullable="false" />
|
|
<Property Name="TargetDate" Type="Edm.DateTime" Nullable="false" />
|
|
<Property Name="CreatedById" Type="Edm.Int64" Nullable="false" />
|
|
<Property Name="ConfirmedById" Type="Edm.Int64" Nullable="false" />
|
|
<NavigationProperty Name="Item" Relationship="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_StockMovement_Item_MFR_Domain_Api_Documents_Item_ItemPartner" ToRole="Item" FromRole="ItemPartner" />
|
|
<NavigationProperty Name="ItemType" Relationship="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_StockMovement_ItemType_MFR_Domain_Api_Documents_ItemType_ItemTypePartner" ToRole="ItemType" FromRole="ItemTypePartner" />
|
|
<NavigationProperty Name="ServiceRequest" Relationship="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_StockMovement_ServiceRequest_MFR_Domain_Api_Documents_ServiceRequest_ServiceRequestPartner" ToRole="ServiceRequest" FromRole="ServiceRequestPartner" />
|
|
<NavigationProperty Name="Warehouse" Relationship="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_StockMovement_Warehouse_MFR_Domain_Api_Documents_ServiceObject_WarehousePartner" ToRole="Warehouse" FromRole="WarehousePartner" />
|
|
<NavigationProperty Name="CreatedBy" Relationship="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_StockMovement_CreatedBy_MFR_Domain_Api_Documents_Contact_CreatedByPartner" ToRole="CreatedBy" FromRole="CreatedByPartner" />
|
|
<NavigationProperty Name="ConfirmedBy" Relationship="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_StockMovement_ConfirmedBy_MFR_Domain_Api_Documents_Contact_ConfirmedByPartner" ToRole="ConfirmedBy" FromRole="ConfirmedByPartner" />
|
|
</EntityType>
|
|
<EntityType Name="CostCenter">
|
|
<Key>
|
|
<PropertyRef Name="Id" />
|
|
</Key>
|
|
<Property Name="Id" Type="Edm.Int64" Nullable="false" />
|
|
<Property Name="Version" Type="Edm.Int32" Nullable="false" />
|
|
<Property Name="Name" Type="Edm.String" />
|
|
</EntityType>
|
|
<EntityType Name="ItemUnit">
|
|
<Key>
|
|
<PropertyRef Name="Id" />
|
|
</Key>
|
|
<Property Name="Id" Type="Edm.Int64" Nullable="false" />
|
|
<Property Name="Version" Type="Edm.Int32" Nullable="false" />
|
|
<Property Name="Name" Type="Edm.String" />
|
|
</EntityType>
|
|
<EntityType Name="TimeEvent">
|
|
<Key>
|
|
<PropertyRef Name="Id" />
|
|
</Key>
|
|
<Property Name="Id" Type="Edm.Int64" Nullable="false" />
|
|
<Property Name="Version" Type="Edm.Int32" Nullable="false" />
|
|
<Property Name="State" Type="Edm.String" />
|
|
<Property Name="IsApproved" Type="Edm.Boolean" Nullable="false" />
|
|
<Property Name="TimeEventType" Type="Edm.String" />
|
|
<Property Name="ExternalId" Type="Edm.String" />
|
|
<Property Name="DateModified" Type="Edm.DateTime" Nullable="false" />
|
|
<Property Name="StartDateTime" Type="Edm.DateTime" Nullable="false" />
|
|
<Property Name="EndDateTime" Type="Edm.DateTime" Nullable="false" />
|
|
<Property Name="ProposedDrivingDistance" Type="Edm.Int32" Nullable="false" />
|
|
<Property Name="ContactId" Type="Edm.Int64" Nullable="false" />
|
|
<Property Name="ServiceRequestId" Type="Edm.Int64" Nullable="false" />
|
|
<Property Name="Description" Type="Edm.String" />
|
|
<NavigationProperty Name="Contact" Relationship="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_TimeEvent_Contact_MFR_Domain_Api_Documents_Contact_ContactPartner" ToRole="Contact" FromRole="ContactPartner" />
|
|
<NavigationProperty Name="ServiceRequest" Relationship="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_TimeEvent_ServiceRequest_MFR_Domain_Api_Documents_ServiceRequest_ServiceRequestPartner" ToRole="ServiceRequest" FromRole="ServiceRequestPartner" />
|
|
</EntityType>
|
|
<EntityType Name="Document">
|
|
<Key>
|
|
<PropertyRef Name="Id" />
|
|
</Key>
|
|
<Property Name="Id" Type="Edm.Int64" Nullable="false" />
|
|
<Property Name="CustomValues" Type="Collection(MFR.Domain.Api.Documents.CustomValue)" Nullable="false" />
|
|
<Property Name="Version" Type="Edm.Int32" Nullable="false" />
|
|
<Property Name="State" Type="Edm.String" />
|
|
<Property Name="ExternalId" Type="Edm.String" />
|
|
<Property Name="URI" Type="Edm.String" />
|
|
<Property Name="IsGlobal" Type="Edm.Boolean" Nullable="false" />
|
|
<Property Name="StartDateTime" Type="Edm.DateTime" Nullable="false" />
|
|
<Property Name="EndDateTime" Type="Edm.DateTime" Nullable="false" />
|
|
<Property Name="FileName" Type="Edm.String" />
|
|
<Property Name="DateModified" Type="Edm.DateTime" Nullable="false" />
|
|
<Property Name="UploadDate" Type="Edm.DateTime" Nullable="false" />
|
|
<Property Name="IsLink" Type="Edm.Boolean" Nullable="false" />
|
|
<Property Name="ContentType" Type="Edm.String" />
|
|
<Property Name="HTMLCode" Type="Edm.String" />
|
|
<Property Name="ServiceRequestId" Type="Edm.Int64" Nullable="false" />
|
|
<Property Name="Note" Type="Edm.String" />
|
|
<NavigationProperty Name="ServiceRequest" Relationship="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_Document_ServiceRequest_MFR_Domain_Api_Documents_ServiceRequest_ServiceRequestPartner" ToRole="ServiceRequest" FromRole="ServiceRequestPartner" />
|
|
</EntityType>
|
|
<EntityType Name="Report">
|
|
<Key>
|
|
<PropertyRef Name="Id" />
|
|
</Key>
|
|
<Property Name="Id" Type="Edm.Int64" Nullable="false" />
|
|
<Property Name="Version" Type="Edm.Int32" Nullable="false" />
|
|
<Property Name="DateOfCreation" Type="Edm.DateTime" Nullable="false" />
|
|
<Property Name="URI" Type="Edm.String" />
|
|
<Property Name="DocumentName" Type="Edm.String" />
|
|
<Property Name="FileTypeString" Type="Edm.String" />
|
|
<Property Name="ReportDefinitionCode" Type="Edm.String" />
|
|
<Property Name="ServiceObjectId" Type="Edm.Int64" Nullable="false" />
|
|
<Property Name="CanBeDeleted" Type="Edm.Boolean" Nullable="false" />
|
|
<Property Name="InvoiceBalance" Type="Edm.Decimal" Nullable="false" />
|
|
<Property Name="InvoiceId" Type="Edm.String" />
|
|
<Property Name="DueDate" Type="Edm.DateTime" Nullable="false" />
|
|
<Property Name="IsPayed" Type="Edm.Boolean" Nullable="false" />
|
|
<Property Name="IsInvoice" Type="Edm.Boolean" Nullable="false" />
|
|
<Property Name="IsCanceled" Type="Edm.Boolean" Nullable="false" />
|
|
<Property Name="CustomValues" Type="Collection(MFR.Domain.Api.Documents.CustomValue)" Nullable="false" />
|
|
<NavigationProperty Name="ServiceRequest" Relationship="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_Report_ServiceRequest_MFR_Domain_Api_Documents_ServiceRequest_ServiceRequestPartner" ToRole="ServiceRequest" FromRole="ServiceRequestPartner" />
|
|
<NavigationProperty Name="ServiceObject" Relationship="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_Report_ServiceObject_MFR_Domain_Api_Documents_ServiceObject_ServiceObjectPartner" ToRole="ServiceObject" FromRole="ServiceObjectPartner" />
|
|
</EntityType>
|
|
<EntityType Name="Comment">
|
|
<Key>
|
|
<PropertyRef Name="Id" />
|
|
</Key>
|
|
<Property Name="Id" Type="Edm.Int64" Nullable="false" />
|
|
<Property Name="Version" Type="Edm.Int32" Nullable="false" />
|
|
<Property Name="DateOfCreation" Type="Edm.DateTime" Nullable="false" />
|
|
<Property Name="IsInternal" Type="Edm.Boolean" Nullable="false" />
|
|
<Property Name="ServiceRequestId" Type="Edm.Int64" Nullable="false" />
|
|
<Property Name="CompanyId" Type="Edm.Int64" Nullable="false" />
|
|
<Property Name="Content" Type="Edm.String" />
|
|
<NavigationProperty Name="Owner" Relationship="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_Comment_Owner_MFR_Domain_Api_Documents_Contact_OwnerPartner" ToRole="Owner" FromRole="OwnerPartner" />
|
|
<NavigationProperty Name="ServiceRequest" Relationship="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_Comment_ServiceRequest_MFR_Domain_Api_Documents_ServiceRequest_ServiceRequestPartner" ToRole="ServiceRequest" FromRole="ServiceRequestPartner" />
|
|
<NavigationProperty Name="Company" Relationship="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_Comment_Company_MFR_Domain_Api_Documents_Company_CompanyPartner" ToRole="Company" FromRole="CompanyPartner" />
|
|
</EntityType>
|
|
<EntityType Name="Attachment">
|
|
<Key>
|
|
<PropertyRef Name="Id" />
|
|
</Key>
|
|
<Property Name="Id" Type="Edm.Int64" Nullable="false" />
|
|
<Property Name="Version" Type="Edm.Int32" Nullable="false" />
|
|
<Property Name="URI" Type="Edm.String" />
|
|
<Property Name="StepId" Type="Edm.Int64" Nullable="false" />
|
|
<NavigationProperty Name="Step" Relationship="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_Attachment_Step_MFR_Domain_Api_Documents_Step_StepPartner" ToRole="Step" FromRole="StepPartner" />
|
|
</EntityType>
|
|
<EntityType Name="Appointment">
|
|
<Key>
|
|
<PropertyRef Name="Id" />
|
|
</Key>
|
|
<Property Name="Id" Type="Edm.Int64" Nullable="false" />
|
|
<Property Name="Version" Type="Edm.Int32" Nullable="false" />
|
|
<Property Name="State" Type="Edm.String" />
|
|
<Property Name="Type" Type="Edm.String" />
|
|
<Property Name="EndDateTime" Type="Edm.DateTime" />
|
|
<Property Name="StartDateTime" Type="Edm.DateTime" Nullable="false" />
|
|
<Property Name="DrivingDistanceFrom" Type="Edm.Int32" />
|
|
<Property Name="DrivingDistanceTo" Type="Edm.Int32" />
|
|
<Property Name="WasReadOnClientSide" Type="Edm.Boolean" Nullable="false" />
|
|
<Property Name="ContactIds" Type="Collection(Edm.Int64)" Nullable="false" />
|
|
<Property Name="ServiceRequestId" Type="Edm.Int64" Nullable="false" />
|
|
<Property Name="ContactId" Type="Edm.Int64" Nullable="false" />
|
|
<Property Name="Note" Type="Edm.String" />
|
|
<NavigationProperty Name="ServiceRequest" Relationship="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_Appointment_ServiceRequest_MFR_Domain_Api_Documents_ServiceRequest_ServiceRequestPartner" ToRole="ServiceRequest" FromRole="ServiceRequestPartner" />
|
|
<NavigationProperty Name="Contacts" Relationship="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_Appointment_Contacts_MFR_Domain_Api_Documents_Contact_ContactsPartner" ToRole="Contacts" FromRole="ContactsPartner" />
|
|
<NavigationProperty Name="Contact" Relationship="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_Appointment_Contact_MFR_Domain_Api_Documents_Contact_ContactPartner" ToRole="Contact" FromRole="ContactPartner" />
|
|
</EntityType>
|
|
<EntityType Name="Step">
|
|
<Key>
|
|
<PropertyRef Name="Id" />
|
|
</Key>
|
|
<Property Name="Id" Type="Edm.Int64" Nullable="false" />
|
|
<Property Name="MobileId" Type="Edm.Int64" />
|
|
<Property Name="Version" Type="Edm.Int32" Nullable="false" />
|
|
<Property Name="Name" Type="Edm.String" />
|
|
<Property Name="IsDone" Type="Edm.Boolean" Nullable="false" />
|
|
<Property Name="HasError" Type="Edm.Boolean" Nullable="false" />
|
|
<Property Name="TrackingId" Type="Edm.String" />
|
|
<Property Name="Type" Type="Edm.String" />
|
|
<Property Name="SortOrder" Type="Edm.Int32" Nullable="false" />
|
|
<Property Name="Data" Type="Edm.String" />
|
|
<Property Name="DateModifiedOffline" Type="Edm.DateTime" />
|
|
<Property Name="ServiceRequestId" Type="Edm.Int64" />
|
|
<Property Name="Description" Type="Edm.String" />
|
|
<Property Name="Comment" Type="Edm.String" />
|
|
<Property Name="InternalComment" Type="Edm.String" />
|
|
<Property Name="ServiceObjectId" Type="Edm.Int64" />
|
|
<Property Name="StepListTemplateId" Type="Edm.Int64" />
|
|
<Property Name="ParentId" Type="Edm.Int64" />
|
|
<NavigationProperty Name="ServiceRequest" Relationship="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_Step_ServiceRequest_MFR_Domain_Api_Documents_ServiceRequest_ServiceRequestPartner" ToRole="ServiceRequest" FromRole="ServiceRequestPartner" />
|
|
<NavigationProperty Name="ServiceObject" Relationship="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_Step_ServiceObject_MFR_Domain_Api_Documents_ServiceObject_ServiceObjectPartner" ToRole="ServiceObject" FromRole="ServiceObjectPartner" />
|
|
<NavigationProperty Name="StepListTemplate" Relationship="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_Step_StepListTemplate_MFR_Domain_Api_Documents_StepListTemplate_StepListTemplatePartner" ToRole="StepListTemplate" FromRole="StepListTemplatePartner" />
|
|
<NavigationProperty Name="Parent" Relationship="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_Step_Parent_MFR_Domain_Api_Documents_Step_ParentPartner" ToRole="Parent" FromRole="ParentPartner" />
|
|
<NavigationProperty Name="Attachments" Relationship="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_Step_Attachments_MFR_Domain_Api_Documents_Attachment_AttachmentsPartner" ToRole="Attachments" FromRole="AttachmentsPartner" />
|
|
</EntityType>
|
|
<EntityType Name="ServiceObject">
|
|
<Key>
|
|
<PropertyRef Name="Id" />
|
|
</Key>
|
|
<Property Name="Location" Type="MFR.Domain.Api.Documents.Location" />
|
|
<Property Name="Id" Type="Edm.Int64" Nullable="false" />
|
|
<Property Name="Name" Type="Edm.String" />
|
|
<Property Name="Note" Type="Edm.String" />
|
|
<Property Name="CustomValues" Type="Collection(MFR.Domain.Api.Documents.CustomValue)" Nullable="false" />
|
|
<Property Name="DateModified" Type="Edm.DateTime" Nullable="false" />
|
|
<Property Name="ExternalId" Type="Edm.String" />
|
|
<Property Name="MappingId" Type="Edm.String" />
|
|
<Property Name="QuickSearch" Type="Edm.String" />
|
|
<Property Name="Version" Type="Edm.Int32" Nullable="false" />
|
|
<Property Name="CreateGeoLocation" Type="Edm.Boolean" Nullable="false" />
|
|
<Property Name="IsWarehouse" Type="Edm.Boolean" Nullable="false" />
|
|
<Property Name="ParentServiceObjectId" Type="Edm.Int64" Nullable="false" />
|
|
<Property Name="CompanyId" Type="Edm.Int64" Nullable="false" />
|
|
<Property Name="ProductId" Type="Edm.Int64" Nullable="false" />
|
|
<NavigationProperty Name="WarehouseManager" Relationship="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_ServiceObject_WarehouseManager_MFR_Domain_Api_Documents_Contact_WarehouseManagerPartner" ToRole="WarehouseManager" FromRole="WarehouseManagerPartner" />
|
|
<NavigationProperty Name="CustomValueSteps" Relationship="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_ServiceObject_CustomValueSteps_MFR_Domain_Api_Documents_Step_CustomValueStepsPartner" ToRole="CustomValueSteps" FromRole="CustomValueStepsPartner" />
|
|
<NavigationProperty Name="Company" Relationship="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_ServiceObject_Company_MFR_Domain_Api_Documents_Company_CompanyPartner" ToRole="Company" FromRole="CompanyPartner" />
|
|
<NavigationProperty Name="Product" Relationship="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_ServiceObject_Product_MFR_Domain_Api_Documents_Product_ProductPartner" ToRole="Product" FromRole="ProductPartner" />
|
|
<NavigationProperty Name="Tags" Relationship="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_ServiceObject_Tags_MFR_Domain_Api_Documents_Tag_TagsPartner" ToRole="Tags" FromRole="TagsPartner" />
|
|
<NavigationProperty Name="ChildServiceObject" Relationship="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_ServiceObject_ChildServiceObject_MFR_Domain_Api_Documents_ServiceObject_ChildServiceObjectPartner" ToRole="ChildServiceObject" FromRole="ChildServiceObjectPartner" />
|
|
<NavigationProperty Name="Contacts" Relationship="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_ServiceObject_Contacts_MFR_Domain_Api_Documents_Contact_ContactsPartner" ToRole="Contacts" FromRole="ContactsPartner" />
|
|
<NavigationProperty Name="Items" Relationship="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_ServiceObject_Items_MFR_Domain_Api_Documents_Item_ItemsPartner" ToRole="Items" FromRole="ItemsPartner" />
|
|
</EntityType>
|
|
<ComplexType Name="Location">
|
|
<Property Name="Version" Type="Edm.Int32" Nullable="false" />
|
|
<Property Name="Id" Type="Edm.Int64" />
|
|
<Property Name="AddressString" Type="Edm.String" />
|
|
<Property Name="Postal" Type="Edm.String" />
|
|
<Property Name="City" Type="Edm.String" />
|
|
<Property Name="State" Type="Edm.String" />
|
|
<Property Name="Country" Type="Edm.String" />
|
|
<Property Name="Longitude" Type="Edm.Double" Nullable="false" />
|
|
<Property Name="Latitude" Type="Edm.Double" Nullable="false" />
|
|
<Property Name="IsValidLocation" Type="Edm.Boolean" Nullable="false" />
|
|
</ComplexType>
|
|
<EntityType Name="StepListTemplate">
|
|
<Key>
|
|
<PropertyRef Name="Id" />
|
|
</Key>
|
|
<Property Name="Id" Type="Edm.Int64" Nullable="false" />
|
|
<Property Name="Version" Type="Edm.Int32" Nullable="false" />
|
|
<Property Name="Name" Type="Edm.String" />
|
|
<Property Name="MappingId" Type="Edm.String" />
|
|
<Property Name="DateModified" Type="Edm.DateTime" Nullable="false" />
|
|
<Property Name="IsReleased" Type="Edm.Boolean" Nullable="false" />
|
|
<Property Name="IsDurable" Type="Edm.Boolean" Nullable="false" />
|
|
<NavigationProperty Name="Steps" Relationship="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_StepListTemplate_Steps_MFR_Domain_Api_Documents_Step_StepsPartner" ToRole="Steps" FromRole="StepsPartner" />
|
|
</EntityType>
|
|
<EntityType Name="StepListTemplateInstance">
|
|
<Key>
|
|
<PropertyRef Name="Id" />
|
|
</Key>
|
|
<Property Name="Id" Type="Edm.Int64" Nullable="false" />
|
|
<Property Name="Version" Type="Edm.Int32" Nullable="false" />
|
|
<Property Name="Name" Type="Edm.String" />
|
|
<Property Name="ServiceRequestId" Type="Edm.Int64" />
|
|
<Property Name="TemplateId" Type="Edm.Int64" />
|
|
<NavigationProperty Name="ServiceRequest" Relationship="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_StepListTemplateInstance_ServiceRequest_MFR_Domain_Api_Documents_ServiceRequest_ServiceRequestPartner" ToRole="ServiceRequest" FromRole="ServiceRequestPartner" />
|
|
<NavigationProperty Name="Template" Relationship="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_StepListTemplateInstance_Template_MFR_Domain_Api_Documents_StepListTemplate_TemplatePartner" ToRole="Template" FromRole="TemplatePartner" />
|
|
</EntityType>
|
|
<EntityType Name="Contact">
|
|
<Key>
|
|
<PropertyRef Name="Id" />
|
|
</Key>
|
|
<Property Name="Id" Type="Edm.Int64" Nullable="false" />
|
|
<Property Name="CustomValues" Type="Collection(MFR.Domain.Api.Documents.CustomValue)" Nullable="false" />
|
|
<Property Name="FirstName" Type="Edm.String" />
|
|
<Property Name="LastName" Type="Edm.String" />
|
|
<Property Name="Email" Type="Edm.String" />
|
|
<Property Name="JobTitle" Type="Edm.String" />
|
|
<Property Name="MobilePhone" Type="Edm.String" />
|
|
<Property Name="Telephone" Type="Edm.String" />
|
|
<Property Name="Fax" Type="Edm.String" />
|
|
<Property Name="Note" Type="Edm.String" />
|
|
<Property Name="DateModified" Type="Edm.DateTime" Nullable="false" />
|
|
<Property Name="Version" Type="Edm.Int32" Nullable="false" />
|
|
<Property Name="CompanyId" Type="Edm.Int64" Nullable="false" />
|
|
<Property Name="IsUser" Type="Edm.Boolean" Nullable="false" />
|
|
<Property Name="ExternalId" Type="Edm.String" />
|
|
<Property Name="Gender" Type="Edm.String" />
|
|
<Property Name="UserId" Type="Edm.Int64" Nullable="false" />
|
|
<NavigationProperty Name="Company" Relationship="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_Contact_Company_MFR_Domain_Api_Documents_Company_CompanyPartner" ToRole="Company" FromRole="CompanyPartner" />
|
|
<NavigationProperty Name="User" Relationship="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_Contact_User_MFR_Domain_Api_Documents_User_UserPartner" ToRole="User" FromRole="UserPartner" />
|
|
</EntityType>
|
|
<EntityType Name="Tag">
|
|
<Key>
|
|
<PropertyRef Name="Id" />
|
|
</Key>
|
|
<Property Name="Id" Type="Edm.Int64" Nullable="false" />
|
|
<Property Name="Version" Type="Edm.Int32" Nullable="false" />
|
|
<Property Name="Name" Type="Edm.String" />
|
|
<Property Name="ColorDefinition" Type="Edm.String" />
|
|
<Property Name="Type" Type="Edm.String" Nullable="false" />
|
|
</EntityType>
|
|
<EntityType Name="Product">
|
|
<Key>
|
|
<PropertyRef Name="Id" />
|
|
</Key>
|
|
<Property Name="Id" Type="Edm.Int64" Nullable="false" />
|
|
<Property Name="Version" Type="Edm.Int32" Nullable="false" />
|
|
<Property Name="Name" Type="Edm.String" />
|
|
<Property Name="SubKey" Type="Edm.String" />
|
|
<Property Name="Description" Type="Edm.String" />
|
|
<Property Name="DateModified" Type="Edm.DateTime" Nullable="false" />
|
|
<Property Name="MappingId" Type="Edm.String" />
|
|
<Property Name="CustomValueStepTemplateId" Type="Edm.Int64" Nullable="false" />
|
|
<NavigationProperty Name="CustomValueStepTemplate" Relationship="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_Product_CustomValueStepTemplate_MFR_Domain_Api_Documents_StepListTemplate_CustomValueStepTemplatePartner" ToRole="CustomValueStepTemplate" FromRole="CustomValueStepTemplatePartner" />
|
|
</EntityType>
|
|
<EntityType Name="Company">
|
|
<Key>
|
|
<PropertyRef Name="Id" />
|
|
</Key>
|
|
<Property Name="Location" Type="MFR.Domain.Api.Documents.Location" />
|
|
<Property Name="Id" Type="Edm.Int64" Nullable="false" />
|
|
<Property Name="Version" Type="Edm.Int32" Nullable="false" />
|
|
<Property Name="IsPhysicalPerson" Type="Edm.Boolean" Nullable="false" />
|
|
<Property Name="IsOwner" Type="Edm.Boolean" Nullable="false" />
|
|
<Property Name="IsEmailInvoicingActive" Type="Edm.Boolean" Nullable="false" />
|
|
<Property Name="IsSupplier" Type="Edm.Boolean" Nullable="false" />
|
|
<Property Name="MappingId" Type="Edm.String" />
|
|
<Property Name="ExternalId" Type="Edm.String" />
|
|
<Property Name="Name" Type="Edm.String" />
|
|
<Property Name="Note" Type="Edm.String" />
|
|
<Property Name="SupportTelephone" Type="Edm.String" />
|
|
<Property Name="SupportFax" Type="Edm.String" />
|
|
<Property Name="SupportMail" Type="Edm.String" />
|
|
<Property Name="QuickSearch" Type="Edm.String" />
|
|
<Property Name="DateModified" Type="Edm.DateTime" Nullable="false" />
|
|
<Property Name="CustomValues" Type="Collection(MFR.Domain.Api.Documents.CustomValue)" Nullable="false" />
|
|
<Property Name="MainContactId" Type="Edm.Int64" Nullable="false" />
|
|
<NavigationProperty Name="MainContact" Relationship="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_Company_MainContact_MFR_Domain_Api_Documents_Contact_MainContactPartner" ToRole="MainContact" FromRole="MainContactPartner" />
|
|
<NavigationProperty Name="Tags" Relationship="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_Company_Tags_MFR_Domain_Api_Documents_Tag_TagsPartner" ToRole="Tags" FromRole="TagsPartner" />
|
|
<NavigationProperty Name="Contacts" Relationship="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_Company_Contacts_MFR_Domain_Api_Documents_Contact_ContactsPartner" ToRole="Contacts" FromRole="ContactsPartner" />
|
|
<NavigationProperty Name="ServiceObjects" Relationship="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_Company_ServiceObjects_MFR_Domain_Api_Documents_ServiceObject_ServiceObjectsPartner" ToRole="ServiceObjects" FromRole="ServiceObjectsPartner" />
|
|
</EntityType>
|
|
<EntityType Name="User">
|
|
<Key>
|
|
<PropertyRef Name="Id" />
|
|
</Key>
|
|
<Property Name="Id" Type="Edm.Int64" Nullable="false" />
|
|
<Property Name="Version" Type="Edm.Int32" Nullable="false" />
|
|
<Property Name="UserName" Type="Edm.String" />
|
|
<Property Name="IsSystem" Type="Edm.Boolean" Nullable="false" />
|
|
<Property Name="CreationDate" Type="Edm.DateTime" Nullable="false" />
|
|
<Property Name="IsApproved" Type="Edm.Boolean" Nullable="false" />
|
|
<Property Name="ContactId" Type="Edm.Int64" Nullable="false" />
|
|
<Property Name="PreferedLanguage" Type="Edm.String" />
|
|
<Property Name="EmailChannelEnabled" Type="Edm.Boolean" Nullable="false" />
|
|
<Property Name="HasFullScreenPreference" Type="Edm.Boolean" Nullable="false" />
|
|
<Property Name="TimeZone" Type="Edm.Int32" Nullable="false" />
|
|
<Property Name="PreferedCulture" Type="Edm.String" />
|
|
<Property Name="IsActive" Type="Edm.Boolean" Nullable="false" />
|
|
<Property Name="IsMobile" Type="Edm.Boolean" Nullable="false" />
|
|
<Property Name="LastLoginDate" Type="Edm.DateTime" />
|
|
<Property Name="UserGuideProgress" Type="Edm.String" />
|
|
<Property Name="DashboardSettings" Type="Edm.String" />
|
|
<NavigationProperty Name="Contact" Relationship="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_User_Contact_MFR_Domain_Api_Documents_Contact_ContactPartner" ToRole="Contact" FromRole="ContactPartner" />
|
|
</EntityType>
|
|
<EntityType Name="Qualification">
|
|
<Key>
|
|
<PropertyRef Name="Id" />
|
|
</Key>
|
|
<Property Name="Id" Type="Edm.Int64" Nullable="false" />
|
|
<Property Name="Version" Type="Edm.Int32" Nullable="false" />
|
|
<Property Name="Name" Type="Edm.String" />
|
|
</EntityType>
|
|
<Association Name="MFR_Domain_Api_Documents_ItemType_Unit_MFR_Domain_Api_Documents_ItemUnit_UnitPartner">
|
|
<End Type="MFR.Domain.Api.Documents.ItemUnit" Role="Unit" Multiplicity="0..1" />
|
|
<End Type="MFR.Domain.Api.Documents.ItemType" Role="UnitPartner" Multiplicity="0..1" />
|
|
</Association>
|
|
<Association Name="MFR_Domain_Api_Documents_ServiceRequest_CreatedBy_MFR_Domain_Api_Documents_Contact_CreatedByPartner">
|
|
<End Type="MFR.Domain.Api.Documents.Contact" Role="CreatedBy" Multiplicity="0..1" />
|
|
<End Type="MFR.Domain.Api.Documents.ServiceRequest" Role="CreatedByPartner" Multiplicity="0..1" />
|
|
</Association>
|
|
<Association Name="MFR_Domain_Api_Documents_ServiceRequest_ClosedBy_MFR_Domain_Api_Documents_User_ClosedByPartner">
|
|
<End Type="MFR.Domain.Api.Documents.User" Role="ClosedBy" Multiplicity="0..1" />
|
|
<End Type="MFR.Domain.Api.Documents.ServiceRequest" Role="ClosedByPartner" Multiplicity="0..1" />
|
|
</Association>
|
|
<Association Name="MFR_Domain_Api_Documents_ServiceRequest_ReleasedBy_MFR_Domain_Api_Documents_User_ReleasedByPartner">
|
|
<End Type="MFR.Domain.Api.Documents.User" Role="ReleasedBy" Multiplicity="0..1" />
|
|
<End Type="MFR.Domain.Api.Documents.ServiceRequest" Role="ReleasedByPartner" Multiplicity="0..1" />
|
|
</Association>
|
|
<Association Name="MFR_Domain_Api_Documents_ServiceRequest_CostCenter_MFR_Domain_Api_Documents_CostCenter_CostCenterPartner">
|
|
<End Type="MFR.Domain.Api.Documents.CostCenter" Role="CostCenter" Multiplicity="0..1" />
|
|
<End Type="MFR.Domain.Api.Documents.ServiceRequest" Role="CostCenterPartner" Multiplicity="0..1" />
|
|
</Association>
|
|
<Association Name="MFR_Domain_Api_Documents_ServiceRequest_Appointments_MFR_Domain_Api_Documents_Appointment_AppointmentsPartner">
|
|
<End Type="MFR.Domain.Api.Documents.Appointment" Role="Appointments" Multiplicity="*" />
|
|
<End Type="MFR.Domain.Api.Documents.ServiceRequest" Role="AppointmentsPartner" Multiplicity="0..1" />
|
|
</Association>
|
|
<Association Name="MFR_Domain_Api_Documents_ServiceRequest_Items_MFR_Domain_Api_Documents_Item_ItemsPartner">
|
|
<End Type="MFR.Domain.Api.Documents.Item" Role="Items" Multiplicity="*" />
|
|
<End Type="MFR.Domain.Api.Documents.ServiceRequest" Role="ItemsPartner" Multiplicity="0..1" />
|
|
</Association>
|
|
<Association Name="MFR_Domain_Api_Documents_ServiceRequest_Documents_MFR_Domain_Api_Documents_Document_DocumentsPartner">
|
|
<End Type="MFR.Domain.Api.Documents.Document" Role="Documents" Multiplicity="*" />
|
|
<End Type="MFR.Domain.Api.Documents.ServiceRequest" Role="DocumentsPartner" Multiplicity="0..1" />
|
|
</Association>
|
|
<Association Name="MFR_Domain_Api_Documents_ServiceRequest_Reports_MFR_Domain_Api_Documents_Report_ReportsPartner">
|
|
<End Type="MFR.Domain.Api.Documents.Report" Role="Reports" Multiplicity="*" />
|
|
<End Type="MFR.Domain.Api.Documents.ServiceRequest" Role="ReportsPartner" Multiplicity="0..1" />
|
|
</Association>
|
|
<Association Name="MFR_Domain_Api_Documents_ServiceRequest_Contacts_MFR_Domain_Api_Documents_Contact_ContactsPartner">
|
|
<End Type="MFR.Domain.Api.Documents.Contact" Role="Contacts" Multiplicity="*" />
|
|
<End Type="MFR.Domain.Api.Documents.ServiceRequest" Role="ContactsPartner" Multiplicity="0..1" />
|
|
</Association>
|
|
<Association Name="MFR_Domain_Api_Documents_ServiceRequest_StepListTemplates_MFR_Domain_Api_Documents_StepListTemplate_StepListTemplatesPartner">
|
|
<End Type="MFR.Domain.Api.Documents.StepListTemplate" Role="StepListTemplates" Multiplicity="*" />
|
|
<End Type="MFR.Domain.Api.Documents.ServiceRequest" Role="StepListTemplatesPartner" Multiplicity="0..1" />
|
|
</Association>
|
|
<Association Name="MFR_Domain_Api_Documents_ServiceRequest_ServiceObjects_MFR_Domain_Api_Documents_ServiceObject_ServiceObjectsPartner">
|
|
<End Type="MFR.Domain.Api.Documents.ServiceObject" Role="ServiceObjects" Multiplicity="*" />
|
|
<End Type="MFR.Domain.Api.Documents.ServiceRequest" Role="ServiceObjectsPartner" Multiplicity="0..1" />
|
|
</Association>
|
|
<Association Name="MFR_Domain_Api_Documents_ServiceRequest_TimeEvents_MFR_Domain_Api_Documents_TimeEvent_TimeEventsPartner">
|
|
<End Type="MFR.Domain.Api.Documents.TimeEvent" Role="TimeEvents" Multiplicity="*" />
|
|
<End Type="MFR.Domain.Api.Documents.ServiceRequest" Role="TimeEventsPartner" Multiplicity="0..1" />
|
|
</Association>
|
|
<Association Name="MFR_Domain_Api_Documents_ServiceRequest_Comments_MFR_Domain_Api_Documents_Comment_CommentsPartner">
|
|
<End Type="MFR.Domain.Api.Documents.Comment" Role="Comments" Multiplicity="*" />
|
|
<End Type="MFR.Domain.Api.Documents.ServiceRequest" Role="CommentsPartner" Multiplicity="0..1" />
|
|
</Association>
|
|
<Association Name="MFR_Domain_Api_Documents_ServiceRequest_CurrentOwner_MFR_Domain_Api_Documents_Contact_CurrentOwnerPartner">
|
|
<End Type="MFR.Domain.Api.Documents.Contact" Role="CurrentOwner" Multiplicity="0..1" />
|
|
<End Type="MFR.Domain.Api.Documents.ServiceRequest" Role="CurrentOwnerPartner" Multiplicity="0..1" />
|
|
</Association>
|
|
<Association Name="MFR_Domain_Api_Documents_ServiceRequest_Customer_MFR_Domain_Api_Documents_Company_CustomerPartner">
|
|
<End Type="MFR.Domain.Api.Documents.Company" Role="Customer" Multiplicity="0..1" />
|
|
<End Type="MFR.Domain.Api.Documents.ServiceRequest" Role="CustomerPartner" Multiplicity="0..1" />
|
|
</Association>
|
|
<Association Name="MFR_Domain_Api_Documents_ServiceRequest_Tags_MFR_Domain_Api_Documents_Tag_TagsPartner">
|
|
<End Type="MFR.Domain.Api.Documents.Tag" Role="Tags" Multiplicity="*" />
|
|
<End Type="MFR.Domain.Api.Documents.ServiceRequest" Role="TagsPartner" Multiplicity="0..1" />
|
|
</Association>
|
|
<Association Name="MFR_Domain_Api_Documents_ServiceRequest_Steps_MFR_Domain_Api_Documents_Step_StepsPartner">
|
|
<End Type="MFR.Domain.Api.Documents.Step" Role="Steps" Multiplicity="*" />
|
|
<End Type="MFR.Domain.Api.Documents.ServiceRequest" Role="StepsPartner" Multiplicity="0..1" />
|
|
</Association>
|
|
<Association Name="MFR_Domain_Api_Documents_ServiceRequest_StockMovements_MFR_Domain_Api_Documents_StockMovement_StockMovementsPartner">
|
|
<End Type="MFR.Domain.Api.Documents.StockMovement" Role="StockMovements" Multiplicity="*" />
|
|
<End Type="MFR.Domain.Api.Documents.ServiceRequest" Role="StockMovementsPartner" Multiplicity="0..1" />
|
|
</Association>
|
|
<Association Name="MFR_Domain_Api_Documents_ServiceRequest_Qualifications_MFR_Domain_Api_Documents_Qualification_QualificationsPartner">
|
|
<End Type="MFR.Domain.Api.Documents.Qualification" Role="Qualifications" Multiplicity="*" />
|
|
<End Type="MFR.Domain.Api.Documents.ServiceRequest" Role="QualificationsPartner" Multiplicity="0..1" />
|
|
</Association>
|
|
<Association Name="MFR_Domain_Api_Documents_Item_ItemType_MFR_Domain_Api_Documents_ItemType_ItemTypePartner">
|
|
<End Type="MFR.Domain.Api.Documents.ItemType" Role="ItemType" Multiplicity="0..1" />
|
|
<End Type="MFR.Domain.Api.Documents.Item" Role="ItemTypePartner" Multiplicity="0..1" />
|
|
</Association>
|
|
<Association Name="MFR_Domain_Api_Documents_Item_ServiceRequest_MFR_Domain_Api_Documents_ServiceRequest_ServiceRequestPartner">
|
|
<End Type="MFR.Domain.Api.Documents.ServiceRequest" Role="ServiceRequest" Multiplicity="0..1" />
|
|
<End Type="MFR.Domain.Api.Documents.Item" Role="ServiceRequestPartner" Multiplicity="0..1" />
|
|
</Association>
|
|
<Association Name="MFR_Domain_Api_Documents_Item_ServiceObject_MFR_Domain_Api_Documents_ServiceObject_ServiceObjectPartner">
|
|
<End Type="MFR.Domain.Api.Documents.ServiceObject" Role="ServiceObject" Multiplicity="0..1" />
|
|
<End Type="MFR.Domain.Api.Documents.Item" Role="ServiceObjectPartner" Multiplicity="0..1" />
|
|
</Association>
|
|
<Association Name="MFR_Domain_Api_Documents_Item_Creator_MFR_Domain_Api_Documents_Contact_CreatorPartner">
|
|
<End Type="MFR.Domain.Api.Documents.Contact" Role="Creator" Multiplicity="0..1" />
|
|
<End Type="MFR.Domain.Api.Documents.Item" Role="CreatorPartner" Multiplicity="0..1" />
|
|
</Association>
|
|
<Association Name="MFR_Domain_Api_Documents_Item_Unit_MFR_Domain_Api_Documents_ItemUnit_UnitPartner">
|
|
<End Type="MFR.Domain.Api.Documents.ItemUnit" Role="Unit" Multiplicity="0..1" />
|
|
<End Type="MFR.Domain.Api.Documents.Item" Role="UnitPartner" Multiplicity="0..1" />
|
|
</Association>
|
|
<Association Name="MFR_Domain_Api_Documents_StockMovement_Item_MFR_Domain_Api_Documents_Item_ItemPartner">
|
|
<End Type="MFR.Domain.Api.Documents.Item" Role="Item" Multiplicity="0..1" />
|
|
<End Type="MFR.Domain.Api.Documents.StockMovement" Role="ItemPartner" Multiplicity="0..1" />
|
|
</Association>
|
|
<Association Name="MFR_Domain_Api_Documents_StockMovement_ItemType_MFR_Domain_Api_Documents_ItemType_ItemTypePartner">
|
|
<End Type="MFR.Domain.Api.Documents.ItemType" Role="ItemType" Multiplicity="0..1" />
|
|
<End Type="MFR.Domain.Api.Documents.StockMovement" Role="ItemTypePartner" Multiplicity="0..1" />
|
|
</Association>
|
|
<Association Name="MFR_Domain_Api_Documents_StockMovement_ServiceRequest_MFR_Domain_Api_Documents_ServiceRequest_ServiceRequestPartner">
|
|
<End Type="MFR.Domain.Api.Documents.ServiceRequest" Role="ServiceRequest" Multiplicity="0..1" />
|
|
<End Type="MFR.Domain.Api.Documents.StockMovement" Role="ServiceRequestPartner" Multiplicity="0..1" />
|
|
</Association>
|
|
<Association Name="MFR_Domain_Api_Documents_StockMovement_Warehouse_MFR_Domain_Api_Documents_ServiceObject_WarehousePartner">
|
|
<End Type="MFR.Domain.Api.Documents.ServiceObject" Role="Warehouse" Multiplicity="0..1" />
|
|
<End Type="MFR.Domain.Api.Documents.StockMovement" Role="WarehousePartner" Multiplicity="0..1" />
|
|
</Association>
|
|
<Association Name="MFR_Domain_Api_Documents_StockMovement_CreatedBy_MFR_Domain_Api_Documents_Contact_CreatedByPartner">
|
|
<End Type="MFR.Domain.Api.Documents.Contact" Role="CreatedBy" Multiplicity="0..1" />
|
|
<End Type="MFR.Domain.Api.Documents.StockMovement" Role="CreatedByPartner" Multiplicity="0..1" />
|
|
</Association>
|
|
<Association Name="MFR_Domain_Api_Documents_StockMovement_ConfirmedBy_MFR_Domain_Api_Documents_Contact_ConfirmedByPartner">
|
|
<End Type="MFR.Domain.Api.Documents.Contact" Role="ConfirmedBy" Multiplicity="0..1" />
|
|
<End Type="MFR.Domain.Api.Documents.StockMovement" Role="ConfirmedByPartner" Multiplicity="0..1" />
|
|
</Association>
|
|
<Association Name="MFR_Domain_Api_Documents_TimeEvent_Contact_MFR_Domain_Api_Documents_Contact_ContactPartner">
|
|
<End Type="MFR.Domain.Api.Documents.Contact" Role="Contact" Multiplicity="0..1" />
|
|
<End Type="MFR.Domain.Api.Documents.TimeEvent" Role="ContactPartner" Multiplicity="0..1" />
|
|
</Association>
|
|
<Association Name="MFR_Domain_Api_Documents_TimeEvent_ServiceRequest_MFR_Domain_Api_Documents_ServiceRequest_ServiceRequestPartner">
|
|
<End Type="MFR.Domain.Api.Documents.ServiceRequest" Role="ServiceRequest" Multiplicity="0..1" />
|
|
<End Type="MFR.Domain.Api.Documents.TimeEvent" Role="ServiceRequestPartner" Multiplicity="0..1" />
|
|
</Association>
|
|
<Association Name="MFR_Domain_Api_Documents_Document_ServiceRequest_MFR_Domain_Api_Documents_ServiceRequest_ServiceRequestPartner">
|
|
<End Type="MFR.Domain.Api.Documents.ServiceRequest" Role="ServiceRequest" Multiplicity="0..1" />
|
|
<End Type="MFR.Domain.Api.Documents.Document" Role="ServiceRequestPartner" Multiplicity="0..1" />
|
|
</Association>
|
|
<Association Name="MFR_Domain_Api_Documents_Report_ServiceRequest_MFR_Domain_Api_Documents_ServiceRequest_ServiceRequestPartner">
|
|
<End Type="MFR.Domain.Api.Documents.ServiceRequest" Role="ServiceRequest" Multiplicity="0..1" />
|
|
<End Type="MFR.Domain.Api.Documents.Report" Role="ServiceRequestPartner" Multiplicity="0..1" />
|
|
</Association>
|
|
<Association Name="MFR_Domain_Api_Documents_Report_ServiceObject_MFR_Domain_Api_Documents_ServiceObject_ServiceObjectPartner">
|
|
<End Type="MFR.Domain.Api.Documents.ServiceObject" Role="ServiceObject" Multiplicity="0..1" />
|
|
<End Type="MFR.Domain.Api.Documents.Report" Role="ServiceObjectPartner" Multiplicity="0..1" />
|
|
</Association>
|
|
<Association Name="MFR_Domain_Api_Documents_Comment_Owner_MFR_Domain_Api_Documents_Contact_OwnerPartner">
|
|
<End Type="MFR.Domain.Api.Documents.Contact" Role="Owner" Multiplicity="0..1" />
|
|
<End Type="MFR.Domain.Api.Documents.Comment" Role="OwnerPartner" Multiplicity="0..1" />
|
|
</Association>
|
|
<Association Name="MFR_Domain_Api_Documents_Comment_ServiceRequest_MFR_Domain_Api_Documents_ServiceRequest_ServiceRequestPartner">
|
|
<End Type="MFR.Domain.Api.Documents.ServiceRequest" Role="ServiceRequest" Multiplicity="0..1" />
|
|
<End Type="MFR.Domain.Api.Documents.Comment" Role="ServiceRequestPartner" Multiplicity="0..1" />
|
|
</Association>
|
|
<Association Name="MFR_Domain_Api_Documents_Comment_Company_MFR_Domain_Api_Documents_Company_CompanyPartner">
|
|
<End Type="MFR.Domain.Api.Documents.Company" Role="Company" Multiplicity="0..1" />
|
|
<End Type="MFR.Domain.Api.Documents.Comment" Role="CompanyPartner" Multiplicity="0..1" />
|
|
</Association>
|
|
<Association Name="MFR_Domain_Api_Documents_Attachment_Step_MFR_Domain_Api_Documents_Step_StepPartner">
|
|
<End Type="MFR.Domain.Api.Documents.Step" Role="Step" Multiplicity="0..1" />
|
|
<End Type="MFR.Domain.Api.Documents.Attachment" Role="StepPartner" Multiplicity="0..1" />
|
|
</Association>
|
|
<Association Name="MFR_Domain_Api_Documents_Appointment_ServiceRequest_MFR_Domain_Api_Documents_ServiceRequest_ServiceRequestPartner">
|
|
<End Type="MFR.Domain.Api.Documents.ServiceRequest" Role="ServiceRequest" Multiplicity="0..1" />
|
|
<End Type="MFR.Domain.Api.Documents.Appointment" Role="ServiceRequestPartner" Multiplicity="0..1" />
|
|
</Association>
|
|
<Association Name="MFR_Domain_Api_Documents_Appointment_Contacts_MFR_Domain_Api_Documents_Contact_ContactsPartner">
|
|
<End Type="MFR.Domain.Api.Documents.Contact" Role="Contacts" Multiplicity="*" />
|
|
<End Type="MFR.Domain.Api.Documents.Appointment" Role="ContactsPartner" Multiplicity="0..1" />
|
|
</Association>
|
|
<Association Name="MFR_Domain_Api_Documents_Appointment_Contact_MFR_Domain_Api_Documents_Contact_ContactPartner">
|
|
<End Type="MFR.Domain.Api.Documents.Contact" Role="Contact" Multiplicity="0..1" />
|
|
<End Type="MFR.Domain.Api.Documents.Appointment" Role="ContactPartner" Multiplicity="0..1" />
|
|
</Association>
|
|
<Association Name="MFR_Domain_Api_Documents_Step_ServiceRequest_MFR_Domain_Api_Documents_ServiceRequest_ServiceRequestPartner">
|
|
<End Type="MFR.Domain.Api.Documents.ServiceRequest" Role="ServiceRequest" Multiplicity="0..1" />
|
|
<End Type="MFR.Domain.Api.Documents.Step" Role="ServiceRequestPartner" Multiplicity="0..1" />
|
|
</Association>
|
|
<Association Name="MFR_Domain_Api_Documents_Step_ServiceObject_MFR_Domain_Api_Documents_ServiceObject_ServiceObjectPartner">
|
|
<End Type="MFR.Domain.Api.Documents.ServiceObject" Role="ServiceObject" Multiplicity="0..1" />
|
|
<End Type="MFR.Domain.Api.Documents.Step" Role="ServiceObjectPartner" Multiplicity="0..1" />
|
|
</Association>
|
|
<Association Name="MFR_Domain_Api_Documents_Step_StepListTemplate_MFR_Domain_Api_Documents_StepListTemplate_StepListTemplatePartner">
|
|
<End Type="MFR.Domain.Api.Documents.StepListTemplate" Role="StepListTemplate" Multiplicity="0..1" />
|
|
<End Type="MFR.Domain.Api.Documents.Step" Role="StepListTemplatePartner" Multiplicity="0..1" />
|
|
</Association>
|
|
<Association Name="MFR_Domain_Api_Documents_Step_Parent_MFR_Domain_Api_Documents_Step_ParentPartner">
|
|
<End Type="MFR.Domain.Api.Documents.Step" Role="Parent" Multiplicity="0..1" />
|
|
<End Type="MFR.Domain.Api.Documents.Step" Role="ParentPartner" Multiplicity="0..1" />
|
|
</Association>
|
|
<Association Name="MFR_Domain_Api_Documents_Step_Attachments_MFR_Domain_Api_Documents_Attachment_AttachmentsPartner">
|
|
<End Type="MFR.Domain.Api.Documents.Attachment" Role="Attachments" Multiplicity="*" />
|
|
<End Type="MFR.Domain.Api.Documents.Step" Role="AttachmentsPartner" Multiplicity="0..1" />
|
|
</Association>
|
|
<Association Name="MFR_Domain_Api_Documents_ServiceObject_WarehouseManager_MFR_Domain_Api_Documents_Contact_WarehouseManagerPartner">
|
|
<End Type="MFR.Domain.Api.Documents.Contact" Role="WarehouseManager" Multiplicity="0..1" />
|
|
<End Type="MFR.Domain.Api.Documents.ServiceObject" Role="WarehouseManagerPartner" Multiplicity="0..1" />
|
|
</Association>
|
|
<Association Name="MFR_Domain_Api_Documents_ServiceObject_CustomValueSteps_MFR_Domain_Api_Documents_Step_CustomValueStepsPartner">
|
|
<End Type="MFR.Domain.Api.Documents.Step" Role="CustomValueSteps" Multiplicity="*" />
|
|
<End Type="MFR.Domain.Api.Documents.ServiceObject" Role="CustomValueStepsPartner" Multiplicity="0..1" />
|
|
</Association>
|
|
<Association Name="MFR_Domain_Api_Documents_ServiceObject_Company_MFR_Domain_Api_Documents_Company_CompanyPartner">
|
|
<End Type="MFR.Domain.Api.Documents.Company" Role="Company" Multiplicity="0..1" />
|
|
<End Type="MFR.Domain.Api.Documents.ServiceObject" Role="CompanyPartner" Multiplicity="0..1" />
|
|
</Association>
|
|
<Association Name="MFR_Domain_Api_Documents_ServiceObject_Product_MFR_Domain_Api_Documents_Product_ProductPartner">
|
|
<End Type="MFR.Domain.Api.Documents.Product" Role="Product" Multiplicity="0..1" />
|
|
<End Type="MFR.Domain.Api.Documents.ServiceObject" Role="ProductPartner" Multiplicity="0..1" />
|
|
</Association>
|
|
<Association Name="MFR_Domain_Api_Documents_ServiceObject_Tags_MFR_Domain_Api_Documents_Tag_TagsPartner">
|
|
<End Type="MFR.Domain.Api.Documents.Tag" Role="Tags" Multiplicity="*" />
|
|
<End Type="MFR.Domain.Api.Documents.ServiceObject" Role="TagsPartner" Multiplicity="0..1" />
|
|
</Association>
|
|
<Association Name="MFR_Domain_Api_Documents_ServiceObject_ChildServiceObject_MFR_Domain_Api_Documents_ServiceObject_ChildServiceObjectPartner">
|
|
<End Type="MFR.Domain.Api.Documents.ServiceObject" Role="ChildServiceObject" Multiplicity="*" />
|
|
<End Type="MFR.Domain.Api.Documents.ServiceObject" Role="ChildServiceObjectPartner" Multiplicity="0..1" />
|
|
</Association>
|
|
<Association Name="MFR_Domain_Api_Documents_ServiceObject_Contacts_MFR_Domain_Api_Documents_Contact_ContactsPartner">
|
|
<End Type="MFR.Domain.Api.Documents.Contact" Role="Contacts" Multiplicity="*" />
|
|
<End Type="MFR.Domain.Api.Documents.ServiceObject" Role="ContactsPartner" Multiplicity="0..1" />
|
|
</Association>
|
|
<Association Name="MFR_Domain_Api_Documents_ServiceObject_Items_MFR_Domain_Api_Documents_Item_ItemsPartner">
|
|
<End Type="MFR.Domain.Api.Documents.Item" Role="Items" Multiplicity="*" />
|
|
<End Type="MFR.Domain.Api.Documents.ServiceObject" Role="ItemsPartner" Multiplicity="0..1" />
|
|
</Association>
|
|
<Association Name="MFR_Domain_Api_Documents_StepListTemplate_Steps_MFR_Domain_Api_Documents_Step_StepsPartner">
|
|
<End Type="MFR.Domain.Api.Documents.Step" Role="Steps" Multiplicity="*" />
|
|
<End Type="MFR.Domain.Api.Documents.StepListTemplate" Role="StepsPartner" Multiplicity="0..1" />
|
|
</Association>
|
|
<Association Name="MFR_Domain_Api_Documents_StepListTemplateInstance_ServiceRequest_MFR_Domain_Api_Documents_ServiceRequest_ServiceRequestPartner">
|
|
<End Type="MFR.Domain.Api.Documents.ServiceRequest" Role="ServiceRequest" Multiplicity="0..1" />
|
|
<End Type="MFR.Domain.Api.Documents.StepListTemplateInstance" Role="ServiceRequestPartner" Multiplicity="0..1" />
|
|
</Association>
|
|
<Association Name="MFR_Domain_Api_Documents_StepListTemplateInstance_Template_MFR_Domain_Api_Documents_StepListTemplate_TemplatePartner">
|
|
<End Type="MFR.Domain.Api.Documents.StepListTemplate" Role="Template" Multiplicity="0..1" />
|
|
<End Type="MFR.Domain.Api.Documents.StepListTemplateInstance" Role="TemplatePartner" Multiplicity="0..1" />
|
|
</Association>
|
|
<Association Name="MFR_Domain_Api_Documents_Contact_Company_MFR_Domain_Api_Documents_Company_CompanyPartner">
|
|
<End Type="MFR.Domain.Api.Documents.Company" Role="Company" Multiplicity="0..1" />
|
|
<End Type="MFR.Domain.Api.Documents.Contact" Role="CompanyPartner" Multiplicity="0..1" />
|
|
</Association>
|
|
<Association Name="MFR_Domain_Api_Documents_Contact_User_MFR_Domain_Api_Documents_User_UserPartner">
|
|
<End Type="MFR.Domain.Api.Documents.User" Role="User" Multiplicity="0..1" />
|
|
<End Type="MFR.Domain.Api.Documents.Contact" Role="UserPartner" Multiplicity="0..1" />
|
|
</Association>
|
|
<Association Name="MFR_Domain_Api_Documents_Product_CustomValueStepTemplate_MFR_Domain_Api_Documents_StepListTemplate_CustomValueStepTemplatePartner">
|
|
<End Type="MFR.Domain.Api.Documents.StepListTemplate" Role="CustomValueStepTemplate" Multiplicity="0..1" />
|
|
<End Type="MFR.Domain.Api.Documents.Product" Role="CustomValueStepTemplatePartner" Multiplicity="0..1" />
|
|
</Association>
|
|
<Association Name="MFR_Domain_Api_Documents_Company_MainContact_MFR_Domain_Api_Documents_Contact_MainContactPartner">
|
|
<End Type="MFR.Domain.Api.Documents.Contact" Role="MainContact" Multiplicity="0..1" />
|
|
<End Type="MFR.Domain.Api.Documents.Company" Role="MainContactPartner" Multiplicity="0..1" />
|
|
</Association>
|
|
<Association Name="MFR_Domain_Api_Documents_Company_Tags_MFR_Domain_Api_Documents_Tag_TagsPartner">
|
|
<End Type="MFR.Domain.Api.Documents.Tag" Role="Tags" Multiplicity="*" />
|
|
<End Type="MFR.Domain.Api.Documents.Company" Role="TagsPartner" Multiplicity="0..1" />
|
|
</Association>
|
|
<Association Name="MFR_Domain_Api_Documents_Company_Contacts_MFR_Domain_Api_Documents_Contact_ContactsPartner">
|
|
<End Type="MFR.Domain.Api.Documents.Contact" Role="Contacts" Multiplicity="*" />
|
|
<End Type="MFR.Domain.Api.Documents.Company" Role="ContactsPartner" Multiplicity="0..1" />
|
|
</Association>
|
|
<Association Name="MFR_Domain_Api_Documents_Company_ServiceObjects_MFR_Domain_Api_Documents_ServiceObject_ServiceObjectsPartner">
|
|
<End Type="MFR.Domain.Api.Documents.ServiceObject" Role="ServiceObjects" Multiplicity="*" />
|
|
<End Type="MFR.Domain.Api.Documents.Company" Role="ServiceObjectsPartner" Multiplicity="0..1" />
|
|
</Association>
|
|
<Association Name="MFR_Domain_Api_Documents_User_Contact_MFR_Domain_Api_Documents_Contact_ContactPartner">
|
|
<End Type="MFR.Domain.Api.Documents.Contact" Role="Contact" Multiplicity="0..1" />
|
|
<End Type="MFR.Domain.Api.Documents.User" Role="ContactPartner" Multiplicity="0..1" />
|
|
</Association>
|
|
</Schema>
|
|
<Schema>
|
|
<ComplexType Name="ServiceRequest">
|
|
<Property Name="Name" Type="Edm.String" />
|
|
<Property Name="Description" Type="Edm.String" />
|
|
<Property Name="Customer" Type="MFR.Domain.Api.Documents.ServiceRequestCreation.Company" />
|
|
<Property Name="ServiceObjects" Type="Collection(MFR.Domain.Api.Documents.ServiceRequestCreation.ServiceObject)" Nullable="false" />
|
|
<Property Name="State" Type="Edm.String" />
|
|
<Property Name="CreateFromServiceRequestTemplateId" Type="Edm.Int64" />
|
|
</ComplexType>
|
|
<ComplexType Name="Company">
|
|
<Property Name="Id" Type="Edm.Int64" />
|
|
<Property Name="Name" Type="Edm.String" />
|
|
<Property Name="ExternalId" Type="Edm.String" />
|
|
<Property Name="CreateGeoLocation" Type="Edm.Boolean" Nullable="false" />
|
|
<Property Name="IsPhysicalPerson" Type="Edm.Boolean" />
|
|
<Property Name="Location" Type="MFR.Domain.Api.Documents.ServiceRequestCreation.Location" />
|
|
</ComplexType>
|
|
<ComplexType Name="Location">
|
|
<Property Name="CreateGeoLocation" Type="Edm.Boolean" />
|
|
<Property Name="AddressString" Type="Edm.String" />
|
|
<Property Name="Postal" Type="Edm.String" />
|
|
<Property Name="City" Type="Edm.String" />
|
|
<Property Name="Country" Type="Edm.String" />
|
|
<Property Name="Longitude" Type="Edm.Double" Nullable="false" />
|
|
<Property Name="Latitude" Type="Edm.Double" Nullable="false" />
|
|
</ComplexType>
|
|
<ComplexType Name="ServiceObject">
|
|
<Property Name="Id" Type="Edm.Int64" />
|
|
<Property Name="Name" Type="Edm.String" />
|
|
<Property Name="ExternalId" Type="Edm.String" />
|
|
<Property Name="CreateGeoLocation" Type="Edm.Boolean" Nullable="false" />
|
|
<Property Name="Location" Type="MFR.Domain.Api.Documents.ServiceRequestCreation.Location" />
|
|
<Property Name="Contacts" Type="Collection(MFR.Domain.Api.Documents.ServiceRequestCreation.Contact)" Nullable="false" />
|
|
</ComplexType>
|
|
<ComplexType Name="Contact">
|
|
<Property Name="FirstName" Type="Edm.String" />
|
|
<Property Name="LastName" Type="Edm.String" />
|
|
<Property Name="Telephone" Type="Edm.String" />
|
|
<Property Name="Mobile" Type="Edm.String" />
|
|
<Property Name="Email" Type="Edm.String" />
|
|
</ComplexType>
|
|
</Schema>
|
|
<Schema xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
|
|
<EntityContainer Name="Container" m:IsDefaultEntityContainer="true">
|
|
<EntitySet Name="ItemTypes" EntityType="MFR.Domain.Api.Documents.ItemType" />
|
|
<EntitySet Name="ServiceRequests" EntityType="MFR.Domain.Api.Documents.ServiceRequest" />
|
|
<EntitySet Name="Items" EntityType="MFR.Domain.Api.Documents.Item" />
|
|
<EntitySet Name="StockMovements" EntityType="MFR.Domain.Api.Documents.StockMovement" />
|
|
<EntitySet Name="CostCenters" EntityType="MFR.Domain.Api.Documents.CostCenter" />
|
|
<EntitySet Name="ItemUnits" EntityType="MFR.Domain.Api.Documents.ItemUnit" />
|
|
<EntitySet Name="TimeEvents" EntityType="MFR.Domain.Api.Documents.TimeEvent" />
|
|
<EntitySet Name="Documents" EntityType="MFR.Domain.Api.Documents.Document" />
|
|
<EntitySet Name="Reports" EntityType="MFR.Domain.Api.Documents.Report" />
|
|
<EntitySet Name="Comments" EntityType="MFR.Domain.Api.Documents.Comment" />
|
|
<EntitySet Name="Attachments" EntityType="MFR.Domain.Api.Documents.Attachment" />
|
|
<EntitySet Name="Appointments" EntityType="MFR.Domain.Api.Documents.Appointment" />
|
|
<EntitySet Name="Steps" EntityType="MFR.Domain.Api.Documents.Step" />
|
|
<EntitySet Name="ServiceObjects" EntityType="MFR.Domain.Api.Documents.ServiceObject" />
|
|
<EntitySet Name="StepListTemplates" EntityType="MFR.Domain.Api.Documents.StepListTemplate" />
|
|
<EntitySet Name="StepListTemplateInstances" EntityType="MFR.Domain.Api.Documents.StepListTemplateInstance" />
|
|
<EntitySet Name="Contacts" EntityType="MFR.Domain.Api.Documents.Contact" />
|
|
<EntitySet Name="Tags" EntityType="MFR.Domain.Api.Documents.Tag" />
|
|
<EntitySet Name="Products" EntityType="MFR.Domain.Api.Documents.Product" />
|
|
<EntitySet Name="Companies" EntityType="MFR.Domain.Api.Documents.Company" />
|
|
<EntitySet Name="Users" EntityType="MFR.Domain.Api.Documents.User" />
|
|
<EntitySet Name="Qualifications" EntityType="MFR.Domain.Api.Documents.Qualification" />
|
|
<FunctionImport Name="GenerateReportHash" ReturnType="Edm.String" IsBindable="true" m:IsAlwaysBindable="true">
|
|
<Parameter Name="bindingParameter" Type="MFR.Domain.Api.Documents.ServiceRequest" />
|
|
<Parameter Name="reportDefinitionId" Type="Edm.Int64" Nullable="false" />
|
|
</FunctionImport>
|
|
<FunctionImport Name="Deep" ReturnType="MFR.Domain.Api.Documents.ServiceRequest" IsBindable="true" EntitySet="ServiceRequests" m:IsAlwaysBindable="true">
|
|
<Parameter Name="bindingParameter" Type="Collection(MFR.Domain.Api.Documents.ServiceRequest)" Nullable="false" />
|
|
<Parameter Name="serviceRequest" Type="MFR.Domain.Api.Documents.ServiceRequestCreation.ServiceRequest" />
|
|
</FunctionImport>
|
|
<AssociationSet Name="MFR_Domain_Api_Documents_ItemType_Unit_MFR_Domain_Api_Documents_ItemUnit_UnitPartnerSet" Association="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_ItemType_Unit_MFR_Domain_Api_Documents_ItemUnit_UnitPartner">
|
|
<End Role="UnitPartner" EntitySet="ItemTypes" />
|
|
<End Role="Unit" EntitySet="ItemUnits" />
|
|
</AssociationSet>
|
|
<AssociationSet Name="MFR_Domain_Api_Documents_ServiceRequest_CreatedBy_MFR_Domain_Api_Documents_Contact_CreatedByPartnerSet" Association="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_ServiceRequest_CreatedBy_MFR_Domain_Api_Documents_Contact_CreatedByPartner">
|
|
<End Role="CreatedByPartner" EntitySet="ServiceRequests" />
|
|
<End Role="CreatedBy" EntitySet="Contacts" />
|
|
</AssociationSet>
|
|
<AssociationSet Name="MFR_Domain_Api_Documents_ServiceRequest_ClosedBy_MFR_Domain_Api_Documents_User_ClosedByPartnerSet" Association="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_ServiceRequest_ClosedBy_MFR_Domain_Api_Documents_User_ClosedByPartner">
|
|
<End Role="ClosedByPartner" EntitySet="ServiceRequests" />
|
|
<End Role="ClosedBy" EntitySet="Users" />
|
|
</AssociationSet>
|
|
<AssociationSet Name="MFR_Domain_Api_Documents_ServiceRequest_ReleasedBy_MFR_Domain_Api_Documents_User_ReleasedByPartnerSet" Association="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_ServiceRequest_ReleasedBy_MFR_Domain_Api_Documents_User_ReleasedByPartner">
|
|
<End Role="ReleasedByPartner" EntitySet="ServiceRequests" />
|
|
<End Role="ReleasedBy" EntitySet="Users" />
|
|
</AssociationSet>
|
|
<AssociationSet Name="MFR_Domain_Api_Documents_ServiceRequest_CostCenter_MFR_Domain_Api_Documents_CostCenter_CostCenterPartnerSet" Association="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_ServiceRequest_CostCenter_MFR_Domain_Api_Documents_CostCenter_CostCenterPartner">
|
|
<End Role="CostCenterPartner" EntitySet="ServiceRequests" />
|
|
<End Role="CostCenter" EntitySet="CostCenters" />
|
|
</AssociationSet>
|
|
<AssociationSet Name="MFR_Domain_Api_Documents_ServiceRequest_Appointments_MFR_Domain_Api_Documents_Appointment_AppointmentsPartnerSet" Association="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_ServiceRequest_Appointments_MFR_Domain_Api_Documents_Appointment_AppointmentsPartner">
|
|
<End Role="AppointmentsPartner" EntitySet="ServiceRequests" />
|
|
<End Role="Appointments" EntitySet="Appointments" />
|
|
</AssociationSet>
|
|
<AssociationSet Name="MFR_Domain_Api_Documents_ServiceRequest_Items_MFR_Domain_Api_Documents_Item_ItemsPartnerSet" Association="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_ServiceRequest_Items_MFR_Domain_Api_Documents_Item_ItemsPartner">
|
|
<End Role="ItemsPartner" EntitySet="ServiceRequests" />
|
|
<End Role="Items" EntitySet="Items" />
|
|
</AssociationSet>
|
|
<AssociationSet Name="MFR_Domain_Api_Documents_ServiceRequest_Documents_MFR_Domain_Api_Documents_Document_DocumentsPartnerSet" Association="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_ServiceRequest_Documents_MFR_Domain_Api_Documents_Document_DocumentsPartner">
|
|
<End Role="DocumentsPartner" EntitySet="ServiceRequests" />
|
|
<End Role="Documents" EntitySet="Documents" />
|
|
</AssociationSet>
|
|
<AssociationSet Name="MFR_Domain_Api_Documents_ServiceRequest_Reports_MFR_Domain_Api_Documents_Report_ReportsPartnerSet" Association="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_ServiceRequest_Reports_MFR_Domain_Api_Documents_Report_ReportsPartner">
|
|
<End Role="ReportsPartner" EntitySet="ServiceRequests" />
|
|
<End Role="Reports" EntitySet="Reports" />
|
|
</AssociationSet>
|
|
<AssociationSet Name="MFR_Domain_Api_Documents_ServiceRequest_Contacts_MFR_Domain_Api_Documents_Contact_ContactsPartnerSet" Association="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_ServiceRequest_Contacts_MFR_Domain_Api_Documents_Contact_ContactsPartner">
|
|
<End Role="ContactsPartner" EntitySet="ServiceRequests" />
|
|
<End Role="Contacts" EntitySet="Contacts" />
|
|
</AssociationSet>
|
|
<AssociationSet Name="MFR_Domain_Api_Documents_ServiceRequest_StepListTemplates_MFR_Domain_Api_Documents_StepListTemplate_StepListTemplatesPartnerSet" Association="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_ServiceRequest_StepListTemplates_MFR_Domain_Api_Documents_StepListTemplate_StepListTemplatesPartner">
|
|
<End Role="StepListTemplatesPartner" EntitySet="ServiceRequests" />
|
|
<End Role="StepListTemplates" EntitySet="StepListTemplates" />
|
|
</AssociationSet>
|
|
<AssociationSet Name="MFR_Domain_Api_Documents_ServiceRequest_ServiceObjects_MFR_Domain_Api_Documents_ServiceObject_ServiceObjectsPartnerSet" Association="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_ServiceRequest_ServiceObjects_MFR_Domain_Api_Documents_ServiceObject_ServiceObjectsPartner">
|
|
<End Role="ServiceObjectsPartner" EntitySet="ServiceRequests" />
|
|
<End Role="ServiceObjects" EntitySet="ServiceObjects" />
|
|
</AssociationSet>
|
|
<AssociationSet Name="MFR_Domain_Api_Documents_ServiceRequest_TimeEvents_MFR_Domain_Api_Documents_TimeEvent_TimeEventsPartnerSet" Association="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_ServiceRequest_TimeEvents_MFR_Domain_Api_Documents_TimeEvent_TimeEventsPartner">
|
|
<End Role="TimeEventsPartner" EntitySet="ServiceRequests" />
|
|
<End Role="TimeEvents" EntitySet="TimeEvents" />
|
|
</AssociationSet>
|
|
<AssociationSet Name="MFR_Domain_Api_Documents_ServiceRequest_Comments_MFR_Domain_Api_Documents_Comment_CommentsPartnerSet" Association="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_ServiceRequest_Comments_MFR_Domain_Api_Documents_Comment_CommentsPartner">
|
|
<End Role="CommentsPartner" EntitySet="ServiceRequests" />
|
|
<End Role="Comments" EntitySet="Comments" />
|
|
</AssociationSet>
|
|
<AssociationSet Name="MFR_Domain_Api_Documents_ServiceRequest_CurrentOwner_MFR_Domain_Api_Documents_Contact_CurrentOwnerPartnerSet" Association="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_ServiceRequest_CurrentOwner_MFR_Domain_Api_Documents_Contact_CurrentOwnerPartner">
|
|
<End Role="CurrentOwnerPartner" EntitySet="ServiceRequests" />
|
|
<End Role="CurrentOwner" EntitySet="Contacts" />
|
|
</AssociationSet>
|
|
<AssociationSet Name="MFR_Domain_Api_Documents_ServiceRequest_Customer_MFR_Domain_Api_Documents_Company_CustomerPartnerSet" Association="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_ServiceRequest_Customer_MFR_Domain_Api_Documents_Company_CustomerPartner">
|
|
<End Role="CustomerPartner" EntitySet="ServiceRequests" />
|
|
<End Role="Customer" EntitySet="Companies" />
|
|
</AssociationSet>
|
|
<AssociationSet Name="MFR_Domain_Api_Documents_ServiceRequest_Tags_MFR_Domain_Api_Documents_Tag_TagsPartnerSet" Association="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_ServiceRequest_Tags_MFR_Domain_Api_Documents_Tag_TagsPartner">
|
|
<End Role="TagsPartner" EntitySet="ServiceRequests" />
|
|
<End Role="Tags" EntitySet="Tags" />
|
|
</AssociationSet>
|
|
<AssociationSet Name="MFR_Domain_Api_Documents_ServiceRequest_Steps_MFR_Domain_Api_Documents_Step_StepsPartnerSet" Association="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_ServiceRequest_Steps_MFR_Domain_Api_Documents_Step_StepsPartner">
|
|
<End Role="StepsPartner" EntitySet="ServiceRequests" />
|
|
<End Role="Steps" EntitySet="Steps" />
|
|
</AssociationSet>
|
|
<AssociationSet Name="MFR_Domain_Api_Documents_ServiceRequest_StockMovements_MFR_Domain_Api_Documents_StockMovement_StockMovementsPartnerSet" Association="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_ServiceRequest_StockMovements_MFR_Domain_Api_Documents_StockMovement_StockMovementsPartner">
|
|
<End Role="StockMovementsPartner" EntitySet="ServiceRequests" />
|
|
<End Role="StockMovements" EntitySet="StockMovements" />
|
|
</AssociationSet>
|
|
<AssociationSet Name="MFR_Domain_Api_Documents_ServiceRequest_Qualifications_MFR_Domain_Api_Documents_Qualification_QualificationsPartnerSet" Association="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_ServiceRequest_Qualifications_MFR_Domain_Api_Documents_Qualification_QualificationsPartner">
|
|
<End Role="QualificationsPartner" EntitySet="ServiceRequests" />
|
|
<End Role="Qualifications" EntitySet="Qualifications" />
|
|
</AssociationSet>
|
|
<AssociationSet Name="MFR_Domain_Api_Documents_Item_ItemType_MFR_Domain_Api_Documents_ItemType_ItemTypePartnerSet" Association="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_Item_ItemType_MFR_Domain_Api_Documents_ItemType_ItemTypePartner">
|
|
<End Role="ItemTypePartner" EntitySet="Items" />
|
|
<End Role="ItemType" EntitySet="ItemTypes" />
|
|
</AssociationSet>
|
|
<AssociationSet Name="MFR_Domain_Api_Documents_Item_ServiceRequest_MFR_Domain_Api_Documents_ServiceRequest_ServiceRequestPartnerSet" Association="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_Item_ServiceRequest_MFR_Domain_Api_Documents_ServiceRequest_ServiceRequestPartner">
|
|
<End Role="ServiceRequestPartner" EntitySet="Items" />
|
|
<End Role="ServiceRequest" EntitySet="ServiceRequests" />
|
|
</AssociationSet>
|
|
<AssociationSet Name="MFR_Domain_Api_Documents_Item_ServiceObject_MFR_Domain_Api_Documents_ServiceObject_ServiceObjectPartnerSet" Association="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_Item_ServiceObject_MFR_Domain_Api_Documents_ServiceObject_ServiceObjectPartner">
|
|
<End Role="ServiceObjectPartner" EntitySet="Items" />
|
|
<End Role="ServiceObject" EntitySet="ServiceObjects" />
|
|
</AssociationSet>
|
|
<AssociationSet Name="MFR_Domain_Api_Documents_Item_Creator_MFR_Domain_Api_Documents_Contact_CreatorPartnerSet" Association="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_Item_Creator_MFR_Domain_Api_Documents_Contact_CreatorPartner">
|
|
<End Role="CreatorPartner" EntitySet="Items" />
|
|
<End Role="Creator" EntitySet="Contacts" />
|
|
</AssociationSet>
|
|
<AssociationSet Name="MFR_Domain_Api_Documents_Item_Unit_MFR_Domain_Api_Documents_ItemUnit_UnitPartnerSet" Association="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_Item_Unit_MFR_Domain_Api_Documents_ItemUnit_UnitPartner">
|
|
<End Role="UnitPartner" EntitySet="Items" />
|
|
<End Role="Unit" EntitySet="ItemUnits" />
|
|
</AssociationSet>
|
|
<AssociationSet Name="MFR_Domain_Api_Documents_StockMovement_Item_MFR_Domain_Api_Documents_Item_ItemPartnerSet" Association="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_StockMovement_Item_MFR_Domain_Api_Documents_Item_ItemPartner">
|
|
<End Role="ItemPartner" EntitySet="StockMovements" />
|
|
<End Role="Item" EntitySet="Items" />
|
|
</AssociationSet>
|
|
<AssociationSet Name="MFR_Domain_Api_Documents_StockMovement_ItemType_MFR_Domain_Api_Documents_ItemType_ItemTypePartnerSet" Association="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_StockMovement_ItemType_MFR_Domain_Api_Documents_ItemType_ItemTypePartner">
|
|
<End Role="ItemTypePartner" EntitySet="StockMovements" />
|
|
<End Role="ItemType" EntitySet="ItemTypes" />
|
|
</AssociationSet>
|
|
<AssociationSet Name="MFR_Domain_Api_Documents_StockMovement_ServiceRequest_MFR_Domain_Api_Documents_ServiceRequest_ServiceRequestPartnerSet" Association="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_StockMovement_ServiceRequest_MFR_Domain_Api_Documents_ServiceRequest_ServiceRequestPartner">
|
|
<End Role="ServiceRequestPartner" EntitySet="StockMovements" />
|
|
<End Role="ServiceRequest" EntitySet="ServiceRequests" />
|
|
</AssociationSet>
|
|
<AssociationSet Name="MFR_Domain_Api_Documents_StockMovement_Warehouse_MFR_Domain_Api_Documents_ServiceObject_WarehousePartnerSet" Association="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_StockMovement_Warehouse_MFR_Domain_Api_Documents_ServiceObject_WarehousePartner">
|
|
<End Role="WarehousePartner" EntitySet="StockMovements" />
|
|
<End Role="Warehouse" EntitySet="ServiceObjects" />
|
|
</AssociationSet>
|
|
<AssociationSet Name="MFR_Domain_Api_Documents_StockMovement_CreatedBy_MFR_Domain_Api_Documents_Contact_CreatedByPartnerSet" Association="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_StockMovement_CreatedBy_MFR_Domain_Api_Documents_Contact_CreatedByPartner">
|
|
<End Role="CreatedByPartner" EntitySet="StockMovements" />
|
|
<End Role="CreatedBy" EntitySet="Contacts" />
|
|
</AssociationSet>
|
|
<AssociationSet Name="MFR_Domain_Api_Documents_StockMovement_ConfirmedBy_MFR_Domain_Api_Documents_Contact_ConfirmedByPartnerSet" Association="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_StockMovement_ConfirmedBy_MFR_Domain_Api_Documents_Contact_ConfirmedByPartner">
|
|
<End Role="ConfirmedByPartner" EntitySet="StockMovements" />
|
|
<End Role="ConfirmedBy" EntitySet="Contacts" />
|
|
</AssociationSet>
|
|
<AssociationSet Name="MFR_Domain_Api_Documents_TimeEvent_Contact_MFR_Domain_Api_Documents_Contact_ContactPartnerSet" Association="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_TimeEvent_Contact_MFR_Domain_Api_Documents_Contact_ContactPartner">
|
|
<End Role="ContactPartner" EntitySet="TimeEvents" />
|
|
<End Role="Contact" EntitySet="Contacts" />
|
|
</AssociationSet>
|
|
<AssociationSet Name="MFR_Domain_Api_Documents_TimeEvent_ServiceRequest_MFR_Domain_Api_Documents_ServiceRequest_ServiceRequestPartnerSet" Association="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_TimeEvent_ServiceRequest_MFR_Domain_Api_Documents_ServiceRequest_ServiceRequestPartner">
|
|
<End Role="ServiceRequestPartner" EntitySet="TimeEvents" />
|
|
<End Role="ServiceRequest" EntitySet="ServiceRequests" />
|
|
</AssociationSet>
|
|
<AssociationSet Name="MFR_Domain_Api_Documents_Document_ServiceRequest_MFR_Domain_Api_Documents_ServiceRequest_ServiceRequestPartnerSet" Association="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_Document_ServiceRequest_MFR_Domain_Api_Documents_ServiceRequest_ServiceRequestPartner">
|
|
<End Role="ServiceRequestPartner" EntitySet="Documents" />
|
|
<End Role="ServiceRequest" EntitySet="ServiceRequests" />
|
|
</AssociationSet>
|
|
<AssociationSet Name="MFR_Domain_Api_Documents_Report_ServiceRequest_MFR_Domain_Api_Documents_ServiceRequest_ServiceRequestPartnerSet" Association="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_Report_ServiceRequest_MFR_Domain_Api_Documents_ServiceRequest_ServiceRequestPartner">
|
|
<End Role="ServiceRequestPartner" EntitySet="Reports" />
|
|
<End Role="ServiceRequest" EntitySet="ServiceRequests" />
|
|
</AssociationSet>
|
|
<AssociationSet Name="MFR_Domain_Api_Documents_Report_ServiceObject_MFR_Domain_Api_Documents_ServiceObject_ServiceObjectPartnerSet" Association="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_Report_ServiceObject_MFR_Domain_Api_Documents_ServiceObject_ServiceObjectPartner">
|
|
<End Role="ServiceObjectPartner" EntitySet="Reports" />
|
|
<End Role="ServiceObject" EntitySet="ServiceObjects" />
|
|
</AssociationSet>
|
|
<AssociationSet Name="MFR_Domain_Api_Documents_Comment_Owner_MFR_Domain_Api_Documents_Contact_OwnerPartnerSet" Association="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_Comment_Owner_MFR_Domain_Api_Documents_Contact_OwnerPartner">
|
|
<End Role="OwnerPartner" EntitySet="Comments" />
|
|
<End Role="Owner" EntitySet="Contacts" />
|
|
</AssociationSet>
|
|
<AssociationSet Name="MFR_Domain_Api_Documents_Comment_ServiceRequest_MFR_Domain_Api_Documents_ServiceRequest_ServiceRequestPartnerSet" Association="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_Comment_ServiceRequest_MFR_Domain_Api_Documents_ServiceRequest_ServiceRequestPartner">
|
|
<End Role="ServiceRequestPartner" EntitySet="Comments" />
|
|
<End Role="ServiceRequest" EntitySet="ServiceRequests" />
|
|
</AssociationSet>
|
|
<AssociationSet Name="MFR_Domain_Api_Documents_Comment_Company_MFR_Domain_Api_Documents_Company_CompanyPartnerSet" Association="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_Comment_Company_MFR_Domain_Api_Documents_Company_CompanyPartner">
|
|
<End Role="CompanyPartner" EntitySet="Comments" />
|
|
<End Role="Company" EntitySet="Companies" />
|
|
</AssociationSet>
|
|
<AssociationSet Name="MFR_Domain_Api_Documents_Attachment_Step_MFR_Domain_Api_Documents_Step_StepPartnerSet" Association="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_Attachment_Step_MFR_Domain_Api_Documents_Step_StepPartner">
|
|
<End Role="StepPartner" EntitySet="Attachments" />
|
|
<End Role="Step" EntitySet="Steps" />
|
|
</AssociationSet>
|
|
<AssociationSet Name="MFR_Domain_Api_Documents_Appointment_ServiceRequest_MFR_Domain_Api_Documents_ServiceRequest_ServiceRequestPartnerSet" Association="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_Appointment_ServiceRequest_MFR_Domain_Api_Documents_ServiceRequest_ServiceRequestPartner">
|
|
<End Role="ServiceRequestPartner" EntitySet="Appointments" />
|
|
<End Role="ServiceRequest" EntitySet="ServiceRequests" />
|
|
</AssociationSet>
|
|
<AssociationSet Name="MFR_Domain_Api_Documents_Appointment_Contacts_MFR_Domain_Api_Documents_Contact_ContactsPartnerSet" Association="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_Appointment_Contacts_MFR_Domain_Api_Documents_Contact_ContactsPartner">
|
|
<End Role="ContactsPartner" EntitySet="Appointments" />
|
|
<End Role="Contacts" EntitySet="Contacts" />
|
|
</AssociationSet>
|
|
<AssociationSet Name="MFR_Domain_Api_Documents_Appointment_Contact_MFR_Domain_Api_Documents_Contact_ContactPartnerSet" Association="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_Appointment_Contact_MFR_Domain_Api_Documents_Contact_ContactPartner">
|
|
<End Role="ContactPartner" EntitySet="Appointments" />
|
|
<End Role="Contact" EntitySet="Contacts" />
|
|
</AssociationSet>
|
|
<AssociationSet Name="MFR_Domain_Api_Documents_Step_ServiceRequest_MFR_Domain_Api_Documents_ServiceRequest_ServiceRequestPartnerSet" Association="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_Step_ServiceRequest_MFR_Domain_Api_Documents_ServiceRequest_ServiceRequestPartner">
|
|
<End Role="ServiceRequestPartner" EntitySet="Steps" />
|
|
<End Role="ServiceRequest" EntitySet="ServiceRequests" />
|
|
</AssociationSet>
|
|
<AssociationSet Name="MFR_Domain_Api_Documents_Step_ServiceObject_MFR_Domain_Api_Documents_ServiceObject_ServiceObjectPartnerSet" Association="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_Step_ServiceObject_MFR_Domain_Api_Documents_ServiceObject_ServiceObjectPartner">
|
|
<End Role="ServiceObjectPartner" EntitySet="Steps" />
|
|
<End Role="ServiceObject" EntitySet="ServiceObjects" />
|
|
</AssociationSet>
|
|
<AssociationSet Name="MFR_Domain_Api_Documents_Step_StepListTemplate_MFR_Domain_Api_Documents_StepListTemplate_StepListTemplatePartnerSet" Association="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_Step_StepListTemplate_MFR_Domain_Api_Documents_StepListTemplate_StepListTemplatePartner">
|
|
<End Role="StepListTemplatePartner" EntitySet="Steps" />
|
|
<End Role="StepListTemplate" EntitySet="StepListTemplates" />
|
|
</AssociationSet>
|
|
<AssociationSet Name="MFR_Domain_Api_Documents_Step_Parent_MFR_Domain_Api_Documents_Step_ParentPartnerSet" Association="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_Step_Parent_MFR_Domain_Api_Documents_Step_ParentPartner">
|
|
<End Role="ParentPartner" EntitySet="Steps" />
|
|
<End Role="Parent" EntitySet="Steps" />
|
|
</AssociationSet>
|
|
<AssociationSet Name="MFR_Domain_Api_Documents_Step_Attachments_MFR_Domain_Api_Documents_Attachment_AttachmentsPartnerSet" Association="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_Step_Attachments_MFR_Domain_Api_Documents_Attachment_AttachmentsPartner">
|
|
<End Role="AttachmentsPartner" EntitySet="Steps" />
|
|
<End Role="Attachments" EntitySet="Attachments" />
|
|
</AssociationSet>
|
|
<AssociationSet Name="MFR_Domain_Api_Documents_ServiceObject_WarehouseManager_MFR_Domain_Api_Documents_Contact_WarehouseManagerPartnerSet" Association="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_ServiceObject_WarehouseManager_MFR_Domain_Api_Documents_Contact_WarehouseManagerPartner">
|
|
<End Role="WarehouseManagerPartner" EntitySet="ServiceObjects" />
|
|
<End Role="WarehouseManager" EntitySet="Contacts" />
|
|
</AssociationSet>
|
|
<AssociationSet Name="MFR_Domain_Api_Documents_ServiceObject_CustomValueSteps_MFR_Domain_Api_Documents_Step_CustomValueStepsPartnerSet" Association="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_ServiceObject_CustomValueSteps_MFR_Domain_Api_Documents_Step_CustomValueStepsPartner">
|
|
<End Role="CustomValueStepsPartner" EntitySet="ServiceObjects" />
|
|
<End Role="CustomValueSteps" EntitySet="Steps" />
|
|
</AssociationSet>
|
|
<AssociationSet Name="MFR_Domain_Api_Documents_ServiceObject_Company_MFR_Domain_Api_Documents_Company_CompanyPartnerSet" Association="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_ServiceObject_Company_MFR_Domain_Api_Documents_Company_CompanyPartner">
|
|
<End Role="CompanyPartner" EntitySet="ServiceObjects" />
|
|
<End Role="Company" EntitySet="Companies" />
|
|
</AssociationSet>
|
|
<AssociationSet Name="MFR_Domain_Api_Documents_ServiceObject_Product_MFR_Domain_Api_Documents_Product_ProductPartnerSet" Association="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_ServiceObject_Product_MFR_Domain_Api_Documents_Product_ProductPartner">
|
|
<End Role="ProductPartner" EntitySet="ServiceObjects" />
|
|
<End Role="Product" EntitySet="Products" />
|
|
</AssociationSet>
|
|
<AssociationSet Name="MFR_Domain_Api_Documents_ServiceObject_Tags_MFR_Domain_Api_Documents_Tag_TagsPartnerSet" Association="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_ServiceObject_Tags_MFR_Domain_Api_Documents_Tag_TagsPartner">
|
|
<End Role="TagsPartner" EntitySet="ServiceObjects" />
|
|
<End Role="Tags" EntitySet="Tags" />
|
|
</AssociationSet>
|
|
<AssociationSet Name="MFR_Domain_Api_Documents_ServiceObject_ChildServiceObject_MFR_Domain_Api_Documents_ServiceObject_ChildServiceObjectPartnerSet" Association="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_ServiceObject_ChildServiceObject_MFR_Domain_Api_Documents_ServiceObject_ChildServiceObjectPartner">
|
|
<End Role="ChildServiceObjectPartner" EntitySet="ServiceObjects" />
|
|
<End Role="ChildServiceObject" EntitySet="ServiceObjects" />
|
|
</AssociationSet>
|
|
<AssociationSet Name="MFR_Domain_Api_Documents_ServiceObject_Contacts_MFR_Domain_Api_Documents_Contact_ContactsPartnerSet" Association="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_ServiceObject_Contacts_MFR_Domain_Api_Documents_Contact_ContactsPartner">
|
|
<End Role="ContactsPartner" EntitySet="ServiceObjects" />
|
|
<End Role="Contacts" EntitySet="Contacts" />
|
|
</AssociationSet>
|
|
<AssociationSet Name="MFR_Domain_Api_Documents_ServiceObject_Items_MFR_Domain_Api_Documents_Item_ItemsPartnerSet" Association="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_ServiceObject_Items_MFR_Domain_Api_Documents_Item_ItemsPartner">
|
|
<End Role="ItemsPartner" EntitySet="ServiceObjects" />
|
|
<End Role="Items" EntitySet="Items" />
|
|
</AssociationSet>
|
|
<AssociationSet Name="MFR_Domain_Api_Documents_StepListTemplate_Steps_MFR_Domain_Api_Documents_Step_StepsPartnerSet" Association="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_StepListTemplate_Steps_MFR_Domain_Api_Documents_Step_StepsPartner">
|
|
<End Role="StepsPartner" EntitySet="StepListTemplates" />
|
|
<End Role="Steps" EntitySet="Steps" />
|
|
</AssociationSet>
|
|
<AssociationSet Name="MFR_Domain_Api_Documents_StepListTemplateInstance_ServiceRequest_MFR_Domain_Api_Documents_ServiceRequest_ServiceRequestPartnerSet" Association="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_StepListTemplateInstance_ServiceRequest_MFR_Domain_Api_Documents_ServiceRequest_ServiceRequestPartner">
|
|
<End Role="ServiceRequestPartner" EntitySet="StepListTemplateInstances" />
|
|
<End Role="ServiceRequest" EntitySet="ServiceRequests" />
|
|
</AssociationSet>
|
|
<AssociationSet Name="MFR_Domain_Api_Documents_StepListTemplateInstance_Template_MFR_Domain_Api_Documents_StepListTemplate_TemplatePartnerSet" Association="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_StepListTemplateInstance_Template_MFR_Domain_Api_Documents_StepListTemplate_TemplatePartner">
|
|
<End Role="TemplatePartner" EntitySet="StepListTemplateInstances" />
|
|
<End Role="Template" EntitySet="StepListTemplates" />
|
|
</AssociationSet>
|
|
<AssociationSet Name="MFR_Domain_Api_Documents_Contact_Company_MFR_Domain_Api_Documents_Company_CompanyPartnerSet" Association="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_Contact_Company_MFR_Domain_Api_Documents_Company_CompanyPartner">
|
|
<End Role="CompanyPartner" EntitySet="Contacts" />
|
|
<End Role="Company" EntitySet="Companies" />
|
|
</AssociationSet>
|
|
<AssociationSet Name="MFR_Domain_Api_Documents_Contact_User_MFR_Domain_Api_Documents_User_UserPartnerSet" Association="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_Contact_User_MFR_Domain_Api_Documents_User_UserPartner">
|
|
<End Role="UserPartner" EntitySet="Contacts" />
|
|
<End Role="User" EntitySet="Users" />
|
|
</AssociationSet>
|
|
<AssociationSet Name="MFR_Domain_Api_Documents_Product_CustomValueStepTemplate_MFR_Domain_Api_Documents_StepListTemplate_CustomValueStepTemplatePartnerSet" Association="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_Product_CustomValueStepTemplate_MFR_Domain_Api_Documents_StepListTemplate_CustomValueStepTemplatePartner">
|
|
<End Role="CustomValueStepTemplatePartner" EntitySet="Products" />
|
|
<End Role="CustomValueStepTemplate" EntitySet="StepListTemplates" />
|
|
</AssociationSet>
|
|
<AssociationSet Name="MFR_Domain_Api_Documents_Company_MainContact_MFR_Domain_Api_Documents_Contact_MainContactPartnerSet" Association="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_Company_MainContact_MFR_Domain_Api_Documents_Contact_MainContactPartner">
|
|
<End Role="MainContactPartner" EntitySet="Companies" />
|
|
<End Role="MainContact" EntitySet="Contacts" />
|
|
</AssociationSet>
|
|
<AssociationSet Name="MFR_Domain_Api_Documents_Company_Tags_MFR_Domain_Api_Documents_Tag_TagsPartnerSet" Association="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_Company_Tags_MFR_Domain_Api_Documents_Tag_TagsPartner">
|
|
<End Role="TagsPartner" EntitySet="Companies" />
|
|
<End Role="Tags" EntitySet="Tags" />
|
|
</AssociationSet>
|
|
<AssociationSet Name="MFR_Domain_Api_Documents_Company_Contacts_MFR_Domain_Api_Documents_Contact_ContactsPartnerSet" Association="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_Company_Contacts_MFR_Domain_Api_Documents_Contact_ContactsPartner">
|
|
<End Role="ContactsPartner" EntitySet="Companies" />
|
|
<End Role="Contacts" EntitySet="Contacts" />
|
|
</AssociationSet>
|
|
<AssociationSet Name="MFR_Domain_Api_Documents_Company_ServiceObjects_MFR_Domain_Api_Documents_ServiceObject_ServiceObjectsPartnerSet" Association="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_Company_ServiceObjects_MFR_Domain_Api_Documents_ServiceObject_ServiceObjectsPartner">
|
|
<End Role="ServiceObjectsPartner" EntitySet="Companies" />
|
|
<End Role="ServiceObjects" EntitySet="ServiceObjects" />
|
|
</AssociationSet>
|
|
<AssociationSet Name="MFR_Domain_Api_Documents_User_Contact_MFR_Domain_Api_Documents_Contact_ContactPartnerSet" Association="MFR.Domain.Api.Documents.MFR_Domain_Api_Documents_User_Contact_MFR_Domain_Api_Documents_Contact_ContactPartner">
|
|
<End Role="ContactPartner" EntitySet="Users" />
|
|
<End Role="Contact" EntitySet="Contacts" />
|
|
</AssociationSet>
|
|
</EntityContainer>
|
|
</Schema>';
|
|
|
|
RETURN @as;
|
|
|
|
END
|
|
GO
|
|
/****** Object: UserDefinedFunction [dbo].[ocms_admin_authenticate] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date, ,>
|
|
-- Description: <Description, ,>
|
|
-- =============================================
|
|
CREATE FUNCTION [dbo].[ocms_admin_authenticate]
|
|
(
|
|
@email varchar(255),
|
|
@password nvarchar(20)
|
|
)
|
|
RETURNS @RET TABLE ( [useraccount_id] varchar(5), [auth] smallint, [name] nvarchar(255) null, [email] varchar(255) NULL, [mobile] varchar(50) null)
|
|
AS
|
|
BEGIN
|
|
DECLARE @auth smallint = -1;
|
|
DECLARE @useraccount_id varchar(10), @name nvarchar(255), @mobile varchar(50);
|
|
|
|
SELECT TOP(1) @useraccount_id = [useraccount_id]
|
|
,@name = DECRYPTBYKEY(ua.[name_enc])
|
|
,@email = DECRYPTBYKEY(ua.[email_enc])
|
|
,@mobile = DECRYPTBYKEY(ua.[mobile_enc])
|
|
FROM [dbo].[ocms_useraccounts] as ua
|
|
WHERE ua.[DateDeleted] is null AND ua.[DateDisabled] is null
|
|
AND DECRYPTBYKEY(ua.[email_enc]) = @email
|
|
AND DECRYPTBYKEY(ua.[password_enc]) = @password
|
|
AND ua.[password_enc] is not null;
|
|
|
|
INSERT INTO @RET
|
|
VALUES(
|
|
@useraccount_id
|
|
,IIF(@useraccount_id is null, -1, 1)
|
|
,IIF(@useraccount_id is null, null, @name)
|
|
,IIF(@useraccount_id is null, null, @email)
|
|
,IIF(@useraccount_id is null, null, @mobile)
|
|
);
|
|
|
|
RETURN;
|
|
|
|
END
|
|
GO
|
|
/****** Object: UserDefinedFunction [dbo].[ocms_admin_checkUserExists] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date, ,>
|
|
-- Description: <Description, ,>
|
|
-- =============================================
|
|
CREATE FUNCTION [dbo].[ocms_admin_checkUserExists]
|
|
(
|
|
@useraccount_id varchar(5)
|
|
)
|
|
RETURNS bit
|
|
AS
|
|
BEGIN
|
|
DECLARE @RET bit;
|
|
|
|
SET @RET = IIF(EXISTS (SELECT * FROM [dbo].[ocms_useraccounts] as ua WHERE [useraccount_id] = @useraccount_id AND ua.[DateDeleted] is null AND ua.[DateDisabled] is null), 1, 0);
|
|
|
|
RETURN @RET;
|
|
|
|
END
|
|
GO
|
|
/****** Object: UserDefinedFunction [dbo].[ocms_admin_getUserAccount] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date, ,>
|
|
-- Description: <Description, ,>
|
|
-- =============================================
|
|
CREATE FUNCTION [dbo].[ocms_admin_getUserAccount]
|
|
(
|
|
@useraccount_id varchar(5)
|
|
)
|
|
RETURNS @RET TABLE ( [useraccount_id] varchar(5), [auth] smallint, [name] nvarchar(255) null, [email] varchar(255) NULL, [mobile] varchar(50) null)
|
|
AS
|
|
BEGIN
|
|
DECLARE @auth smallint = -1;
|
|
DECLARE @name nvarchar(255), @email varchar(255), @mobile varchar(50);
|
|
|
|
SELECT TOP(1) @useraccount_id = [useraccount_id]
|
|
,@name = DECRYPTBYKEY(ua.[name_enc])
|
|
,@email = DECRYPTBYKEY(ua.[email_enc])
|
|
,@mobile = DECRYPTBYKEY(ua.[mobile_enc])
|
|
FROM [dbo].[ocms_useraccounts] as ua
|
|
WHERE ua.[DateDeleted] is null
|
|
AND ua.[DateDisabled] is null
|
|
AND ua.[useraccount_id] = @useraccount_id;
|
|
|
|
INSERT INTO @RET
|
|
VALUES(
|
|
@useraccount_id
|
|
,IIF(@useraccount_id is null, -1, 1)
|
|
,IIF(@useraccount_id is null, null, @name)
|
|
,IIF(@useraccount_id is null, null, @email)
|
|
,IIF(@useraccount_id is null, null, @mobile)
|
|
);
|
|
|
|
RETURN;
|
|
|
|
END
|
|
GO
|
|
/****** Object: UserDefinedFunction [dbo].[ocms_fn_generatePassword] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
CREATE FUNCTION [dbo].[ocms_fn_generatePassword] (
|
|
@length int
|
|
, @specialChars bit = 1
|
|
, @nums bit = 1
|
|
, @lowerCase bit = 1
|
|
)
|
|
RETURNS varchar(255)
|
|
AS
|
|
BEGIN
|
|
DECLARE @randInt int;
|
|
DECLARE @NewCharacter varchar(1);
|
|
DECLARE @NewPassword TABLE([typ] char(1), [char] char(1), [order] int);
|
|
|
|
SET @length = CASE WHEN @length > 255 THEN 255 ELSE @length END;
|
|
|
|
DECLARE @cnt int = 0, @position as int;
|
|
--random characters
|
|
WHILE (@cnt < @length)
|
|
BEGIN
|
|
SELECT @randInt = [dbo].[ocms_fn_randbetween](33,122)
|
|
|
|
IF (CASE WHEN (@randInt>=33 AND @randInt<=47) AND @specialChars = 1 THEN 1
|
|
WHEN (@randInt>=48 AND @randInt<=57) AND @nums = 1 THEN 1
|
|
WHEN (@randInt>=58 AND @randInt<=64) AND @specialChars = 1 THEN 1
|
|
WHEN (@randInt>=65 AND @randInt<=90) THEN 1
|
|
WHEN (@randInt>=91 AND @randInt<=93) AND @specialChars = 1 THEN 1
|
|
WHEN (@randInt>=97 AND @randInt<=122) AND @lowerCase = 1 THEN 1
|
|
ELSE 0
|
|
END) = 1
|
|
BEGIN
|
|
SET @cnt = @cnt + 1;
|
|
|
|
INSERT INTO @NewPassword
|
|
VALUES (CASE WHEN (@randInt>=33 AND @randInt<=47) THEN 's'
|
|
WHEN (@randInt>=48 AND @randInt<=57) THEN 'n'
|
|
WHEN (@randInt>=58 AND @randInt<=64) THEN 's'
|
|
WHEN (@randInt>=65 AND @randInt<=90) THEN 'u'
|
|
WHEN (@randInt>=91 AND @randInt<=93) THEN 's'
|
|
WHEN (@randInt>=97 AND @randInt<=122) THEN 'l'
|
|
END,
|
|
CHAR(@randInt), @cnt);
|
|
END
|
|
END
|
|
|
|
DECLARE @min_n int = CASE WHEN @length > 4 AND @length < 11 THEN 1 ELSE FLOOR(@length * 0.1) END;
|
|
DECLARE @min_s int = FLOOR(@length * 0.1);
|
|
DECLARE @min_l int = FLOOR(@length * 0.4);
|
|
DECLARE @min_u int = FLOOR(@length * 0.4);
|
|
|
|
WHILE (SELECT COUNT(*) FROM @NewPassword WHERE [typ] = 'n') < @min_n AND @length > 0 AND @nums = 1
|
|
BEGIN
|
|
SET @position = [dbo].[ocms_fn_randbetween](1,@length);
|
|
UPDATE @NewPassword SET [char] = CHAR([dbo].[ocms_fn_randbetween](48,57)), [typ] = 'n' WHERE [order] = @position;
|
|
END
|
|
|
|
WHILE (SELECT COUNT(*) FROM @NewPassword WHERE [typ] = 'l') < @min_l AND @length > 0 AND @lowerCase = 1
|
|
BEGIN
|
|
SET @position = [dbo].[ocms_fn_randbetween](1,@length);
|
|
UPDATE @NewPassword SET [char] = CHAR([dbo].[ocms_fn_randbetween](97,122)), [typ] = 'l' WHERE [order] = @position;
|
|
END
|
|
|
|
WHILE (SELECT COUNT(*) FROM @NewPassword WHERE [typ] = 'u') < @min_n AND @length > 0
|
|
BEGIN
|
|
SET @position = [dbo].[ocms_fn_randbetween](1,@length);
|
|
UPDATE @NewPassword SET [char] = CHAR([dbo].[ocms_fn_randbetween](65,90)), [typ] = 'u' WHERE [order] = @position;
|
|
END
|
|
|
|
WHILE (SELECT COUNT(*) FROM @NewPassword WHERE [typ] = 's') < @min_s AND @length > 0 AND @specialChars = 1
|
|
BEGIN
|
|
SET @position = [dbo].[ocms_fn_randbetween](1,@length);
|
|
DECLARE @nc char(1), @nt char(1);
|
|
select @randInt=[dbo].[ocms_fn_randbetween](33,122)
|
|
|
|
UPDATE @NewPassword SET [char] = CHAR(@randint), [typ] = 's' WHERE [order] = @position AND (CASE WHEN (@randInt>=33 AND @randInt<=47) THEN 's'
|
|
WHEN (@randInt>=48 AND @randInt<=57) THEN 'n'
|
|
WHEN (@randInt>=58 AND @randInt<=64) THEN 's'
|
|
WHEN (@randInt>=65 AND @randInt<=90) THEN 'u'
|
|
WHEN (@randInt>=91 AND @randInt<=93) THEN 's'
|
|
WHEN (@randInt>=97 AND @randInt<=122) THEN 'l'
|
|
END) = 's';
|
|
END
|
|
|
|
|
|
|
|
RETURN (Cast((SELECT [CHAR] as [text()] FROM @NewPassword FOR XML PATH(''),TYPE).value('.','NVARCHAR(MAX)') as varchar(255)));
|
|
END;
|
|
GO
|
|
/****** Object: UserDefinedFunction [dbo].[ocms_fn_link_csv] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date, ,>
|
|
-- Description: <Description, ,>
|
|
-- =============================================
|
|
CREATE FUNCTION [dbo].[ocms_fn_link_csv]
|
|
(
|
|
@inp1 varchar(4000)
|
|
,@inp2 varchar(4000)
|
|
)
|
|
RETURNS varchar(4000)
|
|
AS
|
|
BEGIN
|
|
DECLARE @RET varchar(4000) = ISNULL(@inp1, '')
|
|
+ CASE WHEN ISNULL(@inp1, '') <> '' AND ISNULL(@inp2, '') <> '' THEN ',' ELSE '' END
|
|
+ ISNULL(@inp2, '');
|
|
|
|
|
|
RETURN @RET;
|
|
|
|
END
|
|
GO
|
|
/****** Object: UserDefinedFunction [dbo].[ocms_fn_randbetween] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
CREATE FUNCTION [dbo].[ocms_fn_randbetween](@bottom integer, @top integer)
|
|
RETURNS integer
|
|
AS
|
|
BEGIN
|
|
RETURN (select cast(round((@top-@bottom) * [rn] +@bottom,0) as integer) from [dbo].[ocms_fn_rand])
|
|
END
|
|
GO
|
|
/****** Object: UserDefinedFunction [dbo].[ocms_fn_useraccount_id] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
CREATE FUNCTION [dbo].[ocms_fn_useraccount_id] (
|
|
)
|
|
RETURNS varchar(5)
|
|
AS
|
|
BEGIN
|
|
DECLARE @NewAccount varchar(5) = [dbo].[ocms_fn_generatePassword] (5,0,1,0);
|
|
|
|
WHILE EXISTS( SELECT * FROM [dbo].[ocms_useraccounts] WHERE [useraccount_id] = @NewAccount)
|
|
BEGIN
|
|
SET @NewAccount = [dbo].[ocms_fn_generatePassword] (5,0,1,0);
|
|
END
|
|
|
|
RETURN @NewAccount;
|
|
END;
|
|
GO
|
|
/****** Object: UserDefinedFunction [dbo].[ocms_getFullItemTree] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE FUNCTION [dbo].[ocms_getFullItemTree]
|
|
(
|
|
@view_iid bigint
|
|
,@include_hidden bit
|
|
)
|
|
RETURNS @itemtree TABLE (
|
|
[ocms_iid] [bigint] NOT NULL,
|
|
[parent_iid] [bigint] NULL,
|
|
[ocms_pid] [bigint] NULL,
|
|
[name] [nvarchar](255) NULL,
|
|
[view] [bit] NOT NULL,
|
|
[template_id] [bigint] NULL,
|
|
[hide] [bit] NOT NULL,
|
|
[order] [int] NOT NULL,
|
|
[DateCreated] [datetime] NULL,
|
|
[DateModified] [datetime] NULL,
|
|
[level] int, [sub] bit, [sitepropsub] bit, [focus] bit, [new_order] int
|
|
)
|
|
AS
|
|
BEGIN
|
|
|
|
-- get basics
|
|
DECLARE @site bigint = (SELECT TOP(1) [ocms_iid] FROM [dbo].[ocms_items] as i WHERE i.[parent_iid] is null);
|
|
IF @site is NOT null
|
|
BEGIN
|
|
|
|
WITH cteLevels as (
|
|
SELECT t.*
|
|
, CAST(0 as int) as [level]
|
|
, 0 as [sub]
|
|
, 0 as [sitepropsub]
|
|
FROM [dbo].[ocms_items] as t
|
|
WHERE t.[ocms_iid] = @site
|
|
UNION ALL
|
|
SELECT t.*
|
|
, CAST(c.[level] + 1 as int) as [level]
|
|
, CASE WHEN c.[sub] = 1 THEN 1 WHEN t.[parent_iid] = @view_iid THEN 1 ELSE 0 END as [sub]
|
|
, CASE WHEN c.[sitepropsub] = 1 THEN 1 WHEN t.[parent_iid] = @site and t.[view] = 0 THEN 1 ELSE 0 END as [sitepropsub]
|
|
FROM [dbo].[ocms_items] as t
|
|
inner JOIN cteLevels c on t.[parent_iid] = c.[ocms_iid]
|
|
WHERE (t.[hide] = 0 Or @include_hidden = 1)
|
|
)
|
|
INSERT INTO @itemtree
|
|
SELECT t.*
|
|
, IIF( t.[ocms_iid] = @view_iid , 1, 0) as [focus]
|
|
, ROW_NUMBER() OVER (PARTITION BY [parent_iid] ORDER BY [order], [ocms_iid]) as [new_order]
|
|
FROM cteLevels as t;
|
|
|
|
--SELECT * FROM @itemtree
|
|
END
|
|
|
|
|
|
|
|
RETURN
|
|
END
|
|
GO
|
|
/****** Object: UserDefinedFunction [dbo].[ocms_getFullViewTree] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE FUNCTION [dbo].[ocms_getFullViewTree]
|
|
(
|
|
@view_path varchar(255),
|
|
@locale varchar(5)
|
|
)
|
|
RETURNS @itemtree TABLE (
|
|
[ocms_iid] [bigint] NOT NULL,
|
|
[parent_iid] [bigint] NULL,
|
|
[ocms_pid] [bigint] NULL,
|
|
[name] [nvarchar](255) NULL,
|
|
[view] [bit] NOT NULL,
|
|
[template_id] [bigint] NULL,
|
|
[hide] [bit] NOT NULL,
|
|
[order] [int] NOT NULL,
|
|
[DateCreated] datetime null,
|
|
[DateModified] datetime null,
|
|
[locale] varchar(5) NOT NULL, [alias] varchar(25) NULL, [path] varchar(2000), [level] int, [sub] bit, [focus] bit, [nav] bit, [new_order] int
|
|
)
|
|
AS
|
|
BEGIN
|
|
|
|
-- get basics
|
|
DECLARE @site bigint = (SELECT TOP(1) [ocms_iid] FROM [dbo].[ocms_items] as i WHERE i.[parent_iid] is null);
|
|
SET @view_path = ISNULL(@view_path, '');
|
|
SET @locale = IIF(ISNULL(@locale, '')='', null, @locale);
|
|
|
|
IF @site is NOT null
|
|
BEGIN
|
|
--get locales
|
|
DECLARE @locales TABLE([locale] varchar(5), [order] int);
|
|
INSERT INTO @locales
|
|
SELECT * FROM [dbo].[ocms_locales]();
|
|
|
|
-- tree in all locales
|
|
WITH itm as(
|
|
-- items are not localized
|
|
SELECT i.*, l.[locale]
|
|
FROM [dbo].[ocms_items] as i CROSS JOIN (SELECT * FROM @locales as l_ WHERE l_.[locale] <> '*') as l
|
|
WHERE i.[view] = 1 OR ([ocms_iid] = @site)
|
|
), navitm as (
|
|
select itm.*
|
|
,IIF(itm.[name] COLLATE Latin1_General_CI_AS = 'index', 'index', n.[alias]) as 'alias'
|
|
FROM itm
|
|
LEFT JOIN [dbo].[ocms_navigation] as n ON itm.[ocms_iid] = n.[ocms_iid] and itm.[locale] = n.[locale] AND n.[locale] <> '*'
|
|
), cteLevels as (
|
|
SELECT t.*
|
|
, Cast('//' as varchar(2000)) as [path]
|
|
, CAST(0 as int) as [level]
|
|
, 0 as [sub]
|
|
FROM navitm as t
|
|
WHERE t.[ocms_iid] = @site
|
|
UNION ALL
|
|
SELECT navitm.*
|
|
, IIF( navitm.[view] = 0, '', CAST(IIF( c.[path] = '//' , '' , c.[path] + '/' ) + LOWER(navitm.[alias]) as varchar(2000)) ) as [path]
|
|
, CAST(c.[level] + 1 as int) as [level]
|
|
, CASE WHEN c.[sub] = 1 THEN 1 WHEN IIF( CAST(IIF( c.[path] = '//' , '' , c.[path] + '/' ) + ISNULL(LOWER(navitm.[name]), '') as varchar(2000)) = LOWER(@view_path), 1, 0) = 1 THEN 1 ELSE 0 END as [sub]
|
|
FROM navitm
|
|
inner JOIN cteLevels c on navitm.[parent_iid] = c.[ocms_iid] AND navitm.[locale] = c.[locale]
|
|
)
|
|
INSERT INTO @itemtree
|
|
SELECT t.*
|
|
, IIF( [path] COLLATE Latin1_General_CI_AS = @view_path OR [path] COLLATE Latin1_General_CI_AS like (@view_path + '?%'), 1, 0) as [focus]
|
|
, IIF( [view] = 1 AND [level] > 0 AND [path] <> '' AND [path] <> '//' AND ISNULL(t.[hide],0) = 0 , 1, 0 ) as [nav]
|
|
, ROW_NUMBER() OVER (PARTITION BY [parent_iid] ORDER BY [order], [ocms_iid]) as [new_order]
|
|
FROM cteLevels as t;
|
|
|
|
UPDATE @itemtree SET [path] = null WHERE [nav] = 0;
|
|
|
|
|
|
IF(ISNULL(@locale, '') <> '')
|
|
BEGIN
|
|
DECLARE @view_iid bigint = null, @view_level int;
|
|
SELECT TOP(1)
|
|
@view_iid = it.[ocms_iid]
|
|
, @view_level = it.[level]
|
|
, @locale = it.[locale] -- will override the selected language
|
|
FROM @itemtree as it
|
|
WHERE [focus] = 1
|
|
AND ([locale] = @locale OR [name] COLLATE Latin1_General_CI_AS <> 'index'); -- index is available in any language
|
|
|
|
DELETE FROM @itemtree WHERE [locale] <> @locale; -- remove anything that is not in selected language
|
|
END
|
|
|
|
--SELECT * FROM @itemtree
|
|
END
|
|
|
|
|
|
|
|
RETURN
|
|
END
|
|
GO
|
|
/****** Object: UserDefinedFunction [dbo].[ocms_locales] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE FUNCTION [dbo].[ocms_locales]
|
|
(
|
|
)
|
|
RETURNS @RET TABLE ([locale] varchar(5), [order] int)
|
|
AS
|
|
BEGIN
|
|
DECLARE @set_value varchar(2000) = ISNULL((SELECT [value] FROM [ocms_settings] where [key] = 'locales'), '*,de');
|
|
DECLARE @c char = ',';
|
|
|
|
INSERT INTO @RET
|
|
SELECT [value], [order] = ROW_NUMBER() OVER (ORDER BY CHARINDEX(@c + value + @c, @c + @set_value + @c))
|
|
FROM STRING_SPLIT(@set_value, @c);
|
|
|
|
RETURN;
|
|
END
|
|
GO
|
|
/****** Object: UserDefinedFunction [dbo].[ott_20_randomStrings] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE FUNCTION [dbo].[ott_20_randomStrings]
|
|
(
|
|
@digits tinyint
|
|
)
|
|
RETURNS @RET TABLE
|
|
(
|
|
[s] varchar(5)
|
|
)
|
|
AS
|
|
BEGIN
|
|
|
|
DECLARE @new_sessionid varchar(36), @trys int, @chars varchar(100), @UPPER int, @LOWER int;
|
|
SELECT @chars = '012KLMN34STUVWEFGHIJXYZ567OPQR89ABCD';
|
|
SELECT @UPPER = LEN(@chars), @LOWER = 1;
|
|
|
|
INSERT INTO @RET
|
|
SELECT * FROM (SELECT TOP(20) SUBSTRING(SUBSTRING(@chars, [dbo].[ott_random_int](@UPPER,@LOWER), 1) + SUBSTRING(@chars, [dbo].[ott_random_int](@UPPER,@LOWER), 1) + SUBSTRING(@chars, [dbo].[ott_random_int](@UPPER,@LOWER), 1) + SUBSTRING(@chars, [dbo].[ott_random_int](@UPPER,@LOWER), 1) + SUBSTRING(@chars, [dbo].[ott_random_int](@UPPER,@LOWER), 1) + SUBSTRING(@chars, [dbo].[ott_random_int](@UPPER,@LOWER), 1) + SUBSTRING(@chars, [dbo].[ott_random_int](@UPPER,@LOWER), 1) + SUBSTRING(@chars, [dbo].[ott_random_int](@UPPER,@LOWER), 1) + SUBSTRING(@chars, [dbo].[ott_random_int](@UPPER,@LOWER), 1) + SUBSTRING(@chars, [dbo].[ott_random_int](@UPPER,@LOWER), 1), 1, @digits) as id FROM (VALUES(1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13),(14),(15),(16),(17),(18),(19),(20)) vl(id))z WHERE LEN(id) = @digits;
|
|
|
|
|
|
RETURN
|
|
END
|
|
GO
|
|
/****** Object: UserDefinedFunction [dbo].[ott_b10] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date, ,>
|
|
-- Description: <Description, ,>
|
|
-- =============================================
|
|
CREATE FUNCTION [dbo].[ott_b10]
|
|
(
|
|
@string varchar(10)
|
|
)
|
|
RETURNS int
|
|
AS
|
|
BEGIN
|
|
DECLARE @RET int;
|
|
|
|
|
|
DECLARE @str VARCHAR(10) = REVERSE(LOWER(@string));
|
|
WITH Split(stpos,endpos) AS(
|
|
SELECT 1 AS stpos, 2 AS endpos
|
|
UNION ALL
|
|
SELECT endpos, endpos+1
|
|
FROM Split
|
|
WHERE endpos <= LEN(@str)
|
|
)
|
|
, c as (
|
|
SELECT
|
|
'character' = SUBSTRING(@str,stpos,COALESCE(NULLIF(endpos,0),LEN(@str)+1)-stpos)
|
|
,'charindex' = stpos
|
|
FROM Split
|
|
)
|
|
, s as (
|
|
SELECT
|
|
*
|
|
,'num' = ASCII(character) - ASCII('a') + 1
|
|
,'fac' = POWER(26,([charindex] -1))
|
|
,'val' = POWER(26,([charindex] -1)) * (ASCII(character) - ASCII('a') + 1)
|
|
FROM c
|
|
)
|
|
select @RET = SUM([val]) FROM s;
|
|
|
|
RETURN @RET;
|
|
|
|
END
|
|
GO
|
|
/****** Object: UserDefinedFunction [dbo].[ott_b26] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date, ,>
|
|
-- Description: <Description, ,>
|
|
-- =============================================
|
|
CREATE FUNCTION [dbo].[ott_b26]
|
|
(
|
|
@number int
|
|
)
|
|
RETURNS varchar(10)
|
|
AS
|
|
BEGIN
|
|
DECLARE @RET varchar(10)
|
|
|
|
/*
|
|
SELECT
|
|
*,
|
|
LetterCode =
|
|
Coalesce((SELECT Char(65 + (N.Num - 475255) / 456976 % 26) WHERE N.Num >= 475255), '')
|
|
+ Coalesce((SELECT Char(65 + (N.Num - 18279) / 17576 % 26) WHERE N.Num >= 18279), '')
|
|
+ Coalesce((SELECT Char(65 + (N.Num - 703) / 676 % 26) WHERE N.Num >= 703), '')
|
|
+ Coalesce((SELECT Char(65 + (N.Num - 27) / 26 % 26) WHERE N.Num >= 27), '')
|
|
+ (SELECT Char(65 + (N.Num - 1) % 26))
|
|
FROM (VALUES(18931)) as N(Num)
|
|
ORDER BY N.Num
|
|
*/
|
|
|
|
SET @RET = LOWER(
|
|
Coalesce((SELECT Char(65 + (@number - 475255) / 456976 % 26) WHERE @number >= 475255), '')
|
|
+ Coalesce((SELECT Char(65 + (@number - 18279) / 17576 % 26) WHERE @number >= 18279), '')
|
|
+ Coalesce((SELECT Char(65 + (@number - 703) / 676 % 26) WHERE @number >= 703), '')
|
|
+ Coalesce((SELECT Char(65 + (@number - 27) / 26 % 26) WHERE @number >= 27), '')
|
|
+ (SELECT Char(65 + (@number - 1) % 26))
|
|
);
|
|
|
|
RETURN @RET;
|
|
|
|
END
|
|
GO
|
|
/****** Object: UserDefinedFunction [dbo].[ott_csv_contains] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date, ,>
|
|
-- Description: <Description, ,>
|
|
-- =============================================
|
|
CREATE FUNCTION [dbo].[ott_csv_contains]
|
|
(
|
|
@text varchar(500)
|
|
,@fragment varchar(500)
|
|
)
|
|
RETURNS bit
|
|
AS
|
|
BEGIN
|
|
DECLARE @RET bit;
|
|
|
|
-- Will be true
|
|
-- if any of the fragments exist in the list of text-items
|
|
|
|
WITH texts as (SELECT * FROM string_split(ISNULL(@text,''), ','))
|
|
,fragments as (SELECT * FROM string_split(ISNULL(@fragment,''), ','))
|
|
SELECT @RET = CASE WHEN EXISTS (SELECT * FROM texts JOIN fragments ON texts.[value] = fragments.[value]) THEN 1 ELSE 0 END;
|
|
|
|
RETURN @RET;
|
|
|
|
END
|
|
GO
|
|
/****** Object: UserDefinedFunction [dbo].[ott_jcontent] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date, ,>
|
|
-- Description: <Description, ,>
|
|
-- =============================================
|
|
CREATE FUNCTION [dbo].[ott_jcontent]
|
|
(
|
|
@groupcode varchar(10)
|
|
,@text varchar(4000)
|
|
)
|
|
RETURNS varchar(4000)
|
|
AS
|
|
BEGIN
|
|
DECLARE @RET varchar(4000);
|
|
DECLARE @textinput varchar(4000) = REPLACE(ISNULL(@text, ''), ' ', '');
|
|
|
|
IF (@textinput = '' OR @textinput = '{}')
|
|
BEGIN
|
|
SET @RET = 0;
|
|
END
|
|
ELSE
|
|
BEGIN
|
|
|
|
DECLARE @Pattern varchar(20) = '%"' + @groupcode + '":"%';
|
|
DECLARE @P0 int = PATINDEX(@pattern, @textinput);
|
|
DECLARE @P1 int = @P0 + LEN(@pattern) -2;
|
|
DECLARE @P2 int = CHARINDEX('"',@textinput,@p1);
|
|
|
|
SELECT @RET = CASE WHEN @P0 = 0 THEN '' ELSE SUBSTRING(@textinput, @P1, @P2 - @P1) END;
|
|
END
|
|
|
|
RETURN @RET;
|
|
|
|
END
|
|
GO
|
|
/****** Object: UserDefinedFunction [dbo].[ott_jcsv_contains] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date, ,>
|
|
-- Description: <Description, ,>
|
|
-- =============================================
|
|
CREATE FUNCTION [dbo].[ott_jcsv_contains]
|
|
(
|
|
@groupcode varchar(10)
|
|
,@text varchar(4000)
|
|
,@fragment varchar(500)
|
|
)
|
|
RETURNS bit
|
|
AS
|
|
BEGIN
|
|
DECLARE @RET bit;
|
|
DECLARE @textinput varchar(4000) = REPLACE(ISNULL(@text, ''), ' ', '');
|
|
|
|
IF (@textinput = '' OR @textinput = '{}' OR @fragment = '')
|
|
BEGIN
|
|
SET @RET = 0;
|
|
END
|
|
ELSE
|
|
BEGIN
|
|
|
|
-- Will be true
|
|
-- if any of the fragments exist in the list of text-items
|
|
|
|
DECLARE @Pattern varchar(20) = '%"' + @groupcode + '":"%';
|
|
DECLARE @P0 int = PATINDEX(@pattern, @textinput);
|
|
DECLARE @P1 int = @P0 + LEN(@pattern) -2;
|
|
DECLARE @P2 int = CHARINDEX('"',@textinput,@p1);
|
|
|
|
IF @P0 = 0
|
|
BEGIN
|
|
SET @RET = 0;
|
|
|
|
END
|
|
ELSE
|
|
BEGIN
|
|
DECLARE @text2 varchar(4000) = SUBSTRING(@textinput, @P1, @P2 - @P1);
|
|
|
|
WITH texts as (SELECT * FROM string_split(ISNULL(@text2,''), ','))
|
|
,fragments as (SELECT * FROM string_split(ISNULL(@fragment,''), ','))
|
|
SELECT @RET = CASE WHEN EXISTS (SELECT * FROM texts JOIN fragments ON texts.[value] = fragments.[value]) THEN 1 ELSE 0 END;
|
|
END
|
|
|
|
END
|
|
|
|
RETURN @RET;
|
|
|
|
END
|
|
GO
|
|
/****** Object: UserDefinedFunction [dbo].[ott_jcsv_containskey] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date, ,>
|
|
-- Description: <Description, ,>
|
|
-- =============================================
|
|
CREATE FUNCTION [dbo].[ott_jcsv_containskey]
|
|
(
|
|
@groupcode varchar(10)
|
|
,@text varchar(4000)
|
|
)
|
|
RETURNS bit
|
|
AS
|
|
BEGIN
|
|
DECLARE @RET bit;
|
|
DECLARE @textinput varchar(4000) = REPLACE(ISNULL(@text, ''), ' ', '');
|
|
|
|
IF (@textinput = '' OR @textinput = '{}')
|
|
BEGIN
|
|
SET @RET = 0;
|
|
END
|
|
ELSE
|
|
BEGIN
|
|
|
|
-- Will be true
|
|
-- if any of the fragments exist in the list of text-items
|
|
|
|
DECLARE @Pattern varchar(20) = '%"' + @groupcode + '":"%';
|
|
DECLARE @P0 int = PATINDEX(@pattern, @textinput);
|
|
|
|
SET @RET = Case WHEN @P0 = 0 THEN 0 ELSE 1 END;
|
|
|
|
END
|
|
|
|
RETURN @RET;
|
|
|
|
END
|
|
GO
|
|
/****** Object: UserDefinedFunction [dbo].[ott_random_int] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date, ,>
|
|
-- Description: <Description, ,>
|
|
-- =============================================
|
|
CREATE FUNCTION [dbo].[ott_random_int]
|
|
(@UPPER int, @LOWER int)
|
|
RETURNS int
|
|
AS
|
|
BEGIN
|
|
DECLARE @RET INT = CAST(ROUND(((@UPPER - @LOWER - 1) * (SELECT TOP(1) [rn] FROM [dbo].[ocms_fn_rand]) + @LOWER), 0) as int);
|
|
|
|
RETURN @RET;
|
|
|
|
END
|
|
GO
|
|
/****** Object: View [dbo].[ocms_fn_rand] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
CREATE VIEW [dbo].[ocms_fn_rand]
|
|
AS
|
|
select rand(Cast(newid() as varbinary)) as rn
|
|
GO
|
|
/****** Object: Table [dbo].[email_list] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[email_list](
|
|
[uid] [int] IDENTITY(1,1) NOT NULL,
|
|
[email] [varchar](255) NULL,
|
|
[sent] [datetime] NULL,
|
|
[result] [bit] NULL
|
|
) ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[fds__debuglog] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[fds__debuglog](
|
|
[uid] [bigint] IDENTITY(1,1) NOT NULL,
|
|
[CodeReference] [varchar](255) NULL,
|
|
[ExceptionMessage] [varchar](max) NULL,
|
|
[StackTrace] [varchar](max) NULL,
|
|
[Data] [varchar](max) NULL,
|
|
[timestamp] [datetime] NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[fds__log] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[fds__log](
|
|
[table] [varchar](50) NOT NULL,
|
|
[action] [varchar](50) NOT NULL,
|
|
[timestamp] [datetime] NOT NULL,
|
|
[setid] [varchar](10) NULL,
|
|
[info] [varchar](250) NULL
|
|
) ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[fds__status] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[fds__status](
|
|
[table] [varchar](50) NOT NULL,
|
|
[action] [varchar](50) NOT NULL,
|
|
[timestamp] [datetime] NOT NULL,
|
|
[setid] [varchar](10) NULL
|
|
) ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[fuchs_debug] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[fuchs_debug](
|
|
[rn] [bigint] IDENTITY(1,1) NOT NULL,
|
|
[interface] [varchar](50) NOT NULL,
|
|
[url] [varchar](500) NULL,
|
|
[data] [nvarchar](max) NULL,
|
|
[date] [datetime] NOT NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[fuchs_planner] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[fuchs_planner](
|
|
[planner_id] [tinyint] IDENTITY(1,1) NOT NULL,
|
|
[shortname] [varchar](10) NOT NULL,
|
|
[name] [varchar](100) NULL,
|
|
[description] [varchar](2000) NULL,
|
|
[active] [bit] NOT NULL,
|
|
CONSTRAINT [PK_fuchs_planner] PRIMARY KEY CLUSTERED
|
|
(
|
|
[planner_id] ASC
|
|
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
|
) ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[fuchs_planner_groups] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[fuchs_planner_groups](
|
|
[group_id] [int] NOT NULL,
|
|
[code] AS ([dbo].[ott_b26]([group_id])),
|
|
[planner_id] [tinyint] NOT NULL,
|
|
[sequence_order] [tinyint] NOT NULL,
|
|
[parent_codes] [varchar](50) NULL,
|
|
[condition] [varchar](50) NULL,
|
|
[shortname] [varchar](15) NULL,
|
|
[name] [varchar](100) NULL,
|
|
[description] [varchar](max) NULL,
|
|
[selection_type] [varchar](10) NULL,
|
|
[final] [bit] NOT NULL,
|
|
[hide] [bit] NOT NULL,
|
|
CONSTRAINT [PK_fuchs_planner_groups] PRIMARY KEY CLUSTERED
|
|
(
|
|
[group_id] ASC
|
|
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[fuchs_planner_options] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[fuchs_planner_options](
|
|
[option_id] [int] IDENTITY(1,1) NOT NULL,
|
|
[planner_id] [tinyint] NOT NULL,
|
|
[group_id] [int] NOT NULL,
|
|
[code] AS (([dbo].[ott_b26]([group_id])+'.')+[dbo].[ott_b26]([option_id])),
|
|
[subgroup] [varchar](10) NULL,
|
|
[option_order] [tinyint] NOT NULL,
|
|
[option_type] [char](1) NULL,
|
|
[condition] [varchar](100) NULL,
|
|
[name] [varchar](100) NULL,
|
|
[description] [varchar](2000) NULL,
|
|
[tooltip] [varchar](500) NULL,
|
|
[icon_url] [varchar](max) NULL,
|
|
[hide] [bit] NOT NULL,
|
|
CONSTRAINT [PK_fuchs_planner_options] PRIMARY KEY CLUSTERED
|
|
(
|
|
[option_id] ASC
|
|
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[fuchs_planner_traffic] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[fuchs_planner_traffic](
|
|
[uid] [bigint] IDENTITY(1,1) NOT NULL,
|
|
[planner_id] [tinyint] NOT NULL,
|
|
[sessionid] [varchar](10) NOT NULL,
|
|
[group_code] [varchar](10) NULL,
|
|
[values] [nvarchar](4000) NULL,
|
|
[DateSubmitted] [datetime] NOT NULL,
|
|
CONSTRAINT [PK_fuchs_planner_traffic] PRIMARY KEY CLUSTERED
|
|
(
|
|
[uid] ASC
|
|
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
|
) ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[mfr__#customvalues] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[mfr__#customvalues](
|
|
[Id] [bigint] NOT NULL,
|
|
[EntityID] [bigint] NOT NULL,
|
|
[Property] [varchar](255) NOT NULL,
|
|
[Meta] [varchar](255) NOT NULL,
|
|
[Value] [varchar](1000) NULL
|
|
) ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[mfr__#locations] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[mfr__#locations](
|
|
[Id] [bigint] NOT NULL,
|
|
[EntityId] [bigint] NOT NULL,
|
|
[Property] [varchar](255) NOT NULL,
|
|
[Version] [int] NOT NULL,
|
|
[AddressString] [nvarchar](255) NULL,
|
|
[Postal] [nvarchar](255) NULL,
|
|
[City] [nvarchar](255) NULL,
|
|
[State] [nvarchar](255) NULL,
|
|
[Country] [varchar](15) NULL,
|
|
[Longitude] [float] NOT NULL,
|
|
[Latitude] [float] NOT NULL,
|
|
[IsValidLocation] [bit] NOT NULL
|
|
) ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[mfr__*PartnerSet] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[mfr__*PartnerSet](
|
|
[Property] [varchar](50) NOT NULL,
|
|
[PartnerType] [varchar](25) NOT NULL,
|
|
[PartnerId] [bigint] NOT NULL,
|
|
[EntityId] [bigint] NOT NULL
|
|
) ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[mfr__appointments] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[mfr__appointments](
|
|
[Id] [bigint] NOT NULL,
|
|
[Version] [int] NOT NULL,
|
|
[State] [nvarchar](255) NULL,
|
|
[Type] [nvarchar](255) NULL,
|
|
[EndDateTime] [datetime] NULL,
|
|
[StartDateTime] [datetime] NOT NULL,
|
|
[DrivingDistanceFrom] [int] NULL,
|
|
[DrivingDistanceTo] [int] NULL,
|
|
[WasReadOnClientSide] [bit] NOT NULL,
|
|
[ContactIds] [varchar](max) NULL,
|
|
[ServiceRequestId] [bigint] NOT NULL,
|
|
[ContactId] [bigint] NOT NULL,
|
|
[Note] [nvarchar](255) NULL,
|
|
CONSTRAINT [PK_mfr__appointment] PRIMARY KEY CLUSTERED
|
|
(
|
|
[Id] ASC
|
|
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[mfr__attachments] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[mfr__attachments](
|
|
[Id] [bigint] NOT NULL,
|
|
[Version] [int] NOT NULL,
|
|
[URI] [nvarchar](255) NULL,
|
|
[StepId] [bigint] NOT NULL,
|
|
CONSTRAINT [PK_mfr__attachment] PRIMARY KEY CLUSTERED
|
|
(
|
|
[Id] ASC
|
|
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
|
) ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[mfr__comments] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[mfr__comments](
|
|
[Id] [bigint] NOT NULL,
|
|
[Version] [int] NOT NULL,
|
|
[DateOfCreation] [datetime] NOT NULL,
|
|
[IsInternal] [bit] NOT NULL,
|
|
[ServiceRequestId] [bigint] NOT NULL,
|
|
[CompanyId] [bigint] NOT NULL,
|
|
[Content] [nvarchar](255) NULL,
|
|
CONSTRAINT [PK_mfr__comment] PRIMARY KEY CLUSTERED
|
|
(
|
|
[Id] ASC
|
|
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
|
) ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[mfr__companies] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[mfr__companies](
|
|
[Id] [bigint] NOT NULL,
|
|
[Location#ID] [bigint] NULL,
|
|
[Version] [int] NOT NULL,
|
|
[IsPhysicalPerson] [bit] NOT NULL,
|
|
[IsOwner] [bit] NOT NULL,
|
|
[IsEmailInvoicingActive] [bit] NOT NULL,
|
|
[IsSupplier] [bit] NOT NULL,
|
|
[MappingId] [nvarchar](255) NULL,
|
|
[ExternalId] [nvarchar](255) NULL,
|
|
[Name] [nvarchar](255) NULL,
|
|
[Note] [nvarchar](255) NULL,
|
|
[SupportTelephone] [nvarchar](255) NULL,
|
|
[SupportFax] [nvarchar](255) NULL,
|
|
[SupportMail] [nvarchar](255) NULL,
|
|
[QuickSearch] [nvarchar](255) NULL,
|
|
[DateModified] [datetime] NOT NULL,
|
|
[CustomValues] [nvarchar](max) NOT NULL,
|
|
[MainContactId] [bigint] NOT NULL,
|
|
CONSTRAINT [PK_mfr__company] PRIMARY KEY CLUSTERED
|
|
(
|
|
[Id] ASC
|
|
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[mfr__contacts] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[mfr__contacts](
|
|
[Id] [bigint] NOT NULL,
|
|
[CustomValues] [nvarchar](max) NOT NULL,
|
|
[FirstName] [nvarchar](255) NULL,
|
|
[LastName] [nvarchar](255) NULL,
|
|
[Email] [nvarchar](255) NULL,
|
|
[JobTitle] [nvarchar](255) NULL,
|
|
[MobilePhone] [nvarchar](255) NULL,
|
|
[Telephone] [nvarchar](255) NULL,
|
|
[Fax] [nvarchar](255) NULL,
|
|
[Note] [nvarchar](255) NULL,
|
|
[DateModified] [datetime] NOT NULL,
|
|
[Version] [int] NOT NULL,
|
|
[CompanyId] [bigint] NOT NULL,
|
|
[IsUser] [bit] NOT NULL,
|
|
[ExternalId] [nvarchar](255) NULL,
|
|
[Gender] [nvarchar](255) NULL,
|
|
[UserId] [bigint] NOT NULL,
|
|
CONSTRAINT [PK_mfr__contact] PRIMARY KEY CLUSTERED
|
|
(
|
|
[Id] ASC
|
|
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[mfr__costcenters] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[mfr__costcenters](
|
|
[Id] [bigint] NOT NULL,
|
|
[Version] [int] NOT NULL,
|
|
[Name] [nvarchar](255) NULL,
|
|
CONSTRAINT [PK_mfr__costcenter] PRIMARY KEY CLUSTERED
|
|
(
|
|
[Id] ASC
|
|
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
|
) ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[mfr__documents] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[mfr__documents](
|
|
[Id] [bigint] NOT NULL,
|
|
[CustomValues] [nvarchar](max) NOT NULL,
|
|
[Version] [int] NOT NULL,
|
|
[State] [nvarchar](255) NULL,
|
|
[ExternalId] [nvarchar](255) NULL,
|
|
[URI] [nvarchar](255) NULL,
|
|
[IsGlobal] [bit] NOT NULL,
|
|
[StartDateTime] [datetime] NULL,
|
|
[EndDateTime] [datetime] NULL,
|
|
[FileName] [nvarchar](255) NULL,
|
|
[DateModified] [datetime] NOT NULL,
|
|
[UploadDate] [datetime] NOT NULL,
|
|
[IsLink] [bit] NOT NULL,
|
|
[ContentType] [nvarchar](255) NULL,
|
|
[HTMLCode] [nvarchar](255) NULL,
|
|
[ServiceRequestId] [bigint] NOT NULL,
|
|
[Note] [nvarchar](255) NULL,
|
|
CONSTRAINT [PK_mfr__document] PRIMARY KEY CLUSTERED
|
|
(
|
|
[Id] ASC
|
|
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[mfr__items] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[mfr__items](
|
|
[Id] [bigint] NOT NULL,
|
|
[Version] [int] NOT NULL,
|
|
[QuantityHours] [float] NOT NULL,
|
|
[PlannedQuantityHours] [float] NOT NULL,
|
|
[ItemTypeId] [bigint] NULL,
|
|
[ItemNumber] [nvarchar](255) NULL,
|
|
[TrackingId] [nvarchar](255) NULL,
|
|
[Manufacture] [nvarchar](255) NULL,
|
|
[Price] [float] NOT NULL,
|
|
[Costs] [float] NULL,
|
|
[NameOrNumber] [nvarchar](255) NULL,
|
|
[CustomValues] [nvarchar](max) NULL,
|
|
[Note] [nvarchar](max) NULL,
|
|
[ExternalId] [nvarchar](255) NULL,
|
|
[Discount] [float] NOT NULL,
|
|
[VAT] [float] NOT NULL,
|
|
[IsManual] [bit] NOT NULL,
|
|
[SortOrder] [int] NOT NULL,
|
|
[Type] [nvarchar](255) NULL,
|
|
[ServiceRequestId] [bigint] NOT NULL,
|
|
[ServiceObjectId] [bigint] NOT NULL,
|
|
[CreatorId] [bigint] NOT NULL,
|
|
[UnitId] [bigint] NULL,
|
|
[UnitString] [nvarchar](255) NULL,
|
|
CONSTRAINT [PK_mfr__item] PRIMARY KEY CLUSTERED
|
|
(
|
|
[Id] ASC
|
|
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[mfr__itemtypes] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[mfr__itemtypes](
|
|
[Id] [bigint] NOT NULL,
|
|
[CustomValues] [nvarchar](max) NOT NULL,
|
|
[Version] [int] NOT NULL,
|
|
[Costs] [float] NOT NULL,
|
|
[Description] [nvarchar](max) NULL,
|
|
[ListPrice] [float] NOT NULL,
|
|
[Manufacture] [nvarchar](255) NULL,
|
|
[ExternalId] [nvarchar](255) NULL,
|
|
[ItemNumber] [nvarchar](255) NULL,
|
|
[NameOrNumber] [nvarchar](1000) NULL,
|
|
[GlobalTradeItemNr] [nvarchar](255) NULL,
|
|
[Type] [nvarchar](255) NULL,
|
|
[Price] [float] NOT NULL,
|
|
[VAT] [float] NOT NULL,
|
|
[IsPortalOnly] [bit] NOT NULL,
|
|
[Discount] [float] NOT NULL,
|
|
[DateModified] [datetime] NOT NULL,
|
|
[IsDiscontinued] [bit] NOT NULL,
|
|
[IsWarehouse] [bit] NOT NULL,
|
|
[UnitId] [bigint] NULL,
|
|
[UnitString] [nvarchar](255) NULL,
|
|
CONSTRAINT [PK_mfr__itemtype] PRIMARY KEY CLUSTERED
|
|
(
|
|
[Id] ASC
|
|
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[mfr__itemunits] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[mfr__itemunits](
|
|
[Id] [bigint] NOT NULL,
|
|
[Version] [int] NOT NULL,
|
|
[Name] [nvarchar](255) NULL,
|
|
CONSTRAINT [PK_mfr__itemunit] PRIMARY KEY CLUSTERED
|
|
(
|
|
[Id] ASC
|
|
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
|
) ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[mfr__products] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[mfr__products](
|
|
[Id] [bigint] NOT NULL,
|
|
[Version] [int] NOT NULL,
|
|
[Name] [nvarchar](255) NULL,
|
|
[SubKey] [nvarchar](255) NULL,
|
|
[Description] [nvarchar](255) NULL,
|
|
[DateModified] [datetime] NOT NULL,
|
|
[MappingId] [nvarchar](255) NULL,
|
|
[CustomValueStepTemplateId] [bigint] NOT NULL,
|
|
CONSTRAINT [PK_mfr__product] PRIMARY KEY CLUSTERED
|
|
(
|
|
[Id] ASC
|
|
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
|
) ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[mfr__qualifications] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[mfr__qualifications](
|
|
[Id] [bigint] NOT NULL,
|
|
[Version] [int] NOT NULL,
|
|
[Name] [nvarchar](255) NULL,
|
|
CONSTRAINT [PK_mfr__qualification] PRIMARY KEY CLUSTERED
|
|
(
|
|
[Id] ASC
|
|
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
|
) ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[mfr__reports] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[mfr__reports](
|
|
[Id] [bigint] NOT NULL,
|
|
[Version] [int] NOT NULL,
|
|
[DateOfCreation] [datetime] NOT NULL,
|
|
[URI] [nvarchar](255) NULL,
|
|
[DocumentName] [nvarchar](255) NULL,
|
|
[FileTypeString] [nvarchar](255) NULL,
|
|
[ReportDefinitionCode] [nvarchar](255) NULL,
|
|
[ServiceObjectId] [bigint] NOT NULL,
|
|
[CanBeDeleted] [bit] NOT NULL,
|
|
[InvoiceBalance] [float] NOT NULL,
|
|
[InvoiceId] [nvarchar](255) NULL,
|
|
[DueDate] [datetime] NOT NULL,
|
|
[IsPayed] [bit] NOT NULL,
|
|
[IsInvoice] [bit] NOT NULL,
|
|
[IsCanceled] [bit] NOT NULL,
|
|
[CustomValues] [nvarchar](max) NOT NULL,
|
|
CONSTRAINT [PK_mfr__report] PRIMARY KEY CLUSTERED
|
|
(
|
|
[Id] ASC
|
|
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[mfr__serviceobjects] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[mfr__serviceobjects](
|
|
[Id] [bigint] NOT NULL,
|
|
[Location#ID] [bigint] NULL,
|
|
[Name] [nvarchar](255) NULL,
|
|
[Note] [nvarchar](255) NULL,
|
|
[CustomValues] [nvarchar](max) NOT NULL,
|
|
[DateModified] [datetime] NOT NULL,
|
|
[ExternalId] [nvarchar](255) NULL,
|
|
[MappingId] [nvarchar](255) NULL,
|
|
[QuickSearch] [nvarchar](255) NULL,
|
|
[Version] [int] NOT NULL,
|
|
[CreateGeoLocation] [bit] NOT NULL,
|
|
[IsWarehouse] [bit] NOT NULL,
|
|
[ParentServiceObjectId] [bigint] NOT NULL,
|
|
[CompanyId] [bigint] NOT NULL,
|
|
[ProductId] [bigint] NOT NULL,
|
|
CONSTRAINT [PK_mfr__serviceobject] PRIMARY KEY CLUSTERED
|
|
(
|
|
[Id] ASC
|
|
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[mfr__servicerequests] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[mfr__servicerequests](
|
|
[Id] [bigint] NOT NULL,
|
|
[Name] [nvarchar](255) NULL,
|
|
[ExternalId] [nvarchar](255) NULL,
|
|
[InvoiceId] [nvarchar](255) NULL,
|
|
[ClosedAt] [datetime] NULL,
|
|
[ReleasedAt] [datetime] NULL,
|
|
[WorkDoneAt] [datetime] NULL,
|
|
[TargetTimeInMinutes] [bigint] NOT NULL,
|
|
[DateModified] [datetime] NULL,
|
|
[DateOfCreation] [datetime] NULL,
|
|
[DueDateRangeStart] [datetime] NULL,
|
|
[DueDateRangeEnd] [datetime] NULL,
|
|
[PortalLink] [nvarchar](255) NULL,
|
|
[CostCenterId] [bigint] NULL,
|
|
[Description] [nvarchar](max) NULL,
|
|
[State] [nvarchar](255) NULL,
|
|
[CustomValues] [nvarchar](max) NOT NULL,
|
|
[CurrentOwnerId] [bigint] NULL,
|
|
[CustomerId] [bigint] NULL,
|
|
[ParentServiceRequestId] [bigint] NULL,
|
|
[Location#ID] [bigint] NULL,
|
|
[Version] [int] NOT NULL,
|
|
[IsTemplate] [bit] NOT NULL,
|
|
[IsTemplateMobile] [bit] NOT NULL,
|
|
[CreateFromServiceRequestTemplateId] [bigint] NOT NULL,
|
|
[Type] [nvarchar](255) NULL,
|
|
CONSTRAINT [PK_mfr__servicerequest] PRIMARY KEY CLUSTERED
|
|
(
|
|
[Id] ASC
|
|
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[mfr__steplisttemplateinstances] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[mfr__steplisttemplateinstances](
|
|
[Id] [bigint] NOT NULL,
|
|
[Version] [int] NOT NULL,
|
|
[Name] [nvarchar](255) NULL,
|
|
[ServiceRequestId] [bigint] NULL,
|
|
[TemplateId] [bigint] NULL,
|
|
CONSTRAINT [PK_mfr__steplisttemplateinstance] PRIMARY KEY CLUSTERED
|
|
(
|
|
[Id] ASC
|
|
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
|
) ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[mfr__steplisttemplates] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[mfr__steplisttemplates](
|
|
[Id] [bigint] NOT NULL,
|
|
[Version] [int] NOT NULL,
|
|
[Name] [nvarchar](255) NULL,
|
|
[MappingId] [nvarchar](255) NULL,
|
|
[DateModified] [datetime] NOT NULL,
|
|
[IsReleased] [bit] NOT NULL,
|
|
[IsDurable] [bit] NOT NULL,
|
|
CONSTRAINT [PK_mfr__steplisttemplate] PRIMARY KEY CLUSTERED
|
|
(
|
|
[Id] ASC
|
|
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
|
) ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[mfr__steps] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[mfr__steps](
|
|
[Id] [bigint] NOT NULL,
|
|
[MobileId] [bigint] NULL,
|
|
[Version] [int] NOT NULL,
|
|
[Name] [nvarchar](255) NULL,
|
|
[IsDone] [bit] NOT NULL,
|
|
[HasError] [bit] NOT NULL,
|
|
[TrackingId] [nvarchar](255) NULL,
|
|
[Type] [nvarchar](255) NULL,
|
|
[SortOrder] [int] NOT NULL,
|
|
[Data] [nvarchar](max) NULL,
|
|
[DateModifiedOffline] [datetime] NULL,
|
|
[ServiceRequestId] [bigint] NULL,
|
|
[Description] [nvarchar](max) NULL,
|
|
[Comment] [nvarchar](max) NULL,
|
|
[InternalComment] [nvarchar](max) NULL,
|
|
[ServiceObjectId] [bigint] NULL,
|
|
[StepListTemplateId] [bigint] NULL,
|
|
[ParentId] [bigint] NULL,
|
|
CONSTRAINT [PK_mfr__step] PRIMARY KEY CLUSTERED
|
|
(
|
|
[Id] ASC
|
|
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[mfr__stockmovements] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[mfr__stockmovements](
|
|
[Id] [bigint] NOT NULL,
|
|
[Version] [int] NOT NULL,
|
|
[Amount] [float] NOT NULL,
|
|
[AmountReceived] [float] NOT NULL,
|
|
[ExternalId] [varchar](255) NULL,
|
|
[ItemId] [bigint] NULL,
|
|
[ItemTypeId] [bigint] NULL,
|
|
[StockMovementType] [varchar](255) NULL,
|
|
[State] [varchar](255) NULL,
|
|
[ServiceRequestId] [bigint] NOT NULL,
|
|
[WarehouseId] [bigint] NOT NULL,
|
|
[DateOfCreation] [datetime] NOT NULL,
|
|
[DateModified] [datetime] NOT NULL,
|
|
[TargetDate] [datetime] NOT NULL,
|
|
[CreatedById] [bigint] NOT NULL,
|
|
[ConfirmedById] [bigint] NOT NULL,
|
|
CONSTRAINT [PK_mfr__stockmovement] PRIMARY KEY CLUSTERED
|
|
(
|
|
[Id] ASC
|
|
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
|
) ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[mfr__tags] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[mfr__tags](
|
|
[Id] [bigint] NOT NULL,
|
|
[Version] [int] NOT NULL,
|
|
[Name] [nvarchar](255) NULL,
|
|
[ColorDefinition] [nvarchar](255) NULL,
|
|
[Type] [nvarchar](255) NOT NULL,
|
|
CONSTRAINT [PK_mfr__tag] PRIMARY KEY CLUSTERED
|
|
(
|
|
[Id] ASC
|
|
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
|
) ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[mfr__timeevents] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[mfr__timeevents](
|
|
[Id] [bigint] NOT NULL,
|
|
[Version] [int] NOT NULL,
|
|
[State] [nvarchar](255) NULL,
|
|
[IsApproved] [bit] NOT NULL,
|
|
[TimeEventType] [nvarchar](255) NULL,
|
|
[ExternalId] [nvarchar](255) NULL,
|
|
[DateModified] [datetime] NOT NULL,
|
|
[StartDateTime] [datetime] NOT NULL,
|
|
[EndDateTime] [datetime] NOT NULL,
|
|
[ProposedDrivingDistance] [int] NOT NULL,
|
|
[ContactId] [bigint] NOT NULL,
|
|
[ServiceRequestId] [bigint] NOT NULL,
|
|
[Description] [nvarchar](255) NULL,
|
|
CONSTRAINT [PK_mfr__timeevent] PRIMARY KEY CLUSTERED
|
|
(
|
|
[Id] ASC
|
|
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
|
) ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[mfr__users] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[mfr__users](
|
|
[Id] [bigint] NOT NULL,
|
|
[Version] [int] NOT NULL,
|
|
[UserName] [nvarchar](255) NULL,
|
|
[IsSystem] [bit] NOT NULL,
|
|
[CreationDate] [datetime] NOT NULL,
|
|
[IsApproved] [bit] NOT NULL,
|
|
[ContactId] [bigint] NOT NULL,
|
|
[PreferedLanguage] [nvarchar](255) NULL,
|
|
[EmailChannelEnabled] [bit] NOT NULL,
|
|
[HasFullScreenPreference] [bit] NOT NULL,
|
|
[TimeZone] [int] NOT NULL,
|
|
[PreferedCulture] [nvarchar](255) NULL,
|
|
[IsActive] [bit] NOT NULL,
|
|
[IsMobile] [bit] NOT NULL,
|
|
[LastLoginDate] [datetime] NULL,
|
|
[UserGuideProgress] [nvarchar](255) NULL,
|
|
[DashboardSettings] [nvarchar](4000) NULL,
|
|
CONSTRAINT [PK_mfr__user] PRIMARY KEY CLUSTERED
|
|
(
|
|
[Id] ASC
|
|
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
|
) ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[ocms_archive__items] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[ocms_archive__items](
|
|
[ocms_iid] [bigint] NOT NULL,
|
|
[parent_iid] [bigint] NULL,
|
|
[ocms_pid] [bigint] NULL,
|
|
[name] [nvarchar](255) NULL,
|
|
[view] [bit] NOT NULL,
|
|
[template_id] [bigint] NULL,
|
|
[hide] [bit] NOT NULL,
|
|
[order] [int] NOT NULL,
|
|
[DateCreated] [datetime] NULL,
|
|
[DateModified] [datetime] NULL,
|
|
[DateDeleted] [datetime] NULL,
|
|
[UserDeleted] [varchar](36) NULL
|
|
) ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[ocms_archive__properties] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[ocms_archive__properties](
|
|
[ocms_pid] [bigint] NULL,
|
|
[ocms_iid] [bigint] NULL,
|
|
[key] [varchar](50) NULL,
|
|
[value] [nvarchar](max) NULL,
|
|
[locale] [varchar](5) NULL,
|
|
[DateCreated] [datetime] NULL,
|
|
[DateModified] [datetime] NULL,
|
|
[DateDeleted] [datetime] NULL,
|
|
[UserDeleted] [varchar](36) NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[ocms_debug] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[ocms_debug](
|
|
[uid] [bigint] IDENTITY(1,1) NOT NULL,
|
|
[machine] [varchar](50) NULL,
|
|
[error] [varchar](2000) NULL,
|
|
[exception] [varchar](max) NULL,
|
|
[procedure] [varchar](255) NULL,
|
|
[authuser] [varchar](25) NULL,
|
|
[data] [nvarchar](max) NULL,
|
|
[isdebug] [bit] NULL,
|
|
[timestamp] [datetime] NOT NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[ocms_items] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[ocms_items](
|
|
[ocms_iid] [bigint] NOT NULL,
|
|
[parent_iid] [bigint] NULL,
|
|
[ocms_pid] [bigint] NULL,
|
|
[name] [nvarchar](255) NULL,
|
|
[view] [bit] NOT NULL,
|
|
[template_id] [bigint] NULL,
|
|
[hide] [bit] NOT NULL,
|
|
[order] [int] NOT NULL,
|
|
[DateCreated] [datetime] NULL,
|
|
[DateModified] [datetime] NULL,
|
|
CONSTRAINT [PK_ocms_items] PRIMARY KEY CLUSTERED
|
|
(
|
|
[ocms_iid] ASC
|
|
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
|
) ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[ocms_log__properties] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[ocms_log__properties](
|
|
[ocms_pid] [bigint] NULL,
|
|
[action] [varchar](50) NULL,
|
|
[n_ocms_iid] [bigint] NULL,
|
|
[n_key] [varchar](50) NULL,
|
|
[n_value] [nvarchar](max) NULL,
|
|
[n_locale] [varchar](5) NULL,
|
|
[n_DateCreated] [datetime] NULL,
|
|
[n_DateModified] [datetime] NULL,
|
|
[n_DateDeleted] [datetime] NULL,
|
|
[n_UserDeleted] [varchar](36) NULL,
|
|
[o_ocms_iid] [bigint] NULL,
|
|
[o_key] [varchar](50) NULL,
|
|
[o_value] [nvarchar](max) NULL,
|
|
[o_locale] [varchar](5) NULL,
|
|
[o_DateCreated] [datetime] NULL,
|
|
[o_DateModified] [datetime] NULL,
|
|
[o_DateDeleted] [datetime] NULL,
|
|
[o_UserDeleted] [varchar](36) NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[ocms_navigation] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[ocms_navigation](
|
|
[ocms_nid] [bigint] IDENTITY(1,1) NOT NULL,
|
|
[ocms_iid] [bigint] NOT NULL,
|
|
[parent_iid] [bigint] NULL,
|
|
[locale] [varchar](5) NOT NULL,
|
|
[alias] [varchar](25) NOT NULL,
|
|
CONSTRAINT [PK_ocms_navigation] PRIMARY KEY CLUSTERED
|
|
(
|
|
[ocms_nid] ASC
|
|
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
|
) ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[ocms_properties] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[ocms_properties](
|
|
[ocms_pid] [bigint] NOT NULL,
|
|
[ocms_iid] [bigint] NOT NULL,
|
|
[key] [varchar](50) NULL,
|
|
[value] [nvarchar](max) NOT NULL,
|
|
[locale] [varchar](5) NULL,
|
|
[DateCreated] [datetime] NULL,
|
|
[DateModified] [datetime] NULL,
|
|
CONSTRAINT [PK_ocms_properties] PRIMARY KEY CLUSTERED
|
|
(
|
|
[ocms_pid] ASC
|
|
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[ocms_settings] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[ocms_settings](
|
|
[ocms_set] [bigint] IDENTITY(1,1) NOT NULL,
|
|
[key] [varchar](25) NOT NULL,
|
|
[value] [varchar](2000) NULL,
|
|
CONSTRAINT [PK_ocms_settings] PRIMARY KEY CLUSTERED
|
|
(
|
|
[ocms_set] ASC
|
|
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
|
) ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[ocms_template_properties] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[ocms_template_properties](
|
|
[ocms_tpid] [bigint] NOT NULL,
|
|
[ocms_tid] [bigint] NOT NULL,
|
|
[key] [varchar](50) NOT NULL,
|
|
[mandatory] [bit] NOT NULL,
|
|
[type] [varchar](50) NOT NULL,
|
|
[default] [nvarchar](max) NULL,
|
|
[condition] [varchar](max) NULL,
|
|
[order] [int] NOT NULL,
|
|
CONSTRAINT [PK_ocms_template_properties] PRIMARY KEY CLUSTERED
|
|
(
|
|
[ocms_tpid] ASC
|
|
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[ocms_templates] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[ocms_templates](
|
|
[ocms_tid] [bigint] IDENTITY(1,1) NOT NULL,
|
|
[name] [varchar](255) NULL,
|
|
[partial_view] [varchar](255) NULL,
|
|
CONSTRAINT [PK_ocms_templates] PRIMARY KEY CLUSTERED
|
|
(
|
|
[ocms_tid] ASC
|
|
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
|
) ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[ocms_translations] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[ocms_translations](
|
|
[ocms_tln] [bigint] IDENTITY(1,1) NOT NULL,
|
|
[context_typ] [nvarchar](15) NOT NULL,
|
|
[context] [bigint] NULL,
|
|
[value] [nvarchar](255) NOT NULL,
|
|
[translation] [nvarchar](255) NOT NULL,
|
|
[locale] [varchar](5) NOT NULL,
|
|
CONSTRAINT [PK_ocms_translations] PRIMARY KEY CLUSTERED
|
|
(
|
|
[ocms_tln] ASC
|
|
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
|
) ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[ocms_useraccounts] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[ocms_useraccounts](
|
|
[useraccount_id] [varchar](5) NOT NULL,
|
|
[name_enc] [varbinary](600) NOT NULL,
|
|
[email_enc] [varbinary](350) NOT NULL,
|
|
[mobile_enc] [varbinary](120) NULL,
|
|
[password_enc] [varbinary](100) NOT NULL,
|
|
[UserDisabled] [varchar](36) NULL,
|
|
[DateDisabled] [datetime] NULL,
|
|
[UserCreated] [varchar](36) NOT NULL,
|
|
[DateCreated] [datetime] NOT NULL,
|
|
[UserModified] [varchar](36) NULL,
|
|
[DateModified] [datetime] NOT NULL,
|
|
[UserDeleted] [varchar](36) NULL,
|
|
[DateDeleted] [datetime] NULL,
|
|
CONSTRAINT [PK_ocms_useraccounts] PRIMARY KEY CLUSTERED
|
|
(
|
|
[useraccount_id] ASC
|
|
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
|
) ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_4qlwv_mfr__*PartnerSet] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_4qlwv_mfr__*PartnerSet](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Property] [nvarchar](max) NULL,
|
|
[PartnerType] [nvarchar](max) NULL,
|
|
[PartnerId] [bigint] NULL,
|
|
[EntityId] [bigint] NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_4qlwv_mfr__contacts] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_4qlwv_mfr__contacts](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[CustomValues] [nvarchar](max) NULL,
|
|
[FirstName] [nvarchar](max) NULL,
|
|
[LastName] [nvarchar](max) NULL,
|
|
[Email] [nvarchar](max) NULL,
|
|
[JobTitle] [nvarchar](max) NULL,
|
|
[MobilePhone] [nvarchar](max) NULL,
|
|
[Telephone] [nvarchar](max) NULL,
|
|
[Fax] [nvarchar](max) NULL,
|
|
[Note] [nvarchar](max) NULL,
|
|
[DateModified] [datetime] NULL,
|
|
[Version] [int] NULL,
|
|
[CompanyId] [bigint] NULL,
|
|
[IsUser] [bit] NULL,
|
|
[ExternalId] [nvarchar](max) NULL,
|
|
[Gender] [nvarchar](max) NULL,
|
|
[UserId] [bigint] NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_4qlwv_mfr__items] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_4qlwv_mfr__items](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[Version] [int] NULL,
|
|
[QuantityHours] [real] NULL,
|
|
[PlannedQuantityHours] [real] NULL,
|
|
[ItemTypeId] [bigint] NULL,
|
|
[ItemNumber] [nvarchar](max) NULL,
|
|
[TrackingId] [nvarchar](max) NULL,
|
|
[Manufacture] [nvarchar](max) NULL,
|
|
[Price] [real] NULL,
|
|
[Costs] [real] NULL,
|
|
[NameOrNumber] [nvarchar](max) NULL,
|
|
[CustomValues] [nvarchar](max) NULL,
|
|
[Note] [nvarchar](max) NULL,
|
|
[ExternalId] [nvarchar](max) NULL,
|
|
[Discount] [real] NULL,
|
|
[VAT] [real] NULL,
|
|
[IsManual] [bit] NULL,
|
|
[SortOrder] [int] NULL,
|
|
[Type] [nvarchar](max) NULL,
|
|
[ServiceRequestId] [bigint] NULL,
|
|
[ServiceObjectId] [bigint] NULL,
|
|
[CreatorId] [bigint] NULL,
|
|
[UnitId] [bigint] NULL,
|
|
[UnitString] [nvarchar](max) NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_4qlwv_mfr__itemtypes] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_4qlwv_mfr__itemtypes](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[CustomValues] [nvarchar](max) NULL,
|
|
[Version] [int] NULL,
|
|
[Costs] [real] NULL,
|
|
[Description] [nvarchar](max) NULL,
|
|
[ListPrice] [real] NULL,
|
|
[Manufacture] [nvarchar](max) NULL,
|
|
[ExternalId] [nvarchar](max) NULL,
|
|
[ItemNumber] [nvarchar](max) NULL,
|
|
[NameOrNumber] [nvarchar](max) NULL,
|
|
[GlobalTradeItemNr] [nvarchar](max) NULL,
|
|
[Type] [nvarchar](max) NULL,
|
|
[Price] [real] NULL,
|
|
[VAT] [real] NULL,
|
|
[IsPortalOnly] [bit] NULL,
|
|
[Discount] [real] NULL,
|
|
[DateModified] [datetime] NULL,
|
|
[IsDiscontinued] [bit] NULL,
|
|
[IsWarehouse] [bit] NULL,
|
|
[UnitId] [bigint] NULL,
|
|
[UnitString] [nvarchar](max) NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_4qlwv_mfr__serviceobjects] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_4qlwv_mfr__serviceobjects](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[Location#ID] [bigint] NULL,
|
|
[Name] [nvarchar](max) NULL,
|
|
[Note] [nvarchar](max) NULL,
|
|
[CustomValues] [nvarchar](max) NULL,
|
|
[DateModified] [datetime] NULL,
|
|
[ExternalId] [nvarchar](max) NULL,
|
|
[MappingId] [nvarchar](max) NULL,
|
|
[QuickSearch] [nvarchar](max) NULL,
|
|
[Version] [int] NULL,
|
|
[CreateGeoLocation] [bit] NULL,
|
|
[IsWarehouse] [bit] NULL,
|
|
[ParentServiceObjectId] [bigint] NULL,
|
|
[CompanyId] [bigint] NULL,
|
|
[ProductId] [bigint] NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_4qlwv_mfr__stockmovements] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_4qlwv_mfr__stockmovements](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[Version] [int] NULL,
|
|
[Amount] [real] NULL,
|
|
[AmountReceived] [real] NULL,
|
|
[ExternalId] [nvarchar](max) NULL,
|
|
[ItemId] [bigint] NULL,
|
|
[ItemTypeId] [bigint] NULL,
|
|
[StockMovementType] [nvarchar](max) NULL,
|
|
[State] [nvarchar](max) NULL,
|
|
[ServiceRequestId] [bigint] NULL,
|
|
[WarehouseId] [bigint] NULL,
|
|
[DateOfCreation] [datetime] NULL,
|
|
[DateModified] [datetime] NULL,
|
|
[TargetDate] [datetime] NULL,
|
|
[CreatedById] [bigint] NULL,
|
|
[ConfirmedById] [bigint] NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_6bgjg_mfr__documents] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_6bgjg_mfr__documents](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[CustomValues] [nvarchar](max) NULL,
|
|
[Version] [int] NULL,
|
|
[State] [nvarchar](max) NULL,
|
|
[ExternalId] [nvarchar](max) NULL,
|
|
[URI] [nvarchar](max) NULL,
|
|
[IsGlobal] [bit] NULL,
|
|
[StartDateTime] [datetime] NULL,
|
|
[EndDateTime] [datetime] NULL,
|
|
[FileName] [nvarchar](max) NULL,
|
|
[DateModified] [datetime] NULL,
|
|
[UploadDate] [datetime] NULL,
|
|
[IsLink] [bit] NULL,
|
|
[ContentType] [nvarchar](max) NULL,
|
|
[HTMLCode] [nvarchar](max) NULL,
|
|
[ServiceRequestId] [bigint] NULL,
|
|
[Note] [nvarchar](max) NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_atob6_mfr__qualifications] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_atob6_mfr__qualifications](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[Version] [int] NULL,
|
|
[Name] [nvarchar](max) NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_cafep_mfr__*PartnerSet] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_cafep_mfr__*PartnerSet](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Property] [nvarchar](max) NULL,
|
|
[PartnerType] [nvarchar](max) NULL,
|
|
[PartnerId] [bigint] NULL,
|
|
[EntityId] [bigint] NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_cafep_mfr__steplisttemplates] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_cafep_mfr__steplisttemplates](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[Version] [int] NULL,
|
|
[Name] [nvarchar](max) NULL,
|
|
[MappingId] [nvarchar](max) NULL,
|
|
[DateModified] [datetime] NULL,
|
|
[IsReleased] [bit] NULL,
|
|
[IsDurable] [bit] NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_cafep_mfr__steps] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_cafep_mfr__steps](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[MobileId] [bigint] NULL,
|
|
[Version] [int] NULL,
|
|
[Name] [nvarchar](max) NULL,
|
|
[IsDone] [bit] NULL,
|
|
[HasError] [bit] NULL,
|
|
[TrackingId] [nvarchar](max) NULL,
|
|
[Type] [nvarchar](max) NULL,
|
|
[SortOrder] [int] NULL,
|
|
[Data] [nvarchar](max) NULL,
|
|
[DateModifiedOffline] [datetime] NULL,
|
|
[ServiceRequestId] [bigint] NULL,
|
|
[Description] [nvarchar](max) NULL,
|
|
[Comment] [nvarchar](max) NULL,
|
|
[InternalComment] [nvarchar](max) NULL,
|
|
[ServiceObjectId] [bigint] NULL,
|
|
[StepListTemplateId] [bigint] NULL,
|
|
[ParentId] [bigint] NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_eawvf_mfr__*PartnerSet] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_eawvf_mfr__*PartnerSet](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Property] [nvarchar](max) NULL,
|
|
[PartnerType] [nvarchar](max) NULL,
|
|
[PartnerId] [bigint] NULL,
|
|
[EntityId] [bigint] NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_eawvf_mfr__products] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_eawvf_mfr__products](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[Version] [int] NULL,
|
|
[Name] [nvarchar](max) NULL,
|
|
[SubKey] [nvarchar](max) NULL,
|
|
[Description] [nvarchar](max) NULL,
|
|
[DateModified] [datetime] NULL,
|
|
[MappingId] [nvarchar](max) NULL,
|
|
[CustomValueStepTemplateId] [bigint] NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_eawvf_mfr__steplisttemplates] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_eawvf_mfr__steplisttemplates](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[Version] [int] NULL,
|
|
[Name] [nvarchar](max) NULL,
|
|
[MappingId] [nvarchar](max) NULL,
|
|
[DateModified] [datetime] NULL,
|
|
[IsReleased] [bit] NULL,
|
|
[IsDurable] [bit] NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_fx7at_mfr__*PartnerSet] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_fx7at_mfr__*PartnerSet](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Property] [nvarchar](max) NULL,
|
|
[PartnerType] [nvarchar](max) NULL,
|
|
[PartnerId] [bigint] NULL,
|
|
[EntityId] [bigint] NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_fx7at_mfr__itemtypes] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_fx7at_mfr__itemtypes](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[CustomValues] [nvarchar](max) NULL,
|
|
[Version] [int] NULL,
|
|
[Costs] [real] NULL,
|
|
[Description] [nvarchar](max) NULL,
|
|
[ListPrice] [real] NULL,
|
|
[Manufacture] [nvarchar](max) NULL,
|
|
[ExternalId] [nvarchar](max) NULL,
|
|
[ItemNumber] [nvarchar](max) NULL,
|
|
[NameOrNumber] [nvarchar](max) NULL,
|
|
[GlobalTradeItemNr] [nvarchar](max) NULL,
|
|
[Type] [nvarchar](max) NULL,
|
|
[Price] [real] NULL,
|
|
[VAT] [real] NULL,
|
|
[IsPortalOnly] [bit] NULL,
|
|
[Discount] [real] NULL,
|
|
[DateModified] [datetime] NULL,
|
|
[IsDiscontinued] [bit] NULL,
|
|
[IsWarehouse] [bit] NULL,
|
|
[UnitId] [bigint] NULL,
|
|
[UnitString] [nvarchar](max) NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_fx7at_mfr__itemunits] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_fx7at_mfr__itemunits](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[Version] [int] NULL,
|
|
[Name] [nvarchar](max) NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_j63rc_mfr__*PartnerSet] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_j63rc_mfr__*PartnerSet](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Property] [nvarchar](max) NULL,
|
|
[PartnerType] [nvarchar](max) NULL,
|
|
[PartnerId] [bigint] NULL,
|
|
[EntityId] [bigint] NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_j63rc_mfr__contacts] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_j63rc_mfr__contacts](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[CustomValues] [nvarchar](max) NULL,
|
|
[FirstName] [nvarchar](max) NULL,
|
|
[LastName] [nvarchar](max) NULL,
|
|
[Email] [nvarchar](max) NULL,
|
|
[JobTitle] [nvarchar](max) NULL,
|
|
[MobilePhone] [nvarchar](max) NULL,
|
|
[Telephone] [nvarchar](max) NULL,
|
|
[Fax] [nvarchar](max) NULL,
|
|
[Note] [nvarchar](max) NULL,
|
|
[DateModified] [datetime] NULL,
|
|
[Version] [int] NULL,
|
|
[CompanyId] [bigint] NULL,
|
|
[IsUser] [bit] NULL,
|
|
[ExternalId] [nvarchar](max) NULL,
|
|
[Gender] [nvarchar](max) NULL,
|
|
[UserId] [bigint] NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_j63rc_mfr__items] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_j63rc_mfr__items](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[Version] [int] NULL,
|
|
[QuantityHours] [real] NULL,
|
|
[PlannedQuantityHours] [real] NULL,
|
|
[ItemTypeId] [bigint] NULL,
|
|
[ItemNumber] [nvarchar](max) NULL,
|
|
[TrackingId] [nvarchar](max) NULL,
|
|
[Manufacture] [nvarchar](max) NULL,
|
|
[Price] [real] NULL,
|
|
[Costs] [real] NULL,
|
|
[NameOrNumber] [nvarchar](max) NULL,
|
|
[CustomValues] [nvarchar](max) NULL,
|
|
[Note] [nvarchar](max) NULL,
|
|
[ExternalId] [nvarchar](max) NULL,
|
|
[Discount] [real] NULL,
|
|
[VAT] [real] NULL,
|
|
[IsManual] [bit] NULL,
|
|
[SortOrder] [int] NULL,
|
|
[Type] [nvarchar](max) NULL,
|
|
[ServiceRequestId] [bigint] NULL,
|
|
[ServiceObjectId] [bigint] NULL,
|
|
[CreatorId] [bigint] NULL,
|
|
[UnitId] [bigint] NULL,
|
|
[UnitString] [nvarchar](max) NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_j63rc_mfr__itemtypes] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_j63rc_mfr__itemtypes](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[CustomValues] [nvarchar](max) NULL,
|
|
[Version] [int] NULL,
|
|
[Costs] [real] NULL,
|
|
[Description] [nvarchar](max) NULL,
|
|
[ListPrice] [real] NULL,
|
|
[Manufacture] [nvarchar](max) NULL,
|
|
[ExternalId] [nvarchar](max) NULL,
|
|
[ItemNumber] [nvarchar](max) NULL,
|
|
[NameOrNumber] [nvarchar](max) NULL,
|
|
[GlobalTradeItemNr] [nvarchar](max) NULL,
|
|
[Type] [nvarchar](max) NULL,
|
|
[Price] [real] NULL,
|
|
[VAT] [real] NULL,
|
|
[IsPortalOnly] [bit] NULL,
|
|
[Discount] [real] NULL,
|
|
[DateModified] [datetime] NULL,
|
|
[IsDiscontinued] [bit] NULL,
|
|
[IsWarehouse] [bit] NULL,
|
|
[UnitId] [bigint] NULL,
|
|
[UnitString] [nvarchar](max) NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_j63rc_mfr__serviceobjects] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_j63rc_mfr__serviceobjects](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[Location#ID] [bigint] NULL,
|
|
[Name] [nvarchar](max) NULL,
|
|
[Note] [nvarchar](max) NULL,
|
|
[CustomValues] [nvarchar](max) NULL,
|
|
[DateModified] [datetime] NULL,
|
|
[ExternalId] [nvarchar](max) NULL,
|
|
[MappingId] [nvarchar](max) NULL,
|
|
[QuickSearch] [nvarchar](max) NULL,
|
|
[Version] [int] NULL,
|
|
[CreateGeoLocation] [bit] NULL,
|
|
[IsWarehouse] [bit] NULL,
|
|
[ParentServiceObjectId] [bigint] NULL,
|
|
[CompanyId] [bigint] NULL,
|
|
[ProductId] [bigint] NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_j63rc_mfr__stockmovements] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_j63rc_mfr__stockmovements](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[Version] [int] NULL,
|
|
[Amount] [real] NULL,
|
|
[AmountReceived] [real] NULL,
|
|
[ExternalId] [nvarchar](max) NULL,
|
|
[ItemId] [bigint] NULL,
|
|
[ItemTypeId] [bigint] NULL,
|
|
[StockMovementType] [nvarchar](max) NULL,
|
|
[State] [nvarchar](max) NULL,
|
|
[ServiceRequestId] [bigint] NULL,
|
|
[WarehouseId] [bigint] NULL,
|
|
[DateOfCreation] [datetime] NULL,
|
|
[DateModified] [datetime] NULL,
|
|
[TargetDate] [datetime] NULL,
|
|
[CreatedById] [bigint] NULL,
|
|
[ConfirmedById] [bigint] NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_jbnkp_mfr__*PartnerSet] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_jbnkp_mfr__*PartnerSet](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Property] [nvarchar](max) NULL,
|
|
[PartnerType] [nvarchar](max) NULL,
|
|
[PartnerId] [bigint] NULL,
|
|
[EntityId] [bigint] NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_jbnkp_mfr__contacts] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_jbnkp_mfr__contacts](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[CustomValues] [nvarchar](max) NULL,
|
|
[FirstName] [nvarchar](max) NULL,
|
|
[LastName] [nvarchar](max) NULL,
|
|
[Email] [nvarchar](max) NULL,
|
|
[JobTitle] [nvarchar](max) NULL,
|
|
[MobilePhone] [nvarchar](max) NULL,
|
|
[Telephone] [nvarchar](max) NULL,
|
|
[Fax] [nvarchar](max) NULL,
|
|
[Note] [nvarchar](max) NULL,
|
|
[DateModified] [datetime] NULL,
|
|
[Version] [int] NULL,
|
|
[CompanyId] [bigint] NULL,
|
|
[IsUser] [bit] NULL,
|
|
[ExternalId] [nvarchar](max) NULL,
|
|
[Gender] [nvarchar](max) NULL,
|
|
[UserId] [bigint] NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_jbnkp_mfr__timeevents] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_jbnkp_mfr__timeevents](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[Version] [int] NULL,
|
|
[State] [nvarchar](max) NULL,
|
|
[IsApproved] [bit] NULL,
|
|
[TimeEventType] [nvarchar](max) NULL,
|
|
[ExternalId] [nvarchar](max) NULL,
|
|
[DateModified] [datetime] NULL,
|
|
[StartDateTime] [datetime] NULL,
|
|
[EndDateTime] [datetime] NULL,
|
|
[ProposedDrivingDistance] [int] NULL,
|
|
[ContactId] [bigint] NULL,
|
|
[ServiceRequestId] [bigint] NULL,
|
|
[Description] [nvarchar](max) NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_k7zuw_mfr__documents] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_k7zuw_mfr__documents](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[CustomValues] [nvarchar](max) NULL,
|
|
[Version] [int] NULL,
|
|
[State] [nvarchar](max) NULL,
|
|
[ExternalId] [nvarchar](max) NULL,
|
|
[URI] [nvarchar](max) NULL,
|
|
[IsGlobal] [bit] NULL,
|
|
[StartDateTime] [datetime] NULL,
|
|
[EndDateTime] [datetime] NULL,
|
|
[FileName] [nvarchar](max) NULL,
|
|
[DateModified] [datetime] NULL,
|
|
[UploadDate] [datetime] NULL,
|
|
[IsLink] [bit] NULL,
|
|
[ContentType] [nvarchar](max) NULL,
|
|
[HTMLCode] [nvarchar](max) NULL,
|
|
[ServiceRequestId] [bigint] NULL,
|
|
[Note] [nvarchar](max) NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_kubwm_mfr__#locations] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_kubwm_mfr__#locations](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[EntityId] [bigint] NULL,
|
|
[Property] [nvarchar](max) NULL,
|
|
[Version] [int] NULL,
|
|
[AddressString] [nvarchar](max) NULL,
|
|
[Postal] [nvarchar](max) NULL,
|
|
[City] [nvarchar](max) NULL,
|
|
[State] [nvarchar](max) NULL,
|
|
[Country] [nvarchar](max) NULL,
|
|
[Longitude] [real] NULL,
|
|
[Latitude] [real] NULL,
|
|
[IsValidLocation] [bit] NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_kubwm_mfr__*PartnerSet] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_kubwm_mfr__*PartnerSet](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Property] [nvarchar](max) NULL,
|
|
[PartnerType] [nvarchar](max) NULL,
|
|
[PartnerId] [bigint] NULL,
|
|
[EntityId] [bigint] NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_kubwm_mfr__appointments] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_kubwm_mfr__appointments](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[Version] [int] NULL,
|
|
[State] [nvarchar](max) NULL,
|
|
[Type] [nvarchar](max) NULL,
|
|
[EndDateTime] [datetime] NULL,
|
|
[StartDateTime] [datetime] NULL,
|
|
[DrivingDistanceFrom] [int] NULL,
|
|
[DrivingDistanceTo] [int] NULL,
|
|
[WasReadOnClientSide] [bit] NULL,
|
|
[ContactIds] [nvarchar](max) NULL,
|
|
[ServiceRequestId] [bigint] NULL,
|
|
[ContactId] [bigint] NULL,
|
|
[Note] [nvarchar](max) NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_kubwm_mfr__comments] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_kubwm_mfr__comments](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[Version] [int] NULL,
|
|
[DateOfCreation] [datetime] NULL,
|
|
[IsInternal] [bit] NULL,
|
|
[ServiceRequestId] [bigint] NULL,
|
|
[CompanyId] [bigint] NULL,
|
|
[Content] [nvarchar](max) NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_kubwm_mfr__companies] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_kubwm_mfr__companies](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[Location#ID] [bigint] NULL,
|
|
[Version] [int] NULL,
|
|
[IsPhysicalPerson] [bit] NULL,
|
|
[IsOwner] [bit] NULL,
|
|
[IsEmailInvoicingActive] [bit] NULL,
|
|
[IsSupplier] [bit] NULL,
|
|
[MappingId] [nvarchar](max) NULL,
|
|
[ExternalId] [nvarchar](max) NULL,
|
|
[Name] [nvarchar](max) NULL,
|
|
[Note] [nvarchar](max) NULL,
|
|
[SupportTelephone] [nvarchar](max) NULL,
|
|
[SupportFax] [nvarchar](max) NULL,
|
|
[SupportMail] [nvarchar](max) NULL,
|
|
[QuickSearch] [nvarchar](max) NULL,
|
|
[DateModified] [datetime] NULL,
|
|
[CustomValues] [nvarchar](max) NULL,
|
|
[MainContactId] [bigint] NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_kubwm_mfr__contacts] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_kubwm_mfr__contacts](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[CustomValues] [nvarchar](max) NULL,
|
|
[FirstName] [nvarchar](max) NULL,
|
|
[LastName] [nvarchar](max) NULL,
|
|
[Email] [nvarchar](max) NULL,
|
|
[JobTitle] [nvarchar](max) NULL,
|
|
[MobilePhone] [nvarchar](max) NULL,
|
|
[Telephone] [nvarchar](max) NULL,
|
|
[Fax] [nvarchar](max) NULL,
|
|
[Note] [nvarchar](max) NULL,
|
|
[DateModified] [datetime] NULL,
|
|
[Version] [int] NULL,
|
|
[CompanyId] [bigint] NULL,
|
|
[IsUser] [bit] NULL,
|
|
[ExternalId] [nvarchar](max) NULL,
|
|
[Gender] [nvarchar](max) NULL,
|
|
[UserId] [bigint] NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_kubwm_mfr__costcenters] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_kubwm_mfr__costcenters](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[Version] [int] NULL,
|
|
[Name] [nvarchar](max) NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_kubwm_mfr__items] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_kubwm_mfr__items](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[Version] [int] NULL,
|
|
[QuantityHours] [real] NULL,
|
|
[PlannedQuantityHours] [real] NULL,
|
|
[ItemTypeId] [bigint] NULL,
|
|
[ItemNumber] [nvarchar](max) NULL,
|
|
[TrackingId] [nvarchar](max) NULL,
|
|
[Manufacture] [nvarchar](max) NULL,
|
|
[Price] [real] NULL,
|
|
[Costs] [real] NULL,
|
|
[NameOrNumber] [nvarchar](max) NULL,
|
|
[CustomValues] [nvarchar](max) NULL,
|
|
[Note] [nvarchar](max) NULL,
|
|
[ExternalId] [nvarchar](max) NULL,
|
|
[Discount] [real] NULL,
|
|
[VAT] [real] NULL,
|
|
[IsManual] [bit] NULL,
|
|
[SortOrder] [int] NULL,
|
|
[Type] [nvarchar](max) NULL,
|
|
[ServiceRequestId] [bigint] NULL,
|
|
[ServiceObjectId] [bigint] NULL,
|
|
[CreatorId] [bigint] NULL,
|
|
[UnitId] [bigint] NULL,
|
|
[UnitString] [nvarchar](max) NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_kubwm_mfr__reports] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_kubwm_mfr__reports](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[Version] [int] NULL,
|
|
[DateOfCreation] [datetime] NULL,
|
|
[URI] [nvarchar](max) NULL,
|
|
[DocumentName] [nvarchar](max) NULL,
|
|
[FileTypeString] [nvarchar](max) NULL,
|
|
[ReportDefinitionCode] [nvarchar](max) NULL,
|
|
[ServiceObjectId] [bigint] NULL,
|
|
[CanBeDeleted] [bit] NULL,
|
|
[InvoiceBalance] [real] NULL,
|
|
[InvoiceId] [nvarchar](max) NULL,
|
|
[DueDate] [datetime] NULL,
|
|
[IsPayed] [bit] NULL,
|
|
[IsInvoice] [bit] NULL,
|
|
[IsCanceled] [bit] NULL,
|
|
[CustomValues] [nvarchar](max) NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_kubwm_mfr__serviceobjects] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_kubwm_mfr__serviceobjects](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[Location#ID] [bigint] NULL,
|
|
[Name] [nvarchar](max) NULL,
|
|
[Note] [nvarchar](max) NULL,
|
|
[CustomValues] [nvarchar](max) NULL,
|
|
[DateModified] [datetime] NULL,
|
|
[ExternalId] [nvarchar](max) NULL,
|
|
[MappingId] [nvarchar](max) NULL,
|
|
[QuickSearch] [nvarchar](max) NULL,
|
|
[Version] [int] NULL,
|
|
[CreateGeoLocation] [bit] NULL,
|
|
[IsWarehouse] [bit] NULL,
|
|
[ParentServiceObjectId] [bigint] NULL,
|
|
[CompanyId] [bigint] NULL,
|
|
[ProductId] [bigint] NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_kubwm_mfr__servicerequests] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_kubwm_mfr__servicerequests](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[Name] [nvarchar](max) NULL,
|
|
[ExternalId] [nvarchar](max) NULL,
|
|
[InvoiceId] [nvarchar](max) NULL,
|
|
[ClosedAt] [datetime] NULL,
|
|
[ReleasedAt] [datetime] NULL,
|
|
[WorkDoneAt] [datetime] NULL,
|
|
[TargetTimeInMinutes] [bigint] NULL,
|
|
[DateModified] [datetime] NULL,
|
|
[DateOfCreation] [datetime] NULL,
|
|
[DueDateRangeStart] [datetime] NULL,
|
|
[DueDateRangeEnd] [datetime] NULL,
|
|
[PortalLink] [nvarchar](max) NULL,
|
|
[CostCenterId] [bigint] NULL,
|
|
[Description] [nvarchar](max) NULL,
|
|
[State] [nvarchar](max) NULL,
|
|
[CustomValues] [nvarchar](max) NULL,
|
|
[CurrentOwnerId] [bigint] NULL,
|
|
[CustomerId] [bigint] NULL,
|
|
[ParentServiceRequestId] [bigint] NULL,
|
|
[Location#ID] [bigint] NULL,
|
|
[Version] [int] NULL,
|
|
[IsTemplate] [bit] NULL,
|
|
[IsTemplateMobile] [bit] NULL,
|
|
[CreateFromServiceRequestTemplateId] [bigint] NULL,
|
|
[Type] [nvarchar](max) NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_kubwm_mfr__steps] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_kubwm_mfr__steps](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[MobileId] [bigint] NULL,
|
|
[Version] [int] NULL,
|
|
[Name] [nvarchar](max) NULL,
|
|
[IsDone] [bit] NULL,
|
|
[HasError] [bit] NULL,
|
|
[TrackingId] [nvarchar](max) NULL,
|
|
[Type] [nvarchar](max) NULL,
|
|
[SortOrder] [int] NULL,
|
|
[Data] [nvarchar](max) NULL,
|
|
[DateModifiedOffline] [datetime] NULL,
|
|
[ServiceRequestId] [bigint] NULL,
|
|
[Description] [nvarchar](max) NULL,
|
|
[Comment] [nvarchar](max) NULL,
|
|
[InternalComment] [nvarchar](max) NULL,
|
|
[ServiceObjectId] [bigint] NULL,
|
|
[StepListTemplateId] [bigint] NULL,
|
|
[ParentId] [bigint] NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_kubwm_mfr__tags] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_kubwm_mfr__tags](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[Version] [int] NULL,
|
|
[Name] [nvarchar](max) NULL,
|
|
[ColorDefinition] [nvarchar](max) NULL,
|
|
[Type] [nvarchar](max) NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_kubwm_mfr__timeevents] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_kubwm_mfr__timeevents](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[Version] [int] NULL,
|
|
[State] [nvarchar](max) NULL,
|
|
[IsApproved] [bit] NULL,
|
|
[TimeEventType] [nvarchar](max) NULL,
|
|
[ExternalId] [nvarchar](max) NULL,
|
|
[DateModified] [datetime] NULL,
|
|
[StartDateTime] [datetime] NULL,
|
|
[EndDateTime] [datetime] NULL,
|
|
[ProposedDrivingDistance] [int] NULL,
|
|
[ContactId] [bigint] NULL,
|
|
[ServiceRequestId] [bigint] NULL,
|
|
[Description] [nvarchar](max) NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_kubwm_mfr__users] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_kubwm_mfr__users](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[Version] [int] NULL,
|
|
[UserName] [nvarchar](max) NULL,
|
|
[IsSystem] [bit] NULL,
|
|
[CreationDate] [datetime] NULL,
|
|
[IsApproved] [bit] NULL,
|
|
[ContactId] [bigint] NULL,
|
|
[PreferedLanguage] [nvarchar](max) NULL,
|
|
[EmailChannelEnabled] [bit] NULL,
|
|
[HasFullScreenPreference] [bit] NULL,
|
|
[TimeZone] [int] NULL,
|
|
[PreferedCulture] [nvarchar](max) NULL,
|
|
[IsActive] [bit] NULL,
|
|
[IsMobile] [bit] NULL,
|
|
[LastLoginDate] [datetime] NULL,
|
|
[UserGuideProgress] [nvarchar](max) NULL,
|
|
[DashboardSettings] [nvarchar](max) NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_n8jjo_mfr__#locations] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_n8jjo_mfr__#locations](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[EntityId] [bigint] NULL,
|
|
[Property] [nvarchar](max) NULL,
|
|
[Version] [int] NULL,
|
|
[AddressString] [nvarchar](max) NULL,
|
|
[Postal] [nvarchar](max) NULL,
|
|
[City] [nvarchar](max) NULL,
|
|
[State] [nvarchar](max) NULL,
|
|
[Country] [nvarchar](max) NULL,
|
|
[Longitude] [real] NULL,
|
|
[Latitude] [real] NULL,
|
|
[IsValidLocation] [bit] NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_n8jjo_mfr__*PartnerSet] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_n8jjo_mfr__*PartnerSet](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Property] [nvarchar](max) NULL,
|
|
[PartnerType] [nvarchar](max) NULL,
|
|
[PartnerId] [bigint] NULL,
|
|
[EntityId] [bigint] NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_n8jjo_mfr__appointments] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_n8jjo_mfr__appointments](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[Version] [int] NULL,
|
|
[State] [nvarchar](max) NULL,
|
|
[Type] [nvarchar](max) NULL,
|
|
[EndDateTime] [datetime] NULL,
|
|
[StartDateTime] [datetime] NULL,
|
|
[DrivingDistanceFrom] [int] NULL,
|
|
[DrivingDistanceTo] [int] NULL,
|
|
[WasReadOnClientSide] [bit] NULL,
|
|
[ContactIds] [nvarchar](max) NULL,
|
|
[ServiceRequestId] [bigint] NULL,
|
|
[ContactId] [bigint] NULL,
|
|
[Note] [nvarchar](max) NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_n8jjo_mfr__comments] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_n8jjo_mfr__comments](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[Version] [int] NULL,
|
|
[DateOfCreation] [datetime] NULL,
|
|
[IsInternal] [bit] NULL,
|
|
[ServiceRequestId] [bigint] NULL,
|
|
[CompanyId] [bigint] NULL,
|
|
[Content] [nvarchar](max) NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_n8jjo_mfr__companies] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_n8jjo_mfr__companies](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[Location#ID] [bigint] NULL,
|
|
[Version] [int] NULL,
|
|
[IsPhysicalPerson] [bit] NULL,
|
|
[IsOwner] [bit] NULL,
|
|
[IsEmailInvoicingActive] [bit] NULL,
|
|
[IsSupplier] [bit] NULL,
|
|
[MappingId] [nvarchar](max) NULL,
|
|
[ExternalId] [nvarchar](max) NULL,
|
|
[Name] [nvarchar](max) NULL,
|
|
[Note] [nvarchar](max) NULL,
|
|
[SupportTelephone] [nvarchar](max) NULL,
|
|
[SupportFax] [nvarchar](max) NULL,
|
|
[SupportMail] [nvarchar](max) NULL,
|
|
[QuickSearch] [nvarchar](max) NULL,
|
|
[DateModified] [datetime] NULL,
|
|
[CustomValues] [nvarchar](max) NULL,
|
|
[MainContactId] [bigint] NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_n8jjo_mfr__contacts] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_n8jjo_mfr__contacts](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[CustomValues] [nvarchar](max) NULL,
|
|
[FirstName] [nvarchar](max) NULL,
|
|
[LastName] [nvarchar](max) NULL,
|
|
[Email] [nvarchar](max) NULL,
|
|
[JobTitle] [nvarchar](max) NULL,
|
|
[MobilePhone] [nvarchar](max) NULL,
|
|
[Telephone] [nvarchar](max) NULL,
|
|
[Fax] [nvarchar](max) NULL,
|
|
[Note] [nvarchar](max) NULL,
|
|
[DateModified] [datetime] NULL,
|
|
[Version] [int] NULL,
|
|
[CompanyId] [bigint] NULL,
|
|
[IsUser] [bit] NULL,
|
|
[ExternalId] [nvarchar](max) NULL,
|
|
[Gender] [nvarchar](max) NULL,
|
|
[UserId] [bigint] NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_n8jjo_mfr__costcenters] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_n8jjo_mfr__costcenters](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[Version] [int] NULL,
|
|
[Name] [nvarchar](max) NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_n8jjo_mfr__items] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_n8jjo_mfr__items](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[Version] [int] NULL,
|
|
[QuantityHours] [real] NULL,
|
|
[PlannedQuantityHours] [real] NULL,
|
|
[ItemTypeId] [bigint] NULL,
|
|
[ItemNumber] [nvarchar](max) NULL,
|
|
[TrackingId] [nvarchar](max) NULL,
|
|
[Manufacture] [nvarchar](max) NULL,
|
|
[Price] [real] NULL,
|
|
[Costs] [real] NULL,
|
|
[NameOrNumber] [nvarchar](max) NULL,
|
|
[CustomValues] [nvarchar](max) NULL,
|
|
[Note] [nvarchar](max) NULL,
|
|
[ExternalId] [nvarchar](max) NULL,
|
|
[Discount] [real] NULL,
|
|
[VAT] [real] NULL,
|
|
[IsManual] [bit] NULL,
|
|
[SortOrder] [int] NULL,
|
|
[Type] [nvarchar](max) NULL,
|
|
[ServiceRequestId] [bigint] NULL,
|
|
[ServiceObjectId] [bigint] NULL,
|
|
[CreatorId] [bigint] NULL,
|
|
[UnitId] [bigint] NULL,
|
|
[UnitString] [nvarchar](max) NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_n8jjo_mfr__reports] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_n8jjo_mfr__reports](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[Version] [int] NULL,
|
|
[DateOfCreation] [datetime] NULL,
|
|
[URI] [nvarchar](max) NULL,
|
|
[DocumentName] [nvarchar](max) NULL,
|
|
[FileTypeString] [nvarchar](max) NULL,
|
|
[ReportDefinitionCode] [nvarchar](max) NULL,
|
|
[ServiceObjectId] [bigint] NULL,
|
|
[CanBeDeleted] [bit] NULL,
|
|
[InvoiceBalance] [real] NULL,
|
|
[InvoiceId] [nvarchar](max) NULL,
|
|
[DueDate] [datetime] NULL,
|
|
[IsPayed] [bit] NULL,
|
|
[IsInvoice] [bit] NULL,
|
|
[IsCanceled] [bit] NULL,
|
|
[CustomValues] [nvarchar](max) NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_n8jjo_mfr__serviceobjects] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_n8jjo_mfr__serviceobjects](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[Location#ID] [bigint] NULL,
|
|
[Name] [nvarchar](max) NULL,
|
|
[Note] [nvarchar](max) NULL,
|
|
[CustomValues] [nvarchar](max) NULL,
|
|
[DateModified] [datetime] NULL,
|
|
[ExternalId] [nvarchar](max) NULL,
|
|
[MappingId] [nvarchar](max) NULL,
|
|
[QuickSearch] [nvarchar](max) NULL,
|
|
[Version] [int] NULL,
|
|
[CreateGeoLocation] [bit] NULL,
|
|
[IsWarehouse] [bit] NULL,
|
|
[ParentServiceObjectId] [bigint] NULL,
|
|
[CompanyId] [bigint] NULL,
|
|
[ProductId] [bigint] NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_n8jjo_mfr__servicerequests] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_n8jjo_mfr__servicerequests](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[Name] [nvarchar](max) NULL,
|
|
[ExternalId] [nvarchar](max) NULL,
|
|
[InvoiceId] [nvarchar](max) NULL,
|
|
[ClosedAt] [datetime] NULL,
|
|
[ReleasedAt] [datetime] NULL,
|
|
[WorkDoneAt] [datetime] NULL,
|
|
[TargetTimeInMinutes] [bigint] NULL,
|
|
[DateModified] [datetime] NULL,
|
|
[DateOfCreation] [datetime] NULL,
|
|
[DueDateRangeStart] [datetime] NULL,
|
|
[DueDateRangeEnd] [datetime] NULL,
|
|
[PortalLink] [nvarchar](max) NULL,
|
|
[CostCenterId] [bigint] NULL,
|
|
[Description] [nvarchar](max) NULL,
|
|
[State] [nvarchar](max) NULL,
|
|
[CustomValues] [nvarchar](max) NULL,
|
|
[CurrentOwnerId] [bigint] NULL,
|
|
[CustomerId] [bigint] NULL,
|
|
[ParentServiceRequestId] [bigint] NULL,
|
|
[Location#ID] [bigint] NULL,
|
|
[Version] [int] NULL,
|
|
[IsTemplate] [bit] NULL,
|
|
[IsTemplateMobile] [bit] NULL,
|
|
[CreateFromServiceRequestTemplateId] [bigint] NULL,
|
|
[Type] [nvarchar](max) NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_n8jjo_mfr__steps] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_n8jjo_mfr__steps](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[MobileId] [bigint] NULL,
|
|
[Version] [int] NULL,
|
|
[Name] [nvarchar](max) NULL,
|
|
[IsDone] [bit] NULL,
|
|
[HasError] [bit] NULL,
|
|
[TrackingId] [nvarchar](max) NULL,
|
|
[Type] [nvarchar](max) NULL,
|
|
[SortOrder] [int] NULL,
|
|
[Data] [nvarchar](max) NULL,
|
|
[DateModifiedOffline] [datetime] NULL,
|
|
[ServiceRequestId] [bigint] NULL,
|
|
[Description] [nvarchar](max) NULL,
|
|
[Comment] [nvarchar](max) NULL,
|
|
[InternalComment] [nvarchar](max) NULL,
|
|
[ServiceObjectId] [bigint] NULL,
|
|
[StepListTemplateId] [bigint] NULL,
|
|
[ParentId] [bigint] NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_n8jjo_mfr__tags] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_n8jjo_mfr__tags](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[Version] [int] NULL,
|
|
[Name] [nvarchar](max) NULL,
|
|
[ColorDefinition] [nvarchar](max) NULL,
|
|
[Type] [nvarchar](max) NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_n8jjo_mfr__timeevents] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_n8jjo_mfr__timeevents](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[Version] [int] NULL,
|
|
[State] [nvarchar](max) NULL,
|
|
[IsApproved] [bit] NULL,
|
|
[TimeEventType] [nvarchar](max) NULL,
|
|
[ExternalId] [nvarchar](max) NULL,
|
|
[DateModified] [datetime] NULL,
|
|
[StartDateTime] [datetime] NULL,
|
|
[EndDateTime] [datetime] NULL,
|
|
[ProposedDrivingDistance] [int] NULL,
|
|
[ContactId] [bigint] NULL,
|
|
[ServiceRequestId] [bigint] NULL,
|
|
[Description] [nvarchar](max) NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_n8jjo_mfr__users] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_n8jjo_mfr__users](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[Version] [int] NULL,
|
|
[UserName] [nvarchar](max) NULL,
|
|
[IsSystem] [bit] NULL,
|
|
[CreationDate] [datetime] NULL,
|
|
[IsApproved] [bit] NULL,
|
|
[ContactId] [bigint] NULL,
|
|
[PreferedLanguage] [nvarchar](max) NULL,
|
|
[EmailChannelEnabled] [bit] NULL,
|
|
[HasFullScreenPreference] [bit] NULL,
|
|
[TimeZone] [int] NULL,
|
|
[PreferedCulture] [nvarchar](max) NULL,
|
|
[IsActive] [bit] NULL,
|
|
[IsMobile] [bit] NULL,
|
|
[LastLoginDate] [datetime] NULL,
|
|
[UserGuideProgress] [nvarchar](max) NULL,
|
|
[DashboardSettings] [nvarchar](max) NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_ol3sp_mfr__*PartnerSet] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_ol3sp_mfr__*PartnerSet](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Property] [nvarchar](max) NULL,
|
|
[PartnerType] [nvarchar](max) NULL,
|
|
[PartnerId] [bigint] NULL,
|
|
[EntityId] [bigint] NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_ol3sp_mfr__companies] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_ol3sp_mfr__companies](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[Location#ID] [bigint] NULL,
|
|
[Version] [int] NULL,
|
|
[IsPhysicalPerson] [bit] NULL,
|
|
[IsOwner] [bit] NULL,
|
|
[IsEmailInvoicingActive] [bit] NULL,
|
|
[IsSupplier] [bit] NULL,
|
|
[MappingId] [nvarchar](max) NULL,
|
|
[ExternalId] [nvarchar](max) NULL,
|
|
[Name] [nvarchar](max) NULL,
|
|
[Note] [nvarchar](max) NULL,
|
|
[SupportTelephone] [nvarchar](max) NULL,
|
|
[SupportFax] [nvarchar](max) NULL,
|
|
[SupportMail] [nvarchar](max) NULL,
|
|
[QuickSearch] [nvarchar](max) NULL,
|
|
[DateModified] [datetime] NULL,
|
|
[CustomValues] [nvarchar](max) NULL,
|
|
[MainContactId] [bigint] NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_ol3sp_mfr__contacts] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_ol3sp_mfr__contacts](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[CustomValues] [nvarchar](max) NULL,
|
|
[FirstName] [nvarchar](max) NULL,
|
|
[LastName] [nvarchar](max) NULL,
|
|
[Email] [nvarchar](max) NULL,
|
|
[JobTitle] [nvarchar](max) NULL,
|
|
[MobilePhone] [nvarchar](max) NULL,
|
|
[Telephone] [nvarchar](max) NULL,
|
|
[Fax] [nvarchar](max) NULL,
|
|
[Note] [nvarchar](max) NULL,
|
|
[DateModified] [datetime] NULL,
|
|
[Version] [int] NULL,
|
|
[CompanyId] [bigint] NULL,
|
|
[IsUser] [bit] NULL,
|
|
[ExternalId] [nvarchar](max) NULL,
|
|
[Gender] [nvarchar](max) NULL,
|
|
[UserId] [bigint] NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_ruicr_mfr__#locations] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_ruicr_mfr__#locations](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[EntityId] [bigint] NULL,
|
|
[Property] [nvarchar](max) NULL,
|
|
[Version] [int] NULL,
|
|
[AddressString] [nvarchar](max) NULL,
|
|
[Postal] [nvarchar](max) NULL,
|
|
[City] [nvarchar](max) NULL,
|
|
[State] [nvarchar](max) NULL,
|
|
[Country] [nvarchar](max) NULL,
|
|
[Longitude] [real] NULL,
|
|
[Latitude] [real] NULL,
|
|
[IsValidLocation] [bit] NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_ruicr_mfr__*PartnerSet] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_ruicr_mfr__*PartnerSet](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Property] [nvarchar](max) NULL,
|
|
[PartnerType] [nvarchar](max) NULL,
|
|
[PartnerId] [bigint] NULL,
|
|
[EntityId] [bigint] NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_ruicr_mfr__appointments] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_ruicr_mfr__appointments](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[Version] [int] NULL,
|
|
[State] [nvarchar](max) NULL,
|
|
[Type] [nvarchar](max) NULL,
|
|
[EndDateTime] [datetime] NULL,
|
|
[StartDateTime] [datetime] NULL,
|
|
[DrivingDistanceFrom] [int] NULL,
|
|
[DrivingDistanceTo] [int] NULL,
|
|
[WasReadOnClientSide] [bit] NULL,
|
|
[ContactIds] [nvarchar](max) NULL,
|
|
[ServiceRequestId] [bigint] NULL,
|
|
[ContactId] [bigint] NULL,
|
|
[Note] [nvarchar](max) NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_ruicr_mfr__comments] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_ruicr_mfr__comments](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[Version] [int] NULL,
|
|
[DateOfCreation] [datetime] NULL,
|
|
[IsInternal] [bit] NULL,
|
|
[ServiceRequestId] [bigint] NULL,
|
|
[CompanyId] [bigint] NULL,
|
|
[Content] [nvarchar](max) NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_ruicr_mfr__companies] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_ruicr_mfr__companies](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[Location#ID] [bigint] NULL,
|
|
[Version] [int] NULL,
|
|
[IsPhysicalPerson] [bit] NULL,
|
|
[IsOwner] [bit] NULL,
|
|
[IsEmailInvoicingActive] [bit] NULL,
|
|
[IsSupplier] [bit] NULL,
|
|
[MappingId] [nvarchar](max) NULL,
|
|
[ExternalId] [nvarchar](max) NULL,
|
|
[Name] [nvarchar](max) NULL,
|
|
[Note] [nvarchar](max) NULL,
|
|
[SupportTelephone] [nvarchar](max) NULL,
|
|
[SupportFax] [nvarchar](max) NULL,
|
|
[SupportMail] [nvarchar](max) NULL,
|
|
[QuickSearch] [nvarchar](max) NULL,
|
|
[DateModified] [datetime] NULL,
|
|
[CustomValues] [nvarchar](max) NULL,
|
|
[MainContactId] [bigint] NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_ruicr_mfr__contacts] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_ruicr_mfr__contacts](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[CustomValues] [nvarchar](max) NULL,
|
|
[FirstName] [nvarchar](max) NULL,
|
|
[LastName] [nvarchar](max) NULL,
|
|
[Email] [nvarchar](max) NULL,
|
|
[JobTitle] [nvarchar](max) NULL,
|
|
[MobilePhone] [nvarchar](max) NULL,
|
|
[Telephone] [nvarchar](max) NULL,
|
|
[Fax] [nvarchar](max) NULL,
|
|
[Note] [nvarchar](max) NULL,
|
|
[DateModified] [datetime] NULL,
|
|
[Version] [int] NULL,
|
|
[CompanyId] [bigint] NULL,
|
|
[IsUser] [bit] NULL,
|
|
[ExternalId] [nvarchar](max) NULL,
|
|
[Gender] [nvarchar](max) NULL,
|
|
[UserId] [bigint] NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_ruicr_mfr__costcenters] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_ruicr_mfr__costcenters](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[Version] [int] NULL,
|
|
[Name] [nvarchar](max) NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_ruicr_mfr__items] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_ruicr_mfr__items](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[Version] [int] NULL,
|
|
[QuantityHours] [real] NULL,
|
|
[PlannedQuantityHours] [real] NULL,
|
|
[ItemTypeId] [bigint] NULL,
|
|
[ItemNumber] [nvarchar](max) NULL,
|
|
[TrackingId] [nvarchar](max) NULL,
|
|
[Manufacture] [nvarchar](max) NULL,
|
|
[Price] [real] NULL,
|
|
[Costs] [real] NULL,
|
|
[NameOrNumber] [nvarchar](max) NULL,
|
|
[CustomValues] [nvarchar](max) NULL,
|
|
[Note] [nvarchar](max) NULL,
|
|
[ExternalId] [nvarchar](max) NULL,
|
|
[Discount] [real] NULL,
|
|
[VAT] [real] NULL,
|
|
[IsManual] [bit] NULL,
|
|
[SortOrder] [int] NULL,
|
|
[Type] [nvarchar](max) NULL,
|
|
[ServiceRequestId] [bigint] NULL,
|
|
[ServiceObjectId] [bigint] NULL,
|
|
[CreatorId] [bigint] NULL,
|
|
[UnitId] [bigint] NULL,
|
|
[UnitString] [nvarchar](max) NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_ruicr_mfr__reports] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_ruicr_mfr__reports](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[Version] [int] NULL,
|
|
[DateOfCreation] [datetime] NULL,
|
|
[URI] [nvarchar](max) NULL,
|
|
[DocumentName] [nvarchar](max) NULL,
|
|
[FileTypeString] [nvarchar](max) NULL,
|
|
[ReportDefinitionCode] [nvarchar](max) NULL,
|
|
[ServiceObjectId] [bigint] NULL,
|
|
[CanBeDeleted] [bit] NULL,
|
|
[InvoiceBalance] [real] NULL,
|
|
[InvoiceId] [nvarchar](max) NULL,
|
|
[DueDate] [datetime] NULL,
|
|
[IsPayed] [bit] NULL,
|
|
[IsInvoice] [bit] NULL,
|
|
[IsCanceled] [bit] NULL,
|
|
[CustomValues] [nvarchar](max) NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_ruicr_mfr__serviceobjects] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_ruicr_mfr__serviceobjects](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[Location#ID] [bigint] NULL,
|
|
[Name] [nvarchar](max) NULL,
|
|
[Note] [nvarchar](max) NULL,
|
|
[CustomValues] [nvarchar](max) NULL,
|
|
[DateModified] [datetime] NULL,
|
|
[ExternalId] [nvarchar](max) NULL,
|
|
[MappingId] [nvarchar](max) NULL,
|
|
[QuickSearch] [nvarchar](max) NULL,
|
|
[Version] [int] NULL,
|
|
[CreateGeoLocation] [bit] NULL,
|
|
[IsWarehouse] [bit] NULL,
|
|
[ParentServiceObjectId] [bigint] NULL,
|
|
[CompanyId] [bigint] NULL,
|
|
[ProductId] [bigint] NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_ruicr_mfr__servicerequests] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_ruicr_mfr__servicerequests](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[Name] [nvarchar](max) NULL,
|
|
[ExternalId] [nvarchar](max) NULL,
|
|
[InvoiceId] [nvarchar](max) NULL,
|
|
[ClosedAt] [datetime] NULL,
|
|
[ReleasedAt] [datetime] NULL,
|
|
[WorkDoneAt] [datetime] NULL,
|
|
[TargetTimeInMinutes] [bigint] NULL,
|
|
[DateModified] [datetime] NULL,
|
|
[DateOfCreation] [datetime] NULL,
|
|
[DueDateRangeStart] [datetime] NULL,
|
|
[DueDateRangeEnd] [datetime] NULL,
|
|
[PortalLink] [nvarchar](max) NULL,
|
|
[CostCenterId] [bigint] NULL,
|
|
[Description] [nvarchar](max) NULL,
|
|
[State] [nvarchar](max) NULL,
|
|
[CustomValues] [nvarchar](max) NULL,
|
|
[CurrentOwnerId] [bigint] NULL,
|
|
[CustomerId] [bigint] NULL,
|
|
[ParentServiceRequestId] [bigint] NULL,
|
|
[Location#ID] [bigint] NULL,
|
|
[Version] [int] NULL,
|
|
[IsTemplate] [bit] NULL,
|
|
[IsTemplateMobile] [bit] NULL,
|
|
[CreateFromServiceRequestTemplateId] [bigint] NULL,
|
|
[Type] [nvarchar](max) NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_ruicr_mfr__steps] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_ruicr_mfr__steps](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[MobileId] [bigint] NULL,
|
|
[Version] [int] NULL,
|
|
[Name] [nvarchar](max) NULL,
|
|
[IsDone] [bit] NULL,
|
|
[HasError] [bit] NULL,
|
|
[TrackingId] [nvarchar](max) NULL,
|
|
[Type] [nvarchar](max) NULL,
|
|
[SortOrder] [int] NULL,
|
|
[Data] [nvarchar](max) NULL,
|
|
[DateModifiedOffline] [datetime] NULL,
|
|
[ServiceRequestId] [bigint] NULL,
|
|
[Description] [nvarchar](max) NULL,
|
|
[Comment] [nvarchar](max) NULL,
|
|
[InternalComment] [nvarchar](max) NULL,
|
|
[ServiceObjectId] [bigint] NULL,
|
|
[StepListTemplateId] [bigint] NULL,
|
|
[ParentId] [bigint] NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_ruicr_mfr__tags] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_ruicr_mfr__tags](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[Version] [int] NULL,
|
|
[Name] [nvarchar](max) NULL,
|
|
[ColorDefinition] [nvarchar](max) NULL,
|
|
[Type] [nvarchar](max) NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_ruicr_mfr__timeevents] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_ruicr_mfr__timeevents](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[Version] [int] NULL,
|
|
[State] [nvarchar](max) NULL,
|
|
[IsApproved] [bit] NULL,
|
|
[TimeEventType] [nvarchar](max) NULL,
|
|
[ExternalId] [nvarchar](max) NULL,
|
|
[DateModified] [datetime] NULL,
|
|
[StartDateTime] [datetime] NULL,
|
|
[EndDateTime] [datetime] NULL,
|
|
[ProposedDrivingDistance] [int] NULL,
|
|
[ContactId] [bigint] NULL,
|
|
[ServiceRequestId] [bigint] NULL,
|
|
[Description] [nvarchar](max) NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_ruicr_mfr__users] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_ruicr_mfr__users](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[Version] [int] NULL,
|
|
[UserName] [nvarchar](max) NULL,
|
|
[IsSystem] [bit] NULL,
|
|
[CreationDate] [datetime] NULL,
|
|
[IsApproved] [bit] NULL,
|
|
[ContactId] [bigint] NULL,
|
|
[PreferedLanguage] [nvarchar](max) NULL,
|
|
[EmailChannelEnabled] [bit] NULL,
|
|
[HasFullScreenPreference] [bit] NULL,
|
|
[TimeZone] [int] NULL,
|
|
[PreferedCulture] [nvarchar](max) NULL,
|
|
[IsActive] [bit] NULL,
|
|
[IsMobile] [bit] NULL,
|
|
[LastLoginDate] [datetime] NULL,
|
|
[UserGuideProgress] [nvarchar](max) NULL,
|
|
[DashboardSettings] [nvarchar](max) NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_ttrlj_mfr__*PartnerSet] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_ttrlj_mfr__*PartnerSet](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Property] [nvarchar](max) NULL,
|
|
[PartnerType] [nvarchar](max) NULL,
|
|
[PartnerId] [bigint] NULL,
|
|
[EntityId] [bigint] NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_ttrlj_mfr__itemtypes] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_ttrlj_mfr__itemtypes](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[CustomValues] [nvarchar](max) NULL,
|
|
[Version] [int] NULL,
|
|
[Costs] [real] NULL,
|
|
[Description] [nvarchar](max) NULL,
|
|
[ListPrice] [real] NULL,
|
|
[Manufacture] [nvarchar](max) NULL,
|
|
[ExternalId] [nvarchar](max) NULL,
|
|
[ItemNumber] [nvarchar](max) NULL,
|
|
[NameOrNumber] [nvarchar](max) NULL,
|
|
[GlobalTradeItemNr] [nvarchar](max) NULL,
|
|
[Type] [nvarchar](max) NULL,
|
|
[Price] [real] NULL,
|
|
[VAT] [real] NULL,
|
|
[IsPortalOnly] [bit] NULL,
|
|
[Discount] [real] NULL,
|
|
[DateModified] [datetime] NULL,
|
|
[IsDiscontinued] [bit] NULL,
|
|
[IsWarehouse] [bit] NULL,
|
|
[UnitId] [bigint] NULL,
|
|
[UnitString] [nvarchar](max) NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_ttrlj_mfr__itemunits] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_ttrlj_mfr__itemunits](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[Version] [int] NULL,
|
|
[Name] [nvarchar](max) NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_tv7ya_mfr__*PartnerSet] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_tv7ya_mfr__*PartnerSet](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Property] [nvarchar](max) NULL,
|
|
[PartnerType] [nvarchar](max) NULL,
|
|
[PartnerId] [bigint] NULL,
|
|
[EntityId] [bigint] NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_tv7ya_mfr__companies] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_tv7ya_mfr__companies](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[Location#ID] [bigint] NULL,
|
|
[Version] [int] NULL,
|
|
[IsPhysicalPerson] [bit] NULL,
|
|
[IsOwner] [bit] NULL,
|
|
[IsEmailInvoicingActive] [bit] NULL,
|
|
[IsSupplier] [bit] NULL,
|
|
[MappingId] [nvarchar](max) NULL,
|
|
[ExternalId] [nvarchar](max) NULL,
|
|
[Name] [nvarchar](max) NULL,
|
|
[Note] [nvarchar](max) NULL,
|
|
[SupportTelephone] [nvarchar](max) NULL,
|
|
[SupportFax] [nvarchar](max) NULL,
|
|
[SupportMail] [nvarchar](max) NULL,
|
|
[QuickSearch] [nvarchar](max) NULL,
|
|
[DateModified] [datetime] NULL,
|
|
[CustomValues] [nvarchar](max) NULL,
|
|
[MainContactId] [bigint] NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_tv7ya_mfr__contacts] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_tv7ya_mfr__contacts](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[CustomValues] [nvarchar](max) NULL,
|
|
[FirstName] [nvarchar](max) NULL,
|
|
[LastName] [nvarchar](max) NULL,
|
|
[Email] [nvarchar](max) NULL,
|
|
[JobTitle] [nvarchar](max) NULL,
|
|
[MobilePhone] [nvarchar](max) NULL,
|
|
[Telephone] [nvarchar](max) NULL,
|
|
[Fax] [nvarchar](max) NULL,
|
|
[Note] [nvarchar](max) NULL,
|
|
[DateModified] [datetime] NULL,
|
|
[Version] [int] NULL,
|
|
[CompanyId] [bigint] NULL,
|
|
[IsUser] [bit] NULL,
|
|
[ExternalId] [nvarchar](max) NULL,
|
|
[Gender] [nvarchar](max) NULL,
|
|
[UserId] [bigint] NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_u50xs_mfr__*PartnerSet] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_u50xs_mfr__*PartnerSet](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Property] [nvarchar](max) NULL,
|
|
[PartnerType] [nvarchar](max) NULL,
|
|
[PartnerId] [bigint] NULL,
|
|
[EntityId] [bigint] NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_u50xs_mfr__contacts] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_u50xs_mfr__contacts](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[CustomValues] [nvarchar](max) NULL,
|
|
[FirstName] [nvarchar](max) NULL,
|
|
[LastName] [nvarchar](max) NULL,
|
|
[Email] [nvarchar](max) NULL,
|
|
[JobTitle] [nvarchar](max) NULL,
|
|
[MobilePhone] [nvarchar](max) NULL,
|
|
[Telephone] [nvarchar](max) NULL,
|
|
[Fax] [nvarchar](max) NULL,
|
|
[Note] [nvarchar](max) NULL,
|
|
[DateModified] [datetime] NULL,
|
|
[Version] [int] NULL,
|
|
[CompanyId] [bigint] NULL,
|
|
[IsUser] [bit] NULL,
|
|
[ExternalId] [nvarchar](max) NULL,
|
|
[Gender] [nvarchar](max) NULL,
|
|
[UserId] [bigint] NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_u50xs_mfr__servicerequests] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_u50xs_mfr__servicerequests](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[Name] [nvarchar](max) NULL,
|
|
[ExternalId] [nvarchar](max) NULL,
|
|
[InvoiceId] [nvarchar](max) NULL,
|
|
[ClosedAt] [datetime] NULL,
|
|
[ReleasedAt] [datetime] NULL,
|
|
[WorkDoneAt] [datetime] NULL,
|
|
[TargetTimeInMinutes] [bigint] NULL,
|
|
[DateModified] [datetime] NULL,
|
|
[DateOfCreation] [datetime] NULL,
|
|
[DueDateRangeStart] [datetime] NULL,
|
|
[DueDateRangeEnd] [datetime] NULL,
|
|
[PortalLink] [nvarchar](max) NULL,
|
|
[CostCenterId] [bigint] NULL,
|
|
[Description] [nvarchar](max) NULL,
|
|
[State] [nvarchar](max) NULL,
|
|
[CustomValues] [nvarchar](max) NULL,
|
|
[CurrentOwnerId] [bigint] NULL,
|
|
[CustomerId] [bigint] NULL,
|
|
[ParentServiceRequestId] [bigint] NULL,
|
|
[Location#ID] [bigint] NULL,
|
|
[Version] [int] NULL,
|
|
[IsTemplate] [bit] NULL,
|
|
[IsTemplateMobile] [bit] NULL,
|
|
[CreateFromServiceRequestTemplateId] [bigint] NULL,
|
|
[Type] [nvarchar](max) NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_u50xs_mfr__timeevents] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_u50xs_mfr__timeevents](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[Version] [int] NULL,
|
|
[State] [nvarchar](max) NULL,
|
|
[IsApproved] [bit] NULL,
|
|
[TimeEventType] [nvarchar](max) NULL,
|
|
[ExternalId] [nvarchar](max) NULL,
|
|
[DateModified] [datetime] NULL,
|
|
[StartDateTime] [datetime] NULL,
|
|
[EndDateTime] [datetime] NULL,
|
|
[ProposedDrivingDistance] [int] NULL,
|
|
[ContactId] [bigint] NULL,
|
|
[ServiceRequestId] [bigint] NULL,
|
|
[Description] [nvarchar](max) NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_vylqj_mfr__#locations] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_vylqj_mfr__#locations](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[EntityId] [bigint] NULL,
|
|
[Property] [nvarchar](max) NULL,
|
|
[Version] [int] NULL,
|
|
[AddressString] [nvarchar](max) NULL,
|
|
[Postal] [nvarchar](max) NULL,
|
|
[City] [nvarchar](max) NULL,
|
|
[State] [nvarchar](max) NULL,
|
|
[Country] [nvarchar](max) NULL,
|
|
[Longitude] [real] NULL,
|
|
[Latitude] [real] NULL,
|
|
[IsValidLocation] [bit] NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_vylqj_mfr__*PartnerSet] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_vylqj_mfr__*PartnerSet](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Property] [nvarchar](max) NULL,
|
|
[PartnerType] [nvarchar](max) NULL,
|
|
[PartnerId] [bigint] NULL,
|
|
[EntityId] [bigint] NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_vylqj_mfr__companies] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_vylqj_mfr__companies](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[Location#ID] [bigint] NULL,
|
|
[Version] [int] NULL,
|
|
[IsPhysicalPerson] [bit] NULL,
|
|
[IsOwner] [bit] NULL,
|
|
[IsEmailInvoicingActive] [bit] NULL,
|
|
[IsSupplier] [bit] NULL,
|
|
[MappingId] [nvarchar](max) NULL,
|
|
[ExternalId] [nvarchar](max) NULL,
|
|
[Name] [nvarchar](max) NULL,
|
|
[Note] [nvarchar](max) NULL,
|
|
[SupportTelephone] [nvarchar](max) NULL,
|
|
[SupportFax] [nvarchar](max) NULL,
|
|
[SupportMail] [nvarchar](max) NULL,
|
|
[QuickSearch] [nvarchar](max) NULL,
|
|
[DateModified] [datetime] NULL,
|
|
[CustomValues] [nvarchar](max) NULL,
|
|
[MainContactId] [bigint] NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_vylqj_mfr__contacts] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_vylqj_mfr__contacts](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[CustomValues] [nvarchar](max) NULL,
|
|
[FirstName] [nvarchar](max) NULL,
|
|
[LastName] [nvarchar](max) NULL,
|
|
[Email] [nvarchar](max) NULL,
|
|
[JobTitle] [nvarchar](max) NULL,
|
|
[MobilePhone] [nvarchar](max) NULL,
|
|
[Telephone] [nvarchar](max) NULL,
|
|
[Fax] [nvarchar](max) NULL,
|
|
[Note] [nvarchar](max) NULL,
|
|
[DateModified] [datetime] NULL,
|
|
[Version] [int] NULL,
|
|
[CompanyId] [bigint] NULL,
|
|
[IsUser] [bit] NULL,
|
|
[ExternalId] [nvarchar](max) NULL,
|
|
[Gender] [nvarchar](max) NULL,
|
|
[UserId] [bigint] NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_vylqj_mfr__serviceobjects] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_vylqj_mfr__serviceobjects](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[Location#ID] [bigint] NULL,
|
|
[Name] [nvarchar](max) NULL,
|
|
[Note] [nvarchar](max) NULL,
|
|
[CustomValues] [nvarchar](max) NULL,
|
|
[DateModified] [datetime] NULL,
|
|
[ExternalId] [nvarchar](max) NULL,
|
|
[MappingId] [nvarchar](max) NULL,
|
|
[QuickSearch] [nvarchar](max) NULL,
|
|
[Version] [int] NULL,
|
|
[CreateGeoLocation] [bit] NULL,
|
|
[IsWarehouse] [bit] NULL,
|
|
[ParentServiceObjectId] [bigint] NULL,
|
|
[CompanyId] [bigint] NULL,
|
|
[ProductId] [bigint] NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_wkphb_mfr__*PartnerSet] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_wkphb_mfr__*PartnerSet](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Property] [nvarchar](max) NULL,
|
|
[PartnerType] [nvarchar](max) NULL,
|
|
[PartnerId] [bigint] NULL,
|
|
[EntityId] [bigint] NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_wkphb_mfr__products] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_wkphb_mfr__products](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[Version] [int] NULL,
|
|
[Name] [nvarchar](max) NULL,
|
|
[SubKey] [nvarchar](max) NULL,
|
|
[Description] [nvarchar](max) NULL,
|
|
[DateModified] [datetime] NULL,
|
|
[MappingId] [nvarchar](max) NULL,
|
|
[CustomValueStepTemplateId] [bigint] NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_wkphb_mfr__steplisttemplates] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_wkphb_mfr__steplisttemplates](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[Version] [int] NULL,
|
|
[Name] [nvarchar](max) NULL,
|
|
[MappingId] [nvarchar](max) NULL,
|
|
[DateModified] [datetime] NULL,
|
|
[IsReleased] [bit] NULL,
|
|
[IsDurable] [bit] NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_wtg2d_mfr__#locations] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_wtg2d_mfr__#locations](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[EntityId] [bigint] NULL,
|
|
[Property] [nvarchar](max) NULL,
|
|
[Version] [int] NULL,
|
|
[AddressString] [nvarchar](max) NULL,
|
|
[Postal] [nvarchar](max) NULL,
|
|
[City] [nvarchar](max) NULL,
|
|
[State] [nvarchar](max) NULL,
|
|
[Country] [nvarchar](max) NULL,
|
|
[Longitude] [real] NULL,
|
|
[Latitude] [real] NULL,
|
|
[IsValidLocation] [bit] NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_wtg2d_mfr__*PartnerSet] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_wtg2d_mfr__*PartnerSet](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Property] [nvarchar](max) NULL,
|
|
[PartnerType] [nvarchar](max) NULL,
|
|
[PartnerId] [bigint] NULL,
|
|
[EntityId] [bigint] NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_wtg2d_mfr__companies] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_wtg2d_mfr__companies](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[Location#ID] [bigint] NULL,
|
|
[Version] [int] NULL,
|
|
[IsPhysicalPerson] [bit] NULL,
|
|
[IsOwner] [bit] NULL,
|
|
[IsEmailInvoicingActive] [bit] NULL,
|
|
[IsSupplier] [bit] NULL,
|
|
[MappingId] [nvarchar](max) NULL,
|
|
[ExternalId] [nvarchar](max) NULL,
|
|
[Name] [nvarchar](max) NULL,
|
|
[Note] [nvarchar](max) NULL,
|
|
[SupportTelephone] [nvarchar](max) NULL,
|
|
[SupportFax] [nvarchar](max) NULL,
|
|
[SupportMail] [nvarchar](max) NULL,
|
|
[QuickSearch] [nvarchar](max) NULL,
|
|
[DateModified] [datetime] NULL,
|
|
[CustomValues] [nvarchar](max) NULL,
|
|
[MainContactId] [bigint] NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_wtg2d_mfr__contacts] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_wtg2d_mfr__contacts](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[CustomValues] [nvarchar](max) NULL,
|
|
[FirstName] [nvarchar](max) NULL,
|
|
[LastName] [nvarchar](max) NULL,
|
|
[Email] [nvarchar](max) NULL,
|
|
[JobTitle] [nvarchar](max) NULL,
|
|
[MobilePhone] [nvarchar](max) NULL,
|
|
[Telephone] [nvarchar](max) NULL,
|
|
[Fax] [nvarchar](max) NULL,
|
|
[Note] [nvarchar](max) NULL,
|
|
[DateModified] [datetime] NULL,
|
|
[Version] [int] NULL,
|
|
[CompanyId] [bigint] NULL,
|
|
[IsUser] [bit] NULL,
|
|
[ExternalId] [nvarchar](max) NULL,
|
|
[Gender] [nvarchar](max) NULL,
|
|
[UserId] [bigint] NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_wtg2d_mfr__serviceobjects] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_wtg2d_mfr__serviceobjects](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[Location#ID] [bigint] NULL,
|
|
[Name] [nvarchar](max) NULL,
|
|
[Note] [nvarchar](max) NULL,
|
|
[CustomValues] [nvarchar](max) NULL,
|
|
[DateModified] [datetime] NULL,
|
|
[ExternalId] [nvarchar](max) NULL,
|
|
[MappingId] [nvarchar](max) NULL,
|
|
[QuickSearch] [nvarchar](max) NULL,
|
|
[Version] [int] NULL,
|
|
[CreateGeoLocation] [bit] NULL,
|
|
[IsWarehouse] [bit] NULL,
|
|
[ParentServiceObjectId] [bigint] NULL,
|
|
[CompanyId] [bigint] NULL,
|
|
[ProductId] [bigint] NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_wtg2d_mfr__tags] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_wtg2d_mfr__tags](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[Version] [int] NULL,
|
|
[Name] [nvarchar](max) NULL,
|
|
[ColorDefinition] [nvarchar](max) NULL,
|
|
[Type] [nvarchar](max) NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_xtthl_mfr__*PartnerSet] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_xtthl_mfr__*PartnerSet](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Property] [nvarchar](max) NULL,
|
|
[PartnerType] [nvarchar](max) NULL,
|
|
[PartnerId] [bigint] NULL,
|
|
[EntityId] [bigint] NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_xtthl_mfr__steplisttemplates] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_xtthl_mfr__steplisttemplates](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[Version] [int] NULL,
|
|
[Name] [nvarchar](max) NULL,
|
|
[MappingId] [nvarchar](max) NULL,
|
|
[DateModified] [datetime] NULL,
|
|
[IsReleased] [bit] NULL,
|
|
[IsDurable] [bit] NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_xtthl_mfr__steps] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_xtthl_mfr__steps](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[MobileId] [bigint] NULL,
|
|
[Version] [int] NULL,
|
|
[Name] [nvarchar](max) NULL,
|
|
[IsDone] [bit] NULL,
|
|
[HasError] [bit] NULL,
|
|
[TrackingId] [nvarchar](max) NULL,
|
|
[Type] [nvarchar](max) NULL,
|
|
[SortOrder] [int] NULL,
|
|
[Data] [nvarchar](max) NULL,
|
|
[DateModifiedOffline] [datetime] NULL,
|
|
[ServiceRequestId] [bigint] NULL,
|
|
[Description] [nvarchar](max) NULL,
|
|
[Comment] [nvarchar](max) NULL,
|
|
[InternalComment] [nvarchar](max) NULL,
|
|
[ServiceObjectId] [bigint] NULL,
|
|
[StepListTemplateId] [bigint] NULL,
|
|
[ParentId] [bigint] NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_xujqh_mfr__#locations] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_xujqh_mfr__#locations](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[EntityId] [bigint] NULL,
|
|
[Property] [nvarchar](max) NULL,
|
|
[Version] [int] NULL,
|
|
[AddressString] [nvarchar](max) NULL,
|
|
[Postal] [nvarchar](max) NULL,
|
|
[City] [nvarchar](max) NULL,
|
|
[State] [nvarchar](max) NULL,
|
|
[Country] [nvarchar](max) NULL,
|
|
[Longitude] [real] NULL,
|
|
[Latitude] [real] NULL,
|
|
[IsValidLocation] [bit] NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_xujqh_mfr__*PartnerSet] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_xujqh_mfr__*PartnerSet](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Property] [nvarchar](max) NULL,
|
|
[PartnerType] [nvarchar](max) NULL,
|
|
[PartnerId] [bigint] NULL,
|
|
[EntityId] [bigint] NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_xujqh_mfr__companies] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_xujqh_mfr__companies](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[Location#ID] [bigint] NULL,
|
|
[Version] [int] NULL,
|
|
[IsPhysicalPerson] [bit] NULL,
|
|
[IsOwner] [bit] NULL,
|
|
[IsEmailInvoicingActive] [bit] NULL,
|
|
[IsSupplier] [bit] NULL,
|
|
[MappingId] [nvarchar](max) NULL,
|
|
[ExternalId] [nvarchar](max) NULL,
|
|
[Name] [nvarchar](max) NULL,
|
|
[Note] [nvarchar](max) NULL,
|
|
[SupportTelephone] [nvarchar](max) NULL,
|
|
[SupportFax] [nvarchar](max) NULL,
|
|
[SupportMail] [nvarchar](max) NULL,
|
|
[QuickSearch] [nvarchar](max) NULL,
|
|
[DateModified] [datetime] NULL,
|
|
[CustomValues] [nvarchar](max) NULL,
|
|
[MainContactId] [bigint] NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_xujqh_mfr__serviceobjects] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_xujqh_mfr__serviceobjects](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[Location#ID] [bigint] NULL,
|
|
[Name] [nvarchar](max) NULL,
|
|
[Note] [nvarchar](max) NULL,
|
|
[CustomValues] [nvarchar](max) NULL,
|
|
[DateModified] [datetime] NULL,
|
|
[ExternalId] [nvarchar](max) NULL,
|
|
[MappingId] [nvarchar](max) NULL,
|
|
[QuickSearch] [nvarchar](max) NULL,
|
|
[Version] [int] NULL,
|
|
[CreateGeoLocation] [bit] NULL,
|
|
[IsWarehouse] [bit] NULL,
|
|
[ParentServiceObjectId] [bigint] NULL,
|
|
[CompanyId] [bigint] NULL,
|
|
[ProductId] [bigint] NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_xxzcx_mfr__#locations] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_xxzcx_mfr__#locations](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[EntityId] [bigint] NULL,
|
|
[Property] [nvarchar](max) NULL,
|
|
[Version] [int] NULL,
|
|
[AddressString] [nvarchar](max) NULL,
|
|
[Postal] [nvarchar](max) NULL,
|
|
[City] [nvarchar](max) NULL,
|
|
[State] [nvarchar](max) NULL,
|
|
[Country] [nvarchar](max) NULL,
|
|
[Longitude] [real] NULL,
|
|
[Latitude] [real] NULL,
|
|
[IsValidLocation] [bit] NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_xxzcx_mfr__*PartnerSet] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_xxzcx_mfr__*PartnerSet](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Property] [nvarchar](max) NULL,
|
|
[PartnerType] [nvarchar](max) NULL,
|
|
[PartnerId] [bigint] NULL,
|
|
[EntityId] [bigint] NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_xxzcx_mfr__companies] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_xxzcx_mfr__companies](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[Location#ID] [bigint] NULL,
|
|
[Version] [int] NULL,
|
|
[IsPhysicalPerson] [bit] NULL,
|
|
[IsOwner] [bit] NULL,
|
|
[IsEmailInvoicingActive] [bit] NULL,
|
|
[IsSupplier] [bit] NULL,
|
|
[MappingId] [nvarchar](max) NULL,
|
|
[ExternalId] [nvarchar](max) NULL,
|
|
[Name] [nvarchar](max) NULL,
|
|
[Note] [nvarchar](max) NULL,
|
|
[SupportTelephone] [nvarchar](max) NULL,
|
|
[SupportFax] [nvarchar](max) NULL,
|
|
[SupportMail] [nvarchar](max) NULL,
|
|
[QuickSearch] [nvarchar](max) NULL,
|
|
[DateModified] [datetime] NULL,
|
|
[CustomValues] [nvarchar](max) NULL,
|
|
[MainContactId] [bigint] NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_xxzcx_mfr__contacts] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_xxzcx_mfr__contacts](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[CustomValues] [nvarchar](max) NULL,
|
|
[FirstName] [nvarchar](max) NULL,
|
|
[LastName] [nvarchar](max) NULL,
|
|
[Email] [nvarchar](max) NULL,
|
|
[JobTitle] [nvarchar](max) NULL,
|
|
[MobilePhone] [nvarchar](max) NULL,
|
|
[Telephone] [nvarchar](max) NULL,
|
|
[Fax] [nvarchar](max) NULL,
|
|
[Note] [nvarchar](max) NULL,
|
|
[DateModified] [datetime] NULL,
|
|
[Version] [int] NULL,
|
|
[CompanyId] [bigint] NULL,
|
|
[IsUser] [bit] NULL,
|
|
[ExternalId] [nvarchar](max) NULL,
|
|
[Gender] [nvarchar](max) NULL,
|
|
[UserId] [bigint] NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_xxzcx_mfr__serviceobjects] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_xxzcx_mfr__serviceobjects](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[Location#ID] [bigint] NULL,
|
|
[Name] [nvarchar](max) NULL,
|
|
[Note] [nvarchar](max) NULL,
|
|
[CustomValues] [nvarchar](max) NULL,
|
|
[DateModified] [datetime] NULL,
|
|
[ExternalId] [nvarchar](max) NULL,
|
|
[MappingId] [nvarchar](max) NULL,
|
|
[QuickSearch] [nvarchar](max) NULL,
|
|
[Version] [int] NULL,
|
|
[CreateGeoLocation] [bit] NULL,
|
|
[IsWarehouse] [bit] NULL,
|
|
[ParentServiceObjectId] [bigint] NULL,
|
|
[CompanyId] [bigint] NULL,
|
|
[ProductId] [bigint] NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_z9iro_mfr__#locations] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_z9iro_mfr__#locations](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[EntityId] [bigint] NULL,
|
|
[Property] [nvarchar](max) NULL,
|
|
[Version] [int] NULL,
|
|
[AddressString] [nvarchar](max) NULL,
|
|
[Postal] [nvarchar](max) NULL,
|
|
[City] [nvarchar](max) NULL,
|
|
[State] [nvarchar](max) NULL,
|
|
[Country] [nvarchar](max) NULL,
|
|
[Longitude] [real] NULL,
|
|
[Latitude] [real] NULL,
|
|
[IsValidLocation] [bit] NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_z9iro_mfr__*PartnerSet] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_z9iro_mfr__*PartnerSet](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Property] [nvarchar](max) NULL,
|
|
[PartnerType] [nvarchar](max) NULL,
|
|
[PartnerId] [bigint] NULL,
|
|
[EntityId] [bigint] NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_z9iro_mfr__appointments] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_z9iro_mfr__appointments](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[Version] [int] NULL,
|
|
[State] [nvarchar](max) NULL,
|
|
[Type] [nvarchar](max) NULL,
|
|
[EndDateTime] [datetime] NULL,
|
|
[StartDateTime] [datetime] NULL,
|
|
[DrivingDistanceFrom] [int] NULL,
|
|
[DrivingDistanceTo] [int] NULL,
|
|
[WasReadOnClientSide] [bit] NULL,
|
|
[ContactIds] [nvarchar](max) NULL,
|
|
[ServiceRequestId] [bigint] NULL,
|
|
[ContactId] [bigint] NULL,
|
|
[Note] [nvarchar](max) NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_z9iro_mfr__comments] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_z9iro_mfr__comments](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[Version] [int] NULL,
|
|
[DateOfCreation] [datetime] NULL,
|
|
[IsInternal] [bit] NULL,
|
|
[ServiceRequestId] [bigint] NULL,
|
|
[CompanyId] [bigint] NULL,
|
|
[Content] [nvarchar](max) NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_z9iro_mfr__companies] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_z9iro_mfr__companies](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[Location#ID] [bigint] NULL,
|
|
[Version] [int] NULL,
|
|
[IsPhysicalPerson] [bit] NULL,
|
|
[IsOwner] [bit] NULL,
|
|
[IsEmailInvoicingActive] [bit] NULL,
|
|
[IsSupplier] [bit] NULL,
|
|
[MappingId] [nvarchar](max) NULL,
|
|
[ExternalId] [nvarchar](max) NULL,
|
|
[Name] [nvarchar](max) NULL,
|
|
[Note] [nvarchar](max) NULL,
|
|
[SupportTelephone] [nvarchar](max) NULL,
|
|
[SupportFax] [nvarchar](max) NULL,
|
|
[SupportMail] [nvarchar](max) NULL,
|
|
[QuickSearch] [nvarchar](max) NULL,
|
|
[DateModified] [datetime] NULL,
|
|
[CustomValues] [nvarchar](max) NULL,
|
|
[MainContactId] [bigint] NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_z9iro_mfr__contacts] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_z9iro_mfr__contacts](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[CustomValues] [nvarchar](max) NULL,
|
|
[FirstName] [nvarchar](max) NULL,
|
|
[LastName] [nvarchar](max) NULL,
|
|
[Email] [nvarchar](max) NULL,
|
|
[JobTitle] [nvarchar](max) NULL,
|
|
[MobilePhone] [nvarchar](max) NULL,
|
|
[Telephone] [nvarchar](max) NULL,
|
|
[Fax] [nvarchar](max) NULL,
|
|
[Note] [nvarchar](max) NULL,
|
|
[DateModified] [datetime] NULL,
|
|
[Version] [int] NULL,
|
|
[CompanyId] [bigint] NULL,
|
|
[IsUser] [bit] NULL,
|
|
[ExternalId] [nvarchar](max) NULL,
|
|
[Gender] [nvarchar](max) NULL,
|
|
[UserId] [bigint] NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_z9iro_mfr__costcenters] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_z9iro_mfr__costcenters](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[Version] [int] NULL,
|
|
[Name] [nvarchar](max) NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_z9iro_mfr__items] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_z9iro_mfr__items](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[Version] [int] NULL,
|
|
[QuantityHours] [real] NULL,
|
|
[PlannedQuantityHours] [real] NULL,
|
|
[ItemTypeId] [bigint] NULL,
|
|
[ItemNumber] [nvarchar](max) NULL,
|
|
[TrackingId] [nvarchar](max) NULL,
|
|
[Manufacture] [nvarchar](max) NULL,
|
|
[Price] [real] NULL,
|
|
[Costs] [real] NULL,
|
|
[NameOrNumber] [nvarchar](max) NULL,
|
|
[CustomValues] [nvarchar](max) NULL,
|
|
[Note] [nvarchar](max) NULL,
|
|
[ExternalId] [nvarchar](max) NULL,
|
|
[Discount] [real] NULL,
|
|
[VAT] [real] NULL,
|
|
[IsManual] [bit] NULL,
|
|
[SortOrder] [int] NULL,
|
|
[Type] [nvarchar](max) NULL,
|
|
[ServiceRequestId] [bigint] NULL,
|
|
[ServiceObjectId] [bigint] NULL,
|
|
[CreatorId] [bigint] NULL,
|
|
[UnitId] [bigint] NULL,
|
|
[UnitString] [nvarchar](max) NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_z9iro_mfr__reports] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_z9iro_mfr__reports](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[Version] [int] NULL,
|
|
[DateOfCreation] [datetime] NULL,
|
|
[URI] [nvarchar](max) NULL,
|
|
[DocumentName] [nvarchar](max) NULL,
|
|
[FileTypeString] [nvarchar](max) NULL,
|
|
[ReportDefinitionCode] [nvarchar](max) NULL,
|
|
[ServiceObjectId] [bigint] NULL,
|
|
[CanBeDeleted] [bit] NULL,
|
|
[InvoiceBalance] [real] NULL,
|
|
[InvoiceId] [nvarchar](max) NULL,
|
|
[DueDate] [datetime] NULL,
|
|
[IsPayed] [bit] NULL,
|
|
[IsInvoice] [bit] NULL,
|
|
[IsCanceled] [bit] NULL,
|
|
[CustomValues] [nvarchar](max) NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_z9iro_mfr__serviceobjects] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_z9iro_mfr__serviceobjects](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[Location#ID] [bigint] NULL,
|
|
[Name] [nvarchar](max) NULL,
|
|
[Note] [nvarchar](max) NULL,
|
|
[CustomValues] [nvarchar](max) NULL,
|
|
[DateModified] [datetime] NULL,
|
|
[ExternalId] [nvarchar](max) NULL,
|
|
[MappingId] [nvarchar](max) NULL,
|
|
[QuickSearch] [nvarchar](max) NULL,
|
|
[Version] [int] NULL,
|
|
[CreateGeoLocation] [bit] NULL,
|
|
[IsWarehouse] [bit] NULL,
|
|
[ParentServiceObjectId] [bigint] NULL,
|
|
[CompanyId] [bigint] NULL,
|
|
[ProductId] [bigint] NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_z9iro_mfr__servicerequests] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_z9iro_mfr__servicerequests](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[Name] [nvarchar](max) NULL,
|
|
[ExternalId] [nvarchar](max) NULL,
|
|
[InvoiceId] [nvarchar](max) NULL,
|
|
[ClosedAt] [datetime] NULL,
|
|
[ReleasedAt] [datetime] NULL,
|
|
[WorkDoneAt] [datetime] NULL,
|
|
[TargetTimeInMinutes] [bigint] NULL,
|
|
[DateModified] [datetime] NULL,
|
|
[DateOfCreation] [datetime] NULL,
|
|
[DueDateRangeStart] [datetime] NULL,
|
|
[DueDateRangeEnd] [datetime] NULL,
|
|
[PortalLink] [nvarchar](max) NULL,
|
|
[CostCenterId] [bigint] NULL,
|
|
[Description] [nvarchar](max) NULL,
|
|
[State] [nvarchar](max) NULL,
|
|
[CustomValues] [nvarchar](max) NULL,
|
|
[CurrentOwnerId] [bigint] NULL,
|
|
[CustomerId] [bigint] NULL,
|
|
[ParentServiceRequestId] [bigint] NULL,
|
|
[Location#ID] [bigint] NULL,
|
|
[Version] [int] NULL,
|
|
[IsTemplate] [bit] NULL,
|
|
[IsTemplateMobile] [bit] NULL,
|
|
[CreateFromServiceRequestTemplateId] [bigint] NULL,
|
|
[Type] [nvarchar](max) NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_z9iro_mfr__steps] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_z9iro_mfr__steps](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[MobileId] [bigint] NULL,
|
|
[Version] [int] NULL,
|
|
[Name] [nvarchar](max) NULL,
|
|
[IsDone] [bit] NULL,
|
|
[HasError] [bit] NULL,
|
|
[TrackingId] [nvarchar](max) NULL,
|
|
[Type] [nvarchar](max) NULL,
|
|
[SortOrder] [int] NULL,
|
|
[Data] [nvarchar](max) NULL,
|
|
[DateModifiedOffline] [datetime] NULL,
|
|
[ServiceRequestId] [bigint] NULL,
|
|
[Description] [nvarchar](max) NULL,
|
|
[Comment] [nvarchar](max) NULL,
|
|
[InternalComment] [nvarchar](max) NULL,
|
|
[ServiceObjectId] [bigint] NULL,
|
|
[StepListTemplateId] [bigint] NULL,
|
|
[ParentId] [bigint] NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_z9iro_mfr__tags] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_z9iro_mfr__tags](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[Version] [int] NULL,
|
|
[Name] [nvarchar](max) NULL,
|
|
[ColorDefinition] [nvarchar](max) NULL,
|
|
[Type] [nvarchar](max) NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_z9iro_mfr__timeevents] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_z9iro_mfr__timeevents](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[Version] [int] NULL,
|
|
[State] [nvarchar](max) NULL,
|
|
[IsApproved] [bit] NULL,
|
|
[TimeEventType] [nvarchar](max) NULL,
|
|
[ExternalId] [nvarchar](max) NULL,
|
|
[DateModified] [datetime] NULL,
|
|
[StartDateTime] [datetime] NULL,
|
|
[EndDateTime] [datetime] NULL,
|
|
[ProposedDrivingDistance] [int] NULL,
|
|
[ContactId] [bigint] NULL,
|
|
[ServiceRequestId] [bigint] NULL,
|
|
[Description] [nvarchar](max) NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Table [dbo].[t_z9iro_mfr__users] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
CREATE TABLE [dbo].[t_z9iro_mfr__users](
|
|
[setid] [nvarchar](max) NULL,
|
|
[Id] [bigint] NULL,
|
|
[Version] [int] NULL,
|
|
[UserName] [nvarchar](max) NULL,
|
|
[IsSystem] [bit] NULL,
|
|
[CreationDate] [datetime] NULL,
|
|
[IsApproved] [bit] NULL,
|
|
[ContactId] [bigint] NULL,
|
|
[PreferedLanguage] [nvarchar](max) NULL,
|
|
[EmailChannelEnabled] [bit] NULL,
|
|
[HasFullScreenPreference] [bit] NULL,
|
|
[TimeZone] [int] NULL,
|
|
[PreferedCulture] [nvarchar](max) NULL,
|
|
[IsActive] [bit] NULL,
|
|
[IsMobile] [bit] NULL,
|
|
[LastLoginDate] [datetime] NULL,
|
|
[UserGuideProgress] [nvarchar](max) NULL,
|
|
[DashboardSettings] [nvarchar](max) NULL
|
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
GO
|
|
/****** Object: Index [IX_fuchs_planner_groups] Script Date: 23.04.2021 14:34:50 ******/
|
|
CREATE UNIQUE NONCLUSTERED INDEX [IX_fuchs_planner_groups] ON [dbo].[fuchs_planner_groups]
|
|
(
|
|
[planner_id] ASC,
|
|
[sequence_order] ASC
|
|
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
|
GO
|
|
/****** Object: Index [IX_fuchs_planner_options] Script Date: 23.04.2021 14:34:50 ******/
|
|
CREATE UNIQUE NONCLUSTERED INDEX [IX_fuchs_planner_options] ON [dbo].[fuchs_planner_options]
|
|
(
|
|
[planner_id] ASC,
|
|
[group_id] ASC,
|
|
[option_order] ASC
|
|
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
|
GO
|
|
SET ANSI_PADDING ON
|
|
GO
|
|
/****** Object: Index [ocms_items__ix0] Script Date: 23.04.2021 14:34:50 ******/
|
|
CREATE UNIQUE NONCLUSTERED INDEX [ocms_items__ix0] ON [dbo].[ocms_items]
|
|
(
|
|
[parent_iid] ASC,
|
|
[name] ASC
|
|
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
|
GO
|
|
SET ANSI_PADDING ON
|
|
GO
|
|
/****** Object: Index [ocms_items__ix1] Script Date: 23.04.2021 14:34:50 ******/
|
|
CREATE UNIQUE NONCLUSTERED INDEX [ocms_items__ix1] ON [dbo].[ocms_items]
|
|
(
|
|
[name] ASC
|
|
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
|
GO
|
|
SET ANSI_PADDING ON
|
|
GO
|
|
/****** Object: Index [ocms_navigation__ix1] Script Date: 23.04.2021 14:34:50 ******/
|
|
CREATE UNIQUE NONCLUSTERED INDEX [ocms_navigation__ix1] ON [dbo].[ocms_navigation]
|
|
(
|
|
[ocms_iid] ASC,
|
|
[locale] ASC,
|
|
[alias] ASC
|
|
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
|
GO
|
|
SET ANSI_PADDING ON
|
|
GO
|
|
/****** Object: Index [ocms_template_properties__ix1] Script Date: 23.04.2021 14:34:50 ******/
|
|
CREATE UNIQUE NONCLUSTERED INDEX [ocms_template_properties__ix1] ON [dbo].[ocms_template_properties]
|
|
(
|
|
[ocms_tid] ASC,
|
|
[key] ASC
|
|
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
|
GO
|
|
SET ANSI_PADDING ON
|
|
GO
|
|
/****** Object: Index [ocms_templates__ix1] Script Date: 23.04.2021 14:34:50 ******/
|
|
CREATE UNIQUE NONCLUSTERED INDEX [ocms_templates__ix1] ON [dbo].[ocms_templates]
|
|
(
|
|
[name] ASC
|
|
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
|
GO
|
|
SET ANSI_PADDING ON
|
|
GO
|
|
/****** Object: Index [ocms_useraccounts__ix1] Script Date: 23.04.2021 14:34:50 ******/
|
|
CREATE UNIQUE NONCLUSTERED INDEX [ocms_useraccounts__ix1] ON [dbo].[ocms_useraccounts]
|
|
(
|
|
[email_enc] ASC
|
|
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
|
GO
|
|
ALTER TABLE [dbo].[fuchs_debug] ADD CONSTRAINT [DF_fuchs_debug_date] DEFAULT (getutcdate()) FOR [date]
|
|
GO
|
|
ALTER TABLE [dbo].[fuchs_planner] ADD CONSTRAINT [DF_fuchs_planner_active] DEFAULT ((1)) FOR [active]
|
|
GO
|
|
ALTER TABLE [dbo].[fuchs_planner_groups] ADD CONSTRAINT [DF_fuchs_planner_groups_order] DEFAULT ((0)) FOR [sequence_order]
|
|
GO
|
|
ALTER TABLE [dbo].[fuchs_planner_groups] ADD CONSTRAINT [DF_fuchs_planner_groups_final] DEFAULT ((0)) FOR [final]
|
|
GO
|
|
ALTER TABLE [dbo].[fuchs_planner_groups] ADD CONSTRAINT [DF_fuchs_planner_groups_hide] DEFAULT ((0)) FOR [hide]
|
|
GO
|
|
ALTER TABLE [dbo].[fuchs_planner_options] ADD CONSTRAINT [DF_Table_1_item_oder] DEFAULT ((0)) FOR [option_order]
|
|
GO
|
|
ALTER TABLE [dbo].[fuchs_planner_options] ADD CONSTRAINT [DF_fuchs_planner_options_hide] DEFAULT ((0)) FOR [hide]
|
|
GO
|
|
ALTER TABLE [dbo].[fuchs_planner_traffic] ADD CONSTRAINT [DF_fuchs_planner_traffic_DateSubmitted] DEFAULT (getutcdate()) FOR [DateSubmitted]
|
|
GO
|
|
ALTER TABLE [dbo].[ocms_debug] ADD CONSTRAINT [DF_ocms_debug_timestamp] DEFAULT (getutcdate()) FOR [timestamp]
|
|
GO
|
|
ALTER TABLE [dbo].[ocms_items] ADD CONSTRAINT [DF_ocms_items_view] DEFAULT ((0)) FOR [view]
|
|
GO
|
|
ALTER TABLE [dbo].[ocms_items] ADD CONSTRAINT [DF_ocms_items_hide] DEFAULT ((0)) FOR [hide]
|
|
GO
|
|
ALTER TABLE [dbo].[ocms_items] ADD CONSTRAINT [DF_ocms_items_order] DEFAULT ((0)) FOR [order]
|
|
GO
|
|
ALTER TABLE [dbo].[ocms_items] ADD CONSTRAINT [DF_ocms_items_DateCreated] DEFAULT (getutcdate()) FOR [DateCreated]
|
|
GO
|
|
ALTER TABLE [dbo].[ocms_items] ADD CONSTRAINT [DF_ocms_items_DateModified] DEFAULT (getutcdate()) FOR [DateModified]
|
|
GO
|
|
ALTER TABLE [dbo].[ocms_properties] ADD CONSTRAINT [DF_ocms_properties_DateCreated] DEFAULT (getutcdate()) FOR [DateCreated]
|
|
GO
|
|
ALTER TABLE [dbo].[ocms_properties] ADD CONSTRAINT [DF_ocms_properties_DateModified] DEFAULT (getutcdate()) FOR [DateModified]
|
|
GO
|
|
ALTER TABLE [dbo].[ocms_template_properties] ADD CONSTRAINT [DF_ocms_template_properties_mandatory] DEFAULT ((0)) FOR [mandatory]
|
|
GO
|
|
ALTER TABLE [dbo].[ocms_template_properties] ADD CONSTRAINT [DF_ocms_template_properties_order] DEFAULT ((0)) FOR [order]
|
|
GO
|
|
ALTER TABLE [dbo].[ocms_useraccounts] ADD CONSTRAINT [DF_ocms_useraccounts_DateCreated] DEFAULT (getutcdate()) FOR [DateCreated]
|
|
GO
|
|
ALTER TABLE [dbo].[ocms_useraccounts] ADD CONSTRAINT [DF_ocms_useraccounts_DateModified] DEFAULT (getutcdate()) FOR [DateModified]
|
|
GO
|
|
ALTER TABLE [dbo].[fuchs_planner_groups] WITH CHECK ADD CONSTRAINT [FK_fuchs_planner_groups_fuchs_planner] FOREIGN KEY([planner_id])
|
|
REFERENCES [dbo].[fuchs_planner] ([planner_id])
|
|
GO
|
|
ALTER TABLE [dbo].[fuchs_planner_groups] CHECK CONSTRAINT [FK_fuchs_planner_groups_fuchs_planner]
|
|
GO
|
|
ALTER TABLE [dbo].[fuchs_planner_groups] WITH CHECK ADD CONSTRAINT [FK_fuchs_planner_groups_fuchs_planner_groups] FOREIGN KEY([group_id])
|
|
REFERENCES [dbo].[fuchs_planner_groups] ([group_id])
|
|
GO
|
|
ALTER TABLE [dbo].[fuchs_planner_groups] CHECK CONSTRAINT [FK_fuchs_planner_groups_fuchs_planner_groups]
|
|
GO
|
|
ALTER TABLE [dbo].[fuchs_planner_options] WITH CHECK ADD CONSTRAINT [FK_fuchs_planner_options_fuchs_planner] FOREIGN KEY([planner_id])
|
|
REFERENCES [dbo].[fuchs_planner] ([planner_id])
|
|
GO
|
|
ALTER TABLE [dbo].[fuchs_planner_options] CHECK CONSTRAINT [FK_fuchs_planner_options_fuchs_planner]
|
|
GO
|
|
ALTER TABLE [dbo].[fuchs_planner_options] WITH CHECK ADD CONSTRAINT [FK_fuchs_planner_options_fuchs_planner_groups] FOREIGN KEY([group_id])
|
|
REFERENCES [dbo].[fuchs_planner_groups] ([group_id])
|
|
GO
|
|
ALTER TABLE [dbo].[fuchs_planner_options] CHECK CONSTRAINT [FK_fuchs_planner_options_fuchs_planner_groups]
|
|
GO
|
|
ALTER TABLE [dbo].[ocms_items] WITH CHECK ADD CONSTRAINT [FK_ocms_items_ocms_items] FOREIGN KEY([ocms_iid])
|
|
REFERENCES [dbo].[ocms_items] ([ocms_iid])
|
|
GO
|
|
ALTER TABLE [dbo].[ocms_items] CHECK CONSTRAINT [FK_ocms_items_ocms_items]
|
|
GO
|
|
ALTER TABLE [dbo].[ocms_items] WITH CHECK ADD CONSTRAINT [FK_ocms_items_ocms_properties] FOREIGN KEY([ocms_pid])
|
|
REFERENCES [dbo].[ocms_properties] ([ocms_pid])
|
|
GO
|
|
ALTER TABLE [dbo].[ocms_items] CHECK CONSTRAINT [FK_ocms_items_ocms_properties]
|
|
GO
|
|
ALTER TABLE [dbo].[ocms_items] WITH CHECK ADD CONSTRAINT [FK_ocms_items_ocms_templates] FOREIGN KEY([template_id])
|
|
REFERENCES [dbo].[ocms_templates] ([ocms_tid])
|
|
GO
|
|
ALTER TABLE [dbo].[ocms_items] CHECK CONSTRAINT [FK_ocms_items_ocms_templates]
|
|
GO
|
|
ALTER TABLE [dbo].[ocms_items] WITH CHECK ADD CONSTRAINT [FK_ocms_items_parent__ocms_items] FOREIGN KEY([parent_iid])
|
|
REFERENCES [dbo].[ocms_items] ([ocms_iid])
|
|
GO
|
|
ALTER TABLE [dbo].[ocms_items] CHECK CONSTRAINT [FK_ocms_items_parent__ocms_items]
|
|
GO
|
|
ALTER TABLE [dbo].[ocms_properties] WITH CHECK ADD CONSTRAINT [FK_ocms_properties_ocms_items] FOREIGN KEY([ocms_iid])
|
|
REFERENCES [dbo].[ocms_items] ([ocms_iid])
|
|
ON DELETE CASCADE
|
|
GO
|
|
ALTER TABLE [dbo].[ocms_properties] CHECK CONSTRAINT [FK_ocms_properties_ocms_items]
|
|
GO
|
|
ALTER TABLE [dbo].[ocms_template_properties] WITH CHECK ADD CONSTRAINT [FK_ocms_template_properties_ocms_items] FOREIGN KEY([ocms_tid])
|
|
REFERENCES [dbo].[ocms_templates] ([ocms_tid])
|
|
GO
|
|
ALTER TABLE [dbo].[ocms_template_properties] CHECK CONSTRAINT [FK_ocms_template_properties_ocms_items]
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[fds__admin_logdebug] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
-- =============================================
|
|
-- Author: Dr. Stefan Ott
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[fds__admin_logdebug]
|
|
@CodeReference varchar(255)
|
|
,@ExceptionMessage varchar(max)
|
|
,@StackTrace varchar(max)
|
|
,@Data varchar(MAX)
|
|
AS
|
|
BEGIN
|
|
SET NOCOUNT ON;
|
|
|
|
|
|
INSERT INTO [dbo].[fds__debuglog]
|
|
([CodeReference]
|
|
,[ExceptionMessage]
|
|
,[StackTrace]
|
|
,[Data]
|
|
,[timestamp])
|
|
VALUES
|
|
(@CodeReference
|
|
,@ExceptionMessage
|
|
,@StackTrace
|
|
,@Data
|
|
,GETUTCDATE());
|
|
|
|
|
|
END
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[fds__setStatus] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[fds__setStatus]
|
|
@table varchar(50)
|
|
,@action varchar(50)
|
|
,@setid varchar(50)
|
|
AS
|
|
BEGIN
|
|
SET NOCOUNT ON;
|
|
DECLARE @now datetime = GETUTCDATE();
|
|
|
|
MERGE [dbo].[fds__status] as TARGET
|
|
USING (VALUES(@table, @action, @now,@setid)) as src ([table],[action],[timestamp],[setid])
|
|
ON TARGET.[table] = src.[table] and TARGET.[action] = src.[action]
|
|
WHEN MATCHED THEN
|
|
UPDATE SET [timestamp] = src.[timestamp], [setid] = src.[setid]
|
|
WHEN NOT MATCHED BY TARGET THEN
|
|
INSERT ([table],[action],[timestamp],[setid])
|
|
VALUES (src.[table],src.[action],src.[timestamp],src.[setid]);
|
|
|
|
|
|
INSERT INTO [dbo].[fds__log]([table],[action],[timestamp],[setid])
|
|
VALUES (@table,@action,@now,@setid);
|
|
|
|
END
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[fuchs_planner_getNext] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[fuchs_planner_getNext]
|
|
@planner tinyint
|
|
,@session varchar(10)
|
|
,@group_code varchar(10)
|
|
,@values varchar(4000)
|
|
AS
|
|
BEGIN
|
|
SET NOCOUNT ON;
|
|
|
|
DECLARE @GROUPS TABLE (
|
|
[sessionid] varchar(5)
|
|
,[group_id] int
|
|
,[code] varchar(10)
|
|
,[planner_id] tinyint
|
|
,[sequence_order] tinyint
|
|
,[parent_codes] varchar(50)
|
|
,[condition] varchar(50)
|
|
,[shortname] varchar(15)
|
|
,[name] varchar(100)
|
|
,[description] varchar(max)
|
|
,[selection_type] varchar(10)
|
|
,[final] bit
|
|
,[hide] bit
|
|
,[values] varchar(4000)
|
|
,[level] tinyint
|
|
,[grouporder] tinyint
|
|
);
|
|
|
|
SET @session = ISNULL(@session, (SELECT TOP(1) [s] FROM [dbo].[ott_20_randomstrings](5) as rs WHERE NOT EXISTS (SELECT * FROM [fuchs_planner_traffic] as t WHERE t.[sessionid] = rs.[s])));
|
|
INSERT INTO [dbo].[fuchs_planner_traffic] ([planner_id], [sessionid],[group_code],[values]) VALUES(@planner, @session, @group_code, ISNULL(@values, ''));
|
|
|
|
with
|
|
traffic as (SELECT *, CAST(CASE WHEN ROW_NUMBER() OVER (PARTITION BY t.[sessionid],t.[group_code] ORDER BY t.[DateSubmitted] DESC) = 1 THEN 1 ELSE 0 END as bit) as 'last' FROM [dbo].[fuchs_planner_traffic] as t WHERE t.[sessionid] = @session and t.[planner_id] = @planner)
|
|
, plannergroups as (SELECT * FROM [dbo].[fuchs_planner_groups] where [planner_id] = @planner
|
|
UNION
|
|
SELECT * FROM (VALUES (
|
|
-1
|
|
,'contact'
|
|
,@planner
|
|
,255
|
|
,'*'
|
|
,NULL
|
|
,'contact_form'
|
|
,'Ihre Kontaktdaten'
|
|
,'<p>Bitte nennen Sie uns Ihre Kontaktdaten, so dass wir Sie kontaktieren können.</p>'
|
|
,'contact'
|
|
,1
|
|
,0
|
|
)
|
|
) as cf ( [group_id]
|
|
,[code]
|
|
,[planner_id]
|
|
,[sequence_order]
|
|
,[parent_codes]
|
|
,[condition]
|
|
,[shortname]
|
|
,[name]
|
|
,[description]
|
|
,[selection_type]
|
|
,[final]
|
|
,[hide]
|
|
)
|
|
)
|
|
, vals as (SELECT * FROM traffic WHERE [last] = 1)
|
|
, g as (select
|
|
plannergroups.*
|
|
, ISNULL(vals.[values],'') as 'values'
|
|
, ROW_NUMBER() OVER (PARTITION BY plannergroups.[parent_codes] ORDER BY [sequence_order]) AS 'groupfactor'
|
|
FROM plannergroups left join vals ON plannergroups.[code] = vals.[group_code]
|
|
where plannergroups.hide = 0)
|
|
, cte as (
|
|
SELECT @session as [session], g.*, Cast([sequence_order] as tinyint) as [level]
|
|
, CAST(0 as bit) as [exclude]
|
|
, CAST(CASE WHEN [group_id] = -1 THEN POWER(10,7) ELSE 0 END as int) as 'roworder' /* contact form is always last */
|
|
FROM g
|
|
WHERE g.[sequence_order] = 0 OR g.group_id = -1
|
|
UNION ALL
|
|
SELECT @session as [session], g.*, Cast(cte.[level] + 1 as tinyint) as [level]
|
|
, CAST(CASE WHEN cte.[exclude] = 1 THEN 1
|
|
WHEN ISNULL(g.[condition], '') in ('', '{}') THEN 0
|
|
WHEN EXISTS (SELECT * FROM g as gv JOIN [dbo].[fuchs_planner_options] as o
|
|
ON gv.[group_id] = o.[group_id] and o.[option_type] in ('a','c','o')
|
|
AND [dbo].[ott_jcsv_contains](gv.code, gv.[values], o.[code]) = 1
|
|
WHERE [dbo].[ott_csv_contains](g.[condition], o.[code]) = 1 )
|
|
THEN 0
|
|
ELSE 1
|
|
END as bit) as [exclude]
|
|
, cte.[roworder] + Cast(g.[groupfactor] as int) * CAST(POWER(10,4-cte.[level]) as int) as 'roworder' /* by this, the children have a lower number than the following on same level */
|
|
FROM g JOIN cte on g.[sequence_order] > cte.[sequence_order]
|
|
AND cte.group_id >= 0 AND g.group_id >= 0 --not the contact form
|
|
AND [dbo].[ott_csv_contains](g.[parent_codes], cte.[code]) = 1
|
|
AND cte.[final] = 0
|
|
--AND cte.[exclude] = 0
|
|
)
|
|
, f as (
|
|
select
|
|
cte.*
|
|
, ROW_NUMBER() OVER (ORDER BY [roworder], [sequence_order]) as 'grouporder'
|
|
FROM cte
|
|
where exclude = 0
|
|
)
|
|
, this as (SELECT TOP(1) * FROM f WHERE [code] = @group_code)
|
|
insert into @GROUPS
|
|
select TOP(1)
|
|
f.[session]
|
|
,f.[group_id]
|
|
,f.[code]
|
|
,f.[planner_id]
|
|
,f.[sequence_order]
|
|
,f.[parent_codes]
|
|
,f.[condition]
|
|
,f.[shortname]
|
|
,f.[name]
|
|
,f.[description]
|
|
,f.[selection_type]
|
|
,f.[final]
|
|
,f.[hide]
|
|
,f.[values]
|
|
,f.[level]
|
|
,f.[grouporder]
|
|
FROM f left join this on f.[grouporder] > this.[grouporder]
|
|
WHERE NOT EXISTS (SELECT * FROM this) OR (f.grouporder > this.grouporder AND ISNULL(this.final,0) = 0)
|
|
ORDER BY f.[grouporder] ASC;
|
|
|
|
|
|
-- output
|
|
SELECT * FROM @GROUPS;
|
|
|
|
-- output
|
|
SELECT o.*
|
|
FROM [dbo].[fuchs_planner_options] as o
|
|
JOIN @GROUPS as g on o.[planner_id] = g.[planner_id] AND o.[group_id] = g.[group_id]
|
|
AND (ISNULL(o.[condition], '') = ''
|
|
OR EXISTS (SELECT * FROM @GROUPS as gv WHERE [dbo].[ott_csv_contains](o.[condition], gv.[values]) = 1 )
|
|
)
|
|
|
|
|
|
END
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[fuchs_planner_getPrev] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[fuchs_planner_getPrev]
|
|
@planner tinyint
|
|
,@session varchar(10)
|
|
,@group_code varchar(10)
|
|
,@values varchar(4000)
|
|
AS
|
|
BEGIN
|
|
SET NOCOUNT ON;
|
|
|
|
DECLARE @GROUPS TABLE (
|
|
[sessionid] varchar(5)
|
|
,[group_id] int
|
|
,[code] varchar(10)
|
|
,[planner_id] tinyint
|
|
,[sequence_order] tinyint
|
|
,[parent_codes] varchar(50)
|
|
,[condition] varchar(50)
|
|
,[shortname] varchar(15)
|
|
,[name] varchar(100)
|
|
,[description] varchar(max)
|
|
,[selection_type] varchar(10)
|
|
,[final] bit
|
|
,[hide] bit
|
|
,[values] varchar(4000)
|
|
,[level] tinyint
|
|
,[grouporder] tinyint
|
|
);
|
|
|
|
SET @session = ISNULL(@session, (SELECT TOP(1) [s] FROM [dbo].[ott_20_randomstrings](5) as rs WHERE NOT EXISTS (SELECT * FROM [fuchs_planner_traffic] as t WHERE t.[sessionid] = rs.[s])));
|
|
INSERT INTO [dbo].[fuchs_planner_traffic] ([planner_id], [sessionid],[group_code],[values]) VALUES(@planner, @session, @group_code, ISNULL(@values, ''));
|
|
|
|
with
|
|
traffic as (SELECT *, CAST(CASE WHEN ROW_NUMBER() OVER (PARTITION BY t.[sessionid],t.[group_code] ORDER BY t.[DateSubmitted] DESC) = 1 THEN 1 ELSE 0 END as bit) as 'last' FROM [dbo].[fuchs_planner_traffic] as t WHERE t.[sessionid] = @session and t.[planner_id] = @planner)
|
|
, plannergroups as (SELECT * FROM [dbo].[fuchs_planner_groups] where [planner_id] = @planner
|
|
UNION
|
|
SELECT * FROM (VALUES (
|
|
-1
|
|
,'contact'
|
|
,@planner
|
|
,255
|
|
,'*'
|
|
,NULL
|
|
,'contact_form'
|
|
,'Ihre Kontaktdaten'
|
|
,'<p>Bitte nennen Sie uns Ihre Kontaktdaten, so dass wir Sie kontaktieren können.</p>'
|
|
,'contact'
|
|
,1
|
|
,0
|
|
)
|
|
) as cf ( [group_id]
|
|
,[code]
|
|
,[planner_id]
|
|
,[sequence_order]
|
|
,[parent_codes]
|
|
,[condition]
|
|
,[shortname]
|
|
,[name]
|
|
,[description]
|
|
,[selection_type]
|
|
,[final]
|
|
,[hide]
|
|
)
|
|
)
|
|
, vals as (SELECT * FROM traffic WHERE [last] = 1)
|
|
, g as (select
|
|
plannergroups.*
|
|
, ISNULL(vals.[values],'') as 'values'
|
|
, ROW_NUMBER() OVER (PARTITION BY plannergroups.[parent_codes] ORDER BY [sequence_order]) AS 'groupfactor'
|
|
FROM plannergroups left join vals ON plannergroups.[code] = vals.[group_code]
|
|
where plannergroups.hide = 0)
|
|
, cte as (
|
|
SELECT @session as [session], g.*, Cast([sequence_order] as tinyint) as [level]
|
|
, CAST(0 as bit) as [exclude]
|
|
, CAST(CASE WHEN [group_id] = -1 THEN POWER(10,7) ELSE 0 END as int) as 'roworder' /* contact form is always last */
|
|
FROM g
|
|
WHERE g.[sequence_order] = 0 OR g.group_id = -1
|
|
UNION ALL
|
|
SELECT @session as [session], g.*, Cast(cte.[level] + 1 as tinyint) as [level]
|
|
, CAST(CASE WHEN cte.[exclude] = 1 THEN 1
|
|
WHEN ISNULL(g.[condition], '') in ('', '{}') THEN 0
|
|
WHEN EXISTS (SELECT * FROM g as gv JOIN [dbo].[fuchs_planner_options] as o
|
|
ON gv.[group_id] = o.[group_id] and o.[option_type] in ('a','c','o')
|
|
AND [dbo].[ott_jcsv_contains](gv.code, gv.[values], o.[code]) = 1
|
|
WHERE [dbo].[ott_csv_contains](g.[condition], o.[code]) = 1 )
|
|
THEN 0
|
|
ELSE 1
|
|
END as bit) as [exclude]
|
|
, cte.[roworder] + Cast(g.[groupfactor] as int) * CAST(POWER(10,4-cte.[level]) as int) as 'roworder' /* by this, the children have a lower number than the following on same level */
|
|
FROM g JOIN cte on g.[sequence_order] > cte.[sequence_order]
|
|
AND cte.group_id >= 0 AND g.group_id >= 0 --not the contact form
|
|
AND [dbo].[ott_csv_contains](g.[parent_codes], cte.[code]) = 1
|
|
AND cte.[final] = 0
|
|
--AND cte.[exclude] = 0
|
|
)
|
|
, f as (
|
|
select
|
|
cte.*
|
|
, ROW_NUMBER() OVER (ORDER BY [roworder], [sequence_order]) as 'grouporder'
|
|
FROM cte
|
|
where exclude = 0
|
|
)
|
|
, this as (SELECT TOP(1) * FROM f WHERE [code] = @group_code)
|
|
insert into @GROUPS
|
|
select TOP(1)
|
|
f.[session]
|
|
,f.[group_id]
|
|
,f.[code]
|
|
,f.[planner_id]
|
|
,f.[sequence_order]
|
|
,f.[parent_codes]
|
|
,f.[condition]
|
|
,f.[shortname]
|
|
,f.[name]
|
|
,f.[description]
|
|
,f.[selection_type]
|
|
,f.[final]
|
|
,f.[hide]
|
|
,f.[values]
|
|
,f.[level]
|
|
,f.[grouporder]
|
|
FROM f left join this on f.[grouporder] < this.[grouporder] --lower than
|
|
WHERE NOT EXISTS (SELECT * FROM this) OR f.grouporder < this.grouporder OR f.grouporder = 0 /* =0 to at least have the first page returned */
|
|
ORDER BY f.[grouporder] DESC; -- DESCending is important
|
|
|
|
|
|
-- output
|
|
SELECT * FROM @GROUPS;
|
|
|
|
-- output
|
|
SELECT o.*
|
|
FROM [dbo].[fuchs_planner_options] as o
|
|
JOIN @GROUPS as g on o.[planner_id] = g.[planner_id] AND o.[group_id] = g.[group_id]
|
|
AND (ISNULL(o.[condition], '') = ''
|
|
OR EXISTS (SELECT * FROM @GROUPS as gv WHERE [dbo].[ott_csv_contains](o.[condition], gv.[values]) = 1 )
|
|
)
|
|
|
|
|
|
END
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[fuchs_planner_getSummary] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[fuchs_planner_getSummary]
|
|
@planner tinyint
|
|
,@session varchar(10)
|
|
AS
|
|
BEGIN
|
|
|
|
SET NOCOUNT ON;
|
|
|
|
DECLARE @GROUPS TABLE (
|
|
[sessionid] varchar(5)
|
|
,[group_id] int
|
|
,[code] varchar(10)
|
|
,[planner_id] tinyint
|
|
,[sequence_order] tinyint
|
|
,[parent_codes] varchar(50)
|
|
,[condition] varchar(50)
|
|
,[shortname] varchar(15)
|
|
,[name] varchar(100)
|
|
,[description] varchar(max)
|
|
,[selection_type] varchar(10)
|
|
,[final] bit
|
|
,[hide] bit
|
|
,[values] varchar(4000)
|
|
,[level] tinyint
|
|
,[grouporder] tinyint
|
|
);
|
|
|
|
IF ISNULL(@session, '') <> ''
|
|
BEGIN
|
|
|
|
|
|
with
|
|
traffic as (SELECT *, CAST(CASE WHEN ROW_NUMBER() OVER (PARTITION BY t.[sessionid],t.[group_code] ORDER BY t.[DateSubmitted] DESC) = 1 THEN 1 ELSE 0 END as bit) as 'last' FROM [dbo].[fuchs_planner_traffic] as t WHERE t.[sessionid] = @session and t.[planner_id] = @planner)
|
|
, plannergroups as (SELECT * FROM [dbo].[fuchs_planner_groups] where [planner_id] = @planner
|
|
UNION
|
|
SELECT * FROM (VALUES (
|
|
-1
|
|
,'contact'
|
|
,@planner
|
|
,255
|
|
,'*'
|
|
,NULL
|
|
,'contact_form'
|
|
,'Ihre Kontaktdaten'
|
|
,'<p>Bitte nennen Sie uns Ihre Kontaktdaten, so dass wir Sie kontaktieren können.</p>'
|
|
,'contact'
|
|
,1
|
|
,0
|
|
)
|
|
) as cf ( [group_id]
|
|
,[code]
|
|
,[planner_id]
|
|
,[sequence_order]
|
|
,[parent_codes]
|
|
,[condition]
|
|
,[shortname]
|
|
,[name]
|
|
,[description]
|
|
,[selection_type]
|
|
,[final]
|
|
,[hide]
|
|
)
|
|
)
|
|
, vals as (SELECT * FROM traffic WHERE [last] = 1)
|
|
, g as (select
|
|
plannergroups.*
|
|
, ISNULL(vals.[values],'') as 'values'
|
|
, ROW_NUMBER() OVER (PARTITION BY plannergroups.[parent_codes] ORDER BY [sequence_order]) AS 'groupfactor'
|
|
FROM plannergroups left join vals ON plannergroups.[code] = vals.[group_code]
|
|
where plannergroups.hide = 0)
|
|
, cte as (
|
|
SELECT @session as [session], g.*, Cast([sequence_order] as tinyint) as [level]
|
|
, CAST(0 as bit) as [exclude]
|
|
, CAST(CASE WHEN [group_id] = -1 THEN POWER(10,7) ELSE 0 END as int) as 'roworder' /* contact form is always last */
|
|
FROM g
|
|
WHERE g.[sequence_order] = 0 OR g.group_id = -1
|
|
UNION ALL
|
|
SELECT @session as [session], g.*, Cast(cte.[level] + 1 as tinyint) as [level]
|
|
, CAST(CASE WHEN cte.[exclude] = 1 THEN 1
|
|
WHEN ISNULL(g.[condition], '') in ('', '{}') THEN 0
|
|
WHEN EXISTS (SELECT * FROM g as gv JOIN [dbo].[fuchs_planner_options] as o
|
|
ON gv.[group_id] = o.[group_id] and o.[option_type] in ('a','c','o')
|
|
AND [dbo].[ott_jcsv_contains](gv.code, gv.[values], o.[code]) = 1
|
|
WHERE [dbo].[ott_csv_contains](g.[condition], o.[code]) = 1 )
|
|
THEN 0
|
|
ELSE 1
|
|
END as bit) as [exclude]
|
|
, cte.[roworder] + Cast(g.[groupfactor] as int) * CAST(POWER(10,4-cte.[level]) as int) as 'roworder' /* by this, the children have a lower number than the following on same level */
|
|
FROM g JOIN cte on g.[sequence_order] > cte.[sequence_order]
|
|
AND cte.group_id >= 0 AND g.group_id >= 0 --not the contact form
|
|
AND [dbo].[ott_csv_contains](g.[parent_codes], cte.[code]) = 1
|
|
AND cte.[final] = 0
|
|
--AND cte.[exclude] = 0
|
|
)
|
|
, f as (
|
|
select
|
|
cte.*
|
|
, ROW_NUMBER() OVER (ORDER BY [roworder], [sequence_order]) as 'grouporder'
|
|
FROM cte
|
|
where exclude = 0
|
|
)
|
|
insert into @GROUPS
|
|
select
|
|
f.[session]
|
|
,f.[group_id]
|
|
,f.[code]
|
|
,f.[planner_id]
|
|
,f.[sequence_order]
|
|
,f.[parent_codes]
|
|
,f.[condition]
|
|
,f.[shortname]
|
|
,f.[name]
|
|
,f.[description]
|
|
,f.[selection_type]
|
|
,f.[final]
|
|
,f.[hide]
|
|
,f.[values]
|
|
,f.[level]
|
|
,f.[grouporder]
|
|
FROM f
|
|
ORDER BY f.[grouporder] ASC;
|
|
|
|
|
|
-- output
|
|
SELECT
|
|
g.[group_id]
|
|
,g.[shortname]
|
|
,g.[code]
|
|
,g.[name]
|
|
--,[dbo].[ott_jcontent](g.[code],g.[values]) as 'values'
|
|
, g.[values]
|
|
,g.[grouporder]
|
|
,g.[selection_type]
|
|
FROM @GROUPS as g;
|
|
|
|
-- output
|
|
SELECT o.*
|
|
,ISNULL([dbo].[ott_jcontent](o.[code],g.[values]), '')
|
|
FROM [dbo].[fuchs_planner_options] as o
|
|
JOIN @GROUPS as g on o.[planner_id] = g.[planner_id] AND o.[group_id] = g.[group_id]
|
|
AND (ISNULL(o.[condition], '') = ''
|
|
OR EXISTS (SELECT * FROM @GROUPS as gv WHERE [dbo].[ott_csv_contains](o.[condition], gv.[values]) = 1 )
|
|
)
|
|
WHERE (CASE WHEN [dbo].[ott_jcsv_contains](g.[code],g.[values],o.[code]) = 1 THEN 1
|
|
WHEN [dbo].[ott_jcsv_containskey](o.[code], g.[values]) =1 THEN 1
|
|
ELSE 0 END) = 1
|
|
or 1= 1
|
|
--OR ISNULL([dbo].[ott_jcontent](o.[code],g.[values]), '') <> ''
|
|
|
|
|
|
END
|
|
END
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[fuchs_planner_submit] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[fuchs_planner_submit]
|
|
@planner tinyint
|
|
,@session varchar(10)
|
|
,@group_code varchar(10)
|
|
,@values varchar(4000)
|
|
AS
|
|
BEGIN
|
|
SET NOCOUNT ON;
|
|
|
|
SET @session = ISNULL(@session, (SELECT TOP(1) [s] FROM [dbo].[ott_20_randomstrings](5) as rs WHERE NOT EXISTS (SELECT * FROM [fuchs_planner_traffic] as t WHERE t.[sessionid] = rs.[s])));
|
|
INSERT INTO [dbo].[fuchs_planner_traffic] ([planner_id], [sessionid],[group_code],[values]) VALUES(@planner, @session, @group_code, ISNULL(@values, ''));
|
|
|
|
|
|
END
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[mfr__getSchema] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[mfr__getSchema]
|
|
@info varchar(25)
|
|
,@tgttype varchar(50)
|
|
AS
|
|
BEGIN
|
|
SET NOCOUNT ON;
|
|
|
|
DECLARe @AS XML = [dbo].[mfr__schema]();
|
|
|
|
IF @info = 'table'
|
|
BEGIN
|
|
DECLARE @AssociationSets TABLE([#] int, [name] varchar(255), [set] varchar(255), [Association] varchar(255), [role1] varchar(255), [role2] varchar(255), [set1] varchar(255), [set2] varchar(255), [arole1] varchar(255), [arole2] varchar(255), [multi1] varchar(255), [multi2] varchar(255), [tablename] varchar(255));
|
|
DECLARE @ComplexProps TABLE([#] int, [Type] varchar(255), [typ] varchar(50), [name] varchar(255), [EntityType] varchar(255), [tablename] varchar(255));
|
|
DECLARE @NavigationProps TABLE([#] int, [Type] varchar(255), [typ] varchar(50), [name] varchar(255), [ToRole] varchar(255), [FromRole] varchar(255), [countertype] varchar(255), [counterset] varchar(255), [tablename] varchar(255), [countertable] varchar(255), [Association] varchar(255));
|
|
DECLARE @EntityTypes TABLE([#] int, [typ] varchar(50), [name] varchar(255), [set] varchar(255), [EntitySet] varchar(255), [tablename] varchar(255), [url] varchar(500), [DateColumn] varchar(25));
|
|
|
|
WITH XMLNAMESPACES
|
|
(
|
|
|
|
'http://schemas.microsoft.com/ado/2007/06/edmx' as edmx,
|
|
'http://schemas.microsoft.com/ado/2007/08/dataservices/metadata' as m
|
|
) , x as (
|
|
SELECT ROW_NUMBER() OVER(ORDER BY (SELECT NULL)) as '#'
|
|
, xD.value('@Name', 'varchar(255)') as 'set'
|
|
, xD.value('@Association', 'varchar(255)') as 'association'
|
|
, xD.value('End[1]/@Role', 'varchar(255)') as 'role1'
|
|
, xD.value('End[2]/@Role', 'varchar(255)') as 'role2'
|
|
, LOWER(xD.value('End[1]/@EntitySet', 'varchar(255)')) as 'set1'
|
|
, LOWER(xD.value('End[2]/@EntitySet', 'varchar(255)')) as 'set2'
|
|
--, xD.query('.') as 'q'
|
|
from @as.nodes('/Schema/EntityContainer/AssociationSet') as xm(xD)
|
|
) , y as (
|
|
SELECT ROW_NUMBER() OVER(ORDER BY (SELECT NULL)) as '#'
|
|
, xD.value('@Name', 'varchar(255)') as 'association'
|
|
, xD.value('End[1]/@Role', 'varchar(255)') as 'arole1'
|
|
, xD.value('End[2]/@Role', 'varchar(255)') as 'arole2'
|
|
, xD.value('End[1]/@Multiplicity', 'varchar(255)') as 'multi1'
|
|
, xD.value('End[2]/@Multiplicity', 'varchar(255)') as 'multi2'
|
|
--, xD.query('.') as 'q'
|
|
from @as.nodes('/Schema/Association') as xm(xD)
|
|
), z as (
|
|
select x.[#], x.[role1], x.[role2], x.[set1], x.[set2], RIGHT(x.[set],CHARINDEX('_', REVERSE(x.[set])) - 1) as [name],x.[set],x.[association], y.[arole1], y.[arole2], y.[multi1], y.[multi2]
|
|
from x LEFT JOIN y on x.association like ('%[.]' + y.[association])
|
|
)
|
|
INSERT INTO @AssociationSets
|
|
SELECT [#], z.[name],[set], [association],[role1],[role2], [set1], [set2] , [arole1], [arole2], [multi1], [multi2], 'mfr__*PartnerSet' as [tablename]
|
|
FROM z
|
|
LEFT JOIN sys.objects as o ON o.[name] like ('mfr__[*]' + (LOWER(z.[name])));
|
|
|
|
|
|
WITH XMLNAMESPACES
|
|
(
|
|
'http://schemas.microsoft.com/ado/2007/06/edmx' as edmx,
|
|
'http://schemas.microsoft.com/ado/2007/08/dataservices/metadata' as m
|
|
), et as (
|
|
SELECT ROW_NUMBER() OVER(ORDER BY (SELECT NULL)) as '#'
|
|
, xD.value('local-name(.)', 'varchar(50)') as [type]
|
|
, xD.value('@Name', 'varchar(255)') as [EntityType] --, xD.query('.') as 'q'
|
|
, xS.value('@Name', 'varchar(255)') as [Set]
|
|
, o.[name] as [tablename]
|
|
from @as.nodes('/Schema[1]/EntityType') as xm(xD)
|
|
JOIN @as.nodes('/Schema/EntityContainer/EntitySet') as xn(xS) ON (xS.value('@EntityType', 'varchar(255)')) like ('MFR.%[.]' + (xD.value('@Name', 'varchar(255)')))
|
|
JOIN sys.objects as o ON o.[name] like ('mfr__' + (LOWER(xS.value('@Name', 'varchar(255)'))))
|
|
union
|
|
SELECT ROW_NUMBER() OVER(ORDER BY (SELECT NULL)) as '#'
|
|
, xD.value('local-name(.)', 'varchar(50)') as [type]
|
|
, xD.value('@Name', 'varchar(255)') as [EntityType] --, xD.query('.') as 'q'
|
|
, '' as [Set]
|
|
, o.[name] as [tablename]
|
|
from @as.nodes('/Schema[1]/ComplexType') as xm(xD)
|
|
JOIN sys.objects as o ON o.[name] like ('mfr__[#]' + (LOWER(xD.value('@Name', 'varchar(255)'))) + 's')
|
|
)
|
|
INSERT INTO @EntityTypes SELECT [#],[type],[EntityType],[set] = LOWER([set]), [EntitySet] = [set], [tablename], null, null FROM et;
|
|
|
|
WITH XMLNAMESPACES
|
|
(
|
|
'http://schemas.microsoft.com/ado/2007/06/edmx' as edmx,
|
|
'http://schemas.microsoft.com/ado/2007/08/dataservices/metadata' as m
|
|
), np as (
|
|
SELECT ROW_NUMBER() OVER(ORDER BY (SELECT NULL)) as '#'
|
|
, xD.value('../@Name', 'varchar(255)') as [property]
|
|
, xD.value('@Type', 'varchar(255)') as [nodetype]
|
|
|
|
, xD.value('@Name', 'varchar(255)') as [name]
|
|
from @as.nodes('/Schema[1]/EntityType/Property') as xm(xD)
|
|
)
|
|
INSERT INTO @ComplexProps
|
|
SELECT np.[#]
|
|
, [property]
|
|
, [type] = CASE WHEN [nodetype] like 'collection%' THEN 'array' ELSE '' END
|
|
, np.[name]
|
|
, [EntityType] = et.[name]
|
|
, et.[tablename]
|
|
from np LEFT JOIN @EntityTypes as et on np.[name] like (et.[name] + '%')
|
|
WHERE nodetype like '%MFR[.]%';
|
|
|
|
WITH XMLNAMESPACES
|
|
(
|
|
'http://schemas.microsoft.com/ado/2007/06/edmx' as edmx,
|
|
'http://schemas.microsoft.com/ado/2007/08/dataservices/metadata' as m
|
|
), np as (
|
|
SELECT ROW_NUMBER() OVER(ORDER BY (SELECT NULL)) as '#'
|
|
, xD.value('../@Name', 'varchar(255)') as [property]
|
|
, CASE WHEN a.[arole1] = xD.value('@ToRole', 'varchar(255)') AND a.[multi1] = '*' THEN 'array'
|
|
WHEN a.[arole1] = xD.value('@ToRole', 'varchar(255)') AND a.[multi1] = '0..1' THEN 'ref'
|
|
WHEN a.[arole2] = xD.value('@ToRole', 'varchar(255)') AND a.[multi2] = '*' THEN 'array'
|
|
WHEN a.[arole2] = xD.value('@ToRole', 'varchar(255)') AND a.[multi2] = '0..1' THEN 'ref'
|
|
END as [typ]
|
|
, xD.value('@Name', 'varchar(255)') as [name]
|
|
, xD.value('@ToRole', 'varchar(255)') as [ToRole]
|
|
, xD.value('@FromRole', 'varchar(255)') as [FromRole]
|
|
, CASE WHEN xD.value('@ToRole', 'varchar(255)') = a.[role2] THEN [set2] ELSE [set1] END [counterset]
|
|
, a.[tablename] --xD.value('@Relationship', 'varchar(255)') as
|
|
, a.[Association]
|
|
-- , xD.query('.') as 'q'
|
|
from @as.nodes('/Schema[1]/EntityType/NavigationProperty') as xm(xD)
|
|
LEFT JOIN @AssociationSets as a on (xD.value('@Relationship', 'varchar(255)')) like a.[Association]
|
|
)
|
|
INSERT INTO @NavigationProps SELECT np.[#], [property], np.[typ],np.[name],[ToRole], [FromRole],[countertype] = et.[name], [counterset],np.[tablename], [countertable] = et.tablename, [Association] = NULL
|
|
from np LEFT JOIN @EntityTypes as et on np.counterset = et.[set];
|
|
|
|
|
|
UPDATE et SET
|
|
[url] = [EntitySet] +
|
|
CASE WHEN EXISTS (SELECT * FROM @NavigationProps as np WHERE np.[type] = et.[name])
|
|
THEN '?$expand=' + STUFF((SELECT ',' + [name] as [text()] FROM @NavigationProps as np WHERE np.[type] = et.[name] ORDER BY [#] FOR XML PATH('')),1,1, '')
|
|
ELSE '' END
|
|
,[DateColumn] = (SELECT TOP(1) cols.[COLUMN_NAME] FROM INFORMATION_SCHEMA.COLUMNS as cols WHERE cols.[TABLE_NAME] = et.[tablename] AND ([COLUMN_NAME] COLLATE Latin1_General_CI_AS IN ('DateModified','DateCreated')) ORDER BY cols.[COLUMN_NAME] DESC)
|
|
FROM @EntityTypes as et;
|
|
|
|
|
|
SELECT * FROM @EntityTypes as et WHERE @tgttype is null or et.name = @tgttype;
|
|
SELECT * FROM @ComplexProps as cp where @tgttype is null or cp.[type] = @tgttype;
|
|
SELECT n.* FROM @NavigationProps as n WHERE @tgttype is null or n.[type] = @tgttype;
|
|
--SELECT * FROM @AssociationSets;
|
|
|
|
with tt as (
|
|
--SELECT [tablename] FROM @EntityTypes
|
|
--UNION
|
|
SELECT [tablename] FROM @ComplexProps as cp where @tgttype is null or cp.[type] = @tgttype
|
|
UNION
|
|
SELECT [tablename] FROM @NavigationProps as n WHERE @tgttype is null or n.[type] = @tgttype
|
|
UNION
|
|
SELECT [tablename] = [countertable] FROM @NavigationProps as n WHERE @tgttype is null or n.[type] = @tgttype
|
|
)
|
|
SELECT DISTINCT [tablename] from tt
|
|
where not exists(SELECT * FROM @EntityTypes as et where et.tablename = tt.[tablename] AND (@tgttype is null or et.name = @tgttype));
|
|
|
|
END
|
|
ELSE IF @info = 'tabledef'
|
|
BEGIN
|
|
DECLARE @types TABLE ([edm] varchar(100), [sql] varchar(50));
|
|
INSERT INTO @types VALUES ('Edm.Boolean', 'bit'),
|
|
('Edm.DateTime', 'DateTime'),
|
|
('Edm.Decimal', 'decimal'),
|
|
('Edm.Double', 'float'),
|
|
('Edm.Int32', 'int'),
|
|
('Edm.Int64', 'bigint'),
|
|
('Edm.String', 'varchar(255)');
|
|
|
|
|
|
END
|
|
END
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[mfr__updt__#locations] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[mfr__updt__#locations]
|
|
@tblname as nvarchar(50)
|
|
AS
|
|
BEGIN
|
|
SET NOCOUNT ON;
|
|
|
|
DECLARE @tmp [dbo].[mfr__tt__#locations];
|
|
|
|
DECLARE @tmp_cmd nvarchar(1000) = N'SELECT DISTINCT * FROM ' + @tblname;
|
|
INSERT INTO @tmp EXECUTE [sp_executesql] @tmp_cmd;
|
|
|
|
|
|
MERGE [dbo].[mfr__#locations] as TARGET
|
|
USING @tmp as SOURCE ON TARGET.[Id] = SOURCE.[Id] AND TARGET.[Property] = SOURCE.[Property]
|
|
WHEN MATCHED AND (TARGET.[Version] <= SOURCE.[Version]) THEN
|
|
UPDATE
|
|
SET [Id] = SOURCE.[Id]
|
|
,[EntityId] = SOURCE.[EntityId]
|
|
,[Property] = SOURCE.[Property]
|
|
,[Version] = SOURCE.[Version]
|
|
,[AddressString] = SOURCE.[AddressString]
|
|
,[Postal] = SOURCE.[Postal]
|
|
,[City] = SOURCE.[City]
|
|
,[State] = SOURCE.[State]
|
|
,[Country] = SOURCE.[Country]
|
|
,[Longitude] = SOURCE.[Longitude]
|
|
,[Latitude] = SOURCE.[Latitude]
|
|
,[IsValidLocation] = SOURCE.[IsValidLocation]
|
|
WHEN NOT MATCHED BY TARGET THEN
|
|
INSERT
|
|
( [Id]
|
|
,[EntityId]
|
|
,[Property]
|
|
,[Version]
|
|
,[AddressString]
|
|
,[Postal]
|
|
,[City]
|
|
,[State]
|
|
,[Country]
|
|
,[Longitude]
|
|
,[Latitude]
|
|
,[IsValidLocation])
|
|
VALUES
|
|
(SOURCE.[Id]
|
|
,SOURCE.[EntityId]
|
|
,SOURCE.[Property]
|
|
,SOURCE.[Version]
|
|
,SOURCE.[AddressString]
|
|
,SOURCE.[Postal]
|
|
,SOURCE.[City]
|
|
,SOURCE.[State]
|
|
,SOURCE.[Country]
|
|
,SOURCE.[Longitude]
|
|
,SOURCE.[Latitude]
|
|
,SOURCE.[IsValidLocation]);
|
|
END
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[mfr__updt__*PartnerSet] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[mfr__updt__*PartnerSet]
|
|
@tblname as nvarchar(50)
|
|
AS
|
|
BEGIN
|
|
SET NOCOUNT ON;
|
|
|
|
DECLARE @tmp [dbo].[mfr__tt__*PartnerSet];
|
|
|
|
DECLARE @tmp_cmd nvarchar(1000) = N'SELECT DISTINCT * FROM ' + @tblname;
|
|
INSERT INTO @tmp EXECUTE [sp_executesql] @tmp_cmd;
|
|
|
|
|
|
MERGE [dbo].[mfr__*PartnerSet] as TARGET
|
|
USING @tmp as SOURCE ON
|
|
TARGET.[Property] = SOURCE.[Property]
|
|
AND TARGET.[PartnerType] = SOURCE.[PartnerType]
|
|
AND TARGET.[PartnerId] = SOURCE.[PartnerId]
|
|
AND TARGET.[EntityId] = SOURCE.[EntityId]
|
|
WHEN MATCHED THEN
|
|
UPDATE
|
|
SET [Property] = SOURCE.[Property]
|
|
,[PartnerType] = SOURCE.[PartnerType]
|
|
,[PartnerId] = SOURCE.[PartnerId]
|
|
,[EntityId] = SOURCE.[EntityId]
|
|
WHEN NOT MATCHED BY TARGET THEN
|
|
INSERT
|
|
( [Property]
|
|
,[PartnerType]
|
|
,[PartnerId]
|
|
,[EntityId])
|
|
VALUES
|
|
(SOURCE.[Property]
|
|
,SOURCE.[PartnerType]
|
|
,SOURCE.[PartnerId]
|
|
,SOURCE.[EntityId]);
|
|
END
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[mfr__updt__appointments] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[mfr__updt__appointments]
|
|
@tblname as nvarchar(50)
|
|
AS
|
|
BEGIN
|
|
SET NOCOUNT ON;
|
|
|
|
DECLARE @tmp [dbo].[mfr__tt__appointments];
|
|
|
|
DECLARE @tmp_cmd nvarchar(1000) = N'SELECT DISTINCT * FROM ' + @tblname
|
|
INSERT INTO @tmp EXECUTE [sp_executesql] @tmp_cmd;
|
|
|
|
|
|
MERGE [dbo].[mfr__appointments] as TARGET
|
|
USING @tmp as SOURCE ON TARGET.[Id] = SOURCE.[Id]
|
|
WHEN MATCHED AND (TARGET.[Version] <= SOURCE.[Version] ) THEN
|
|
UPDATE
|
|
SET [Id] = SOURCE.[Id]
|
|
,[Version] = SOURCE.[Version]
|
|
,[State] = SOURCE.[State]
|
|
,[Type] = SOURCE.[Type]
|
|
,[EndDateTime] = SOURCE.[EndDateTime]
|
|
,[StartDateTime] = SOURCE.[StartDateTime]
|
|
,[DrivingDistanceFrom] = SOURCE.[DrivingDistanceFrom]
|
|
,[DrivingDistanceTo] = SOURCE.[DrivingDistanceTo]
|
|
,[WasReadOnClientSide] = SOURCE.[WasReadOnClientSide]
|
|
,[ContactIds] = SOURCE.[ContactIds]
|
|
,[ServiceRequestId] = SOURCE.[ServiceRequestId]
|
|
,[ContactId] = SOURCE.[ContactId]
|
|
,[Note] = SOURCE.[Note]
|
|
WHEN NOT MATCHED BY TARGET THEN
|
|
INSERT
|
|
([Id]
|
|
,[Version]
|
|
,[State]
|
|
,[Type]
|
|
,[EndDateTime]
|
|
,[StartDateTime]
|
|
,[DrivingDistanceFrom]
|
|
,[DrivingDistanceTo]
|
|
,[WasReadOnClientSide]
|
|
,[ContactIds]
|
|
,[ServiceRequestId]
|
|
,[ContactId]
|
|
,[Note])
|
|
VALUES
|
|
(SOURCE.[Id]
|
|
,SOURCE.[Version]
|
|
,SOURCE.[State]
|
|
,SOURCE.[Type]
|
|
,SOURCE.[EndDateTime]
|
|
,SOURCE.[StartDateTime]
|
|
,SOURCE.[DrivingDistanceFrom]
|
|
,SOURCE.[DrivingDistanceTo]
|
|
,SOURCE.[WasReadOnClientSide]
|
|
,SOURCE.[ContactIds]
|
|
,SOURCE.[ServiceRequestId]
|
|
,SOURCE.[ContactId]
|
|
,SOURCE.[Note]);
|
|
END
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[mfr__updt__attachments] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[mfr__updt__attachments]
|
|
@tblname as nvarchar(50)
|
|
AS
|
|
BEGIN
|
|
SET NOCOUNT ON;
|
|
|
|
DECLARE @tmp [dbo].[mfr__tt__attachments];
|
|
|
|
DECLARE @tmp_cmd nvarchar(1000) = N'SELECT DISTINCT * FROM ' + @tblname
|
|
INSERT INTO @tmp EXECUTE [sp_executesql] @tmp_cmd;
|
|
|
|
|
|
MERGE [dbo].[mfr__attachments] as TARGET
|
|
USING @tmp as SOURCE ON TARGET.[Id] = SOURCE.[Id]
|
|
WHEN MATCHED AND (TARGET.[Version] <= SOURCE.[Version]) THEN
|
|
UPDATE
|
|
SET [Id] = SOURCE.[Id]
|
|
,[Version] = SOURCE.[Version]
|
|
,[URI] = SOURCE.[URI]
|
|
,[StepId] = SOURCE.[StepId]
|
|
WHEN NOT MATCHED BY TARGET THEN
|
|
INSERT
|
|
([Id]
|
|
,[Version]
|
|
,[URI]
|
|
,[StepId])
|
|
VALUES
|
|
(SOURCE.[Id]
|
|
,SOURCE.[Version]
|
|
,SOURCE.[URI]
|
|
,SOURCE.[StepId]);
|
|
END
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[mfr__updt__comments] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[mfr__updt__comments]
|
|
@tblname as nvarchar(50)
|
|
AS
|
|
BEGIN
|
|
SET NOCOUNT ON;
|
|
|
|
DECLARE @tmp [dbo].[mfr__tt__comments];
|
|
|
|
DECLARE @tmp_cmd nvarchar(1000) = N'SELECT DISTINCT * FROM ' + @tblname
|
|
INSERT INTO @tmp EXECUTE [sp_executesql] @tmp_cmd;
|
|
|
|
|
|
MERGE [dbo].[mfr__comments] as TARGET
|
|
USING @tmp as SOURCE ON TARGET.[Id] = SOURCE.[Id]
|
|
WHEN MATCHED AND (TARGET.[Version] <= SOURCE.[Version] OR TARGET.[DateOfCreation] <= SOURCE.[DateOfCreation]) THEN
|
|
UPDATE
|
|
SET [Id] = SOURCE.[Id]
|
|
,[Version] = SOURCE.[Version]
|
|
,[DateOfCreation] = SOURCE.[DateOfCreation]
|
|
,[IsInternal] = SOURCE.[IsInternal]
|
|
,[ServiceRequestId] = SOURCE.[ServiceRequestId]
|
|
,[CompanyId] = SOURCE.[CompanyId]
|
|
,[Content] = SOURCE.[Content]
|
|
WHEN NOT MATCHED BY TARGET THEN
|
|
INSERT
|
|
([Id]
|
|
,[Version]
|
|
,[DateOfCreation]
|
|
,[IsInternal]
|
|
,[ServiceRequestId]
|
|
,[CompanyId]
|
|
,[Content])
|
|
VALUES
|
|
(SOURCE.[Id]
|
|
,SOURCE.[Version]
|
|
,SOURCE.[DateOfCreation]
|
|
,SOURCE.[IsInternal]
|
|
,SOURCE.[ServiceRequestId]
|
|
,SOURCE.[CompanyId]
|
|
,SOURCE.[Content]);
|
|
END
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[mfr__updt__companies] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[mfr__updt__companies]
|
|
@tblname as nvarchar(50)
|
|
AS
|
|
BEGIN
|
|
SET NOCOUNT ON;
|
|
|
|
DECLARE @tmp [dbo].[mfr__tt__companies];
|
|
|
|
DECLARE @tmp_cmd nvarchar(1000) = N'SELECT DISTINCT * FROM ' + @tblname
|
|
INSERT INTO @tmp EXECUTE [sp_executesql] @tmp_cmd;
|
|
|
|
|
|
MERGE [dbo].[mfr__companies] as TARGET
|
|
USING @tmp as SOURCE ON TARGET.[Id] = SOURCE.[Id]
|
|
WHEN MATCHED AND (TARGET.[Version] <= SOURCE.[Version] OR TARGET.[DateModified] <= SOURCE.[DateModified]) THEN
|
|
UPDATE
|
|
SET [Id] = SOURCE.[Id]
|
|
,[Location#ID] = SOURCE.[Location#ID]
|
|
,[Version] = SOURCE.[Version]
|
|
,[IsPhysicalPerson] = SOURCE.[IsPhysicalPerson]
|
|
,[IsOwner] = SOURCE.[IsOwner]
|
|
,[IsEmailInvoicingActive] = SOURCE.[IsEmailInvoicingActive]
|
|
,[IsSupplier] = SOURCE.[IsSupplier]
|
|
,[MappingId] = SOURCE.[MappingId]
|
|
,[ExternalId] = SOURCE.[ExternalId]
|
|
,[Name] = SOURCE.[Name]
|
|
,[Note] = SOURCE.[Note]
|
|
,[SupportTelephone] = SOURCE.[SupportTelephone]
|
|
,[SupportFax] = SOURCE.[SupportFax]
|
|
,[SupportMail] = SOURCE.[SupportMail]
|
|
,[QuickSearch] = SOURCE.[QuickSearch]
|
|
,[DateModified] = SOURCE.[DateModified]
|
|
,[CustomValues] = SOURCE.[CustomValues]
|
|
,[MainContactId] = SOURCE.[MainContactId]
|
|
WHEN NOT MATCHED BY TARGET THEN
|
|
INSERT
|
|
( [Id]
|
|
,[Location#ID]
|
|
,[Version]
|
|
,[IsPhysicalPerson]
|
|
,[IsOwner]
|
|
,[IsEmailInvoicingActive]
|
|
,[IsSupplier]
|
|
,[MappingId]
|
|
,[ExternalId]
|
|
,[Name]
|
|
,[Note]
|
|
,[SupportTelephone]
|
|
,[SupportFax]
|
|
,[SupportMail]
|
|
,[QuickSearch]
|
|
,[DateModified]
|
|
,[CustomValues]
|
|
,[MainContactId])
|
|
VALUES
|
|
(SOURCE.[Id]
|
|
,SOURCE.[Location#ID]
|
|
,SOURCE.[Version]
|
|
,SOURCE.[IsPhysicalPerson]
|
|
,SOURCE.[IsOwner]
|
|
,SOURCE.[IsEmailInvoicingActive]
|
|
,SOURCE.[IsSupplier]
|
|
,SOURCE.[MappingId]
|
|
,SOURCE.[ExternalId]
|
|
,SOURCE.[Name]
|
|
,SOURCE.[Note]
|
|
,SOURCE.[SupportTelephone]
|
|
,SOURCE.[SupportFax]
|
|
,SOURCE.[SupportMail]
|
|
,SOURCE.[QuickSearch]
|
|
,SOURCE.[DateModified]
|
|
,SOURCE.[CustomValues]
|
|
,SOURCE.[MainContactId]);
|
|
END
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[mfr__updt__contacts] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[mfr__updt__contacts]
|
|
@tblname as nvarchar(50)
|
|
AS
|
|
BEGIN
|
|
SET NOCOUNT ON;
|
|
|
|
DECLARE @tmp [dbo].[mfr__tt__contacts];
|
|
|
|
DECLARE @tmp_cmd nvarchar(1000) = N'SELECT DISTINCT * FROM ' + @tblname
|
|
INSERT INTO @tmp EXECUTE [sp_executesql] @tmp_cmd;
|
|
|
|
|
|
MERGE [dbo].[mfr__contacts] as TARGET
|
|
USING @tmp as SOURCE ON TARGET.[Id] = SOURCE.[Id]
|
|
WHEN MATCHED AND (TARGET.[Version] <= SOURCE.[Version] OR TARGET.[DateModified] <= SOURCE.[DateModified]) THEN
|
|
UPDATE
|
|
SET [Id] = SOURCE.[Id]
|
|
,[CustomValues] = SOURCE.[CustomValues]
|
|
,[FirstName] = SOURCE.[FirstName]
|
|
,[LastName] = SOURCE.[LastName]
|
|
,[Email] = SOURCE.[Email]
|
|
,[JobTitle] = SOURCE.[JobTitle]
|
|
,[MobilePhone] = SOURCE.[MobilePhone]
|
|
,[Telephone] = SOURCE.[Telephone]
|
|
,[Fax] = SOURCE.[Fax]
|
|
,[Note] = SOURCE.[Note]
|
|
,[DateModified] = SOURCE.[DateModified]
|
|
,[Version] = SOURCE.[Version]
|
|
,[CompanyId] = SOURCE.[CompanyId]
|
|
,[IsUser] = SOURCE.[IsUser]
|
|
,[ExternalId] = SOURCE.[ExternalId]
|
|
,[Gender] = SOURCE.[Gender]
|
|
,[UserId] = SOURCE.[UserId]
|
|
WHEN NOT MATCHED BY TARGET THEN
|
|
INSERT
|
|
([Id]
|
|
,[CustomValues]
|
|
,[FirstName]
|
|
,[LastName]
|
|
,[Email]
|
|
,[JobTitle]
|
|
,[MobilePhone]
|
|
,[Telephone]
|
|
,[Fax]
|
|
,[Note]
|
|
,[DateModified]
|
|
,[Version]
|
|
,[CompanyId]
|
|
,[IsUser]
|
|
,[ExternalId]
|
|
,[Gender]
|
|
,[UserId])
|
|
VALUES
|
|
(SOURCE.[Id]
|
|
,SOURCE.[CustomValues]
|
|
,SOURCE.[FirstName]
|
|
,SOURCE.[LastName]
|
|
,SOURCE.[Email]
|
|
,SOURCE.[JobTitle]
|
|
,SOURCE.[MobilePhone]
|
|
,SOURCE.[Telephone]
|
|
,SOURCE.[Fax]
|
|
,SOURCE.[Note]
|
|
,SOURCE.[DateModified]
|
|
,SOURCE.[Version]
|
|
,SOURCE.[CompanyId]
|
|
,SOURCE.[IsUser]
|
|
,SOURCE.[ExternalId]
|
|
,SOURCE.[Gender]
|
|
,SOURCE.[UserId]);
|
|
END
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[mfr__updt__costcenters] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[mfr__updt__costcenters]
|
|
@tblname as nvarchar(50)
|
|
AS
|
|
BEGIN
|
|
SET NOCOUNT ON;
|
|
|
|
DECLARE @tmp [dbo].[mfr__tt__costcenters];
|
|
|
|
DECLARE @tmp_cmd nvarchar(1000) = N'SELECT DISTINCT * FROM ' + @tblname
|
|
INSERT INTO @tmp EXECUTE [sp_executesql] @tmp_cmd;
|
|
|
|
|
|
MERGE [dbo].[mfr__costcenters] as TARGET
|
|
USING @tmp as SOURCE ON TARGET.[Id] = SOURCE.[Id]
|
|
WHEN MATCHED AND (TARGET.[Version] <= SOURCE.[Version]) THEN
|
|
UPDATE
|
|
SET [Id] = SOURCE.[Id]
|
|
,[Version] = SOURCE.[Version]
|
|
,[Name] = SOURCE.[Name]
|
|
WHEN NOT MATCHED BY TARGET THEN
|
|
INSERT
|
|
([Id]
|
|
,[Version]
|
|
,[Name])
|
|
VALUES
|
|
(SOURCE.[Id]
|
|
,SOURCE.[Version]
|
|
,SOURCE.[Name]);
|
|
END
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[mfr__updt__documents] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[mfr__updt__documents]
|
|
@tblname as nvarchar(50)
|
|
AS
|
|
BEGIN
|
|
SET NOCOUNT ON;
|
|
|
|
DECLARE @tmp [dbo].[mfr__tt__documents];
|
|
|
|
DECLARE @tmp_cmd nvarchar(1000) = N'SELECT DISTINCT * FROM ' + @tblname
|
|
INSERT INTO @tmp EXECUTE [sp_executesql] @tmp_cmd;
|
|
|
|
|
|
MERGE [dbo].[mfr__documents] as TARGET
|
|
USING @tmp as SOURCE ON TARGET.[Id] = SOURCE.[Id]
|
|
WHEN MATCHED AND (TARGET.[Version] <= SOURCE.[Version] OR TARGET.[DateModified] <= SOURCE.[DateModified] ) THEN
|
|
UPDATE
|
|
SET [Id] = SOURCE.[Id]
|
|
,[CustomValues] = SOURCE.[CustomValues]
|
|
,[Version] = SOURCE.[Version]
|
|
,[State] = SOURCE.[State]
|
|
,[ExternalId] = SOURCE.[ExternalId]
|
|
,[URI] = SOURCE.[URI]
|
|
,[IsGlobal] = SOURCE.[IsGlobal]
|
|
,[StartDateTime] = SOURCE.[StartDateTime]
|
|
,[EndDateTime] = SOURCE.[EndDateTime]
|
|
,[FileName] = SOURCE.[FileName]
|
|
,[DateModified] = SOURCE.[DateModified]
|
|
,[UploadDate] = SOURCE.[UploadDate]
|
|
,[IsLink] = SOURCE.[IsLink]
|
|
,[ContentType] = SOURCE.[ContentType]
|
|
,[HTMLCode] = SOURCE.[HTMLCode]
|
|
,[ServiceRequestId] = SOURCE.[ServiceRequestId]
|
|
,[Note] = SOURCE.[Note]
|
|
WHEN NOT MATCHED BY TARGET THEN
|
|
INSERT
|
|
([Id]
|
|
,[CustomValues]
|
|
,[Version]
|
|
,[State]
|
|
,[ExternalId]
|
|
,[URI]
|
|
,[IsGlobal]
|
|
,[StartDateTime]
|
|
,[EndDateTime]
|
|
,[FileName]
|
|
,[DateModified]
|
|
,[UploadDate]
|
|
,[IsLink]
|
|
,[ContentType]
|
|
,[HTMLCode]
|
|
,[ServiceRequestId]
|
|
,[Note])
|
|
VALUES
|
|
(SOURCE.[Id]
|
|
,SOURCE.[CustomValues]
|
|
,SOURCE.[Version]
|
|
,SOURCE.[State]
|
|
,SOURCE.[ExternalId]
|
|
,SOURCE.[URI]
|
|
,SOURCE.[IsGlobal]
|
|
,SOURCE.[StartDateTime]
|
|
,SOURCE.[EndDateTime]
|
|
,SOURCE.[FileName]
|
|
,SOURCE.[DateModified]
|
|
,SOURCE.[UploadDate]
|
|
,SOURCE.[IsLink]
|
|
,SOURCE.[ContentType]
|
|
,SOURCE.[HTMLCode]
|
|
,SOURCE.[ServiceRequestId]
|
|
,SOURCE.[Note]);
|
|
END
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[mfr__updt__items] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[mfr__updt__items]
|
|
@tblname as nvarchar(50)
|
|
AS
|
|
BEGIN
|
|
SET NOCOUNT ON;
|
|
|
|
DECLARE @tmp [dbo].[mfr__tt__items];
|
|
|
|
DECLARE @tmp_cmd nvarchar(1000) = N'SELECT DISTINCT * FROM ' + @tblname
|
|
INSERT INTO @tmp EXECUTE [sp_executesql] @tmp_cmd;
|
|
|
|
|
|
MERGE [dbo].[mfr__items] as TARGET
|
|
USING @tmp as SOURCE ON TARGET.[Id] = SOURCE.[Id]
|
|
WHEN MATCHED AND (TARGET.[Version] <= SOURCE.[Version]) THEN
|
|
UPDATE
|
|
SET [Id] = SOURCE.[Id]
|
|
,[Version] = SOURCE.[Version]
|
|
,[QuantityHours] = SOURCE.[QuantityHours]
|
|
,[PlannedQuantityHours] = SOURCE.[PlannedQuantityHours]
|
|
,[ItemTypeId] = SOURCE.[ItemTypeId]
|
|
,[ItemNumber] = SOURCE.[ItemNumber]
|
|
,[TrackingId] = SOURCE.[TrackingId]
|
|
,[Manufacture] = SOURCE.[Manufacture]
|
|
,[Price] = SOURCE.[Price]
|
|
,[Costs] = SOURCE.[Costs]
|
|
,[NameOrNumber] = SOURCE.[NameOrNumber]
|
|
,[CustomValues] = SOURCE.[CustomValues]
|
|
,[Note] = SOURCE.[Note]
|
|
,[ExternalId] = SOURCE.[ExternalId]
|
|
,[Discount] = SOURCE.[Discount]
|
|
,[VAT] = SOURCE.[VAT]
|
|
,[IsManual] = SOURCE.[IsManual]
|
|
,[SortOrder] = SOURCE.[SortOrder]
|
|
,[Type] = SOURCE.[Type]
|
|
,[ServiceRequestId] = SOURCE.[ServiceRequestId]
|
|
,[ServiceObjectId] = SOURCE.[ServiceObjectId]
|
|
,[CreatorId] = SOURCE.[CreatorId]
|
|
,[UnitId] = SOURCE.[UnitId]
|
|
,[UnitString] = SOURCE.[UnitString]
|
|
WHEN NOT MATCHED BY TARGET THEN
|
|
INSERT
|
|
( [Id]
|
|
,[Version]
|
|
,[QuantityHours]
|
|
,[PlannedQuantityHours]
|
|
,[ItemTypeId]
|
|
,[ItemNumber]
|
|
,[TrackingId]
|
|
,[Manufacture]
|
|
,[Price]
|
|
,[Costs]
|
|
,[NameOrNumber]
|
|
,[CustomValues]
|
|
,[Note]
|
|
,[ExternalId]
|
|
,[Discount]
|
|
,[VAT]
|
|
,[IsManual]
|
|
,[SortOrder]
|
|
,[Type]
|
|
,[ServiceRequestId]
|
|
,[ServiceObjectId]
|
|
,[CreatorId]
|
|
,[UnitId]
|
|
,[UnitString])
|
|
VALUES
|
|
(SOURCE.[Id]
|
|
,SOURCE.[Version]
|
|
,SOURCE.[QuantityHours]
|
|
,SOURCE.[PlannedQuantityHours]
|
|
,SOURCE.[ItemTypeId]
|
|
,SOURCE.[ItemNumber]
|
|
,SOURCE.[TrackingId]
|
|
,SOURCE.[Manufacture]
|
|
,SOURCE.[Price]
|
|
,SOURCE.[Costs]
|
|
,SOURCE.[NameOrNumber]
|
|
,SOURCE.[CustomValues]
|
|
,SOURCE.[Note]
|
|
,SOURCE.[ExternalId]
|
|
,SOURCE.[Discount]
|
|
,SOURCE.[VAT]
|
|
,SOURCE.[IsManual]
|
|
,SOURCE.[SortOrder]
|
|
,SOURCE.[Type]
|
|
,SOURCE.[ServiceRequestId]
|
|
,SOURCE.[ServiceObjectId]
|
|
,SOURCE.[CreatorId]
|
|
,SOURCE.[UnitId]
|
|
,SOURCE.[UnitString]);
|
|
END
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[mfr__updt__itemtypes] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[mfr__updt__itemtypes]
|
|
@tblname as nvarchar(50)
|
|
AS
|
|
BEGIN
|
|
SET NOCOUNT ON;
|
|
|
|
DECLARE @tmp [dbo].[mfr__tt__itemtypes];
|
|
|
|
DECLARE @tmp_cmd nvarchar(1000) = N'SELECT DISTINCT * FROM ' + @tblname
|
|
INSERT INTO @tmp EXECUTE [sp_executesql] @tmp_cmd;
|
|
|
|
|
|
MERGE [dbo].[mfr__itemtypes] as TARGET
|
|
USING @tmp as SOURCE ON TARGET.[Id] = SOURCE.[Id]
|
|
WHEN MATCHED AND (TARGET.[Version] <= SOURCE.[Version] OR TARGET.[DateModified] <= SOURCE.[DateModified] ) THEN
|
|
UPDATE
|
|
SET [Id] = SOURCE.[Id]
|
|
,[CustomValues] = SOURCE.[CustomValues]
|
|
,[Version] = SOURCE.[Version]
|
|
,[Costs] = SOURCE.[Costs]
|
|
,[Description] = SOURCE.[Description]
|
|
,[ListPrice] = SOURCE.[ListPrice]
|
|
,[Manufacture] = SOURCE.[Manufacture]
|
|
,[ExternalId] = SOURCE.[ExternalId]
|
|
,[ItemNumber] = SOURCE.[ItemNumber]
|
|
,[NameOrNumber] = SOURCE.[NameOrNumber]
|
|
,[GlobalTradeItemNr] = SOURCE.[GlobalTradeItemNr]
|
|
,[Type] = SOURCE.[Type]
|
|
,[Price] = SOURCE.[Price]
|
|
,[VAT] = SOURCE.[VAT]
|
|
,[IsPortalOnly] = SOURCE.[IsPortalOnly]
|
|
,[Discount] = SOURCE.[Discount]
|
|
,[DateModified] = SOURCE.[DateModified]
|
|
,[IsDiscontinued] = SOURCE.[IsDiscontinued]
|
|
,[IsWarehouse] = SOURCE.[IsWarehouse]
|
|
,[UnitId] = SOURCE.[UnitId]
|
|
,[UnitString] = SOURCE.[UnitString]
|
|
WHEN NOT MATCHED BY TARGET THEN
|
|
INSERT
|
|
([Id]
|
|
,[CustomValues]
|
|
,[Version]
|
|
,[Costs]
|
|
,[Description]
|
|
,[ListPrice]
|
|
,[Manufacture]
|
|
,[ExternalId]
|
|
,[ItemNumber]
|
|
,[NameOrNumber]
|
|
,[GlobalTradeItemNr]
|
|
,[Type]
|
|
,[Price]
|
|
,[VAT]
|
|
,[IsPortalOnly]
|
|
,[Discount]
|
|
,[DateModified]
|
|
,[IsDiscontinued]
|
|
,[IsWarehouse]
|
|
,[UnitId]
|
|
,[UnitString])
|
|
VALUES
|
|
(SOURCE.[Id]
|
|
,SOURCE.[CustomValues]
|
|
,SOURCE.[Version]
|
|
,SOURCE.[Costs]
|
|
,SOURCE.[Description]
|
|
,SOURCE.[ListPrice]
|
|
,SOURCE.[Manufacture]
|
|
,SOURCE.[ExternalId]
|
|
,SOURCE.[ItemNumber]
|
|
,SOURCE.[NameOrNumber]
|
|
,SOURCE.[GlobalTradeItemNr]
|
|
,SOURCE.[Type]
|
|
,SOURCE.[Price]
|
|
,SOURCE.[VAT]
|
|
,SOURCE.[IsPortalOnly]
|
|
,SOURCE.[Discount]
|
|
,SOURCE.[DateModified]
|
|
,SOURCE.[IsDiscontinued]
|
|
,SOURCE.[IsWarehouse]
|
|
,SOURCE.[UnitId]
|
|
,SOURCE.[UnitString]);
|
|
END
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[mfr__updt__itemunits] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[mfr__updt__itemunits]
|
|
@tblname as nvarchar(50)
|
|
AS
|
|
BEGIN
|
|
SET NOCOUNT ON;
|
|
|
|
DECLARE @tmp [dbo].[mfr__tt__itemunits];
|
|
|
|
DECLARE @tmp_cmd nvarchar(1000) = N'SELECT DISTINCT * FROM ' + @tblname
|
|
INSERT INTO @tmp EXECUTE [sp_executesql] @tmp_cmd;
|
|
|
|
|
|
MERGE [dbo].[mfr__itemunits] as TARGET
|
|
USING @tmp as SOURCE ON TARGET.[Id] = SOURCE.[Id]
|
|
WHEN MATCHED AND (TARGET.[Version] <= SOURCE.[Version]) THEN
|
|
UPDATE
|
|
SET [Id] = SOURCE.[Id]
|
|
,[Version] = SOURCE.[Version]
|
|
,[Name] = SOURCE.[Name]
|
|
WHEN NOT MATCHED BY TARGET THEN
|
|
INSERT
|
|
([Id]
|
|
,[Version]
|
|
,[Name])
|
|
VALUES
|
|
(SOURCE.[Id]
|
|
,SOURCE.[Version]
|
|
,SOURCE.[Name]);
|
|
END
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[mfr__updt__products] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[mfr__updt__products]
|
|
@tblname as nvarchar(50)
|
|
AS
|
|
BEGIN
|
|
SET NOCOUNT ON;
|
|
|
|
DECLARE @tmp [dbo].[mfr__tt__products];
|
|
|
|
DECLARE @tmp_cmd nvarchar(1000) = N'SELECT DISTINCT * FROM ' + @tblname
|
|
INSERT INTO @tmp EXECUTE [sp_executesql] @tmp_cmd;
|
|
|
|
|
|
MERGE [dbo].[mfr__products] as TARGET
|
|
USING @tmp as SOURCE ON TARGET.[Id] = SOURCE.[Id]
|
|
WHEN MATCHED AND (TARGET.[Version] <= SOURCE.[Version] OR TARGET.[DateModified] <= SOURCE.[DateModified]) THEN
|
|
UPDATE
|
|
SET [Id] = SOURCE.[Id]
|
|
,[Version] = SOURCE.[Version]
|
|
,[Name] = SOURCE.[Name]
|
|
,[SubKey] = SOURCE.[SubKey]
|
|
,[Description] = SOURCE.[Description]
|
|
,[DateModified] = SOURCE.[DateModified]
|
|
,[MappingId] = SOURCE.[MappingId]
|
|
,[CustomValueStepTemplateId] = SOURCE.[CustomValueStepTemplateId]
|
|
WHEN NOT MATCHED BY TARGET THEN
|
|
INSERT
|
|
( [Id]
|
|
,[Version]
|
|
,[Name]
|
|
,[SubKey]
|
|
,[Description]
|
|
,[DateModified]
|
|
,[MappingId]
|
|
,[CustomValueStepTemplateId])
|
|
VALUES
|
|
(SOURCE.[Id]
|
|
,SOURCE.[Version]
|
|
,SOURCE.[Name]
|
|
,SOURCE.[SubKey]
|
|
,SOURCE.[Description]
|
|
,SOURCE.[DateModified]
|
|
,SOURCE.[MappingId]
|
|
,SOURCE.[CustomValueStepTemplateId]);
|
|
END
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[mfr__updt__qualifications] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[mfr__updt__qualifications]
|
|
@tblname as nvarchar(50)
|
|
AS
|
|
BEGIN
|
|
SET NOCOUNT ON;
|
|
|
|
DECLARE @tmp [dbo].[mfr__tt__qualifications];
|
|
|
|
DECLARE @tmp_cmd nvarchar(1000) = N'SELECT DISTINCT * FROM ' + @tblname
|
|
INSERT INTO @tmp EXECUTE [sp_executesql] @tmp_cmd;
|
|
|
|
|
|
MERGE [dbo].[mfr__qualifications] as TARGET
|
|
USING @tmp as SOURCE ON TARGET.[Id] = SOURCE.[Id]
|
|
WHEN MATCHED AND (TARGET.[Version] <= SOURCE.[Version]) THEN
|
|
UPDATE
|
|
SET [Id] = SOURCE.[Id]
|
|
,[Version] = SOURCE.[Version]
|
|
,[Name] = SOURCE.[Name]
|
|
WHEN NOT MATCHED BY TARGET THEN
|
|
INSERT
|
|
([Id]
|
|
,[Version]
|
|
,[Name])
|
|
VALUES
|
|
(SOURCE.[Id]
|
|
,SOURCE.[Version]
|
|
,SOURCE.[Name]);
|
|
END
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[mfr__updt__reports] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[mfr__updt__reports]
|
|
@tblname as nvarchar(50)
|
|
AS
|
|
BEGIN
|
|
SET NOCOUNT ON;
|
|
|
|
DECLARE @tmp [dbo].[mfr__tt__reports];
|
|
|
|
DECLARE @tmp_cmd nvarchar(1000) = N'SELECT DISTINCT * FROM ' + @tblname
|
|
INSERT INTO @tmp EXECUTE [sp_executesql] @tmp_cmd;
|
|
|
|
|
|
MERGE [dbo].[mfr__reports] as TARGET
|
|
USING @tmp as SOURCE ON TARGET.[Id] = SOURCE.[Id]
|
|
WHEN MATCHED AND (TARGET.[Version] <= SOURCE.[Version] OR TARGET.[DateOfCreation] <= SOURCE.[DateOfCreation] ) THEN
|
|
UPDATE
|
|
SET [Id] = SOURCE.[Id]
|
|
,[Version] = SOURCE.[Version]
|
|
,[DateOfCreation] = SOURCE.[DateOfCreation]
|
|
,[URI] = SOURCE.[URI]
|
|
,[DocumentName] = SOURCE.[DocumentName]
|
|
,[FileTypeString] = SOURCE.[FileTypeString]
|
|
,[ReportDefinitionCode] = SOURCE.[ReportDefinitionCode]
|
|
,[ServiceObjectId] = SOURCE.[ServiceObjectId]
|
|
,[CanBeDeleted] = SOURCE.[CanBeDeleted]
|
|
,[InvoiceBalance] = SOURCE.[InvoiceBalance]
|
|
,[InvoiceId] = SOURCE.[InvoiceId]
|
|
,[DueDate] = SOURCE.[DueDate]
|
|
,[IsPayed] = SOURCE.[IsPayed]
|
|
,[IsInvoice] = SOURCE.[IsInvoice]
|
|
,[IsCanceled] = SOURCE.[IsCanceled]
|
|
,[CustomValues] = SOURCE.[CustomValues]
|
|
WHEN NOT MATCHED BY TARGET THEN
|
|
INSERT
|
|
([Id]
|
|
,[Version]
|
|
,[DateOfCreation]
|
|
,[URI]
|
|
,[DocumentName]
|
|
,[FileTypeString]
|
|
,[ReportDefinitionCode]
|
|
,[ServiceObjectId]
|
|
,[CanBeDeleted]
|
|
,[InvoiceBalance]
|
|
,[InvoiceId]
|
|
,[DueDate]
|
|
,[IsPayed]
|
|
,[IsInvoice]
|
|
,[IsCanceled]
|
|
,[CustomValues])
|
|
VALUES
|
|
(SOURCE.[Id]
|
|
,SOURCE.[Version]
|
|
,SOURCE.[DateOfCreation]
|
|
,SOURCE.[URI]
|
|
,SOURCE.[DocumentName]
|
|
,SOURCE.[FileTypeString]
|
|
,SOURCE.[ReportDefinitionCode]
|
|
,SOURCE.[ServiceObjectId]
|
|
,SOURCE.[CanBeDeleted]
|
|
,SOURCE.[InvoiceBalance]
|
|
,SOURCE.[InvoiceId]
|
|
,SOURCE.[DueDate]
|
|
,SOURCE.[IsPayed]
|
|
,SOURCE.[IsInvoice]
|
|
,SOURCE.[IsCanceled]
|
|
,SOURCE.[CustomValues]);
|
|
END
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[mfr__updt__serviceobjects] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[mfr__updt__serviceobjects]
|
|
@tblname as nvarchar(50)
|
|
AS
|
|
BEGIN
|
|
SET NOCOUNT ON;
|
|
|
|
DECLARE @tmp [dbo].[mfr__tt__serviceobjects];
|
|
|
|
DECLARE @tmp_cmd nvarchar(1000) = N'SELECT DISTINCT * FROM ' + @tblname
|
|
INSERT INTO @tmp EXECUTE [sp_executesql] @tmp_cmd;
|
|
|
|
|
|
MERGE [dbo].[mfr__serviceobjects] as TARGET
|
|
USING @tmp as SOURCE ON TARGET.[Id] = SOURCE.[Id]
|
|
WHEN MATCHED AND (TARGET.[Version] <= SOURCE.[Version] OR TARGET.[DateModified] <= SOURCE.[DateModified]) THEN
|
|
UPDATE
|
|
SET [Id] = SOURCE.[Id]
|
|
,[Location#ID] = SOURCE.[Location#ID]
|
|
,[Name] = SOURCE.[Name]
|
|
,[Note] = SOURCE.[Note]
|
|
,[CustomValues] = SOURCE.[CustomValues]
|
|
,[DateModified] = SOURCE.[DateModified]
|
|
,[ExternalId] = SOURCE.[ExternalId]
|
|
,[MappingId] = SOURCE.[MappingId]
|
|
,[QuickSearch] = SOURCE.[QuickSearch]
|
|
,[Version] = SOURCE.[Version]
|
|
,[CreateGeoLocation] = SOURCE.[CreateGeoLocation]
|
|
,[IsWarehouse] = SOURCE.[IsWarehouse]
|
|
,[ParentServiceObjectId] = SOURCE.[ParentServiceObjectId]
|
|
,[CompanyId] = SOURCE.[CompanyId]
|
|
,[ProductId] = SOURCE.[ProductId]
|
|
WHEN NOT MATCHED BY TARGET THEN
|
|
INSERT
|
|
( [Id]
|
|
,[Location#ID]
|
|
,[Name]
|
|
,[Note]
|
|
,[CustomValues]
|
|
,[DateModified]
|
|
,[ExternalId]
|
|
,[MappingId]
|
|
,[QuickSearch]
|
|
,[Version]
|
|
,[CreateGeoLocation]
|
|
,[IsWarehouse]
|
|
,[ParentServiceObjectId]
|
|
,[CompanyId]
|
|
,[ProductId])
|
|
VALUES
|
|
(SOURCE.[Id]
|
|
,SOURCE.[Location#ID]
|
|
,SOURCE.[Name]
|
|
,SOURCE.[Note]
|
|
,SOURCE.[CustomValues]
|
|
,SOURCE.[DateModified]
|
|
,SOURCE.[ExternalId]
|
|
,SOURCE.[MappingId]
|
|
,SOURCE.[QuickSearch]
|
|
,SOURCE.[Version]
|
|
,SOURCE.[CreateGeoLocation]
|
|
,SOURCE.[IsWarehouse]
|
|
,SOURCE.[ParentServiceObjectId]
|
|
,SOURCE.[CompanyId]
|
|
,SOURCE.[ProductId]);
|
|
END
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[mfr__updt__servicerequests] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[mfr__updt__servicerequests]
|
|
@tblname as nvarchar(50)
|
|
AS
|
|
BEGIN
|
|
SET NOCOUNT ON;
|
|
|
|
DECLARE @tmp [dbo].[mfr__tt__servicerequests];
|
|
|
|
DECLARE @tmp_cmd nvarchar(1000) = N'SELECT DISTINCT * FROM ' + @tblname
|
|
INSERT INTO @tmp EXECUTE [sp_executesql] @tmp_cmd;
|
|
|
|
|
|
MERGE [dbo].[mfr__servicerequests] as TARGET
|
|
USING @tmp as SOURCE ON TARGET.[Id] = SOURCE.[Id]
|
|
WHEN MATCHED AND (TARGET.[Version] <= SOURCE.[Version] OR TARGET.[DateModified] <= SOURCE.[DateModified] OR TARGET.[DateOfCreation] <= SOURCE.[DateOfCreation] ) THEN
|
|
UPDATE
|
|
SET [Id] = SOURCE.[Id]
|
|
,[Name] = SOURCE.[Name]
|
|
,[ExternalId] = SOURCE.[ExternalId]
|
|
,[InvoiceId] = SOURCE.[InvoiceId]
|
|
,[ClosedAt] = SOURCE.[ClosedAt]
|
|
,[ReleasedAt] = SOURCE.[ReleasedAt]
|
|
,[WorkDoneAt] = SOURCE.[WorkDoneAt]
|
|
,[TargetTimeInMinutes] = SOURCE.[TargetTimeInMinutes]
|
|
,[DateModified] = SOURCE.[DateModified]
|
|
,[DateOfCreation] = SOURCE.[DateOfCreation]
|
|
,[DueDateRangeStart] = SOURCE.[DueDateRangeStart]
|
|
,[DueDateRangeEnd] = SOURCE.[DueDateRangeEnd]
|
|
,[PortalLink] = SOURCE.[PortalLink]
|
|
,[CostCenterId] = SOURCE.[CostCenterId]
|
|
,[Description] = SOURCE.[Description]
|
|
,[State] = SOURCE.[State]
|
|
,[CustomValues] = SOURCE.[CustomValues]
|
|
,[CurrentOwnerId] = SOURCE.[CurrentOwnerId]
|
|
,[CustomerId] = SOURCE.[CustomerId]
|
|
,[ParentServiceRequestId] = SOURCE.[ParentServiceRequestId]
|
|
,[Location#ID] = SOURCE.[Location#ID]
|
|
,[Version] = SOURCE.[Version]
|
|
,[IsTemplate] = SOURCE.[IsTemplate]
|
|
,[IsTemplateMobile] = SOURCE.[IsTemplateMobile]
|
|
,[CreateFromServiceRequestTemplateId] = SOURCE.[CreateFromServiceRequestTemplateId]
|
|
,[Type] = SOURCE.[Type]
|
|
WHEN NOT MATCHED BY TARGET THEN
|
|
INSERT
|
|
([Id]
|
|
,[Name]
|
|
,[ExternalId]
|
|
,[InvoiceId]
|
|
,[ClosedAt]
|
|
,[ReleasedAt]
|
|
,[WorkDoneAt]
|
|
,[TargetTimeInMinutes]
|
|
,[DateModified]
|
|
,[DateOfCreation]
|
|
,[DueDateRangeStart]
|
|
,[DueDateRangeEnd]
|
|
,[PortalLink]
|
|
,[CostCenterId]
|
|
,[Description]
|
|
,[State]
|
|
,[CustomValues]
|
|
,[CurrentOwnerId]
|
|
,[CustomerId]
|
|
,[ParentServiceRequestId]
|
|
,[Location#ID]
|
|
,[Version]
|
|
,[IsTemplate]
|
|
,[IsTemplateMobile]
|
|
,[CreateFromServiceRequestTemplateId]
|
|
,[Type])
|
|
VALUES
|
|
(SOURCE.[Id]
|
|
,SOURCE.[Name]
|
|
,SOURCE.[ExternalId]
|
|
,SOURCE.[InvoiceId]
|
|
,SOURCE.[ClosedAt]
|
|
,SOURCE.[ReleasedAt]
|
|
,SOURCE.[WorkDoneAt]
|
|
,SOURCE.[TargetTimeInMinutes]
|
|
,SOURCE.[DateModified]
|
|
,SOURCE.[DateOfCreation]
|
|
,SOURCE.[DueDateRangeStart]
|
|
,SOURCE.[DueDateRangeEnd]
|
|
,SOURCE.[PortalLink]
|
|
,SOURCE.[CostCenterId]
|
|
,SOURCE.[Description]
|
|
,SOURCE.[State]
|
|
,SOURCE.[CustomValues]
|
|
,SOURCE.[CurrentOwnerId]
|
|
,SOURCE.[CustomerId]
|
|
,SOURCE.[ParentServiceRequestId]
|
|
,SOURCE.[Location#ID]
|
|
,SOURCE.[Version]
|
|
,SOURCE.[IsTemplate]
|
|
,SOURCE.[IsTemplateMobile]
|
|
,SOURCE.[CreateFromServiceRequestTemplateId]
|
|
,SOURCE.[Type]);
|
|
END
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[mfr__updt__steplisttemplateinstances] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[mfr__updt__steplisttemplateinstances]
|
|
@tblname as nvarchar(50)
|
|
AS
|
|
BEGIN
|
|
SET NOCOUNT ON;
|
|
|
|
DECLARE @tmp [dbo].[mfr__tt__steplisttemplateinstances];
|
|
|
|
DECLARE @tmp_cmd nvarchar(1000) = N'SELECT DISTINCT * FROM ' + @tblname
|
|
INSERT INTO @tmp EXECUTE [sp_executesql] @tmp_cmd;
|
|
|
|
|
|
MERGE [dbo].[mfr__steplisttemplateinstances] as TARGET
|
|
USING @tmp as SOURCE ON TARGET.[Id] = SOURCE.[Id]
|
|
WHEN MATCHED AND (TARGET.[Version] <= SOURCE.[Version]) THEN
|
|
UPDATE
|
|
SET [Id] = SOURCE.[Id]
|
|
,[Version] = SOURCE.[Version]
|
|
,[Name] = SOURCE.[Name]
|
|
,[ServiceRequestId] = SOURCE.[ServiceRequestId]
|
|
,[TemplateId] = SOURCE.[TemplateId]
|
|
WHEN NOT MATCHED BY TARGET THEN
|
|
INSERT
|
|
([Id]
|
|
,[Version]
|
|
,[Name]
|
|
,[ServiceRequestId]
|
|
,[TemplateId])
|
|
VALUES
|
|
(SOURCE.[Id]
|
|
,SOURCE.[Version]
|
|
,SOURCE.[Name]
|
|
,SOURCE.[ServiceRequestId]
|
|
,SOURCE.[TemplateId]);
|
|
END
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[mfr__updt__steplisttemplates] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[mfr__updt__steplisttemplates]
|
|
@tblname as nvarchar(50)
|
|
AS
|
|
BEGIN
|
|
SET NOCOUNT ON;
|
|
|
|
DECLARE @tmp [dbo].[mfr__tt__steplisttemplates];
|
|
|
|
DECLARE @tmp_cmd nvarchar(1000) = N'SELECT DISTINCT * FROM ' + @tblname
|
|
INSERT INTO @tmp EXECUTE [sp_executesql] @tmp_cmd;
|
|
|
|
|
|
MERGE [dbo].[mfr__steplisttemplates] as TARGET
|
|
USING @tmp as SOURCE ON TARGET.[Id] = SOURCE.[Id]
|
|
WHEN MATCHED AND (TARGET.[Version] <= SOURCE.[Version] OR TARGET.[DateModified] <= SOURCE.[DateModified]) THEN
|
|
UPDATE
|
|
SET [Id] = SOURCE.[Id]
|
|
,[Version] = SOURCE.[Version]
|
|
,[Name] = SOURCE.[Name]
|
|
,[MappingId] = SOURCE.[MappingId]
|
|
,[DateModified] = SOURCE.[DateModified]
|
|
,[IsReleased] = SOURCE.[IsReleased]
|
|
,[IsDurable] = SOURCE.[IsDurable]
|
|
WHEN NOT MATCHED BY TARGET THEN
|
|
INSERT
|
|
([Id]
|
|
,[Version]
|
|
,[Name]
|
|
,[MappingId]
|
|
,[DateModified]
|
|
,[IsReleased]
|
|
,[IsDurable])
|
|
VALUES
|
|
(SOURCE.[Id]
|
|
,SOURCE.[Version]
|
|
,SOURCE.[Name]
|
|
,SOURCE.[MappingId]
|
|
,SOURCE.[DateModified]
|
|
,SOURCE.[IsReleased]
|
|
,SOURCE.[IsDurable]);
|
|
END
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[mfr__updt__steps] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[mfr__updt__steps]
|
|
@tblname as nvarchar(50)
|
|
AS
|
|
BEGIN
|
|
SET NOCOUNT ON;
|
|
|
|
DECLARE @tmp [dbo].[mfr__tt__steps];
|
|
|
|
DECLARE @tmp_cmd nvarchar(1000) = N'SELECT DISTINCT * FROM ' + @tblname
|
|
INSERT INTO @tmp EXECUTE [sp_executesql] @tmp_cmd;
|
|
|
|
|
|
MERGE [dbo].[mfr__steps] as TARGET
|
|
USING @tmp as SOURCE ON TARGET.[Id] = SOURCE.[Id]
|
|
WHEN MATCHED AND (TARGET.[Version] <= SOURCE.[Version]) THEN
|
|
UPDATE
|
|
SET [Id] = SOURCE.[Id]
|
|
,[MobileId] = SOURCE.[MobileId]
|
|
,[Version] = SOURCE.[Version]
|
|
,[Name] = SOURCE.[Name]
|
|
,[IsDone] = SOURCE.[IsDone]
|
|
,[HasError] = SOURCE.[HasError]
|
|
,[TrackingId] = SOURCE.[TrackingId]
|
|
,[Type] = SOURCE.[Type]
|
|
,[SortOrder] = SOURCE.[SortOrder]
|
|
,[Data] = SOURCE.[Data]
|
|
,[DateModifiedOffline] = SOURCE.[DateModifiedOffline]
|
|
,[ServiceRequestId] = SOURCE.[ServiceRequestId]
|
|
,[Description] = SOURCE.[Description]
|
|
,[Comment] = SOURCE.[Comment]
|
|
,[InternalComment] = SOURCE.[InternalComment]
|
|
,[ServiceObjectId] = SOURCE.[ServiceObjectId]
|
|
,[StepListTemplateId] = SOURCE.[StepListTemplateId]
|
|
,[ParentId] = SOURCE.[ParentId]
|
|
WHEN NOT MATCHED BY TARGET THEN
|
|
INSERT
|
|
( [Id]
|
|
,[MobileId]
|
|
,[Version]
|
|
,[Name]
|
|
,[IsDone]
|
|
,[HasError]
|
|
,[TrackingId]
|
|
,[Type]
|
|
,[SortOrder]
|
|
,[Data]
|
|
,[DateModifiedOffline]
|
|
,[ServiceRequestId]
|
|
,[Description]
|
|
,[Comment]
|
|
,[InternalComment]
|
|
,[ServiceObjectId]
|
|
,[StepListTemplateId]
|
|
,[ParentId])
|
|
VALUES
|
|
(SOURCE.[Id]
|
|
,SOURCE.[MobileId]
|
|
,SOURCE.[Version]
|
|
,SOURCE.[Name]
|
|
,SOURCE.[IsDone]
|
|
,SOURCE.[HasError]
|
|
,SOURCE.[TrackingId]
|
|
,SOURCE.[Type]
|
|
,SOURCE.[SortOrder]
|
|
,SOURCE.[Data]
|
|
,SOURCE.[DateModifiedOffline]
|
|
,SOURCE.[ServiceRequestId]
|
|
,SOURCE.[Description]
|
|
,SOURCE.[Comment]
|
|
,SOURCE.[InternalComment]
|
|
,SOURCE.[ServiceObjectId]
|
|
,SOURCE.[StepListTemplateId]
|
|
,SOURCE.[ParentId]);
|
|
END
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[mfr__updt__stockmovements] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[mfr__updt__stockmovements]
|
|
@tblname as nvarchar(50)
|
|
AS
|
|
BEGIN
|
|
SET NOCOUNT ON;
|
|
|
|
DECLARE @tmp [dbo].[mfr__tt__stockmovements];
|
|
|
|
DECLARE @tmp_cmd nvarchar(1000) = N'SELECT DISTINCT * FROM ' + @tblname
|
|
INSERT INTO @tmp EXECUTE [sp_executesql] @tmp_cmd;
|
|
|
|
|
|
MERGE [dbo].[mfr__stockmovements] as TARGET
|
|
USING @tmp as SOURCE ON TARGET.[Id] = SOURCE.[Id]
|
|
WHEN MATCHED AND (TARGET.[Version] <= SOURCE.[Version] OR TARGET.[DateModified] <= SOURCE.[DateModified] OR TARGET.[DateOfCreation] <= SOURCE.[DateOfCreation] ) THEN
|
|
UPDATE
|
|
SET [Id] = SOURCE.[Id]
|
|
,[Version] = SOURCE.[Version]
|
|
,[Amount] = SOURCE.[Amount]
|
|
,[AmountReceived] = SOURCE.[AmountReceived]
|
|
,[ExternalId] = SOURCE.[ExternalId]
|
|
,[ItemId] = SOURCE.[ItemId]
|
|
,[ItemTypeId] = SOURCE.[ItemTypeId]
|
|
,[StockMovementType] = SOURCE.[StockMovementType]
|
|
,[State] = SOURCE.[State]
|
|
,[ServiceRequestId] = SOURCE.[ServiceRequestId]
|
|
,[WarehouseId] = SOURCE.[WarehouseId]
|
|
,[DateOfCreation] = SOURCE.[DateOfCreation]
|
|
,[DateModified] = SOURCE.[DateModified]
|
|
,[TargetDate] = SOURCE.[TargetDate]
|
|
,[CreatedById] = SOURCE.[CreatedById]
|
|
,[ConfirmedById] = SOURCE.[ConfirmedById]
|
|
WHEN NOT MATCHED BY TARGET THEN
|
|
INSERT
|
|
([Id]
|
|
,[Version]
|
|
,[Amount]
|
|
,[AmountReceived]
|
|
,[ExternalId]
|
|
,[ItemId]
|
|
,[ItemTypeId]
|
|
,[StockMovementType]
|
|
,[State]
|
|
,[ServiceRequestId]
|
|
,[WarehouseId]
|
|
,[DateOfCreation]
|
|
,[DateModified]
|
|
,[TargetDate]
|
|
,[CreatedById]
|
|
,[ConfirmedById])
|
|
VALUES
|
|
(SOURCE.[Id]
|
|
,SOURCE.[Version]
|
|
,SOURCE.[Amount]
|
|
,SOURCE.[AmountReceived]
|
|
,SOURCE.[ExternalId]
|
|
,SOURCE.[ItemId]
|
|
,SOURCE.[ItemTypeId]
|
|
,SOURCE.[StockMovementType]
|
|
,SOURCE.[State]
|
|
,SOURCE.[ServiceRequestId]
|
|
,SOURCE.[WarehouseId]
|
|
,SOURCE.[DateOfCreation]
|
|
,SOURCE.[DateModified]
|
|
,SOURCE.[TargetDate]
|
|
,SOURCE.[CreatedById]
|
|
,SOURCE.[ConfirmedById]);
|
|
END
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[mfr__updt__tags] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[mfr__updt__tags]
|
|
@tblname as nvarchar(50)
|
|
AS
|
|
BEGIN
|
|
SET NOCOUNT ON;
|
|
|
|
DECLARE @tmp [dbo].[mfr__tt__tags];
|
|
|
|
DECLARE @tmp_cmd nvarchar(1000) = N'SELECT DISTINCT * FROM ' + @tblname
|
|
INSERT INTO @tmp EXECUTE [sp_executesql] @tmp_cmd;
|
|
|
|
WITH tmp as (
|
|
SELECT *, ROW_NUMBER() OVER (PARTITION BY [id] ORDER BY [version] DESC) as '#' FROM @tmp
|
|
), SOURCE as (
|
|
SELECT * FROM tmp WHERE [#] = 1
|
|
)
|
|
MERGE [dbo].[mfr__tags] as TARGET
|
|
USING SOURCE ON TARGET.[Id] = SOURCE.[Id]
|
|
WHEN MATCHED AND (TARGET.[Version] <= SOURCE.[Version]) THEN
|
|
UPDATE
|
|
SET [Id] = SOURCE.[Id]
|
|
,[Version] = SOURCE.[Version]
|
|
,[Name] = SOURCE.[Name]
|
|
,[ColorDefinition] = SOURCE.[ColorDefinition]
|
|
,[Type] = SOURCE.[Type]
|
|
WHEN NOT MATCHED BY TARGET THEN
|
|
INSERT
|
|
( [Id]
|
|
,[Version]
|
|
,[Name]
|
|
,[ColorDefinition]
|
|
,[Type])
|
|
VALUES
|
|
(SOURCE.[Id]
|
|
,SOURCE.[Version]
|
|
,SOURCE.[Name]
|
|
,SOURCE.[ColorDefinition]
|
|
,SOURCE.[Type]);
|
|
END
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[mfr__updt__timeevents] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[mfr__updt__timeevents]
|
|
@tblname as nvarchar(50)
|
|
AS
|
|
BEGIN
|
|
SET NOCOUNT ON;
|
|
|
|
DECLARE @tmp [dbo].[mfr__tt__timeevents];
|
|
|
|
DECLARE @tmp_cmd nvarchar(1000) = N'SELECT DISTINCT * FROM ' + @tblname
|
|
INSERT INTO @tmp EXECUTE [sp_executesql] @tmp_cmd;
|
|
|
|
|
|
MERGE [dbo].[mfr__timeevents] as TARGET
|
|
USING @tmp as SOURCE ON TARGET.[Id] = SOURCE.[Id]
|
|
WHEN MATCHED AND (TARGET.[Version] <= SOURCE.[Version] OR TARGET.[DateModified] <= SOURCE.[DateModified]) THEN
|
|
UPDATE
|
|
SET [Id] = SOURCE.[Id]
|
|
,[Version] = SOURCE.[Version]
|
|
,[State] = SOURCE.[State]
|
|
,[IsApproved] = SOURCE.[IsApproved]
|
|
,[TimeEventType] = SOURCE.[TimeEventType]
|
|
,[ExternalId] = SOURCE.[ExternalId]
|
|
,[DateModified] = SOURCE.[DateModified]
|
|
,[StartDateTime] = SOURCE.[StartDateTime]
|
|
,[EndDateTime] = SOURCE.[EndDateTime]
|
|
,[ProposedDrivingDistance] = SOURCE.[ProposedDrivingDistance]
|
|
,[ContactId] = SOURCE.[ContactId]
|
|
,[ServiceRequestId] = SOURCE.[ServiceRequestId]
|
|
,[Description] = SOURCE.[Description]
|
|
WHEN NOT MATCHED BY TARGET THEN
|
|
INSERT
|
|
([Id]
|
|
,[Version]
|
|
,[State]
|
|
,[IsApproved]
|
|
,[TimeEventType]
|
|
,[ExternalId]
|
|
,[DateModified]
|
|
,[StartDateTime]
|
|
,[EndDateTime]
|
|
,[ProposedDrivingDistance]
|
|
,[ContactId]
|
|
,[ServiceRequestId]
|
|
,[Description])
|
|
VALUES
|
|
(SOURCE.[Id]
|
|
,SOURCE.[Version]
|
|
,SOURCE.[State]
|
|
,SOURCE.[IsApproved]
|
|
,SOURCE.[TimeEventType]
|
|
,SOURCE.[ExternalId]
|
|
,SOURCE.[DateModified]
|
|
,SOURCE.[StartDateTime]
|
|
,SOURCE.[EndDateTime]
|
|
,SOURCE.[ProposedDrivingDistance]
|
|
,SOURCE.[ContactId]
|
|
,SOURCE.[ServiceRequestId]
|
|
,SOURCE.[Description]);
|
|
END
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[mfr__updt__users] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[mfr__updt__users]
|
|
@tblname as nvarchar(50)
|
|
AS
|
|
BEGIN
|
|
SET NOCOUNT ON;
|
|
|
|
DECLARE @tmp [dbo].[mfr__tt__users];
|
|
|
|
DECLARE @tmp_cmd nvarchar(1000) = N'SELECT DISTINCT * FROM ' + @tblname
|
|
INSERT INTO @tmp EXECUTE [sp_executesql] @tmp_cmd;
|
|
|
|
|
|
MERGE [dbo].[mfr__users] as TARGET
|
|
USING @tmp as SOURCE ON TARGET.[Id] = SOURCE.[Id]
|
|
WHEN MATCHED AND (TARGET.[Version] <= SOURCE.[Version] OR TARGET.[CreationDate] <= SOURCE.[CreationDate]) THEN
|
|
UPDATE
|
|
SET [Id] = SOURCE.[Id]
|
|
,[Version] = SOURCE.[Version]
|
|
,[UserName] = SOURCE.[UserName]
|
|
,[IsSystem] = SOURCE.[IsSystem]
|
|
,[CreationDate] = SOURCE.[CreationDate]
|
|
,[IsApproved] = SOURCE.[IsApproved]
|
|
,[ContactId] = SOURCE.[ContactId]
|
|
,[PreferedLanguage] = SOURCE.[PreferedLanguage]
|
|
,[EmailChannelEnabled] = SOURCE.[EmailChannelEnabled]
|
|
,[HasFullScreenPreference] = SOURCE.[HasFullScreenPreference]
|
|
,[TimeZone] = SOURCE.[TimeZone]
|
|
,[PreferedCulture] = SOURCE.[PreferedCulture]
|
|
,[IsActive] = SOURCE.[IsActive]
|
|
,[IsMobile] = SOURCE.[IsMobile]
|
|
,[LastLoginDate] = SOURCE.[LastLoginDate]
|
|
,[UserGuideProgress] = SOURCE.[UserGuideProgress]
|
|
,[DashboardSettings] = SOURCE.[DashboardSettings]
|
|
WHEN NOT MATCHED BY TARGET THEN
|
|
INSERT
|
|
( [Id]
|
|
,[Version]
|
|
,[UserName]
|
|
,[IsSystem]
|
|
,[CreationDate]
|
|
,[IsApproved]
|
|
,[ContactId]
|
|
,[PreferedLanguage]
|
|
,[EmailChannelEnabled]
|
|
,[HasFullScreenPreference]
|
|
,[TimeZone]
|
|
,[PreferedCulture]
|
|
,[IsActive]
|
|
,[IsMobile]
|
|
,[LastLoginDate]
|
|
,[UserGuideProgress]
|
|
,[DashboardSettings])
|
|
VALUES
|
|
(SOURCE.[Id]
|
|
,SOURCE.[Version]
|
|
,SOURCE.[UserName]
|
|
,SOURCE.[IsSystem]
|
|
,SOURCE.[CreationDate]
|
|
,SOURCE.[IsApproved]
|
|
,SOURCE.[ContactId]
|
|
,SOURCE.[PreferedLanguage]
|
|
,SOURCE.[EmailChannelEnabled]
|
|
,SOURCE.[HasFullScreenPreference]
|
|
,SOURCE.[TimeZone]
|
|
,SOURCE.[PreferedCulture]
|
|
,SOURCE.[IsActive]
|
|
,SOURCE.[IsMobile]
|
|
,SOURCE.[LastLoginDate]
|
|
,SOURCE.[UserGuideProgress]
|
|
,SOURCE.[DashboardSettings]);
|
|
END
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[ocms_admin_createUserAccount] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date, ,>
|
|
-- Description: <Description, ,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[ocms_admin_createUserAccount]
|
|
@name nvarchar(255)
|
|
,@email varchar(255)
|
|
,@mobile varchar(50)
|
|
,@password nvarchar(20)
|
|
,@enc_key uniqueidentifier
|
|
AS
|
|
BEGIN
|
|
SET NOCOUNT ON;
|
|
|
|
DECLARE @utcnow datetime = GETUTCDATE();
|
|
|
|
INSERT INTO [dbo].[ocms_useraccounts]
|
|
([useraccount_id]
|
|
,[name_enc]
|
|
,[email_enc]
|
|
,[mobile_enc]
|
|
,[password_enc]
|
|
,[UserDisabled]
|
|
,[DateDisabled]
|
|
,[UserCreated]
|
|
,[DateCreated]
|
|
,[UserModified]
|
|
,[DateModified]
|
|
,[UserDeleted]
|
|
,[DateDeleted])
|
|
OUTPUT inserted.[useraccount_id]
|
|
VALUES
|
|
([dbo].[ocms_fn_useraccount_id] ()
|
|
,ENCRYPTBYKEY(@enc_key, @name)
|
|
,ENCRYPTBYKEY(@enc_key, @email)
|
|
,ENCRYPTBYKEY(@enc_key, @mobile)
|
|
,CASE WHEN @password is null then null ELSE ENCRYPTBYKEY(@enc_key, @password) END
|
|
,NULL --[UserDisabled]
|
|
,NULL --[DateDisabled]
|
|
,'sa'
|
|
,@utcnow
|
|
,'sa'
|
|
,@utcnow
|
|
,NULL
|
|
,NULL);
|
|
|
|
END
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[ocms_admin_debug_log] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
-- =============================================
|
|
-- Author: Dr. Stefan Ott
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[ocms_admin_debug_log]
|
|
@machine varchar(50)
|
|
,@error varchar(2000)
|
|
,@exception varchar(max)
|
|
,@procedure varchar(255)
|
|
,@authuser varchar(25)
|
|
,@data nvarchar(max)
|
|
,@isdebug bit
|
|
AS
|
|
BEGIN
|
|
SET NOCOUNT ON;
|
|
|
|
INSERT INTO [dbo].[ocms_debug]
|
|
([machine]
|
|
,[error]
|
|
,[exception]
|
|
,[procedure]
|
|
,[authuser]
|
|
,[data]
|
|
,[isdebug])
|
|
VALUES
|
|
(
|
|
@machine
|
|
,@error
|
|
,@exception
|
|
,@procedure
|
|
,@authuser
|
|
,@data
|
|
,@isdebug
|
|
);
|
|
|
|
END
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[ocms_cleanups] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[ocms_cleanups]
|
|
|
|
AS
|
|
BEGIN
|
|
SET NOCOUNT ON;
|
|
|
|
/* UPDATE Template Property Numbering */
|
|
with tpo as (
|
|
select *
|
|
, ROW_NUMBER() OVER (PARTITION BY ocms_tid ORDER BY [order], ocms_tpid) as 'tpo'
|
|
from [dbo].[ocms_template_properties]
|
|
)
|
|
update tp
|
|
SET tp.[order] = tpo.[tpo]
|
|
From [dbo].[ocms_template_properties] as tp
|
|
JOIN tpo ON tp.[ocms_tpid] = tpo.[ocms_tpid];
|
|
|
|
|
|
/* UPDATE ITEM NUMBERING */
|
|
with ino as (
|
|
select *
|
|
, ROW_NUMBER() OVER (PARTITION BY [parent_iid] ORDER BY [order], [ocms_iid]) as 'itmo' -- 999 for any new
|
|
from [dbo].[ocms_items]
|
|
)
|
|
update i
|
|
SET i.[order] = ino.[itmo]
|
|
From [dbo].[ocms_items] as i
|
|
JOIN ino ON i.[ocms_iid] = ino.[ocms_iid]
|
|
WHERE i.[order] >= 0 and i.[parent_iid] is not null
|
|
|
|
END
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[ocms_cloneItem] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[ocms_cloneItem]
|
|
@old_ocms_iid bigint
|
|
,@new_parent_iid bigint
|
|
AS
|
|
BEGIN
|
|
|
|
SET NOCOUNT ON;
|
|
|
|
IF EXISTS (SELECT * from [dbo].[ocms_items] as i where i.[ocms_iid] = @old_ocms_iid)
|
|
AND EXISTS (SELECT * from [dbo].[ocms_items] as i where i.[ocms_iid] = @new_parent_iid)
|
|
BEGIN
|
|
DECLARE @NEW TABLE ([ocms_iid] bigint, [old_ocms_pid] bigint);
|
|
|
|
INSERT INTO [dbo].[ocms_items]
|
|
([parent_iid]
|
|
,[ocms_pid]
|
|
,[name]
|
|
,[view]
|
|
,[template_id]
|
|
,[hide]
|
|
,[order]
|
|
,[DateCreated]
|
|
,[DateModified])
|
|
OUTPUT inserted.[ocms_iid], inserted.[ocms_pid] INTO @new
|
|
SELECT @new_parent_iid
|
|
,[ocms_pid]
|
|
,[name]
|
|
,[view]
|
|
,[template_id]
|
|
,[hide]
|
|
,[order]
|
|
,GETUTCDATE()
|
|
,GETUTCDATE()
|
|
FROM [dbo].[ocms_items] as i
|
|
WHERE [ocms_iid] = @old_ocms_iid;
|
|
|
|
DECLARE @new_ocms_iid bigint, @old_ocms_pid bigint;
|
|
SELECT TOP(1) @new_ocms_iid = [ocms_iid], @old_ocms_pid = [old_ocms_pid] FROM @NEW;
|
|
|
|
|
|
IF NOT EXISTS (SELECT pn.* from [dbo].[ocms_properties] as pn JOIN [dbo].[ocms_properties] as po ON pn.[key] = po.[key] and pn.[locale] = po.[locale]
|
|
WHERE pn.[ocms_iid] = @new_parent_iid AND po.[ocms_pid] = @old_ocms_pid)
|
|
BEGIN
|
|
DECLARE @newprop [dbo].[ocms_type_properties_base];
|
|
DECLARE @property_key varchar(50), @locale varchar(5), @new_ocms_pid bigint;
|
|
SELECT TOP(1) @property_key = [key], @locale = [locale] FROM [dbo].[ocms_properties] as p WHERE [ocms_pid] = @old_ocms_pid;
|
|
|
|
IF ISNULL(@property_key, '') <> ''
|
|
BEGIN
|
|
INSERT INTO @newprop VALUES(@new_parent_iid, @property_key, '', @locale);
|
|
EXECUTE [dbo].[ocms_merge_properties] @newprop; --makes sure is ok with template
|
|
END
|
|
|
|
SELECT TOP(1) @new_ocms_pid = [ocms_pid] FROM [dbo].[ocms_properties] WHERE [ocms_iid] = @new_parent_iid AND [key] = @property_key;
|
|
|
|
UPDATE [dbo].[ocms_items]
|
|
SET [ocms_pid] = @new_ocms_pid
|
|
,[DateModified] = GETUTCDATE()
|
|
WHERE [ocms_iid] = @new_ocms_iid;
|
|
END
|
|
|
|
IF @new_ocms_iid is not null
|
|
BEGIN
|
|
INSERT INTO [dbo].[ocms_properties]
|
|
([ocms_iid]
|
|
,[key]
|
|
,[value]
|
|
,[locale]
|
|
,[DateCreated]
|
|
,[DateModified]
|
|
)
|
|
SELECT
|
|
@new_ocms_iid
|
|
,[key]
|
|
,[value]
|
|
,[locale]
|
|
,GETUTCDATE()
|
|
,GETUTCDATE()
|
|
FROM [dbo].[ocms_properties]
|
|
WHERE [ocms_iid] = @old_ocms_iid;
|
|
END
|
|
|
|
END
|
|
|
|
END
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[ocms_createPropertyItem] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[ocms_createPropertyItem]
|
|
@name nvarchar(255),
|
|
@parent_iid bigint,
|
|
@ocms_pid bigint,
|
|
@property_key varchar(50),
|
|
@template_id bigint,
|
|
@locale varchar(5)
|
|
AS
|
|
BEGIN
|
|
SET NOCOUNT ON;
|
|
|
|
DECLARE @site bigint = (SELECT TOP(1) [ocms_iid] FROM [dbo].[ocms_items] as i WHERE i.[parent_iid] is null);
|
|
|
|
IF ISNULL(@name, '') = ''
|
|
THROW 61010, 'name missing', 1;
|
|
IF EXISTS (SELECT * FROM [dbo].[ocms_items] WHERE [name] = @name)
|
|
THROW 61010, 'name already exists', 1;
|
|
IF NOT EXISTS (SELECT * FROM [dbo].[ocms_items] WHERE [ocms_iid] = @parent_iid)
|
|
THROW 61010, 'parent does not exist', 1;
|
|
IF NOT EXISTS (SELECT * FROM [dbo].[ocms_templates] WHERE [ocms_tid] = @template_id)
|
|
THROW 61010, 'template does not exist', 1;
|
|
|
|
IF NOT EXISTS (SELECT * FROM [dbo].[ocms_properties] WHERE [ocms_iid] = @parent_iid AND ([ocms_pid] = @ocms_pid OR (@ocms_pid is null AND [key] = @property_key)))
|
|
BEGIN
|
|
DECLARE @newprop [dbo].[ocms_type_properties_base];
|
|
INSERT INTO @newprop VALUES(@parent_iid, @property_key, '', @locale);
|
|
EXECUTE [dbo].[ocms_merge_properties] @newprop; --makes sure is ok with template
|
|
END
|
|
|
|
SELECT TOP(1) @ocms_pid = [ocms_pid] FROM [dbo].[ocms_properties] WHERE [ocms_iid] = @parent_iid AND ([ocms_pid] = @ocms_pid OR (@ocms_pid is null AND [key] = @property_key));
|
|
|
|
--get last ocms_iid
|
|
DECLARE @lastiid int = ISNULL ( (SELECT MAX(ISNULL(p.[ocms_iid], ap.[ocms_iid]))
|
|
FROM [dbo].[ocms_items] as p FULL OUTER JOIN [ocms_archive__items] as ap on p.[ocms_iid] = ap.[ocms_iid])
|
|
,0);
|
|
|
|
IF NOT EXISTS (SELECT * FROM [dbo].[ocms_properties] WHERE [ocms_iid] = @parent_iid AND [ocms_pid] = @ocms_pid)
|
|
THROW 61010, 'parent''s property does not exist', 1;
|
|
|
|
|
|
IF @site is not null
|
|
BEGIN
|
|
MERGE [dbo].[ocms_items] as TARGET
|
|
USING (VALUES(
|
|
@parent_iid
|
|
,@ocms_pid
|
|
,@name
|
|
,0
|
|
,@template_id
|
|
,0
|
|
,999 -- append always
|
|
)) as SOURCE ([parent_iid]
|
|
,[ocms_pid]
|
|
,[name]
|
|
,[view]
|
|
,[template_id]
|
|
,[hide]
|
|
,[order])
|
|
ON TARGET.[name] = SOURCE.[name]
|
|
WHEN NOT MATCHED BY TARGET THEN
|
|
INSERT
|
|
([ocms_iid]
|
|
,[parent_iid]
|
|
,[ocms_pid]
|
|
,[name]
|
|
,[view]
|
|
,[template_id]
|
|
,[hide]
|
|
,[order]
|
|
,[DateCreated]
|
|
,[DateModified])
|
|
VALUES( @lastiid + 1, SOURCE.[parent_iid], SOURCE.[ocms_pid], SOURCE.[name], SOURCE.[view], SOURCE.[template_id], SOURCE.[hide], SOURCE.[order], GETUTCDATE(), GETUTCDATE())
|
|
OUTPUT inserted.[ocms_iid];
|
|
|
|
END
|
|
|
|
END
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[ocms_createView] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[ocms_createView]
|
|
@name nvarchar(255),
|
|
@parent_iid bigint
|
|
AS
|
|
BEGIN
|
|
SET NOCOUNT ON;
|
|
|
|
DECLARE @site bigint = (SELECT TOP(1) [ocms_iid] FROM [dbo].[ocms_items] as i WHERE i.[parent_iid] is null);
|
|
DECLARE @template_id bigint = (SELECT TOP(1) [ocms_tid] FROM [dbo].[ocms_templates] as t WHERE t.[name] = 'view');
|
|
|
|
IF ISNULL(@name, '') = ''
|
|
THROW 61010, 'name missing', 1;
|
|
IF EXISTS (SELECT * FROM [dbo].[ocms_items] WHERE [name] = @name)
|
|
THROW 61110, 'name already exists', 1;
|
|
IF @site is null
|
|
THROW 61110, 'site does not exist', 1;
|
|
|
|
|
|
SELECT @parent_iid = [ocms_iid] FROM [dbo].[ocms_items] as i WHERE [ocms_iid] = @parent_iid AND (i.[parent_iid] is null OR i.[view] = 1);
|
|
--apply site as fallback
|
|
SET @parent_iid = ISNULL(@parent_iid, @site);
|
|
|
|
--get last ocms_iid
|
|
DECLARE @lastiid int = ISNULL ( (SELECT MAX(ISNULL(p.[ocms_iid], ap.[ocms_iid]))
|
|
FROM [dbo].[ocms_items] as p FULL OUTER JOIN [ocms_archive__items] as ap on p.[ocms_iid] = ap.[ocms_iid])
|
|
,0);
|
|
|
|
|
|
-- get locales setting
|
|
DECLARE @locales TABLE([locale] varchar(5), [order] int);
|
|
INSERT INTO @locales
|
|
SELECT * FROM [dbo].[ocms_locales]();
|
|
|
|
|
|
-- add item
|
|
DECLARE @output TABLE([ocms_iid] bigint);
|
|
DECLARE @ocms_iid bigint;
|
|
MERGE [dbo].[ocms_items] as TARGET
|
|
USING (VALUES(
|
|
@site
|
|
,NULL
|
|
,@name
|
|
,1
|
|
,@template_id
|
|
,0
|
|
,999 -- append always
|
|
)) as SOURCE ([parent_iid]
|
|
,[ocms_pid]
|
|
,[name]
|
|
,[view]
|
|
,[template_id]
|
|
,[hide]
|
|
,[order])
|
|
ON TARGET.[name] = SOURCE.[name]
|
|
WHEN NOT MATCHED BY TARGET THEN
|
|
INSERT
|
|
([ocms_iid]
|
|
,[parent_iid]
|
|
,[ocms_pid]
|
|
,[name]
|
|
,[view]
|
|
,[template_id]
|
|
,[hide]
|
|
,[order]
|
|
,[DateCreated]
|
|
,[DateModified])
|
|
VALUES(@lastiid + 1, SOURCE.[parent_iid], SOURCE.[ocms_pid], SOURCE.[name], SOURCE.[view], SOURCE.[template_id], SOURCE.[hide], SOURCE.[order], GETUTCDATE(), GETUTCDATE())
|
|
OUTPUT inserted.[ocms_iid]
|
|
INTO @output;
|
|
|
|
SELECT TOP(1) @ocms_iid = [ocms_iid] FROM @output;
|
|
|
|
-- add navigation
|
|
|
|
-- update nav table
|
|
UPDATE n
|
|
SET n.[parent_iid] = i.[parent_iid]
|
|
FROM [dbo].[ocms_navigation] as n
|
|
JOIN [ocms_items] as i ON n.[ocms_iid] = i.[ocms_iid];
|
|
|
|
DECLARE @newnav [dbo].[ocms_type_navigation_base];
|
|
DECLARE @suffix int = 0;
|
|
INSERT INTO @newnav
|
|
SELECT @ocms_iid, [locale], @name + '_' + [locale]
|
|
FROM @locales as l
|
|
WHERE l.[locale] <> '*';
|
|
|
|
WHILE EXISTS (SELECT * FROM [dbo].[ocms_navigation] as cn JOIN @newnav as nn
|
|
ON cn.[parent_iid] = @parent_iid
|
|
AND cn.[alias] = nn.[alias])
|
|
BEGIN
|
|
SET @suffix = @suffix + 1;
|
|
UPDATE @newnav
|
|
SET [alias] = @name + '_' + [locale] + CAST(@suffix as varchar(3));
|
|
END
|
|
|
|
EXECUTE [dbo].[ocms_merge_navigation] @newnav;
|
|
|
|
--output
|
|
SELECT @ocms_iid;
|
|
|
|
END
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[ocms_deleteItem] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[ocms_deleteItem]
|
|
@ocms_iid bigint
|
|
AS
|
|
BEGIN
|
|
SET NOCOUNT ON;
|
|
|
|
DECLARE @children TABLE([ocms_iid] bigint, [parent_iid] bigint);
|
|
with cte as ( select [ocms_iid], [parent_iid] from [ocms_items] as i WHERE i.[parent_iid] = @ocms_iid --only children and below
|
|
UNION ALL
|
|
select i.[ocms_iid], i.[parent_iid] from [ocms_items] as i JOIN cte on cte.ocms_iid = i.[parent_iid]
|
|
)
|
|
insert into @children select * from cte;
|
|
|
|
--first delete childrens properties, bc else the foreign key constraint will prevent to continue */
|
|
|
|
DELETE p
|
|
OUTPUT deleted.*, GETUTCDATE(), null
|
|
INTO [dbo].[ocms_archive__properties]
|
|
FROM [dbo].[ocms_properties] as p
|
|
WHERE p.[ocms_iid] in (SELECT c.[ocms_iid] FROM @children as c); -- only children's as selected at beginning /
|
|
|
|
DELETE i
|
|
OUTPUT deleted.*, GETUTCDATE(), null
|
|
INTO [dbo].[ocms_archive__items]
|
|
FROM [ocms_items] as i
|
|
WHERE i.[ocms_iid] in (SELECT c.[ocms_iid] FROM @children as c);; -- only children as selected at beginning /
|
|
|
|
DELETE p
|
|
OUTPUT deleted.*, GETUTCDATE(), null
|
|
INTO [dbo].[ocms_archive__properties]
|
|
FROM [dbo].[ocms_properties] as p
|
|
WHERE p.[ocms_iid] = @ocms_iid; -- only children's as selected at beginning /
|
|
|
|
DELETE FROM [ocms_items]
|
|
OUTPUT deleted.*, GETUTCDATE(), null
|
|
INTO [dbo].[ocms_archive__items]
|
|
WHERE [ocms_iid] = @ocms_iid;
|
|
|
|
|
|
SELECT TOP(1) [ocms_iid]
|
|
FROM [dbo].[ocms_archive__items]
|
|
WHERE [ocms_iid] = @ocms_iid;
|
|
|
|
|
|
END
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[ocms_getAvailableTemplates] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[ocms_getAvailableTemplates]
|
|
@ocms_iid bigint
|
|
,@ocms_pid bigint
|
|
,@property_key varchar(50)
|
|
AS
|
|
BEGIN
|
|
SET NOCOUNT ON;
|
|
|
|
IF NOT EXISTS (SELECT * FROM [dbo].[ocms_items] WHERE [ocms_iid] = @ocms_iid)
|
|
THROW 61010, 'item does not exist', 1;
|
|
|
|
DECLARE @TP TABLE(
|
|
[ocms_tpid] [bigint] NOT NULL,
|
|
[ocms_pid] [bigint],
|
|
[condition] [varchar](max) NULL
|
|
);
|
|
INSERT INTO @TP
|
|
SELECT tp.[ocms_tpid], p.[ocms_pid], tp.[condition]
|
|
FROM [dbo].[ocms_items] as i
|
|
JOIN [dbo].[ocms_templates] as t on i.[template_id] = t.[ocms_tid]
|
|
JOIN [dbo].[ocms_template_properties] as tp ON t.[ocms_tid] = tp.[ocms_tid] AND tp.[type] = 'array'
|
|
LEFT JOIN [dbo].[ocms_properties] as p ON i.[ocms_iid] = p.[ocms_iid] AND p.[key] = tp.[key]
|
|
WHERE i.[ocms_iid] = @ocms_iid
|
|
AND (p.[ocms_pid] = @ocms_pid OR (@ocms_pid is null AND tp.[key] = @property_key))
|
|
AND tp.[type] = 'array';
|
|
|
|
IF NOT EXISTS (SELECT * FROM @TP)
|
|
THROW 61010, 'items''s property type is not array', 1;
|
|
|
|
DECLARE @condition varchar(max);
|
|
|
|
SET @condition = ISNULL((SELECT TOP(1) [condition] FROM @TP), '');
|
|
DECLARE @TIDS TABLE ([ocms_tid] bigint);
|
|
|
|
|
|
IF LEFT(@condition, 1) = '{' AND RIGHT(@condition, 1) = '}'
|
|
BEGIN
|
|
INSERT INTO @TIDS SELECT RTRIM(LTRIM(value)) FROM string_split(SUBSTRING(@condition,2,LEN(@condition) - 2), ',');
|
|
END
|
|
ELSE IF @condition <> ''
|
|
BEGIN
|
|
INSERT INTO @TIDS SELECT [ocms_tid] FROM [ocms_templates] WHERE [name] like @condition;
|
|
END
|
|
|
|
--output
|
|
SELECT t.[ocms_tid],t.[name] FROM [dbo].[ocms_templates] as t JOIN @TIDS as tids ON t.[ocms_tid] = tids.ocms_tid;
|
|
|
|
|
|
|
|
|
|
--select STUFF(
|
|
-- (SELECT ',' + [name] as [text()]
|
|
-- FROM [dbo].[ocms_templates]
|
|
-- WHERE name like 'section%'
|
|
-- FOR XML PATH, TYPE).value(N'.[1]', N'nvarchar(max)')
|
|
-- ,1,1,'')
|
|
|
|
|
|
END
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[ocms_getFullTree] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[ocms_getFullTree]
|
|
@locale varchar(5)
|
|
AS
|
|
BEGIN
|
|
/* FULL TREE is only intended for OCMS admin portal
|
|
Hidden items will be shown !
|
|
*/
|
|
|
|
SET NOCOUNT ON;
|
|
|
|
-- get basics
|
|
DECLARE @site bigint = (SELECT TOP(1) [ocms_iid] FROM [dbo].[ocms_items] as i WHERE i.[parent_iid] is null);
|
|
IF @site is null
|
|
THROW 61110, 'site does not exist', 1;
|
|
|
|
--get locales
|
|
DECLARE @locales TABLE([locale] varchar(5), [order] int);
|
|
INSERT INTO @locales
|
|
SELECT * FROM [dbo].[ocms_locales]();
|
|
|
|
|
|
-- calculate tree and paths
|
|
DECLARE @itemtree TABLE(
|
|
[ocms_iid] [bigint] NOT NULL,
|
|
[parent_iid] [bigint] NULL,
|
|
[ocms_pid] [bigint] NULL,
|
|
[name] [nvarchar](255) NULL,
|
|
[view] [bit] NOT NULL,
|
|
[template_id] [bigint] NULL,
|
|
[hide] [bit] NOT NULL,
|
|
[order] [int] NOT NULL,
|
|
[DateCreated] datetime null,
|
|
[DateModified] datetime null,
|
|
[level] int, [new_order] int
|
|
);
|
|
WITH cteLevels as (
|
|
SELECT t.*
|
|
, cast(0 as int) as [level]
|
|
FROM [dbo].[ocms_items] t
|
|
WHERE t.[ocms_iid] = @site
|
|
UNION ALL
|
|
SELECT t.*
|
|
, CAST(c.[level] + 1 as int) as [level]
|
|
FROM [dbo].[ocms_items] t
|
|
inner JOIN cteLevels c on t.[parent_iid] = c.[ocms_iid]
|
|
)
|
|
INSERT INTO @itemtree
|
|
SELECT t.*
|
|
, ROW_NUMBER() OVER (PARTITION BY [parent_iid] ORDER BY [order], [ocms_iid]) as [new_order]
|
|
FROM cteLevels as t;
|
|
--WHERE [hide] = 0;
|
|
|
|
|
|
|
|
|
|
-- output site properties
|
|
WITH SP As (
|
|
SELECT
|
|
p.*
|
|
, ROW_NUMBER() OVER (PARTITION BY p.[ocms_iid], p.[key] ORDER BY CAST((CASE WHEN p.[locale] = '*' THEN 1 ELSE 0 END) as int)) as 'rwi'
|
|
FROM @itemtree as it
|
|
JOIN [dbo].[ocms_properties] as p ON it.[ocms_iid] = p.[ocms_iid]
|
|
WHERE it.[level] = 0 --site
|
|
AND (p.[locale] = @locale OR p.[locale] = '*')
|
|
)
|
|
SELECT
|
|
it.[ocms_iid]
|
|
,p.[ocms_pid]
|
|
,ISNULL(tp.[key], p.[key]) as [key]
|
|
,IIF(ISNULL(tp.[mandatory],0) = 0, p.[value], ISNULL(p.[value],'')) as [value]
|
|
,tp.[type]
|
|
FROM @itemtree as it
|
|
FULL OUTER JOIN [dbo].[ocms_template_properties] as tp ON it.[template_id] = tp.[ocms_tid]
|
|
FULL OUTER JOIN SP as p ON p.[ocms_iid] = it.[ocms_iid] AND (tp.[key] = p.[key] OR tp.[key] is null)
|
|
AND p.[rwi] = 1 -- only the right language or fallback
|
|
WHERE it.[level] = 0;
|
|
|
|
|
|
|
|
-- output locales
|
|
SELECT * FROM @locales;
|
|
|
|
|
|
-- output children
|
|
SELECT
|
|
it.*
|
|
,p.[key] as 'property_key'
|
|
,p.[locale] as 'property_locale'
|
|
,tpl.[name] as 'template_name'
|
|
,ROW_NUMBER() OVER (PARTITION BY it.[parent_iid] ORDER BY IIF(it.[view] = 1, 0, 1), it.[ocms_pid], it.[ORDER], it.[ocms_iid]) as 'item_order'
|
|
FROM @itemtree as it
|
|
LEFT JOIN [dbo].[ocms_templates] as tpl on it.[template_id] = tpl.[ocms_tid]
|
|
LEFT JOIN [dbo].[ocms_properties] as p on it.[ocms_pid] = p.[ocms_pid]; --only arrays
|
|
|
|
|
|
-- output childrens' properties ONLY arrays
|
|
SELECT
|
|
it.[ocms_iid]
|
|
,p.[ocms_pid]
|
|
,ISNULL(tp.[key], p.[key]) as [key]
|
|
,IIF(ISNULL(tp.[mandatory],0) = 0, p.[value], ISNULL(p.[value],'')) as [value]
|
|
,p.locale
|
|
,tp.[type]
|
|
FROM @itemtree as it
|
|
JOIN [dbo].[ocms_template_properties] as tp ON it.[template_id] = tp.[ocms_tid]
|
|
FULL OUTER JOIN [dbo].[ocms_properties] as p ON p.[ocms_iid] = it.[ocms_iid] AND (tp.[key] = p.[key] OR tp.[key] is null)
|
|
WHERE ISNULL(ISNULL(tp.[key], p.[key]),'') <> ''
|
|
AND tp.[type] = 'array';
|
|
|
|
|
|
END
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[ocms_getItem] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[ocms_getItem]
|
|
@ocms_iid bigint
|
|
AS
|
|
BEGIN
|
|
SET NOCOUNT ON;
|
|
|
|
-- get basics
|
|
DECLARE @site bigint = (SELECT TOP(1) [ocms_iid] FROM [dbo].[ocms_items] as i WHERE i.[parent_iid] is null);
|
|
IF @site is null
|
|
THROW 61110, 'site does not exist', 1;
|
|
|
|
--get locales
|
|
DECLARE @locales TABLE([locale] varchar(5), [order] int);
|
|
INSERT INTO @locales
|
|
SELECT * FROM [dbo].[ocms_locales]();
|
|
|
|
-- get viewtree and paths
|
|
DECLARE @viewtree [dbo].[ocms_type_viewtree_full];
|
|
INSERT INTO @viewtree
|
|
SELECT * FROM [dbo].[ocms_getFullViewTree](null, null) -- get full with all languages
|
|
WHERE [ocms_iid] = @ocms_iid; -- only selected view
|
|
|
|
--get itemtree
|
|
DECLARE @itemtree [dbo].[ocms_type_itemtree];
|
|
INSERT INTO @itemtree SELECT * FROM [dbo].[ocms_getFullItemTree](@ocms_iid, 1);
|
|
|
|
/*-----------------------------------------------------------------------------------------------------------------------------------------------------*/
|
|
|
|
|
|
-- output site properties
|
|
SELECT
|
|
t.[ocms_iid]
|
|
,p.[ocms_pid]
|
|
,ISNULL(tp.[key], p.[key]) as [key]
|
|
,IIF(ISNULL(tp.[mandatory],0) = 0, p.[value], ISNULL(p.[value],'')) as [value]
|
|
,tp.[type]
|
|
FROM @itemtree as t
|
|
FULL OUTER JOIN [dbo].[ocms_template_properties] as tp ON t.[template_id] = tp.[ocms_tid]
|
|
FULL OUTER JOIN [dbo].[ocms_properties] as p ON p.[ocms_iid] = t.[ocms_iid] AND p.[value] is not null AND (tp.[key] = p.[key] OR tp.[key] is null)
|
|
WHERE t.[level] = 0;
|
|
|
|
|
|
-- output locales
|
|
SELECT * FROM @locales;
|
|
|
|
-- output item
|
|
SELECT TOP(1)
|
|
it.*
|
|
,p.[key] as 'property_key'
|
|
,p.[locale] as 'property_locale'
|
|
,tpl.[name] as 'template_name'
|
|
,ROW_NUMBER() OVER (PARTITION BY it.[parent_iid], it.[ocms_pid] ORDER BY it.[ORDER], it.[ocms_iid]) as 'item_order'
|
|
FROM @itemtree as it --not necessary a view
|
|
LEFT JOIN [dbo].[ocms_templates] as tpl on it.[template_id] = tpl.[ocms_tid]
|
|
LEFT JOIN [dbo].[ocms_properties] as p on it.[ocms_pid] = p.ocms_pid and p.[value] is not null
|
|
WHERE it.[ocms_iid] = @ocms_iid; -- item in focus
|
|
|
|
-- output children
|
|
SELECT
|
|
it.*
|
|
,p.[key] as 'property_key'
|
|
,p.[locale] as 'property_locale'
|
|
,tpl.[name] as 'template_name'
|
|
,ROW_NUMBER() OVER (PARTITION BY it.[parent_iid], it.[ocms_pid] ORDER BY it.[ORDER], it.[ocms_iid]) as 'item_order'
|
|
FROM @itemtree as it
|
|
LEFT JOIN [dbo].[ocms_templates] as tpl on it.[template_id] = tpl.[ocms_tid]
|
|
LEFT JOIN [dbo].[ocms_properties] as p on it.[ocms_pid] = p.ocms_pid and p.[value] is not null
|
|
WHERE it.[ocms_iid] <> @ocms_iid
|
|
AND it.[sub] = 1;
|
|
|
|
-- output items properties
|
|
WITH tp as (
|
|
SELECT tp_.*, ROW_NUMBER() OVER (ORDER BY tp_.[order], tp_.[ocms_tpid], tp_.[key]) as 'tpo', l.locale, l.[order] as [locorder] FROM [dbo].[ocms_template_properties] as tp_ CROSS JOIN @locales as l -- incl. fallback locale '*'
|
|
)
|
|
SELECT
|
|
it.[ocms_iid]
|
|
,p.[ocms_pid]
|
|
,ISNULL(tp.[key], p.[key]) as [key]
|
|
,IIF(ISNULL(tp.[mandatory],0) = 0, p.[value], ISNULL(p.[value],'')) as [value]
|
|
,tp.locale
|
|
,tp.[type]
|
|
,tp.[mandatory]
|
|
,IIF(tp.[type] <> 'array', tp.[condition], '') as [condition]
|
|
,ROW_NUMBER() OVER (ORDER BY it.[ocms_iid], tp.[tpo], p.[ocms_pid]) as [order]
|
|
FROM @itemtree as it
|
|
JOIN tp ON it.[template_id] = tp.[ocms_tid]
|
|
FULL OUTER JOIN [dbo].[ocms_properties] as p
|
|
ON p.[ocms_iid] = it.[ocms_iid]
|
|
AND p.[value] is not null
|
|
AND (tp.[key] = p.[key] OR tp.[key] is null)
|
|
AND p.[locale] = tp.[locale]
|
|
WHERE ISNULL(ISNULL(tp.[key], p.[key]),'') <> ''
|
|
AND it.[ocms_iid] = @ocms_iid;
|
|
|
|
|
|
-- output items navs
|
|
WITH nav as (
|
|
select [ocms_iid], [locale], [alias]
|
|
from [dbo].[ocms_navigation] as n WHERE ISNULL(n.[alias], '') <> '' AND n.[locale] <> '*'
|
|
UNION
|
|
SELECT i.[ocms_iid], l.[locale], i.[name]
|
|
FROM [dbo].[ocms_items] as i
|
|
CROSS JOIN @locales as l
|
|
WHERE i.[parent_iid] = @site AND i.[name] = 'index' and l.[locale] <> '*'
|
|
)SELECT
|
|
l.[locale]
|
|
,n.[alias]
|
|
,vt.[path]
|
|
FROM @viewtree as vt
|
|
CROSS JOIN @locales as l
|
|
LEFT JOIN nav as n ON vt.[ocms_iid] = n.[ocms_iid] AND l.[locale] = n.[locale]
|
|
WHERE vt.[ocms_iid] = @ocms_iid
|
|
AND l.[locale] <> '*';
|
|
|
|
END
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[ocms_getItem_byName] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[ocms_getItem_byName]
|
|
@name nvarchar(255)
|
|
AS
|
|
BEGIN
|
|
SET NOCOUNT ON;
|
|
|
|
DECLARE @ocms_iid bigint = (SELECT TOP(1) [ocms_iid] FROM [dbo].[ocms_items] as i WHERE [name] = @name);
|
|
|
|
EXECUTE [dbo].[ocms_getItem] @ocms_iid;
|
|
END
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[ocms_getView] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[ocms_getView]
|
|
@view_path varchar(255)
|
|
,@locale varchar(5)
|
|
AS
|
|
BEGIN
|
|
SET NOCOUNT ON;
|
|
|
|
IF ISNULL(@locale, '') = ''
|
|
SET @locale = 'de'; -- fallback
|
|
IF ISNULL(@view_path, '') = ''
|
|
SET @view_path = 'index';
|
|
|
|
-- get basics
|
|
DECLARE @site bigint = (SELECT TOP(1) [ocms_iid] FROM [dbo].[ocms_items] as i WHERE i.[parent_iid] is null);
|
|
IF @site is null
|
|
THROW 61110, 'site does not exist', 1;
|
|
|
|
--get locales
|
|
DECLARE @locales TABLE([locale] varchar(5), [order] int);
|
|
INSERT INTO @locales
|
|
SELECT * FROM [dbo].[ocms_locales]();
|
|
|
|
|
|
-- get viewtree and paths
|
|
DECLARE @view_iid bigint = null, @view_level int, @view_name nvarchar(255), @view_is_hidden bit;
|
|
DECLARE @viewtree [dbo].[ocms_type_viewtree_full];
|
|
INSERT INTO @viewtree SELECT * FROM [dbo].[ocms_getFullViewTree](@view_path, null); -- any locale to be able to determine language from path
|
|
|
|
SELECT TOP(1)
|
|
@view_iid = it.[ocms_iid]
|
|
, @view_level = it.[level]
|
|
, @locale = it.[locale] -- will override the selected language
|
|
, @view_name = it.[name]
|
|
, @view_is_hidden = it.[hide]
|
|
FROM @viewtree as it
|
|
ORDER BY (CASE WHEN [focus] = 1 AND [locale] = @locale THEN 0 WHEN [focus] = 1 THEN 1 ELSE 2 END) ASC;
|
|
|
|
|
|
--get itemtree
|
|
DECLARE @itemtree [dbo].[ocms_type_itemtree];
|
|
INSERT INTO @itemtree SELECT * FROM [dbo].[ocms_getFullItemTree](@view_iid, @view_is_hidden); -- items are not localized
|
|
|
|
|
|
--get properties
|
|
DECLARE @PROP TABLE(
|
|
[ocms_pid] [bigint] NOT NULL,
|
|
[ocms_iid] [bigint] NOT NULL,
|
|
[key] [varchar](50) NULL,
|
|
[value] [nvarchar](max) NOT NULL,
|
|
[DateModified] [datetime] NULL
|
|
);
|
|
WITH SP As (
|
|
SELECT
|
|
p.*
|
|
,it.[focus]
|
|
,it.[level]
|
|
, ROW_NUMBER() OVER (PARTITION BY p.[ocms_iid], p.[key] ORDER BY CAST((CASE WHEN p.[locale] = '*' THEN 1 ELSE 0 END) as int)) as 'rwi'
|
|
FROM @itemtree as it
|
|
JOIN [dbo].[ocms_properties] as p ON it.[ocms_iid] = p.[ocms_iid]
|
|
WHERE (it.[level] = 0 --site
|
|
OR it.[sub] = 1
|
|
OR it.[sitepropsub] = 1
|
|
OR it.[focus] = 1
|
|
OR it.[parent_iid] = @site) -- or itms below selected
|
|
AND (p.[locale] = @locale OR p.[locale] = '*')
|
|
)
|
|
INSERT INTO @PROP
|
|
SELECT [ocms_pid],[ocms_iid],[key],[value],[DateModified]
|
|
FROM SP
|
|
WHERE rwi = 1;
|
|
|
|
|
|
DECLARE @translations TABLE (
|
|
[ocms_tln] [bigint] NOT NULL,
|
|
[context_typ] [nvarchar](15) NOT NULL,
|
|
[context] [bigint] NULL,
|
|
[value] [nvarchar](255) NOT NULL,
|
|
[translation] [nvarchar](255) NOT NULL,
|
|
[locale] [varchar](5) NOT NULL
|
|
);
|
|
|
|
|
|
/* outputs *********************************************************************************************************************************************************/
|
|
|
|
|
|
-- output nav
|
|
SELECT vt.[ocms_iid]
|
|
,[parent_iid]
|
|
,vt.[ocms_pid]
|
|
,[name]
|
|
,ISNULL(p.[value], vt.[name]) as [title]
|
|
,[view]
|
|
,[template_id]
|
|
,[hide]
|
|
,[new_order] as [order]
|
|
, [path], [level], [sub], [focus], [nav]
|
|
FROM @viewtree as vt -- vt must be filtered by locale
|
|
LEFT JOIN [dbo].[ocms_properties] as p ON vt.[ocms_iid] = p.[ocms_iid] AND p.[key] = 'title' AND p.[locale] = vt.[locale] -- ! localized
|
|
WHERE [nav] = 1
|
|
AND vt.[locale] = @locale;
|
|
|
|
|
|
-- output site properties
|
|
SELECT
|
|
vt.[ocms_iid]
|
|
,p.[ocms_pid]
|
|
,ISNULL(tp.[key], p.[key]) as [key]
|
|
,IIF(ISNULL(tp.[mandatory],0) = 0, p.[value], ISNULL(p.[value],'')) as [value]
|
|
,tp.[type]
|
|
FROM @viewtree as vt -- site is part if viewtree // -- vt must be filtered by locale
|
|
FULL OUTER JOIN [dbo].[ocms_template_properties] as tp ON vt.[template_id] = tp.[ocms_tid]
|
|
FULL OUTER JOIN @PROP as p ON p.[ocms_iid] = vt.[ocms_iid] AND (tp.[key] = p.[key] OR tp.[key] is null) -- properties are ! localized, but already filtered for @PROP
|
|
WHERE vt.[ocms_iid] = @site
|
|
AND vt.[locale] = @locale
|
|
UNION
|
|
SELECT
|
|
NULL as [ocms_iid]
|
|
,NULL as [ocms_pid]
|
|
,'DateModified' as [key]
|
|
,FORMAT((SELECT MAX([DateModified]) FROM @PROP),'yyyy-MM-ddTHH:mm:ssZ') as [value]
|
|
,'string';
|
|
|
|
INSERT INTO @translations
|
|
SELECT * from [dbo].[ocms_translations] as TL WHERE TL.[context_typ] = 'site' AND TL.[locale] = @locale;
|
|
|
|
|
|
-- output locales
|
|
WITH pd as (SELECT DISTINCT [ocms_iid], [path], [locale] FROM @viewtree WHERE [ocms_iid] = @view_iid)
|
|
SELECT
|
|
pd.*
|
|
, CAST(IIF(l.[locale] = @locale, 1, 0) as bit) as 'active'
|
|
FROM @locales as l JOIN pd ON l.[locale] = pd.[locale]
|
|
WHERE l.[locale] <> '*';
|
|
|
|
|
|
-- output view properties
|
|
SELECT
|
|
vt.[ocms_iid]
|
|
,p.[ocms_pid]
|
|
,ISNULL(tp.[key], p.[key]) as [key]
|
|
,IIF(ISNULL(tp.[mandatory],0) = 0, p.[value], ISNULL(p.[value],'')) as [value]
|
|
,tp.[type]
|
|
FROM @viewtree as vt -- vt must be filtered by locale
|
|
FULL OUTER JOIN [dbo].[ocms_template_properties] as tp ON vt.[template_id] = tp.[ocms_tid]
|
|
FULL OUTER JOIN @PROP as p ON p.[ocms_iid] = vt.[ocms_iid] AND (tp.[key] = p.[key] OR tp.[key] is null) -- properties are ! localized, but already filtered for @PROP
|
|
WHERE vt.[focus] = 1
|
|
AND ISNULL(ISNULL(tp.[key], p.[key]),'') <> ''
|
|
AND vt.[locale] = @locale;
|
|
|
|
INSERT INTO @translations
|
|
SELECT * from [dbo].[ocms_translations] as TL
|
|
WHERE TL.[context] = @view_iid AND TL.[locale] = @locale; --context = 'view' and all other context_types
|
|
|
|
|
|
-- output children
|
|
SELECT
|
|
it.*
|
|
,tpl.[partial_view]
|
|
,tpl.[name] as [template_name]
|
|
,ROW_NUMBER() OVER (PARTITION BY it.[parent_iid], it.[ocms_pid] ORDER BY it.[ORDER], it.[ocms_iid]) as 'item_order'
|
|
FROM @itemtree as it -- items are not localized
|
|
LEFT JOIN [dbo].[ocms_templates] as tpl on it.[template_id] = tpl.[ocms_tid]
|
|
WHERE [sub] = 1 OR [sitepropsub] = 1 OR it.[parent_iid] = @site; --to include also site relevant children
|
|
|
|
INSERT INTO @translations
|
|
SELECT TL.* from @itemtree as it JOIN [dbo].[ocms_translations] as TL ON TL.[context_typ] = 'template' AND TL.[context] = it.[template_id] AND TL.[locale] = @locale;
|
|
|
|
|
|
-- output childrens' properties
|
|
SELECT
|
|
it.[ocms_iid]
|
|
,p.[ocms_pid]
|
|
,ISNULL(tp.[key], p.[key]) as [key]
|
|
,IIF(ISNULL(tp.[mandatory],0) = 0, p.[value], ISNULL(p.[value],'')) as [value]
|
|
,tp.[type]
|
|
FROM @itemtree as it -- items are not localized
|
|
JOIN [dbo].[ocms_template_properties] as tp ON it.[template_id] = tp.[ocms_tid] -- properties are ! localized, but already filtered for @PROP
|
|
FULL OUTER JOIN @PROP as p ON p.[ocms_iid] = it.[ocms_iid] AND (tp.[key] = p.[key] OR tp.[key] is null)
|
|
WHERE ([sub] = 1 OR [sitepropsub] = 1 OR it.[parent_iid] = @site) AND [focus] = 0
|
|
AND ISNULL(ISNULL(tp.[key], p.[key]),'') <> '';
|
|
|
|
|
|
|
|
--output translations
|
|
SELECT DISTINCT * FROM @translations;
|
|
|
|
|
|
--output breadcrumbs
|
|
WITH vws as(
|
|
SELECT vt.[ocms_iid], [parent_iid], ISNULL(p.[value], vt.[name]) as [title], [path] FROM @viewtree as vt -- vt must be filtered by locale
|
|
LEFT JOIN [dbo].[ocms_properties] as p ON vt.[ocms_iid] = p.[ocms_iid] AND p.[key] = 'title' AND p.[locale] = vt.[locale] -- ! localized
|
|
)
|
|
,
|
|
cte as (
|
|
SELECT vws.*, [title] as [breadcrumb], 0 as [level]
|
|
FROM vws
|
|
WHERE vws.[ocms_iid] = @view_iid
|
|
UNION ALL
|
|
SELECT vws.*, ( vws.[title] + ' > ' + cte.[breadcrumb]) as [breadcrumb]
|
|
, [level] + 1 as [level]
|
|
FROM vws JOIN cte ON vws.[ocms_iid] = cte.[parent_iid]
|
|
)
|
|
select [title]
|
|
, [path]
|
|
, CASE WHEN [level] = 0 THEN (SELECT TOP(1) [breadcrumb] FROM cte as cte1 ORDER BY [level] DESC) ELSE NULL END as [breadcrumb]
|
|
, ROW_NUMBER() OVER (ORDER BY [level] DESC) as [order]
|
|
FROM cte;
|
|
|
|
|
|
END
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[ocms_getView_byName] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[ocms_getView_byName]
|
|
@name nvarchar(255)
|
|
,@locale varchar(5)
|
|
,@include_hidden bit
|
|
AS
|
|
BEGIN
|
|
SET NOCOUNT ON;
|
|
|
|
IF ISNULL(@locale, '') = ''
|
|
SET @locale = 'de'; -- fallback
|
|
DECLARE @view_path varchar(255) = 'index';
|
|
|
|
-- get basics
|
|
DECLARE @site bigint = (SELECT TOP(1) [ocms_iid] FROM [dbo].[ocms_items] as i WHERE i.[parent_iid] is null);
|
|
IF @site is null
|
|
THROW 61110, 'site does not exist', 1;
|
|
|
|
--get locales
|
|
DECLARE @locales TABLE([locale] varchar(5), [order] int);
|
|
INSERT INTO @locales
|
|
SELECT * FROM [dbo].[ocms_locales]();
|
|
|
|
|
|
-- get viewtree and paths
|
|
DECLARE @view_iid bigint = null, @view_level int, @view_name nvarchar(255);
|
|
DECLARE @viewtree [dbo].[ocms_type_viewtree_full];
|
|
INSERT INTO @viewtree SELECT * FROM [dbo].[ocms_getFullViewTree](@view_path, null); -- any locale to be able to determine language from path
|
|
|
|
DECLARE @tgt_ocms_iid bigint = (SELECT TOP(1) [ocms_iid] FROM [dbo].[ocms_items] as i WHERE [name] = @name and (i.[hide] = 0 OR @include_hidden = 1));
|
|
|
|
SELECT TOP(1)
|
|
@view_iid = it.[ocms_iid]
|
|
, @view_level = it.[level]
|
|
, @locale = it.[locale] -- will override the selected language
|
|
, @view_name = it.[name]
|
|
FROM @viewtree as it
|
|
WHERE it.[ocms_iid] = @tgt_ocms_iid
|
|
ORDER BY (CASE WHEN [focus] = 1 AND [locale] = @locale THEN 0 WHEN [focus] = 1 THEN 1 ELSE 2 END) ASC;
|
|
|
|
|
|
--get itemtree
|
|
DECLARE @itemtree [dbo].[ocms_type_itemtree];
|
|
INSERT INTO @itemtree SELECT * FROM [dbo].[ocms_getFullItemTree](@view_iid, @include_hidden); -- items are not localized
|
|
|
|
|
|
--get properties
|
|
DECLARE @PROP TABLE(
|
|
[ocms_pid] [bigint] NOT NULL,
|
|
[ocms_iid] [bigint] NOT NULL,
|
|
[key] [varchar](50) NULL,
|
|
[value] [nvarchar](max) NOT NULL,
|
|
[DateModified] [datetime] NULL
|
|
);
|
|
WITH SP As (
|
|
SELECT
|
|
p.*
|
|
,it.[focus]
|
|
,it.[level]
|
|
, ROW_NUMBER() OVER (PARTITION BY p.[ocms_iid], p.[key] ORDER BY CAST((CASE WHEN p.[locale] = '*' THEN 1 ELSE 0 END) as int)) as 'rwi'
|
|
FROM @itemtree as it
|
|
JOIN [dbo].[ocms_properties] as p ON it.[ocms_iid] = p.[ocms_iid]
|
|
WHERE (it.[level] = 0 --site
|
|
OR it.[sub] = 1
|
|
OR it.[sitepropsub] = 1
|
|
OR it.[focus] = 1
|
|
OR it.[parent_iid] = @site) -- or itms below selected
|
|
AND (p.[locale] = @locale OR p.[locale] = '*')
|
|
)
|
|
INSERT INTO @PROP
|
|
SELECT [ocms_pid],[ocms_iid],[key],[value],[DateModified]
|
|
FROM SP
|
|
WHERE rwi = 1;
|
|
|
|
|
|
DECLARE @translations TABLE (
|
|
[ocms_tln] [bigint] NOT NULL,
|
|
[context_typ] [nvarchar](15) NOT NULL,
|
|
[context] [bigint] NULL,
|
|
[value] [nvarchar](255) NOT NULL,
|
|
[translation] [nvarchar](255) NOT NULL,
|
|
[locale] [varchar](5) NOT NULL
|
|
);
|
|
|
|
|
|
/* outputs *********************************************************************************************************************************************************/
|
|
|
|
|
|
-- output nav
|
|
SELECT vt.[ocms_iid]
|
|
,[parent_iid]
|
|
,vt.[ocms_pid]
|
|
,[name]
|
|
,ISNULL(p.[value], vt.[name]) as [title]
|
|
,[view]
|
|
,[template_id]
|
|
,[hide]
|
|
,[new_order] as [order]
|
|
, [path], [level], [sub], [focus], [nav]
|
|
FROM @viewtree as vt -- vt must be filtered by locale
|
|
LEFT JOIN [dbo].[ocms_properties] as p ON vt.[ocms_iid] = p.[ocms_iid] AND p.[key] = 'title' AND p.[locale] = vt.[locale] -- ! localized
|
|
WHERE [nav] = 1
|
|
AND vt.[locale] = @locale;
|
|
|
|
|
|
-- output site properties
|
|
SELECT
|
|
vt.[ocms_iid]
|
|
,p.[ocms_pid]
|
|
,ISNULL(tp.[key], p.[key]) as [key]
|
|
,IIF(ISNULL(tp.[mandatory],0) = 0, p.[value], ISNULL(p.[value],'')) as [value]
|
|
,tp.[type]
|
|
FROM @viewtree as vt -- site is part if viewtree // -- vt must be filtered by locale
|
|
FULL OUTER JOIN [dbo].[ocms_template_properties] as tp ON vt.[template_id] = tp.[ocms_tid]
|
|
FULL OUTER JOIN @PROP as p ON p.[ocms_iid] = vt.[ocms_iid] AND (tp.[key] = p.[key] OR tp.[key] is null) -- properties are ! localized, but already filtered for @PROP
|
|
WHERE vt.[ocms_iid] = @site
|
|
AND vt.[locale] = @locale
|
|
UNION
|
|
SELECT
|
|
NULL as [ocms_iid]
|
|
,NULL as [ocms_pid]
|
|
,'DateModified' as [key]
|
|
,FORMAT((SELECT MAX([DateModified]) FROM @PROP),'yyyy-MM-ddTHH:mm:ssZ') as [value]
|
|
,'string';
|
|
|
|
INSERT INTO @translations
|
|
SELECT * from [dbo].[ocms_translations] as TL WHERE TL.[context_typ] = 'site' AND TL.[locale] = @locale;
|
|
|
|
|
|
-- output locales
|
|
WITH pd as (SELECT DISTINCT [ocms_iid], [path], [locale] FROM @viewtree WHERE [ocms_iid] = @view_iid)
|
|
SELECT
|
|
pd.*
|
|
, CAST(IIF(l.[locale] = @locale, 1, 0) as bit) as 'active'
|
|
FROM @locales as l JOIN pd ON l.[locale] = pd.[locale]
|
|
WHERE l.[locale] <> '*';
|
|
|
|
|
|
-- output view properties
|
|
SELECT
|
|
vt.[ocms_iid]
|
|
,p.[ocms_pid]
|
|
,ISNULL(tp.[key], p.[key]) as [key]
|
|
,IIF(ISNULL(tp.[mandatory],0) = 0, p.[value], ISNULL(p.[value],'')) as [value]
|
|
,tp.[type]
|
|
FROM @viewtree as vt -- vt must be filtered by locale
|
|
FULL OUTER JOIN [dbo].[ocms_template_properties] as tp ON vt.[template_id] = tp.[ocms_tid]
|
|
FULL OUTER JOIN @PROP as p ON p.[ocms_iid] = vt.[ocms_iid] AND (tp.[key] = p.[key] OR tp.[key] is null) -- properties are ! localized, but already filtered for @PROP
|
|
WHERE vt.[focus] = 1
|
|
AND ISNULL(ISNULL(tp.[key], p.[key]),'') <> ''
|
|
AND vt.[locale] = @locale;
|
|
|
|
INSERT INTO @translations
|
|
SELECT * from [dbo].[ocms_translations] as TL
|
|
WHERE TL.[context] = @view_iid AND TL.[locale] = @locale; --context = 'view' and all other context_types
|
|
|
|
|
|
-- output children
|
|
SELECT
|
|
it.*
|
|
,tpl.[partial_view]
|
|
,tpl.[name] as [template_name]
|
|
,ROW_NUMBER() OVER (PARTITION BY it.[parent_iid], it.[ocms_pid] ORDER BY it.[ORDER], it.[ocms_iid]) as 'item_order'
|
|
FROM @itemtree as it -- items are not localized
|
|
LEFT JOIN [dbo].[ocms_templates] as tpl on it.[template_id] = tpl.[ocms_tid]
|
|
WHERE [sub] = 1 OR [sitepropsub] = 1 OR it.[parent_iid] = @site; --to include also site relevant children
|
|
|
|
INSERT INTO @translations
|
|
SELECT TL.* from @itemtree as it JOIN [dbo].[ocms_translations] as TL ON TL.[context_typ] = 'template' AND TL.[context] = it.[template_id] AND TL.[locale] = @locale;
|
|
|
|
|
|
-- output childrens' properties
|
|
SELECT
|
|
it.[ocms_iid]
|
|
,p.[ocms_pid]
|
|
,ISNULL(tp.[key], p.[key]) as [key]
|
|
,IIF(ISNULL(tp.[mandatory],0) = 0, p.[value], ISNULL(p.[value],'')) as [value]
|
|
,tp.[type]
|
|
FROM @itemtree as it -- items are not localized
|
|
JOIN [dbo].[ocms_template_properties] as tp ON it.[template_id] = tp.[ocms_tid] -- properties are ! localized, but already filtered for @PROP
|
|
FULL OUTER JOIN @PROP as p ON p.[ocms_iid] = it.[ocms_iid] AND (tp.[key] = p.[key] OR tp.[key] is null)
|
|
WHERE ([sub] = 1 OR [sitepropsub] = 1 OR it.[parent_iid] = @site) AND [focus] = 0
|
|
AND ISNULL(ISNULL(tp.[key], p.[key]),'') <> '';
|
|
|
|
|
|
|
|
--output translations
|
|
SELECT DISTINCT * FROM @translations;
|
|
|
|
|
|
--output breadcrumbs
|
|
WITH vws as(
|
|
SELECT vt.[ocms_iid], [parent_iid], ISNULL(p.[value], vt.[name]) as [title], [path] FROM @viewtree as vt -- vt must be filtered by locale
|
|
LEFT JOIN [dbo].[ocms_properties] as p ON vt.[ocms_iid] = p.[ocms_iid] AND p.[key] = 'title' AND p.[locale] = vt.[locale] -- ! localized
|
|
)
|
|
,
|
|
cte as (
|
|
SELECT vws.*, [title] as [breadcrumb], 0 as [level]
|
|
FROM vws
|
|
WHERE vws.[ocms_iid] = @view_iid
|
|
UNION ALL
|
|
SELECT vws.*, ( vws.[title] + ' > ' + cte.[breadcrumb]) as [breadcrumb]
|
|
, [level] + 1 as [level]
|
|
FROM vws JOIN cte ON vws.[ocms_iid] = cte.[parent_iid]
|
|
)
|
|
select [title]
|
|
, [path]
|
|
, CASE WHEN [level] = 0 THEN (SELECT TOP(1) [breadcrumb] FROM cte as cte1 ORDER BY [level] DESC) ELSE NULL END as [breadcrumb]
|
|
, ROW_NUMBER() OVER (ORDER BY [level] DESC) as [order]
|
|
FROM cte;
|
|
|
|
|
|
END
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[ocms_merge_navigation] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[ocms_merge_navigation]
|
|
@newnav [dbo].[ocms_type_navigation_base] READONLY
|
|
AS
|
|
BEGIN
|
|
-- SET NOCOUNT ON added to prevent extra result sets from
|
|
-- interfering with SELECT statements.
|
|
SET NOCOUNT ON;
|
|
|
|
-- update nav table
|
|
UPDATE n
|
|
SET n.[parent_iid] = i.[parent_iid]
|
|
FROM [dbo].[ocms_navigation] as n
|
|
JOIN [ocms_items] as i ON n.[ocms_iid] = i.[ocms_iid];
|
|
|
|
-- merge nav
|
|
WITH np as (
|
|
-- make sure nav are allowed by locales and path constraints
|
|
SELECT
|
|
n.*
|
|
,i.[parent_iid]
|
|
FROM @newnav as n
|
|
JOIN [dbo].[ocms_items] as i ON n.[ocms_iid] = i.[ocms_iid] AND [view] = 1
|
|
FULL OUTER JOIN [dbo].[ocms_locales]() as l on n.[locale] = l.[locale] AND l.[locale] <> '*'
|
|
WHERE NOT EXISTS (SELECT * FROM [dbo].[ocms_navigation] as cn
|
|
WHERE cn.[parent_iid] = i.[parent_iid]
|
|
AND cn.[alias] = n.[alias]
|
|
AND [cn].[ocms_iid] <> n.[ocms_iid])
|
|
AND i.[name] <> 'index' -- nav not allowed for index
|
|
AND n.[alias] not in ('index') -- keyword index not allowed
|
|
)
|
|
MERGE [dbo].[ocms_navigation] as TARGET
|
|
USING np as SOURCE ON TARGET.[locale] = SOURCE.[locale] AND TARGET.[ocms_iid] = SOURCE.[ocms_iid]
|
|
WHEN MATCHED AND SOURCE.[alias] is null THEN
|
|
DELETE
|
|
WHEN MATCHED THEN
|
|
UPDATE SET [alias] = LOWER(SOURCE.[alias])
|
|
WHEN NOT MATCHED BY TARGET THEN
|
|
INSERT ([ocms_iid], [locale], [alias])
|
|
VALUES (SOURCE.[ocms_iid], SOURCE.[locale], LOWER(SOURCE.[alias]));
|
|
|
|
END
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[ocms_merge_properties] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[ocms_merge_properties]
|
|
@newprop [dbo].[ocms_type_properties_base] READONLY
|
|
AS
|
|
BEGIN
|
|
-- SET NOCOUNT ON added to prevent extra result sets from
|
|
-- interfering with SELECT statements.
|
|
SET NOCOUNT ON;
|
|
DECLARE @lastpid int = ISNULL ( (SELECT MAX(ISNULL(p.[ocms_pid], ap.[ocms_pid]))
|
|
FROM [dbo].[ocms_properties] as p FULL OUTER JOIN [ocms_archive__properties] as ap on p.[ocms_pid] = ap.[ocms_pid])
|
|
,0);
|
|
|
|
WITH np as (
|
|
-- make sure properties are allowed by templates
|
|
SELECT
|
|
[pid] = isnull(pp.[ocms_pid], ROW_NUMBER() OVER (PARTITION BY pp.[ocms_pid] order BY tp.[ocms_tpid], n.[key]) + @lastpid)
|
|
,n.*
|
|
,tp.[type]
|
|
FROM @newprop as n
|
|
JOIN [dbo].[ocms_items] as i ON n.[ocms_iid] = i.[ocms_iid]
|
|
JOIN [dbo].[ocms_templates] as t ON i.[template_id] = t.[ocms_tid]
|
|
JOIN [dbo].[ocms_template_properties] as tp ON t.[ocms_tid] = tp.[ocms_tid] AND n.[key] = tp.[key]
|
|
LEFT JOIN [dbo].[ocms_properties] as pp ON pp.[key] = n.[key] and pp.[locale] = n.[locale] AND pp.[ocms_iid] = n.[ocms_iid]
|
|
)
|
|
MERGE [dbo].[ocms_properties] as TARGET
|
|
USING np as SOURCE ON TARGET.[key] = SOURCE.[key] and TARGET.[locale] = SOURCE.[locale] AND TARGET.[ocms_iid] = SOURCE.[ocms_iid]
|
|
WHEN MATCHED AND ISNULL(SOURCE.[value], '') = '' AND SOURCE.[type] <> 'array' THEN
|
|
DELETE
|
|
WHEN MATCHED AND TARGET.[Value] <> SOURCE.[value] THEN
|
|
UPDATE SET [value] = SOURCE.[value], [DateModified] = GETUTCDATE()
|
|
WHEN NOT MATCHED BY TARGET THEN
|
|
INSERT ([ocms_pid], [ocms_iid], [key], [value], [locale], [DateCreated], [DateModified])
|
|
VALUES (SOURCE.[pid], SOURCE.[ocms_iid], SOURCE.[key], SOURCE.[value], SOURCE.[locale], GETUTCDATE(), GETUTCDATE())
|
|
OUTPUT
|
|
ISNULL(inserted.[ocms_pid], deleted.[ocms_pid]),
|
|
$action,
|
|
inserted.[ocms_iid], inserted.[key], inserted.[value], inserted.[locale], inserted.[DateCreated], inserted.[DateModified], NULL, NULL,
|
|
deleted.[ocms_iid], deleted.[key], deleted.[value], deleted.[locale], deleted.[DateCreated], deleted.[DateModified], NULL, NULL
|
|
INTO [dbo].[ocms_log__properties]
|
|
;
|
|
|
|
END
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[ocms_recoverItem] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[ocms_recoverItem]
|
|
@ocms_iid bigint
|
|
AS
|
|
BEGIN
|
|
SET NOCOUNT ON;
|
|
|
|
SET IDENTITY_INSERT [dbo].[ocms_items] ON;
|
|
|
|
|
|
insert into ocms_items
|
|
([ocms_iid]
|
|
,[parent_iid]
|
|
,[ocms_pid]
|
|
,[name]
|
|
,[view]
|
|
,[template_id]
|
|
,[hide]
|
|
,[order]
|
|
,[DateCreated]
|
|
,[DateModified])
|
|
select [ocms_iid]
|
|
,[parent_iid]
|
|
,[ocms_pid]
|
|
,[name]
|
|
,[view]
|
|
,[template_id]
|
|
,[hide]
|
|
,[order]
|
|
,[DateCreated]
|
|
,[DateModified]
|
|
from ocms_archive__items
|
|
where ocms_iid = @ocms_iid
|
|
|
|
SET IDENTITY_INSERT [dbo].[ocms_items] OFF;
|
|
|
|
|
|
SET IDENTITY_INSERT [dbo].[ocms_properties] ON;
|
|
|
|
insert into ocms_properties
|
|
([ocms_pid]
|
|
,[ocms_iid]
|
|
,[key]
|
|
,[value]
|
|
,[locale]
|
|
,[DateCreated]
|
|
,[DateModified])
|
|
select
|
|
[ocms_pid]
|
|
,[ocms_iid]
|
|
,[key]
|
|
,[value]
|
|
,[locale]
|
|
,[DateCreated]
|
|
,[DateModified]
|
|
from ocms_archive__properties where ocms_iid = @ocms_iid
|
|
|
|
SET IDENTITY_INSERT [dbo].[ocms_properties] OFF;
|
|
|
|
END
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[ocms_setItemName] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[ocms_setItemName]
|
|
@ocms_iid bigint,
|
|
@name nvarchar(255)
|
|
AS
|
|
BEGIN
|
|
SET NOCOUNT ON;
|
|
|
|
IF NOT EXISTS (SELECT * FROM [dbo].[ocms_items] WHERE [ocms_iid] = @ocms_iid)
|
|
THROW 61110, 'item does not exist', 1;
|
|
IF EXISTS (SELECT * FROM [dbo].[ocms_items] WHERE [ocms_iid] = @ocms_iid AND [name] = 'index')
|
|
THROW 61110, 'index cannot be renamed', 1;
|
|
IF ISNULL(@name, '') = ''
|
|
THROW 61010, 'name missing', 1;
|
|
IF EXISTS (SELECT * FROM [dbo].[ocms_items] WHERE [name] = @name AND [ocms_iid] <> @ocms_iid)
|
|
THROW 61110, 'name already exists', 1;
|
|
|
|
DECLARE @OUTPUT TABLE ([ocms_iid] bigint, [name] nvarchar(255));
|
|
|
|
UPDATE i
|
|
SET [name] = @name
|
|
,[DateModified] = GETUTCDATE()
|
|
OUTPUT inserted.[ocms_iid], inserted.[name]
|
|
INTO @OUTPUT
|
|
FROM [dbo].[ocms_items] as i
|
|
WHERE i.[ocms_iid] = @ocms_iid;
|
|
|
|
SELECT TOP(1) * FROM @OUTPUT;
|
|
|
|
END
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[ocms_setItemOrder] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[ocms_setItemOrder]
|
|
@ocms_iid_csv varchar(2000)
|
|
AS
|
|
BEGIN
|
|
SET NOCOUNT ON;
|
|
|
|
DECLARE @neworder TABLE([ocms_iid] bigint, [order] int);
|
|
DECLARE @c char(1) = ','; --delimiter
|
|
|
|
INSERT INTO @neworder
|
|
SELECT value, idx = ROW_NUMBER() OVER (ORDER BY CHARINDEX(@c + value + @c, @c + @ocms_iid_csv + @c))
|
|
FROM STRING_SPLIT(@ocms_iid_csv, ',');
|
|
|
|
DECLARE @parents TABLE([parent_iid] bigint);
|
|
INSERT INTO @parents
|
|
SELECT DISTINCT [parent_iid]
|
|
FROM [dbo].[ocms_items] as i
|
|
JOIN @neworder as no ON i.[ocms_iid] = no.[ocms_iid]
|
|
WHERE i.[parent_iid] is not null;
|
|
|
|
select * from @parents
|
|
|
|
IF (SELECT COUNT(*) FROM @parents) <> 1
|
|
THROW 61010, 'order can only be set for exact one parent', 1;
|
|
|
|
DECLARE @parent_iid bigint = (SELECT TOP(1) [parent_iid] FROM @parents);
|
|
|
|
UPDATE i
|
|
SET [order] = ISNULL(no.[order], 999)
|
|
OUTPUT
|
|
inserted.[ocms_iid], inserted.[order]
|
|
FROM [dbo].[ocms_items] as i
|
|
LEFT JOIN @neworder as no ON i.[ocms_iid] = no.[ocms_iid]
|
|
WHERE i.[parent_iid] = @parent_iid;
|
|
|
|
END
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[ocms_setViewItem_HiddenStatus] Script Date: 23.04.2021 14:34:50 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[ocms_setViewItem_HiddenStatus]
|
|
@ocms_iid bigint,
|
|
@hidden bit
|
|
AS
|
|
BEGIN
|
|
SET NOCOUNT ON;
|
|
|
|
IF NOT EXISTS (SELECT * FROM [dbo].[ocms_items] WHERE [ocms_iid] = @ocms_iid)
|
|
THROW 61110, 'item does not exist', 1;
|
|
IF NOT EXISTS (SELECT * FROM [dbo].[ocms_items] WHERE [ocms_iid] = @ocms_iid AND [view] = 1)
|
|
THROW 61110, 'item is not a view', 1;
|
|
|
|
DECLARE @OUTPUT TABLE ([ocms_iid] bigint, [name] nvarchar(255), [hide] bit);
|
|
|
|
UPDATE i
|
|
SET i.[hide] = @hidden
|
|
OUTPUT inserted.[ocms_iid], inserted.[name], inserted.[hide]
|
|
INTO @OUTPUT
|
|
FROM [dbo].[ocms_items] as i
|
|
WHERE i.[ocms_iid] = @ocms_iid
|
|
AND [view] = 1;
|
|
|
|
SELECT TOP(1) * FROM @OUTPUT;
|
|
|
|
END
|
|
GO
|
|
USE [master]
|
|
GO
|
|
ALTER DATABASE [site_fuchs] SET READ_WRITE
|
|
GO
|