reset title variable when looping with biblio A/T collab/phasefx/biblio_action_triggers
authorJason Etheridge <jason@esilibrary.com>
Thu, 8 Nov 2012 16:27:13 +0000 (11:27 -0500)
committerJason Etheridge <jason@esilibrary.com>
Thu, 8 Nov 2012 16:43:48 +0000 (11:43 -0500)
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>
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 e722361..a56afd0 100644 (file)
@@ -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,
index 5668078..c4a4010 100644 (file)
@@ -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 @@ $$
 <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;