Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lease/License Type and Lease Purpose Seed Script Fixes #4235

Merged
merged 1 commit into from
Aug 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,44 @@ GO
IF @@ERROR <> 0 SET NOEXEC ON
GO

-- Disable the "LIOCCHMK" type
PRINT N'Disable the "LIOCCHMK" type'
GO
DECLARE @CurrCd NVARCHAR(20)
SET @CurrCd = N'LIOCCHMK'

SELECT LEASE_LICENSE_TYPE_CODE
FROM PIMS_LEASE_LICENSE_TYPE
WHERE LEASE_LICENSE_TYPE_CODE = @CurrCd;

IF @@ROWCOUNT = 1
UPDATE PIMS_LEASE_LICENSE_TYPE
SET IS_DISABLED = 1
, CONCURRENCY_CONTROL_NUMBER = CONCURRENCY_CONTROL_NUMBER + 1
WHERE LEASE_LICENSE_TYPE_CODE = @CurrCd;
GO
IF @@ERROR <> 0 SET NOEXEC ON
GO

-- Disable the "LOOBCTFA" type
PRINT N'Disable the "LOOBCTFA" type'
GO
DECLARE @CurrCd NVARCHAR(20)
SET @CurrCd = N'LOOBCTFA'

SELECT LEASE_LICENSE_TYPE_CODE
FROM PIMS_LEASE_LICENSE_TYPE
WHERE LEASE_LICENSE_TYPE_CODE = @CurrCd;

IF @@ROWCOUNT = 1
UPDATE PIMS_LEASE_LICENSE_TYPE
SET IS_DISABLED = 1
, CONCURRENCY_CONTROL_NUMBER = CONCURRENCY_CONTROL_NUMBER + 1
WHERE LEASE_LICENSE_TYPE_CODE = @CurrCd;
GO
IF @@ERROR <> 0 SET NOEXEC ON
GO

-- Disable the "AMNDAGREE" type
PRINT N'Disable the "AMNDAGREE" type'
GO
Expand Down Expand Up @@ -94,10 +132,19 @@ GO
-- Enable the LIOCCUSE type
PRINT N'Enable the LIOCCUSE type'
GO
DECLARE @CurrCd NVARCHAR(20)
SET @CurrCd = N'LIOCCUSE'

SELECT LEASE_LICENSE_TYPE_CODE
FROM PIMS_LEASE_LICENSE_TYPE
WHERE LEASE_LICENSE_TYPE_CODE = @CurrCd;

IF @@ROWCOUNT = 1
UPDATE PIMS_LEASE_LICENSE_TYPE
SET IS_DISABLED = 0
SET DESCRIPTION = N'License of Occupation (use)'
, IS_DISABLED = 0
, CONCURRENCY_CONTROL_NUMBER = CONCURRENCY_CONTROL_NUMBER + 1
WHERE LEASE_LICENSE_TYPE_CODE = N'LIOCCUSE';
WHERE LEASE_LICENSE_TYPE_CODE = @CurrCd;
GO
IF @@ERROR <> 0 SET NOEXEC ON
GO
Expand All @@ -115,6 +162,7 @@ WHERE LEASE_LICENSE_TYPE_CODE = @CurrCd;
IF @@ROWCOUNT = 1
UPDATE PIMS_LEASE_LICENSE_TYPE
SET DESCRIPTION = N'MOTI Project Use License'
, IS_DISABLED = 0
, CONCURRENCY_CONTROL_NUMBER = CONCURRENCY_CONTROL_NUMBER + 1
WHERE LEASE_LICENSE_TYPE_CODE = @CurrCd;
GO
Expand All @@ -134,6 +182,7 @@ WHERE LEASE_LICENSE_TYPE_CODE = @CurrCd;
IF @@ROWCOUNT = 1
UPDATE PIMS_LEASE_LICENSE_TYPE
SET DESCRIPTION = N'License of Occupation (access)'
, IS_DISABLED = 0
, CONCURRENCY_CONTROL_NUMBER = CONCURRENCY_CONTROL_NUMBER + 1
WHERE LEASE_LICENSE_TYPE_CODE = @CurrCd;
GO
Expand All @@ -153,6 +202,7 @@ WHERE LEASE_LICENSE_TYPE_CODE = @CurrCd;
IF @@ROWCOUNT = 1
UPDATE PIMS_LEASE_LICENSE_TYPE
SET DESCRIPTION = N'License of Occupation (titled)'
, IS_DISABLED = 0
, CONCURRENCY_CONTROL_NUMBER = CONCURRENCY_CONTROL_NUMBER + 1
WHERE LEASE_LICENSE_TYPE_CODE = @CurrCd;
GO
Expand Down Expand Up @@ -197,6 +247,26 @@ GO
IF @@ERROR <> 0 SET NOEXEC ON
GO

