diff --git a/source/backend/apimodels/Models/Concepts/AcquisitionFile/AcquisitionFileOwnerMap.cs b/source/backend/apimodels/Models/Concepts/AcquisitionFile/AcquisitionFileOwnerMap.cs index 6de53bb67f..f94c143de6 100644 --- a/source/backend/apimodels/Models/Concepts/AcquisitionFile/AcquisitionFileOwnerMap.cs +++ b/source/backend/apimodels/Models/Concepts/AcquisitionFile/AcquisitionFileOwnerMap.cs @@ -1,4 +1,5 @@ using Mapster; +using Pims.Core.Extensions; using Entity = Pims.Dal.Entities; namespace Pims.Api.Models.Concepts.AcquisitionFile @@ -21,6 +22,9 @@ public void Register(TypeAdapterConfig config) .Map(dest => dest.ContactPhoneNum, src => src.ContactPhoneNum) .Map(dest => dest.IncorporationNumber, src => src.IncorporationNumber) .Map(dest => dest.RegistrationNumber, src => src.RegistrationNumber) + .Map(dest => dest.IsFromLtsa, src => src.IsFromLtsa ?? false) + .Map(dest => dest.LtsaPid, src => src.LtsaPid) + .Map(dest => dest.LtsaSourcedDate, src => src.LtsaSourcedDate.ToNullableDateOnly()) .Map(dest => dest.Address, src => src.Address); config @@ -37,6 +41,9 @@ public void Register(TypeAdapterConfig config) .Map(dest => dest.ContactPhoneNum, src => src.ContactPhoneNum) .Map(dest => dest.IncorporationNumber, src => src.IncorporationNumber) .Map(dest => dest.RegistrationNumber, src => src.RegistrationNumber) + .Map(dest => dest.IsFromLtsa, src => src.IsFromLtsa) + .Map(dest => dest.LtsaPid, src => src.LtsaPid) + .Map(dest => dest.LtsaSourcedDate, src => src.LtsaSourcedDate.ToNullableDateTime()) .Map(dest => dest.AddressId, src => src.Address.Id) .Map(dest => dest.Address, src => src.Address); @@ -53,6 +60,9 @@ public void Register(TypeAdapterConfig config) .Map(dest => dest.ContactPhoneNum, src => src.ContactPhoneNum) .Map(dest => dest.IncorporationNumber, src => src.IncorporationNumber) .Map(dest => dest.RegistrationNumber, src => src.RegistrationNumber) + .Map(dest => dest.IsFromLtsa, src => src.IsFromLtsa) + .Map(dest => dest.LtsaPid, src => src.LtsaPid) + .Map(dest => dest.LtsaSourcedDate, src => src.LtsaSourcedDate) .Map(dest => dest.AddressId, src => src.AddressId); } } diff --git a/source/backend/apimodels/Models/Concepts/AcquisitionFile/AcquisitionFileOwnerModel.cs b/source/backend/apimodels/Models/Concepts/AcquisitionFile/AcquisitionFileOwnerModel.cs index 29a79b52af..3a1510ad65 100644 --- a/source/backend/apimodels/Models/Concepts/AcquisitionFile/AcquisitionFileOwnerModel.cs +++ b/source/backend/apimodels/Models/Concepts/AcquisitionFile/AcquisitionFileOwnerModel.cs @@ -1,3 +1,4 @@ +using System; using Pims.Api.Models.Base; using Pims.Api.Models.Concepts.Address; @@ -28,5 +29,11 @@ public class AcquisitionFileOwnerModel : BaseAuditModel public string ContactPhoneNum { get; set; } public AddressModel Address { get; set; } + + public bool? IsFromLtsa { get; set; } + + public string LtsaPid { get; set; } + + public DateOnly? LtsaSourcedDate { get; set; } } } diff --git a/source/backend/entities/PimsBaseContext.cs b/source/backend/entities/PimsBaseContext.cs index d79fe245ce..dd4a45f062 100644 --- a/source/backend/entities/PimsBaseContext.cs +++ b/source/backend/entities/PimsBaseContext.cs @@ -1947,9 +1947,14 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) entity.Property(e => e.ExpiryDate).HasComment("Date the owner record expired."); entity.Property(e => e.GivenName).HasComment("Given name of the owner (person)."); entity.Property(e => e.IncorporationNumber).HasComment("Incorporation number of the organization."); + entity.Property(e => e.IsFromLtsa) + .HasDefaultValue(false) + .HasComment("User Story: As a PIMS user, I need to pre-populate the owner name(s) from LTSA title, as I’m required to use the LTSA title owner as the owner for an Acquisition file, and having that populate automatically based on properties in the file saves me time an"); entity.Property(e => e.IsOrganization).HasComment("Indicates if the owner is an organization. Default value is FALSE, indicating that the owner is a person."); entity.Property(e => e.IsPrimaryOwner).HasComment("Indicates that this is the file's primary owner."); entity.Property(e => e.LastNameAndCorpName).HasComment("Name of the owner (person or organization). If person, surname."); + entity.Property(e => e.LtsaPid).HasComment("PID of the originating LTSA file."); + entity.Property(e => e.LtsaSourcedDate).HasComment("Date that LTSA data was imported into the PIMS system."); entity.Property(e => e.OtherName).HasComment("Optional name field if required."); entity.Property(e => e.RegistrationNumber).HasComment("Registration number of the organization."); diff --git a/source/backend/entities/ef/PimsAcquisitionOwner.cs b/source/backend/entities/ef/PimsAcquisitionOwner.cs index eade7c9603..aa24ee34f8 100644 --- a/source/backend/entities/ef/PimsAcquisitionOwner.cs +++ b/source/backend/entities/ef/PimsAcquisitionOwner.cs @@ -197,6 +197,25 @@ public partial class PimsAcquisitionOwner [StringLength(30)] public string DbLastUpdateUserid { get; set; } + /// + /// User Story: As a PIMS user, I need to pre-populate the owner name(s) from LTSA title, as I’m required to use the LTSA title owner as the owner for an Acquisition file, and having that populate automatically based on properties in the file saves me time an + /// + [Column("IS_FROM_LTSA")] + public bool? IsFromLtsa { get; set; } + + /// + /// PID of the originating LTSA file. + /// + [Column("LTSA_PID")] + [StringLength(9)] + public string LtsaPid { get; set; } + + /// + /// Date that LTSA data was imported into the PIMS system. + /// + [Column("LTSA_SOURCED_DATE", TypeName = "datetime")] + public DateTime? LtsaSourcedDate { get; set; } + [ForeignKey("AcquisitionFileId")] [InverseProperty("PimsAcquisitionOwners")] public virtual PimsAcquisitionFile AcquisitionFile { get; set; } diff --git a/source/backend/entities/ef/PimsAcquisitionOwnerHist.cs b/source/backend/entities/ef/PimsAcquisitionOwnerHist.cs index 047a65eb94..4077c756ba 100644 --- a/source/backend/entities/ef/PimsAcquisitionOwnerHist.cs +++ b/source/backend/entities/ef/PimsAcquisitionOwnerHist.cs @@ -119,4 +119,14 @@ public partial class PimsAcquisitionOwnerHist [Column("DB_LAST_UPDATE_USERID")] [StringLength(30)] public string DbLastUpdateUserid { get; set; } + + [Column("IS_FROM_LTSA")] + public bool? IsFromLtsa { get; set; } + + [Column("LTSA_PID")] + [StringLength(9)] + public string LtsaPid { get; set; } + + [Column("LTSA_SOURCED_DATE", TypeName = "datetime")] + public DateTime? LtsaSourcedDate { get; set; } } diff --git a/source/backend/entities/ef/PimsAgreement.cs b/source/backend/entities/ef/PimsAgreement.cs index 63417a7c67..f4c77bca54 100644 --- a/source/backend/entities/ef/PimsAgreement.cs +++ b/source/backend/entities/ef/PimsAgreement.cs @@ -68,6 +68,12 @@ public partial class PimsAgreement [Column("COMMENCEMENT_DATE")] public DateOnly? CommencementDate { get; set; } + /// + /// Date the agreement was signed. + /// + [Column("AGREEMENT_SIGNED_DATE")] + public DateOnly? AgreementSignedDate { get; set; } + /// /// Amount of the deposit on the agreement. /// @@ -86,6 +92,12 @@ public partial class PimsAgreement [Column("PURCHASE_PRICE", TypeName = "money")] public decimal? PurchasePrice { get; set; } + /// + /// Date of the advance payment. + /// + [Column("ADVANCE_PAYMENT_DATE")] + public DateOnly? AdvancePaymentDate { get; set; } + /// /// Legal survey plan number, /// @@ -226,18 +238,6 @@ public partial class PimsAgreement [StringLength(30)] public string DbLastUpdateUserid { get; set; } - /// - /// Date the agreement was signed. - /// - [Column("AGREEMENT_SIGNED_DATE")] - public DateOnly? AgreementSignedDate { get; set; } - - /// - /// Date of the advance payment. - /// - [Column("ADVANCE_PAYMENT_DATE")] - public DateOnly? AdvancePaymentDate { get; set; } - [ForeignKey("AcquisitionFileId")] [InverseProperty("PimsAgreements")] public virtual PimsAcquisitionFile AcquisitionFile { get; set; } diff --git a/source/backend/entities/ef/PimsAgreementHist.cs b/source/backend/entities/ef/PimsAgreementHist.cs index e72c36315b..9336f55e76 100644 --- a/source/backend/entities/ef/PimsAgreementHist.cs +++ b/source/backend/entities/ef/PimsAgreementHist.cs @@ -48,6 +48,9 @@ public partial class PimsAgreementHist [Column("COMMENCEMENT_DATE")] public DateOnly? CommencementDate { get; set; } + [Column("AGREEMENT_SIGNED_DATE")] + public DateOnly? AgreementSignedDate { get; set; } + [Column("DEPOSIT_AMOUNT", TypeName = "money")] public decimal? DepositAmount { get; set; } @@ -57,6 +60,9 @@ public partial class PimsAgreementHist [Column("PURCHASE_PRICE", TypeName = "money")] public decimal? PurchasePrice { get; set; } + [Column("ADVANCE_PAYMENT_DATE")] + public DateOnly? AdvancePaymentDate { get; set; } + [Column("LEGAL_SURVEY_PLAN_NUM")] [StringLength(250)] public string LegalSurveyPlanNum { get; set; } @@ -133,10 +139,4 @@ public partial class PimsAgreementHist [Column("DB_LAST_UPDATE_USERID")] [StringLength(30)] public string DbLastUpdateUserid { get; set; } - - [Column("AGREEMENT_SIGNED_DATE")] - public DateOnly? AgreementSignedDate { get; set; } - - [Column("ADVANCE_PAYMENT_DATE")] - public DateOnly? AdvancePaymentDate { get; set; } } diff --git a/source/frontend/src/features/mapSideBar/acquisition/common/models.ts b/source/frontend/src/features/mapSideBar/acquisition/common/models.ts index a74c3616d3..5b74a1f17b 100644 --- a/source/frontend/src/features/mapSideBar/acquisition/common/models.ts +++ b/source/frontend/src/features/mapSideBar/acquisition/common/models.ts @@ -99,6 +99,9 @@ export class AcquisitionOwnerFormModel { contactEmailAddress: string | '' = ''; contactPhoneNumber: string | '' = ''; address?: OwnerAddressFormModel = new OwnerAddressFormModel(); + isFromLtsa: boolean | null; + ltsaPid: string | null; + ltsaSourcedDate: string | null; isEmpty(): boolean { if (this.isOrganization === 'true') { @@ -149,6 +152,9 @@ export class AcquisitionOwnerFormModel { contactPhoneNum: this.contactPhoneNumber.trim() === '' ? null : this.contactPhoneNumber.trim(), address: OwnerAddressFormModel.toApi(this.address), + isFromLtsa: this.isFromLtsa, + ltsaPid: this.ltsaPid, + ltsaSourcedDate: this.ltsaSourcedDate, ...getEmptyBaseAudit(this.rowVersion), }; } diff --git a/source/frontend/src/features/mapSideBar/acquisition/common/update/acquisitionOwners/UpdateAcquisitionOwnersSubForm.test.tsx b/source/frontend/src/features/mapSideBar/acquisition/common/update/acquisitionOwners/UpdateAcquisitionOwnersSubForm.test.tsx index 670172c5c1..0826376514 100644 --- a/source/frontend/src/features/mapSideBar/acquisition/common/update/acquisitionOwners/UpdateAcquisitionOwnersSubForm.test.tsx +++ b/source/frontend/src/features/mapSideBar/acquisition/common/update/acquisitionOwners/UpdateAcquisitionOwnersSubForm.test.tsx @@ -129,6 +129,9 @@ describe('UpdateAcquisitionOwnersSubForm component', () => { isEmpty: noop as any, toApi: noop as any, address: { countryId: 4, countryOther: 'fake country' }, + isFromLtsa: null, + ltsaPid: null, + ltsaSourcedDate: null, }, ], }, diff --git a/source/frontend/src/mocks/ExpropriationPayment.mock.ts b/source/frontend/src/mocks/ExpropriationPayment.mock.ts index e8e0d8f248..3f3285ab86 100644 --- a/source/frontend/src/mocks/ExpropriationPayment.mock.ts +++ b/source/frontend/src/mocks/ExpropriationPayment.mock.ts @@ -43,6 +43,9 @@ export const mockGetExpropriationPaymentApi = ( districtCode: null, regionCode: null, }, + isFromLtsa: false, + ltsaPid: null, + ltsaSourcedDate: null, ...getEmptyBaseAudit(3), }, interestHolderId: null, diff --git a/source/frontend/src/mocks/acquisitionFiles.mock.ts b/source/frontend/src/mocks/acquisitionFiles.mock.ts index 19a5858984..ece06eeba4 100644 --- a/source/frontend/src/mocks/acquisitionFiles.mock.ts +++ b/source/frontend/src/mocks/acquisitionFiles.mock.ts @@ -307,6 +307,9 @@ export const mockAcquisitionFileResponse = ( postal: 'IH8 B0B', rowVersion: 1, }, + isFromLtsa: null, + ltsaPid: null, + ltsaSourcedDate: null, appCreateTimestamp: '2023-02-06T22:27:22.01', appLastUpdateTimestamp: '2023-02-06T22:27:22.01', appLastUpdateUserid: 'dbo', @@ -339,6 +342,9 @@ export const mockAcquisitionFileResponse = ( postal: 'I4M B0B', rowVersion: 1, }, + isFromLtsa: null, + ltsaPid: null, + ltsaSourcedDate: null, appCreateTimestamp: '2023-02-08T18:11:12.303', appLastUpdateTimestamp: '2023-02-08T18:11:12.303', appLastUpdateUserid: 'dbo', @@ -485,6 +491,9 @@ export const getMockApiAcquisitionFileOwnerPerson = ( regionCode: null, districtCode: null, }, + isFromLtsa: null, + ltsaPid: null, + ltsaSourcedDate: null, appCreateTimestamp: '0001-01-01T00:00:00', appLastUpdateTimestamp: '0001-01-01T00:00:00', appCreateUserGuid: null, @@ -529,6 +538,9 @@ export const getMockApiAcquisitionFileOwnerOrganization = ( districtCode: null, regionCode: null, }, + isFromLtsa: null, + ltsaPid: null, + ltsaSourcedDate: null, appCreateTimestamp: '0001-01-01T00:00:00', appLastUpdateTimestamp: '0001-01-01T00:00:00', appCreateUserGuid: null, diff --git a/source/frontend/src/models/api/generated/ApiGen_Concepts_AcquisitionFileOwner.ts b/source/frontend/src/models/api/generated/ApiGen_Concepts_AcquisitionFileOwner.ts index 275ef91f8f..01d32fc18d 100644 --- a/source/frontend/src/models/api/generated/ApiGen_Concepts_AcquisitionFileOwner.ts +++ b/source/frontend/src/models/api/generated/ApiGen_Concepts_AcquisitionFileOwner.ts @@ -2,6 +2,8 @@ * File autogenerated by TsGenerator. * Do not manually modify, changes made to this file will be lost when this file is regenerated. */ +import { UtcIsoDate } from '@/models/api/UtcIsoDateTime'; + import { ApiGen_Base_BaseAudit } from './ApiGen_Base_BaseAudit'; import { ApiGen_Concepts_Address } from './ApiGen_Concepts_Address'; @@ -19,4 +21,7 @@ export interface ApiGen_Concepts_AcquisitionFileOwner extends ApiGen_Base_BaseAu contactEmailAddr: string | null; contactPhoneNum: string | null; address: ApiGen_Concepts_Address | null; + isFromLtsa: boolean | null; + ltsaPid: string | null; + ltsaSourcedDate: UtcIsoDate | null; }