From 820d6caf55c31f7cd862bf2295c62a096e349567 Mon Sep 17 00:00:00 2001 From: gmc Date: Tue, 2 Nov 2010 15:50:13 +0000 Subject: [PATCH] add definition for UPC line item attribute Useful for providers of audiovisual material that don't have ISBNs. Signed-off-by: Galen Charlton git-svn-id: svn://svn.open-ils.org/ILS/trunk@18578 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/src/sql/Pg/002.schema.config.sql | 2 +- Open-ILS/src/sql/Pg/1.6.1-2.0-upgrade-db.sql | 6 ++++++ Open-ILS/src/sql/Pg/200.schema.acq.sql | 1 + Open-ILS/src/sql/Pg/upgrade/0456.data.upc-lineitem-attr.sql | 11 +++++++++++ 4 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 Open-ILS/src/sql/Pg/upgrade/0456.data.upc-lineitem-attr.sql diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql index 3ceb7f004..f0e4622e8 100644 --- a/Open-ILS/src/sql/Pg/002.schema.config.sql +++ b/Open-ILS/src/sql/Pg/002.schema.config.sql @@ -70,7 +70,7 @@ CREATE TABLE config.upgrade_log ( install_date TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW() ); -INSERT INTO config.upgrade_log (version) VALUES ('0455'); -- gmc +INSERT INTO config.upgrade_log (version) VALUES ('0456'); -- gmc CREATE TABLE config.bib_source ( id SERIAL PRIMARY KEY, diff --git a/Open-ILS/src/sql/Pg/1.6.1-2.0-upgrade-db.sql b/Open-ILS/src/sql/Pg/1.6.1-2.0-upgrade-db.sql index 5dbe40096..d40cf9118 100644 --- a/Open-ILS/src/sql/Pg/1.6.1-2.0-upgrade-db.sql +++ b/Open-ILS/src/sql/Pg/1.6.1-2.0-upgrade-db.sql @@ -18756,6 +18756,12 @@ ALTER TABLE action.hold_copy_map DROP TRIGGER IF EXISTS push_due_date_tgr ON action.circulation; CREATE TRIGGER push_due_date_tgr BEFORE INSERT OR UPDATE ON action.circulation FOR EACH ROW EXECUTE PROCEDURE action.push_circ_due_time(); +INSERT INTO acq.lineitem_marc_attr_definition ( code, description, xpath, remove ) +SELECT 'upc', 'UPC', '//*[@tag="024" and @ind1="1"]/*[@code="a"]', $r$(?:-|\s.+$)$r$ +WHERE NOT EXISTS ( + SELECT 1 FROM acq.lineitem_marc_attr_definition WHERE code = 'upc' +); + COMMIT; -- Some operations go outside of the transaction, because they may diff --git a/Open-ILS/src/sql/Pg/200.schema.acq.sql b/Open-ILS/src/sql/Pg/200.schema.acq.sql index 6184c01b3..82064a7ee 100644 --- a/Open-ILS/src/sql/Pg/200.schema.acq.sql +++ b/Open-ILS/src/sql/Pg/200.schema.acq.sql @@ -598,6 +598,7 @@ INSERT INTO acq.lineitem_marc_attr_definition ( code, description, xpath ) VALUE INSERT INTO acq.lineitem_marc_attr_definition ( code, description, xpath ) VALUES ('pagination','Pagination','//*[@tag="300"]/*[@code="a"][1]'); INSERT INTO acq.lineitem_marc_attr_definition ( code, description, xpath, remove ) VALUES ('isbn','ISBN','//*[@tag="020"]/*[@code="a"]', $r$(?:-|\s.+$)$r$); INSERT INTO acq.lineitem_marc_attr_definition ( code, description, xpath, remove ) VALUES ('issn','ISSN','//*[@tag="022"]/*[@code="a"]', $r$(?:-|\s.+$)$r$); +INSERT INTO acq.lineitem_marc_attr_definition ( code, description, xpath, remove ) VALUES ('upc', 'UPC', '//*[@tag="024" and @ind1="1"]/*[@code="a"]', $r$(?:-|\s.+$)$r$); INSERT INTO acq.lineitem_marc_attr_definition ( code, description, xpath ) VALUES ('price','Price','//*[@tag="020" or @tag="022"]/*[@code="c"][1]'); INSERT INTO acq.lineitem_marc_attr_definition ( code, description, xpath ) VALUES ('identifier','Identifier','//*[@tag="001"]'); INSERT INTO acq.lineitem_marc_attr_definition ( code, description, xpath ) VALUES ('publisher','Publisher','//*[@tag="260"]/*[@code="b"][1]'); diff --git a/Open-ILS/src/sql/Pg/upgrade/0456.data.upc-lineitem-attr.sql b/Open-ILS/src/sql/Pg/upgrade/0456.data.upc-lineitem-attr.sql new file mode 100644 index 000000000..dde72eee9 --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/0456.data.upc-lineitem-attr.sql @@ -0,0 +1,11 @@ +BEGIN; + +INSERT INTO config.upgrade_log (version) VALUES ('0456'); -- gmc + +INSERT INTO acq.lineitem_marc_attr_definition ( code, description, xpath, remove ) +SELECT 'upc', 'UPC', '//*[@tag="024" and @ind1="1"]/*[@code="a"]', $r$(?:-|\s.+$)$r$ +WHERE NOT EXISTS ( + SELECT 1 FROM acq.lineitem_marc_attr_definition WHERE code = 'upc' +); + +COMMIT; -- 2.11.0