reset title variable when looping with biblio A/T
authorJason Etheridge <jason@esilibrary.com>
Thu, 8 Nov 2012 16:27:13 +0000 (11:27 -0500)
committerBen Shum <bshum@biblio.org>
Sat, 7 Sep 2013 03:18:23 +0000 (23:18 -0400)
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 <jason@esilibrary.com>
Signed-off-by: Ben Shum <bshum@biblio.org>
Conflicts:
Open-ILS/src/sql/Pg/002.schema.config.sql

Open-ILS/src/sql/Pg/950.data.seed-values.sql
Open-ILS/src/sql/Pg/upgrade/XXXX.data.bre_format.sql [new file with mode: 0644]

index 801a29a..8242492 100644 (file)
@@ -8973,7 +8973,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;
 
@@ -9021,7 +9021,7 @@ $$
 <div>
     <style> li { padding: 8px; margin 5px; }</style>
     <ol>
-    [% 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 (file)
index 0000000..86644b4
--- /dev/null
@@ -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;