diff --git a/source/database/mssql/scripts/dbscripts/PSP_PIMS_LATEST/Alter Down/054_DML_PIMS_LEASE_LICENSE_TYPE_Alter_Down.sql b/source/database/mssql/scripts/dbscripts/PSP_PIMS_LATEST/Alter Down/054_DML_PIMS_LEASE_LICENSE_TYPE_Alter_Down.sql index 86fd605a6a..dddecef446 100644 --- a/source/database/mssql/scripts/dbscripts/PSP_PIMS_LATEST/Alter Down/054_DML_PIMS_LEASE_LICENSE_TYPE_Alter_Down.sql +++ b/source/database/mssql/scripts/dbscripts/PSP_PIMS_LATEST/Alter Down/054_DML_PIMS_LEASE_LICENSE_TYPE_Alter_Down.sql @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/source/database/mssql/scripts/dbscripts/PSP_PIMS_LATEST/Alter Up/054_DML_PIMS_LEASE_LICENSE_TYPE_Alter_Up.sql b/source/database/mssql/scripts/dbscripts/PSP_PIMS_LATEST/Alter Up/054_DML_PIMS_LEASE_LICENSE_TYPE_Alter_Up.sql index aee86b8351..aec37256e3 100644 --- a/source/database/mssql/scripts/dbscripts/PSP_PIMS_LATEST/Alter Up/054_DML_PIMS_LEASE_LICENSE_TYPE_Alter_Up.sql +++ b/source/database/mssql/scripts/dbscripts/PSP_PIMS_LATEST/Alter Up/054_DML_PIMS_LEASE_LICENSE_TYPE_Alter_Up.sql @@ -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 @@ -103,22 +192,34 @@ 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 @@ -126,18 +227,22 @@ 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 @@ -145,18 +250,21 @@ 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 @@ -164,9 +272,12 @@ 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 @@ -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 diff --git a/source/database/mssql/scripts/dbscripts/PSP_PIMS_LATEST/Alter Up/056_DML_PIMS_LEASE_PURPOSE_TYPE_Alter_Up.sql b/source/database/mssql/scripts/dbscripts/PSP_PIMS_LATEST/Alter Up/056_DML_PIMS_LEASE_PURPOSE_TYPE_Alter_Up.sql index b9f4fd46b5..b071e077df 100644 --- a/source/database/mssql/scripts/dbscripts/PSP_PIMS_LATEST/Alter Up/056_DML_PIMS_LEASE_PURPOSE_TYPE_Alter_Up.sql +++ b/source/database/mssql/scripts/dbscripts/PSP_PIMS_LATEST/Alter Up/056_DML_PIMS_LEASE_PURPOSE_TYPE_Alter_Up.sql @@ -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 diff --git a/source/database/mssql/scripts/dbscripts/PSP_PIMS_LATEST/Build/054_DML_PIMS_LEASE_LICENSE_TYPE.sql b/source/database/mssql/scripts/dbscripts/PSP_PIMS_LATEST/Build/054_DML_PIMS_LEASE_LICENSE_TYPE.sql index 9b2536bbf5..d76a6dd00f 100644 --- a/source/database/mssql/scripts/dbscripts/PSP_PIMS_LATEST/Build/054_DML_PIMS_LEASE_LICENSE_TYPE.sql +++ b/source/database/mssql/scripts/dbscripts/PSP_PIMS_LATEST/Build/054_DML_PIMS_LEASE_LICENSE_TYPE.sql @@ -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 -- -------------------------------------------------------------- diff --git a/source/database/mssql/scripts/dbscripts/PSP_PIMS_S85_00/Alter Down/054_DML_PIMS_LEASE_LICENSE_TYPE_Alter_Down.sql b/source/database/mssql/scripts/dbscripts/PSP_PIMS_S85_00/Alter Down/054_DML_PIMS_LEASE_LICENSE_TYPE_Alter_Down.sql index 86fd605a6a..dddecef446 100644 --- a/source/database/mssql/scripts/dbscripts/PSP_PIMS_S85_00/Alter Down/054_DML_PIMS_LEASE_LICENSE_TYPE_Alter_Down.sql +++ b/source/database/mssql/scripts/dbscripts/PSP_PIMS_S85_00/Alter Down/054_DML_PIMS_LEASE_LICENSE_TYPE_Alter_Down.sql @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/source/database/mssql/scripts/dbscripts/PSP_PIMS_S85_00/Alter Up/054_DML_PIMS_LEASE_LICENSE_TYPE_Alter_Up.sql b/source/database/mssql/scripts/dbscripts/PSP_PIMS_S85_00/Alter Up/054_DML_PIMS_LEASE_LICENSE_TYPE_Alter_Up.sql index aee86b8351..aec37256e3 100644 --- a/source/database/mssql/scripts/dbscripts/PSP_PIMS_S85_00/Alter Up/054_DML_PIMS_LEASE_LICENSE_TYPE_Alter_Up.sql +++ b/source/database/mssql/scripts/dbscripts/PSP_PIMS_S85_00/Alter Up/054_DML_PIMS_LEASE_LICENSE_TYPE_Alter_Up.sql @@ -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 @@ -103,22 +192,34 @@ 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 @@ -126,18 +227,22 @@ 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 @@ -145,18 +250,21 @@ 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 @@ -164,9 +272,12 @@ 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 @@ -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 diff --git a/source/database/mssql/scripts/dbscripts/PSP_PIMS_S85_00/Alter Up/056_DML_PIMS_LEASE_PURPOSE_TYPE_Alter_Up.sql b/source/database/mssql/scripts/dbscripts/PSP_PIMS_S85_00/Alter Up/056_DML_PIMS_LEASE_PURPOSE_TYPE_Alter_Up.sql index b9f4fd46b5..b071e077df 100644 --- a/source/database/mssql/scripts/dbscripts/PSP_PIMS_S85_00/Alter Up/056_DML_PIMS_LEASE_PURPOSE_TYPE_Alter_Up.sql +++ b/source/database/mssql/scripts/dbscripts/PSP_PIMS_S85_00/Alter Up/056_DML_PIMS_LEASE_PURPOSE_TYPE_Alter_Up.sql @@ -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 diff --git a/source/database/mssql/scripts/dbscripts/PSP_PIMS_S85_00/Build/054_DML_PIMS_LEASE_LICENSE_TYPE.sql b/source/database/mssql/scripts/dbscripts/PSP_PIMS_S85_00/Build/054_DML_PIMS_LEASE_LICENSE_TYPE.sql index 9b2536bbf5..d76a6dd00f 100644 --- a/source/database/mssql/scripts/dbscripts/PSP_PIMS_S85_00/Build/054_DML_PIMS_LEASE_LICENSE_TYPE.sql +++ b/source/database/mssql/scripts/dbscripts/PSP_PIMS_S85_00/Build/054_DML_PIMS_LEASE_LICENSE_TYPE.sql @@ -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 -- --------------------------------------------------------------