From: Galen Charlton Date: Wed, 2 Sep 2020 16:32:25 +0000 (-0400) Subject: LP#1857150: various schema and IDL changes X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=97318d8d6929140c82b8c30453fd88d1cb36b579;p=evergreen%2Fpines.git LP#1857150: various schema and IDL changes * Add a primary_contact column to acq.provider. The primary contact, when set, signifies the primary point of contact in case a provider has multiple contacts. This is displayed on the summary pane in the Angular interface. * Mark various non-NULL fields as required so that the record editor, can require them in turn: - acqpro.name - acqpro.owner - acqpro.currency_type - acqpro.code - acqpa.city - acqpa.country - acqpa.post_code - acqpa.state - acqpa.street1 - acqpc.provider - acqpc.name - acqpca.city - acqpca.country - acqpca.post_code - acqpca.state - acqpca.street - acqlipad.code - acqlipad.description - acqlipad.xpath - acqlipad.provider - acqphsm.provider - acqphsm.name - acqphsm.subfield - acqedi.label - acqedi.host - acqedi.owner - acqedi.provider - acqedi.use_attrs * Make acqpro.name not be translatable. This appears to have just been a case of copy-and-pastitis, as providers don't seem to vary their names by locale. * Add various virtual fields to support more fleshing: - acqpro.contacts - acqpro.holdings_subfields - acqpro.attributes - acqpro.edi_accounts - acqpc.addresses This patch includes contributions by Mike Rylander. Sponsored-by: Evergreen Community Development Initiative Signed-off-by: Galen Charlton Signed-off-by: Ruth Frasur Signed-off-by: Bill Erickson Signed-off-by: Jason Etheridge --- diff --git a/Open-ILS/examples/fm_IDL.xml b/Open-ILS/examples/fm_IDL.xml index 44455db884..520f6e6beb 100644 --- a/Open-ILS/examples/fm_IDL.xml +++ b/Open-ILS/examples/fm_IDL.xml @@ -8785,10 +8785,10 @@ SELECT usr, - - - - + + + + @@ -8801,15 +8801,25 @@ SELECT usr, + + + + + - - + + + + + + + @@ -8974,14 +8984,14 @@ SELECT usr, - - + + - - - + + + @@ -9010,13 +9020,15 @@ SELECT usr, - - + + + + @@ -9039,15 +9051,15 @@ SELECT usr, - - + + - - - + + + - + @@ -10026,10 +10038,10 @@ SELECT usr, - - - - + + + + @@ -10058,9 +10070,9 @@ SELECT usr, - - - + + + @@ -10096,20 +10108,20 @@ SELECT usr, - - + + - + - + - + diff --git a/Open-ILS/src/sql/Pg/200.schema.acq.sql b/Open-ILS/src/sql/Pg/200.schema.acq.sql index ce23237f34..2ddf74eb0b 100644 --- a/Open-ILS/src/sql/Pg/200.schema.acq.sql +++ b/Open-ILS/src/sql/Pg/200.schema.acq.sql @@ -84,6 +84,7 @@ CREATE TABLE acq.provider ( default_copy_count INT NOT NULL DEFAULT 0, default_claim_policy INT REFERENCES acq.claim_policy DEFERRABLE INITIALLY DEFERRED, + primary_contact INT, -- REFERENCE acq.provider_contact(id) ON DELETE SET NULL ON UPDATE CASCADE DEFERRABLE INITIALLY DEFERRED CONSTRAINT provider_name_once_per_owner UNIQUE (name,owner), CONSTRAINT code_once_per_owner UNIQUE (code, owner) ); diff --git a/Open-ILS/src/sql/Pg/800.fkeys.sql b/Open-ILS/src/sql/Pg/800.fkeys.sql index 58181cb21d..9ec6446bb4 100644 --- a/Open-ILS/src/sql/Pg/800.fkeys.sql +++ b/Open-ILS/src/sql/Pg/800.fkeys.sql @@ -66,6 +66,7 @@ ALTER TABLE actor.org_unit_proximity_adjustment ADD CONSTRAINT actor_org_unit_pr ALTER TABLE actor.org_unit_proximity_adjustment ADD CONSTRAINT actor_org_unit_proximity_copy_location_fkey FOREIGN KEY (copy_location) REFERENCES asset.copy_location (id) DEFERRABLE INITIALLY DEFERRED; ALTER TABLE acq.provider ADD CONSTRAINT acq_provider_edi_default_fkey FOREIGN KEY (edi_default) REFERENCES acq.edi_account (id) DEFERRABLE INITIALLY DEFERRED; +ALTER TABLE acq.provider ADD CONSTRAINT acq_provider_primary_contact_fkey FOREIGN KEY (primary_contact) REFERENCES acq.provider_contact (id) ON DELETE SET NULL ON UPDATE CASCADE DEFERRABLE INITIALLY DEFERRED; ALTER TABLE biblio.record_note ADD CONSTRAINT biblio_record_note_record_fkey FOREIGN KEY (record) REFERENCES biblio.record_entry (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; ALTER TABLE biblio.record_note ADD CONSTRAINT biblio_record_note_creator_fkey FOREIGN KEY (creator) REFERENCES actor.usr (id) DEFERRABLE INITIALLY DEFERRED; diff --git a/Open-ILS/src/sql/Pg/upgrade/AAAA.schema.provider-primary-contact.sql b/Open-ILS/src/sql/Pg/upgrade/AAAA.schema.provider-primary-contact.sql new file mode 100644 index 0000000000..b95f456bd8 --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/AAAA.schema.provider-primary-contact.sql @@ -0,0 +1,8 @@ +BEGIN; + +-- SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version); + +ALTER TABLE acq.provider ADD COLUMN primary_contact INT; +ALTER TABLE acq.provider ADD CONSTRAINT acq_provider_primary_contact_fkey FOREIGN KEY (primary_contact) REFERENCES acq.provider_contact (id) ON DELETE SET NULL ON UPDATE CASCADE DEFERRABLE INITIALLY DEFERRED; + +COMMIT;