From 32c06280e2f72980bc2753beceb75c82dc1296f9 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 Signed-off-by: Ben Shum Conflicts: Open-ILS/src/sql/Pg/002.schema.config.sql --- Open-ILS/src/sql/Pg/950.data.seed-values.sql | 4 ++-- Open-ILS/src/sql/Pg/upgrade/XXXX.data.bre_format.sql | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 Open-ILS/src/sql/Pg/upgrade/XXXX.data.bre_format.sql 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 0c4d18e0ea..0667da52dd 100644 --- a/Open-ILS/src/sql/Pg/950.data.seed-values.sql +++ b/Open-ILS/src/sql/Pg/950.data.seed-values.sql @@ -8851,7 +8851,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; @@ -8899,7 +8899,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