-- Update the description for the "LIOCCUTIL" type
PRINT N'Update the description for the "LIOCCUTIL" type'
GO
DECLARE @CurrCd NVARCHAR(20)
SET @CurrCd = N'LIOCCUTIL'

SELECT LEASE_LICENSE_TYPE_CODE
FROM PIMS_LEASE_LICENSE_TYPE
WHERE LEASE_LICENSE_TYPE_CODE = @CurrCd;

IF @@ROWCOUNT = 1
UPDATE PIMS_LEASE_LICENSE_TYPE
SET DESCRIPTION = N'License of Occupation (utilities)'
, IS_DISABLED = 0
, CONCURRENCY_CONTROL_NUMBER = CONCURRENCY_CONTROL_NUMBER + 1
WHERE LEASE_LICENSE_TYPE_CODE = @CurrCd;
GO
IF @@ERROR <> 0 SET NOEXEC ON
GO

-- Update the description for the "LSUNREG" type
PRINT N'Update the description for the "LSUNREG" type'
GO
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,95 @@ GO
IF @@ERROR <> 0 SET NOEXEC ON
GO

-- Update the "OTHER" type
PRINT N'Update the "OTHER" type'
GO
DECLARE @CurrCd NVARCHAR(20)
SET @CurrCd = N'OTHER'

SELECT LEASE_LICENSE_TYPE_CODE
FROM PIMS_LEASE_LICENSE_TYPE
WHERE LEASE_LICENSE_TYPE_CODE = @CurrCd;

IF @@ROWCOUNT = 1
UPDATE PIMS_LEASE_LICENSE_TYPE
SET DESCRIPTION = N'Other'
, IS_DISABLED = 0
, CONCURRENCY_CONTROL_NUMBER = CONCURRENCY_CONTROL_NUMBER + 1
WHERE LEASE_LICENSE_TYPE_CODE = @CurrCd;
ELSE
INSERT INTO PIMS_LEASE_LICENSE_TYPE (LEASE_LICENSE_TYPE_CODE, DESCRIPTION)
VALUES (N'OTHER', N'Other');
GO
IF @@ERROR <> 0 SET NOEXEC ON
GO

-- Update the "LIOCCUTIL" type
PRINT N'Update the "LIOCCUTIL" type'
GO
DECLARE @CurrCd NVARCHAR(20)
SET @CurrCd = N'LIOCCUTIL'

SELECT LEASE_LICENSE_TYPE_CODE
FROM PIMS_LEASE_LICENSE_TYPE
WHERE LEASE_LICENSE_TYPE_CODE = @CurrCd;

IF @@ROWCOUNT = 1
UPDATE PIMS_LEASE_LICENSE_TYPE
SET DESCRIPTION = N'Licence of Occupation (BCTFA fee simple)'
, IS_DISABLED = 1
, CONCURRENCY_CONTROL_NUMBER = CONCURRENCY_CONTROL_NUMBER + 1
WHERE LEASE_LICENSE_TYPE_CODE = @CurrCd;
ELSE
INSERT INTO PIMS_LEASE_LICENSE_TYPE (LEASE_LICENSE_TYPE_CODE, DESCRIPTION, IS_DISABLED)
VALUES (N'LIOCCUTIL', N'Licence of Occupation (BCTFA fee simple)', 1);
GO
IF @@ERROR <> 0 SET NOEXEC ON
GO

-- Update the "LIOCCUSE" type
PRINT N'Update the "LIOCCUSE" type'
GO
DECLARE @CurrCd NVARCHAR(20)
SET @CurrCd = N'LIOCCUSE'

