[open-ils-commits] [GIT] Evergreen ILS branch master updated. 69b28b8dd84974e4515c3f59f2dbbfa4595bca04
Evergreen Git
git at git.evergreen-ils.org
Sat Sep 1 23:31:42 EDT 2012
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".
The branch, master has been updated
via 69b28b8dd84974e4515c3f59f2dbbfa4595bca04 (commit)
via a7534229e228bbfb34fed719fdcc78f702a79d24 (commit)
from 03cb2f98abc0f1c3efa2b6062239d4a296f2d967 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 69b28b8dd84974e4515c3f59f2dbbfa4595bca04
Author: Dan Scott <dscott at laurentian.ca>
Date: Sat Sep 1 22:59:21 2012 -0400
Do the SQL upgrade dance for list pubdate in CSV
With a slight tweak to base the upgrade off of the event definition name
instead of the ID; possibly more resilient.
Signed-off-by: Dan Scott <dscott at laurentian.ca>
diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql
index 1ded67e..8439b14 100644
--- a/Open-ILS/src/sql/Pg/002.schema.config.sql
+++ b/Open-ILS/src/sql/Pg/002.schema.config.sql
@@ -87,7 +87,7 @@ CREATE TRIGGER no_overlapping_deps
BEFORE INSERT OR UPDATE ON config.db_patch_dependencies
FOR EACH ROW EXECUTE PROCEDURE evergreen.array_overlap_check ('deprecates');
-INSERT INTO config.upgrade_log (version, applied_to) VALUES ('0736', :eg_version); -- miker/tsbere
+INSERT INTO config.upgrade_log (version, applied_to) VALUES ('0737', :eg_version); -- dyrcona/dbs
CREATE TABLE config.bib_source (
id SERIAL PRIMARY KEY,
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.data.update_ContainerCSV_template.sql b/Open-ILS/src/sql/Pg/upgrade/0737.data.update_ContainerCSV_template.sql
similarity index 92%
rename from Open-ILS/src/sql/Pg/upgrade/XXXX.data.update_ContainerCSV_template.sql
rename to Open-ILS/src/sql/Pg/upgrade/0737.data.update_ContainerCSV_template.sql
index 5af0feb..6e1106f 100644
--- a/Open-ILS/src/sql/Pg/upgrade/XXXX.data.update_ContainerCSV_template.sql
+++ b/Open-ILS/src/sql/Pg/upgrade/0737.data.update_ContainerCSV_template.sql
@@ -1,6 +1,6 @@
BEGIN;
-- check whether patch can be applied
-SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
+SELECT evergreen.upgrade_deps_block_check('0737', :eg_version);
UPDATE action_trigger.event_definition
SET template =
@@ -28,6 +28,6 @@ FOR item IN items;
helpers.csv_datum(title) %],[% helpers.csv_datum(author) %],[% helpers.csv_datum(pub_date) %],[% helpers.csv_datum(item_type) %],[% FOR note IN item.notes; helpers.csv_datum(note.note); ","; END; "\n";
END -%]
$$
-WHERE id = 48;
+WHERE name = 'Bookbag CSV';
COMMIT;
commit a7534229e228bbfb34fed719fdcc78f702a79d24
Author: Jason Stephenson <jstephenson at mvlc.org>
Date: Fri Jul 27 09:25:05 2012 -0400
Add pub date to CSV output.
Change the template for the ContainerCSV reactor to add the publication
date (MARC 260$c) in the csv output in the same position that the previous
commit adds it to the html output.
Add an upgrade script to update the existing template for the ContainerCSV
reactor in action_trigger.event_definition.
Signed-off-by: Jason Stephenson <jstephenson at mvlc.org>
Signed-off-by: Dan Scott <dscott at laurentian.ca>
diff --git a/Open-ILS/src/sql/Pg/950.data.seed-values.sql b/Open-ILS/src/sql/Pg/950.data.seed-values.sql
index 41eb5fe..e5daf85 100644
--- a/Open-ILS/src/sql/Pg/950.data.seed-values.sql
+++ b/Open-ILS/src/sql/Pg/950.data.seed-values.sql
@@ -9989,8 +9989,15 @@ FOR item IN items;
END;
author = bibxml.findnodes('//*[@tag="100"]/*[@code="a"]').textContent;
item_type = bibxml.findnodes('//*[local-name()="attributes"]/*[local-name()="field"][@name="item_type"]').getAttribute('coded-value');
-
- helpers.csv_datum(title) %],[% helpers.csv_datum(author) %],[% helpers.csv_datum(item_type) %],[% FOR note IN item.notes; helpers.csv_datum(note.note); ","; END; "\n";
+ pub_date = "";
+ FOR pdatum IN bibxml.findnodes('//*[@tag="260"]/*[@code="c"]');
+ IF pub_date ;
+ pub_date = pub_date _ ", " _ pdatum.textContent;
+ ELSE ;
+ pub_date = pdatum.textContent;
+ END;
+ END;
+ helpers.csv_datum(title) %],[% helpers.csv_datum(author) %],[% helpers.csv_datum(pub_date) %],[% helpers.csv_datum(item_type) %],[% FOR note IN item.notes; helpers.csv_datum(note.note); ","; END; "\n";
END -%]
$$
);
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.data.update_ContainerCSV_template.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.data.update_ContainerCSV_template.sql
new file mode 100644
index 0000000..5af0feb
--- /dev/null
+++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.data.update_ContainerCSV_template.sql
@@ -0,0 +1,33 @@
+BEGIN;
+-- check whether patch can be applied
+SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
+
+UPDATE action_trigger.event_definition
+SET template =
+$$
+[%-
+# target is the bookbag itself. The 'items' variable does not need to be in
+# the environment because a special reactor will take care of filling it in.
+
+FOR item IN items;
+ bibxml = helpers.unapi_bre(item.target_biblio_record_entry, {flesh => '{mra}'});
+ title = "";
+ FOR part IN bibxml.findnodes('//*[@tag="245"]/*[@code="a" or @code="b"]');
+ title = title _ part.textContent;
+ END;
+ author = bibxml.findnodes('//*[@tag="100"]/*[@code="a"]').textContent;
+ item_type = bibxml.findnodes('//*[local-name()="attributes"]/*[local-name()="field"][@name="item_type"]').getAttribute('coded-value');
+ pub_date = "";
+ FOR pdatum IN bibxml.findnodes('//*[@tag="260"]/*[@code="c"]');
+ IF pub_date ;
+ pub_date = pub_date _ ", " _ pdatum.textContent;
+ ELSE ;
+ pub_date = pdatum.textContent;
+ END;
+ END;
+ helpers.csv_datum(title) %],[% helpers.csv_datum(author) %],[% helpers.csv_datum(pub_date) %],[% helpers.csv_datum(item_type) %],[% FOR note IN item.notes; helpers.csv_datum(note.note); ","; END; "\n";
+END -%]
+$$
+WHERE id = 48;
+
+COMMIT;
-----------------------------------------------------------------------
Summary of changes:
Open-ILS/src/sql/Pg/002.schema.config.sql | 2 +-
Open-ILS/src/sql/Pg/950.data.seed-values.sql | 11 ++++++++-
... => 0737.data.update_ContainerCSV_template.sql} | 21 ++++++++++++++-----
3 files changed, 25 insertions(+), 9 deletions(-)
copy Open-ILS/src/sql/Pg/upgrade/{0660.data.bib-container-csv-unapi-template.sql => 0737.data.update_ContainerCSV_template.sql} (55%)
hooks/post-receive
--
Evergreen ILS
More information about the open-ils-commits
mailing list