From: Galen Charlton Date: Wed, 2 Mar 2016 19:32:35 +0000 (-0500) Subject: LP#1519911: upgrade script to fix self-checkout receipt A/T template X-Git-Tag: sprint4-merge-nov22~467 X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=ba689b93cc120ea22f0be821762157c0bad4e2eb;p=working%2FEvergreen.git LP#1519911: upgrade script to fix self-checkout receipt A/T template This patch adds an update to fix the "lb_addr.post_code" typo in the stock A/T event definition for self-checkout receipts. This update changes the definition *only* if it has not been customized by the user, and it does not attempt to fix any copies of that definition. To test ------- [1] Upon applying the update, generate a receipt from the web-based self-check interface. The library's postal code (if set) should now display in the receipt. Signed-off-by: Galen Charlton --- diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql index 544eb7a327..e8620ff79c 100644 --- a/Open-ILS/src/sql/Pg/002.schema.config.sql +++ b/Open-ILS/src/sql/Pg/002.schema.config.sql @@ -91,7 +91,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 ('0964', :eg_version); -- jlitrell/kmlussier/bshum +INSERT INTO config.upgrade_log (version, applied_to) VALUES ('0965', :eg_version); -- gmcharlt CREATE TABLE config.bib_source ( id SERIAL PRIMARY KEY, diff --git a/Open-ILS/src/sql/Pg/upgrade/0965.data.fix_atevdef_typo.sql b/Open-ILS/src/sql/Pg/upgrade/0965.data.fix_atevdef_typo.sql new file mode 100644 index 0000000000..295b161a9b --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/0965.data.fix_atevdef_typo.sql @@ -0,0 +1,158 @@ +BEGIN; + +SELECT evergreen.upgrade_deps_block_check('0965', :eg_version); + +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 %] [% lib_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 user_data.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 AND 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 user_data.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 %] +
+
+
+$$; + +COMMIT;