From 2e8cccec07aa8e471c880ede78834b7480333455 Mon Sep 17 00:00:00 2001 From: Jason Etheridge Date: Thu, 8 Nov 2012 11:27:13 -0500 Subject: [PATCH] reset title variable when looping with biblio A/T Two templates that I'm concerned with, though there may be others that could use this treatment: biblio.record_entry.email and biblio.record_entry.print Basically, they can group events from the same user and consolidate bibs, but as they loop through the bibs they're not clearing the temporary variable that contains the bib title, so we get duplicated and run-on titles in the output. Signed-off-by: Jason Etheridge --- Open-ILS/src/sql/Pg/002.schema.config.sql | 2 +- Open-ILS/src/sql/Pg/950.data.seed-values.sql | 4 ++-- Open-ILS/src/sql/Pg/upgrade/XXXX.data.bre_format.sql | 18 ++++++++++++++++++ 3 files changed, 21 insertions(+), 3 deletions(-) create mode 100644 Open-ILS/src/sql/Pg/upgrade/XXXX.data.bre_format.sql diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql index e722361130..a56afd02a5 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 ('0743', :eg_version); -- dbs/tsbere +INSERT INTO config.upgrade_log (version, applied_to) VALUES ('XXXX', :eg_version); -- phasefx CREATE TABLE config.bib_source ( id SERIAL PRIMARY KEY, 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 5668078c5d..c4a4010e37 100644 --- a/Open-ILS/src/sql/Pg/950.data.seed-values.sql +++ b/Open-ILS/src/sql/Pg/950.data.seed-values.sql @@ -8631,7 +8631,7 @@ To: [%- params.recipient_email || user.email %] From: [%- params.sender_email || default_sender %] Subject: Bibliographic Records -[% FOR cbreb IN target %] +[% FOR cbreb IN target %][% title = '' %] [% FOR item IN cbreb.items; bre_id = item.target_biblio_record_entry; @@ -8679,7 +8679,7 @@ $$
    - [% FOR cbreb IN target %] + [% FOR cbreb IN target %][% title = '' %] [% FOR item IN cbreb.items; bre_id = item.target_biblio_record_entry; diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.data.bre_format.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.data.bre_format.sql new file mode 100644 index 0000000000..86644b4191 --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.data.bre_format.sql @@ -0,0 +1,18 @@ +-- Evergreen DB patch XXXX.data.bre_format.sql +-- +-- Fix some templates that loop over bibs to not have duplicated/run-on titles +-- +BEGIN; + +-- check whether patch can be applied +SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version); + +-- I think we shy away from modifying templates on existing systems, but this seems pretty safe... +UPDATE + action_trigger.event_definition +SET + template = replace(template,'[% FOR cbreb IN target %]','[% FOR cbreb IN target %][% title = '''' %]') +WHERE + id IN (31,32); + +COMMIT; -- 2.11.0