diff --git a/source/database/mssql/scripts/dbscripts/PSP_PIMS_S87_00/Alter Down/154_DML_PIMS_LEASE_STAKEHOLDER_TYPE_Alter_Down.sql b/source/database/mssql/scripts/dbscripts/PSP_PIMS_S87_00/Alter Down/154_DML_PIMS_LEASE_STAKEHOLDER_TYPE_Alter_Down.sql new file mode 100644 index 0000000000..7f8c5e2517 --- /dev/null +++ b/source/database/mssql/scripts/dbscripts/PSP_PIMS_S87_00/Alter Down/154_DML_PIMS_LEASE_STAKEHOLDER_TYPE_Alter_Down.sql @@ -0,0 +1,37 @@ +IF EXISTS ( + SELECT + 1 + FROM + PIMS_LEASE_STAKEHOLDER_TYPE + WHERE + LEASE_STAKEHOLDER_TYPE_CODE = 'OWNER' +) BEGIN +UPDATE + PIMS_LEASE_STAKEHOLDER_TYPE +SET + IS_DISABLED = 1, + CONCURRENCY_CONTROL_NUMBER = CONCURRENCY_CONTROL_NUMBER + 1 +WHERE + LEASE_STAKEHOLDER_TYPE_CODE = 'OWNER'; + +END; + +IF EXISTS ( + SELECT + 1 + FROM + PIMS_LEASE_STAKEHOLDER_TYPE + WHERE + LEASE_STAKEHOLDER_TYPE_CODE = 'OWNREP' +) BEGIN +UPDATE + PIMS_LEASE_STAKEHOLDER_TYPE +SET + IS_DISABLED = 1, + CONCURRENCY_CONTROL_NUMBER = CONCURRENCY_CONTROL_NUMBER + 1 +WHERE + LEASE_STAKEHOLDER_TYPE_CODE = 'OWNREP'; + +END; + +GO \ No newline at end of file diff --git a/source/database/mssql/scripts/dbscripts/PSP_PIMS_S87_00/Alter Up/154_DML_PIMS_LEASE_STAKEHOLDER_TYPE_Alter_Up.sql b/source/database/mssql/scripts/dbscripts/PSP_PIMS_S87_00/Alter Up/154_DML_PIMS_LEASE_STAKEHOLDER_TYPE_Alter_Up.sql new file mode 100644 index 0000000000..b6cbae39db --- /dev/null +++ b/source/database/mssql/scripts/dbscripts/PSP_PIMS_S87_00/Alter Up/154_DML_PIMS_LEASE_STAKEHOLDER_TYPE_Alter_Up.sql @@ -0,0 +1,53 @@ +IF NOT EXISTS ( + SELECT + 1 + FROM + PIMS_LEASE_STAKEHOLDER_TYPE + WHERE + LEASE_STAKEHOLDER_TYPE_CODE = 'OWNER' +) +INSERT INTO + PIMS_LEASE_STAKEHOLDER_TYPE ( + LEASE_STAKEHOLDER_TYPE_CODE, + DESCRIPTION, + IS_PAYABLE_RELATED + ) +VALUES + ('OWNER', N'Owner', 1); + +ELSE +UPDATE + PIMS_LEASE_STAKEHOLDER_TYPE +SET + IS_DISABLED = 0, + CONCURRENCY_CONTROL_NUMBER = CONCURRENCY_CONTROL_NUMBER + 1 +WHERE + LEASE_STAKEHOLDER_TYPE_CODE = 'OWNER'; + +IF NOT EXISTS ( + SELECT + 1 + FROM + PIMS_LEASE_STAKEHOLDER_TYPE + WHERE + LEASE_STAKEHOLDER_TYPE_CODE = 'OWNREP' +) +INSERT INTO + PIMS_LEASE_STAKEHOLDER_TYPE ( + LEASE_STAKEHOLDER_TYPE_CODE, + DESCRIPTION, + IS_PAYABLE_RELATED + ) +VALUES + ('OWNREP', N'Owner Representative', 1); + +ELSE +UPDATE + PIMS_LEASE_STAKEHOLDER_TYPE +SET + IS_DISABLED = 0, + CONCURRENCY_CONTROL_NUMBER = CONCURRENCY_CONTROL_NUMBER + 1 +WHERE + LEASE_STAKEHOLDER_TYPE_CODE = 'OWNREP'; + +GO \ No newline at end of file diff --git a/source/frontend/src/components/common/form/Select.tsx b/source/frontend/src/components/common/form/Select.tsx index 2a668b446b..74ebe1ae26 100644 --- a/source/frontend/src/components/common/form/Select.tsx +++ b/source/frontend/src/components/common/form/Select.tsx @@ -100,10 +100,12 @@ export const Select: React.FC> = ({ }; const renderPlaceholder = () => { - if (!placeholder) { + const calculatedPlaceholder = + !value || options.find(option => option.value === value) ? null : 'N/A'; // Render N/A in the event that the currently selected value is not in the list. + if (!calculatedPlaceholder && !placeholder) { return null; } - return ; + return ; }; const renderOptions = () => { @@ -153,7 +155,7 @@ export const Select: React.FC> = ({ custom={custom} isInvalid={!!touch && !!error} {...rest} - value={getIn(values, field) ?? ''} + value={value ?? ''} multiple={multiple} onChange={onSelectChange} onBlur={(e: any) => { diff --git a/source/frontend/src/features/documents/documentDetail/__snapshots__/DocumentDetailForm.test.tsx.snap b/source/frontend/src/features/documents/documentDetail/__snapshots__/DocumentDetailForm.test.tsx.snap index 467210bd4e..9800e35ce8 100644 --- a/source/frontend/src/features/documents/documentDetail/__snapshots__/DocumentDetailForm.test.tsx.snap +++ b/source/frontend/src/features/documents/documentDetail/__snapshots__/DocumentDetailForm.test.tsx.snap @@ -362,6 +362,11 @@ exports[`DocumentDetailForm component > renders as expected 1`] = ` id="input-documentStatusCode" name="documentStatusCode" > +