SELECT LEASE_LICENSE_TYPE_CODE
FROM PIMS_LEASE_LICENSE_TYPE
WHERE LEASE_LICENSE_TYPE_CODE = @CurrCd;

IF @@ROWCOUNT = 1
UPDATE PIMS_LEASE_LICENSE_TYPE
SET DESCRIPTION = N'Licence of Occupation (BCTFA fee simple)'
, IS_DISABLED = 1
, CONCURRENCY_CONTROL_NUMBER = CONCURRENCY_CONTROL_NUMBER + 1
WHERE LEASE_LICENSE_TYPE_CODE = @CurrCd;
ELSE
INSERT INTO PIMS_LEASE_LICENSE_TYPE (LEASE_LICENSE_TYPE_CODE, DESCRIPTION, IS_DISABLED)
VALUES (N'LIOCCUSE', N'Licence of Occupation (BCTFA fee simple)', 1);
GO
IF @@ERROR <> 0 SET NOEXEC ON
GO

-- Update the description for the "LIMOTIPRJ" type
PRINT N'Update the description for the "LIMOTIPRJ" type'
GO
DECLARE @CurrCd NVARCHAR(20)
SET @CurrCd = N'LIMOTIPRJ'

SELECT LEASE_LICENSE_TYPE_CODE
FROM PIMS_LEASE_LICENSE_TYPE
WHERE LEASE_LICENSE_TYPE_CODE = @CurrCd;

IF @@ROWCOUNT = 1
UPDATE PIMS_LEASE_LICENSE_TYPE
SET DESCRIPTION = N'Licence of Occupation (BCTFA fee simple)'
, IS_DISABLED = 1
, CONCURRENCY_CONTROL_NUMBER = CONCURRENCY_CONTROL_NUMBER + 1
WHERE LEASE_LICENSE_TYPE_CODE = @CurrCd;
GO
IF @@ERROR <> 0 SET NOEXEC ON
GO

-- Insert/Enable the "LTRINTENT" type
PRINT N'Update the description for the "LTRINTENT" type'
GO
Expand Down Expand Up @@ -103,70 +192,92 @@ GO
IF @@ERROR <> 0 SET NOEXEC ON
GO

-- Disable various types
PRINT N'Disable various types'
-- Update the description for the "LIOCCACCS" type
PRINT N'Update the description for the "LIOCCACCS" type'
GO
UPDATE PIMS_LEASE_LICENSE_TYPE
SET IS_DISABLED = 1
, CONCURRENCY_CONTROL_NUMBER = CONCURRENCY_CONTROL_NUMBER + 1
WHERE LEASE_LICENSE_TYPE_CODE = N'LIOCCUSE';
DECLARE @CurrCd NVARCHAR(20)
SET @CurrCd = N'LIOCCACCS'

SELECT LEASE_LICENSE_TYPE_CODE
FROM PIMS_LEASE_LICENSE_TYPE
WHERE LEASE_LICENSE_TYPE_CODE = @CurrCd;

IF @@ROWCOUNT = 1
UPDATE PIMS_LEASE_LICENSE_TYPE
SET DESCRIPTION = N'Licence of Occupation (BCTFA fee simple)'
, IS_DISABLED = 1
, CONCURRENCY_CONTROL_NUMBER = CONCURRENCY_CONTROL_NUMBER + 1
WHERE LEASE_LICENSE_TYPE_CODE = @CurrCd;
ELSE
INSERT INTO PIMS_LEASE_LICENSE_TYPE (LEASE_LICENSE_TYPE_CODE, DESCRIPTION, IS_DISABLED)
VALUES (N'LIOCCACCS', N'Licence of Occupation (BCTFA fee simple)', 1);
GO
IF @@ERROR <> 0 SET NOEXEC ON
GO

-- Update the description for the "LIMOTIPRJ" type
PRINT N'Update the description for the "LIMOTIPRJ" type'
-- Update the description for the "LIOCCTTLD" type
PRINT N'Update the description for the "LIOCCTTLD" type'
GO
DECLARE @CurrCd NVARCHAR(20)
SET @CurrCd = N'LIMOTIPRJ'
SET @CurrCd = N'LIOCCTTLD'

