From ad2c2068c2313237ffddfffa9b4b96588b78198b Mon Sep 17 00:00:00 2001 From: erickson Date: Mon, 30 Nov 2009 14:14:23 +0000 Subject: [PATCH] access the user_data hash directly from the env variable and don't clobber said variable in the process git-svn-id: svn://svn.open-ils.org/ILS/trunk@15039 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/src/sql/Pg/002.schema.config.sql | 2 +- Open-ILS/src/sql/Pg/950.data.seed-values.sql | 2 +- .../0096.data.selfcheck-receipt-template2.sql | 84 +++++++++++++++++++ 3 files changed, 86 insertions(+), 2 deletions(-) create mode 100644 Open-ILS/src/sql/Pg/upgrade/0096.data.selfcheck-receipt-template2.sql diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql index e36f9d4029..191b1a8556 100644 --- a/Open-ILS/src/sql/Pg/002.schema.config.sql +++ b/Open-ILS/src/sql/Pg/002.schema.config.sql @@ -51,7 +51,7 @@ CREATE TABLE config.upgrade_log ( install_date TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW() ); -INSERT INTO config.upgrade_log (version) VALUES ('0095'); -- miker +INSERT INTO config.upgrade_log (version) VALUES ('0096'); -- berick 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 c398375168..928e0474d6 100644 --- a/Open-ILS/src/sql/Pg/950.data.seed-values.sql +++ b/Open-ILS/src/sql/Pg/950.data.seed-values.sql @@ -2656,7 +2656,7 @@ $$ [% FOR circ IN target %] [%- SET idx = loop.count - 1; - SET user_data = EventProcessor.findEvent( event.$idx ).environment.user_data + SET udata = user_data.$idx -%]
  • [% helpers.get_copy_bib_basics(circ.target_copy.id).title %]
    diff --git a/Open-ILS/src/sql/Pg/upgrade/0096.data.selfcheck-receipt-template2.sql b/Open-ILS/src/sql/Pg/upgrade/0096.data.selfcheck-receipt-template2.sql new file mode 100644 index 0000000000..2a6e162831 --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/0096.data.selfcheck-receipt-template2.sql @@ -0,0 +1,84 @@ +BEGIN; + +INSERT INTO config.upgrade_log (version) VALUES ('0096'); + +UPDATE action_trigger.event_definition SET template = +$$ +[%- USE date -%] +[%- SET user = target.0.usr -%] +[%- SET lib = target.0.circ_lib -%] +[%- SET lib_addr = target.0.circ_lib.billing_address -%] +[%- SET hours = lib.hours_of_operation -%] +
    + +
    [% date.format %]
    +
    [% lib.name %]
    +
    [% lib_addr.street1 %] [% lib_addr.street2 %]
    +
    [% lib_addr.city %], [% lib_addr.state %] [% lb_addr.post_code %]
    +
    [% lib.phone %]
    +
    + + [% user.family_name %], [% user.first_given_name %] +
      + [% FOR circ IN target %] + [%- + SET idx = loop.count - 1; + SET udata = user_data.$idx + -%] +
    1. +
      [% helpers.get_copy_bib_basics(circ.target_copy.id).title %]
      +
      Barcode: [% circ.target_copy.barcode %]
      + [% IF udata.renewal_failure %] +
      Renewal Failed
      + [% ELSE %] +
      Due Date: [% date.format(helpers.format_date(circ.due_date), '%Y-%m-%d') %]
      + [% END %] +
    2. + [% END %] +
    + +
    + Library Hours + [%- BLOCK format_time; date.format(time _ ' 1/1/1000', format='%I:%M %p'); END -%] +
    + Monday + [% PROCESS format_time time = hours.dow_0_open %] + [% PROCESS format_time time = hours.dow_0_close %] +
    +
    + Tuesday + [% PROCESS format_time time = hours.dow_1_open %] + [% PROCESS format_time time = hours.dow_1_close %] +
    +
    + Wednesday + [% PROCESS format_time time = hours.dow_2_open %] + [% PROCESS format_time time = hours.dow_2_close %] +
    +
    + Thursday + [% PROCESS format_time time = hours.dow_3_open %] + [% PROCESS format_time time = hours.dow_3_close %] +
    +
    + Friday + [% PROCESS format_time time = hours.dow_4_open %] + [% PROCESS format_time time = hours.dow_4_close %] +
    +
    + Saturday + [% PROCESS format_time time = hours.dow_5_open %] + [% PROCESS format_time time = hours.dow_5_close %] +
    +
    + Sunday + [% PROCESS format_time time = hours.dow_6_open %] + [% PROCESS format_time time = hours.dow_6_close %] +
    +
    +
    +$$ + +WHERE id = 10; + +COMMIT; -- 2.43.2