SELECT LEASE_LICENSE_TYPE_CODE
FROM PIMS_LEASE_LICENSE_TYPE
WHERE LEASE_LICENSE_TYPE_CODE = @CurrCd;

IF @@ROWCOUNT = 1
UPDATE PIMS_LEASE_LICENSE_TYPE
SET DESCRIPTION = N'MoTI Use Licence of Occupation (BCTFA fee simple)'
SET DESCRIPTION = N'Licence of Occupation (BCTFA fee simple)'
, IS_DISABLED = 1
, CONCURRENCY_CONTROL_NUMBER = CONCURRENCY_CONTROL_NUMBER + 1
WHERE LEASE_LICENSE_TYPE_CODE = @CurrCd;
ELSE
INSERT INTO PIMS_LEASE_LICENSE_TYPE (LEASE_LICENSE_TYPE_CODE, DESCRIPTION, IS_DISABLED)
VALUES (N'LIOCCTTLD', N'Licence of Occupation (BCTFA fee simple)', 1);
GO
IF @@ERROR <> 0 SET NOEXEC ON
GO

-- Update the description for the "LIOCCACCS" type
PRINT N'Update the description for the "LIOCCACCS" type'
-- Update the description for the "LIOCCHMK" type
PRINT N'Update the description for the "LIOCCHMK" type'
GO
DECLARE @CurrCd NVARCHAR(20)
SET @CurrCd = N'LIOCCACCS'
SET @CurrCd = N'LIOCCHMK'

SELECT LEASE_LICENSE_TYPE_CODE
FROM PIMS_LEASE_LICENSE_TYPE
WHERE LEASE_LICENSE_TYPE_CODE = @CurrCd;

IF @@ROWCOUNT = 1
UPDATE PIMS_LEASE_LICENSE_TYPE
SET DESCRIPTION = N'Licence of Occupation (BCTFA fee simple)'
SET DESCRIPTION = N'Licence of Occupation (HMK fee simple)'
, CONCURRENCY_CONTROL_NUMBER = CONCURRENCY_CONTROL_NUMBER + 1
WHERE LEASE_LICENSE_TYPE_CODE = @CurrCd;
ELSE
INSERT INTO PIMS_LEASE_LICENSE_TYPE (LEASE_LICENSE_TYPE_CODE, DESCRIPTION)
VALUES (N'LIOCCHMK', N'Licence of Occupation (HMK fee simple)');
GO
IF @@ERROR <> 0 SET NOEXEC ON
GO

-- Update the description for the "LIOCCTTLD" type
PRINT N'Update the description for the "LIOCCTTLD" type'
-- Update the description for the "LOOBCTFA" type
PRINT N'Update the description for the "LOOBCTFA" type'
GO
DECLARE @CurrCd NVARCHAR(20)
SET @CurrCd = N'LIOCCTTLD'
SET @CurrCd = N'LOOBCTFA'

SELECT LEASE_LICENSE_TYPE_CODE
FROM PIMS_LEASE_LICENSE_TYPE
WHERE LEASE_LICENSE_TYPE_CODE = @CurrCd;

IF @@ROWCOUNT = 1
UPDATE PIMS_LEASE_LICENSE_TYPE
SET DESCRIPTION = N'Licence of Occupation (HMK fee simple)'
SET DESCRIPTION = N'Licence of Occupation (BCTFA fee simple)'
, CONCURRENCY_CONTROL_NUMBER = CONCURRENCY_CONTROL_NUMBER + 1
WHERE LEASE_LICENSE_TYPE_CODE = @CurrCd;
ELSE
INSERT INTO PIMS_LEASE_LICENSE_TYPE (LEASE_LICENSE_TYPE_CODE, DESCRIPTION)
VALUES (N'LOOBCTFA', N'Licence of Occupation (BCTFA fee simple)');
GO
IF @@ERROR <> 0 SET NOEXEC ON
GO
Expand Down Expand Up @@ -291,10 +402,10 @@ GO
UPDATE tbl
SET tbl.DISPLAY_ORDER = seq.ROW_NUM
, tbl.CONCURRENCY_CONTROL_NUMBER = CONCURRENCY_CONTROL_NUMBER + 1
FROM PIMS_LEASE_PROGRAM_TYPE tbl JOIN
(SELECT LEASE_PROGRAM_TYPE_CODE
FROM PIMS_LEASE_LICENSE_TYPE tbl JOIN
(SELECT LEASE_LICENSE_TYPE_CODE
, ROW_NUMBER() OVER (ORDER BY DESCRIPTION) AS ROW_NUM
FROM PIMS_LEASE_PROGRAM_TYPE) seq ON seq.LEASE_PROGRAM_TYPE_CODE = tbl.LEASE_PROGRAM_TYPE_CODE
FROM PIMS_LEASE_LICENSE_TYPE) seq ON seq.LEASE_LICENSE_TYPE_CODE = tbl.LEASE_LICENSE_TYPE_CODE
GO
IF @@ERROR <> 0 SET NOEXEC ON
GO
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ IF @@ROWCOUNT = 0
(N'AGRIC', N'Agricultural Grazing/haying');
ELSE
UPDATE PIMS_LEASE_PURPOSE_TYPE
SET DESCRIPTION = N'Agricultural Grazing/haying'
SET DESCRIPTION = N'Grazing/haying'
, CONCURRENCY_CONTROL_NUMBER = CONCURRENCY_CONTROL_NUMBER + 1
WHERE LEASE_PURPOSE_TYPE_CODE = @CurrCd;
GO
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,26 @@ GO

INSERT INTO PIMS_LEASE_LICENSE_TYPE (LEASE_LICENSE_TYPE_CODE, DESCRIPTION, IS_DISABLED)
VALUES
(N'LSREG', N'Lease - Registered (payable)', 0),
(N'LSUNREG', N'Lease - Unregistered (payable)', 0),
(N'LSGRND', N'Land Lease (receivable)', 0),
(N'LIOCCTTLD', N'Licence of Occupation (HMK fee simple)', 0),
(N'LIOCCUSE', N'License of Occupation (use)', 1),
(N'LIOCCACCS', N'Licence of Occupation (BCTFA fee simple)', 0),
(N'LIOCCUTIL', N'Utilities Other', 0),
(N'LICONSTRC', N'License to Construct', 1),
(N'LIPPUBHWY', N'License of Prov Public Highway', 0),
(N'RESLNDTEN', N'Residential Tenancy Agreement', 0),
(N'LIMOTIPRJ', N'MoTI Use Licence of Occupation (BCTFA fee simple)', 0),
(N'MANUFHOME', N'Manufactured Home Tenancy', 0),
(N'ROADXING', N'Crossing Agreement', 0),
(N'OTHER', N'Other', 0);
(N'LSREG', N'Lease - Registered (payable)', 0),
(N'LSUNREG', N'Lease - Unregistered (payable)', 0),
(N'LSGRND', N'Land Lease (receivable)', 0),
(N'LIOCCTTLD', N'Licence of Occupation (BCTFA fee simple)', 1),
(N'LIOCCUSE', N'Licence of Occupation (BCTFA fee simple)', 1),
(N'LIOCCACCS', N'Licence of Occupation (BCTFA fee simple)', 1),
(N'LIOCCUTIL', N'Licence of Occupation (BCTFA fee simple)', 1),
(N'LICONSTRC', N'License to Construct', 1),
(N'LIPPUBHWY', N'License of Prov Public Highway', 0),
(N'RESLNDTEN', N'Residential Tenancy Agreement', 0),
(N'LIMOTIPRJ', N'Licence of Occupation (BCTFA fee simple)', 1),
(N'MANUFHOME', N'Manufactured Home Tenancy', 0),
(N'ROADXING', N'Crossing Agreement', 0),
(N'OTHER', N'Other', 0),
(N'LTRINTENT', N'Letter of Intended Use', 0),
(N'LTRINDMNY', N'Indemnity letter', 0),
(N'AMNDAGREE', N'Amending Agreement', 0),
(N'BLDGLSRCV', N'Building Lease (receivable)', 0),
(N'LIOCCHMK', N'Licence of Occupation (HMK fee simple)', 0),
(N'LOOBCTFA', N'Licence of Occupation (BCTFA fee simple)', 0);
GO

-- --------------------------------------------------------------
Expand Down
Loading
Loading