From 4d696a59025bf82328112e4620c19cf300051f72 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Tue, 3 May 2016 11:59:43 -0400 Subject: [PATCH] JBAS-953 Drop CC cols local SQL Column mods and print/email template updates. Signed-off-by: Bill Erickson --- KCLS/sql/schema/deploy/drop-cc-cols.sql | 228 ++++++++++++++++++++++++++++++++ KCLS/sql/schema/revert/drop-cc-cols.sql | 222 +++++++++++++++++++++++++++++++ KCLS/sql/schema/sqitch.plan | 1 + KCLS/sql/schema/verify/drop-cc-cols.sql | 7 + 4 files changed, 458 insertions(+) create mode 100644 KCLS/sql/schema/deploy/drop-cc-cols.sql create mode 100644 KCLS/sql/schema/revert/drop-cc-cols.sql create mode 100644 KCLS/sql/schema/verify/drop-cc-cols.sql diff --git a/KCLS/sql/schema/deploy/drop-cc-cols.sql b/KCLS/sql/schema/deploy/drop-cc-cols.sql new file mode 100644 index 0000000000..f73af506e2 --- /dev/null +++ b/KCLS/sql/schema/deploy/drop-cc-cols.sql @@ -0,0 +1,228 @@ +-- Deploy kcls-evergreen:drop-cc-cols to pg +-- requires: sip-activity-types + +BEGIN; + +ALTER TABLE money.credit_card_payment + DROP COLUMN cc_type, + DROP COLUMN expire_month, + DROP COLUMN expire_year, + DROP COLUMN cc_first_name, + DROP COLUMN cc_last_name; + +UPDATE action_trigger.event_definition SET template = +$$ +[%- USE date -%] +[%- SET user = target.xact.usr -%][% USE money=format('%.2f') -%] +To: [%- params.recipient_email || user.email %] +From: [%- params.sender_email || default_sender %] +Subject: KCLS Payment Receipt + +[% MACRO mkdate(ts) GET date.format(helpers.format_date(ts), '%m/%d/%Y') %][% date.format(date.now, '%m/%d/%Y') %] + +Please print ALL PAGES of this receipt for your records. +If you are paying for a lost item, and you return the item within 12 months of this date, +this receipt will be REQUIRED to request a refund. + +Billing Info +[% SET xact_mp_hash = {} %][% FOR mp IN target %][%# Template is hooked around payments, but let us make the receipt focused on transactions %][% SET xact_id = mp.xact.id %][% IF ! xact_mp_hash.defined( xact_id ) %][% xact_mp_hash.$xact_id = { 'xact' => mp.xact, 'payments' => [] } %][% END %][% xact_mp_hash.$xact_id.payments.push(mp) %][% END %][% FOR xact_id IN xact_mp_hash.keys.sort %][% SET xact = xact_mp_hash.$xact_id.xact %][% SET mb_type_hash = {} %][% FOR mb IN xact.billings %][%# Group billings by their btype %][% IF mb.voided == 'f' %][% SET mb_type = mb.btype.id %][% IF ! mb_type_hash.defined( mb_type ) %][% mb_type_hash.$mb_type = { 'sum' => 0.00, 'billings' => [] } %][% END %][% IF ! mb_type_hash.$mb_type.defined( 'first_ts' ) %][% mb_type_hash.$mb_type.first_ts = mb.billing_ts %][% END %][% mb_type_hash.$mb_type.last_ts = mb.billing_ts %][% mb_type_hash.$mb_type.sum = mb_type_hash.$mb_type.sum + mb.amount %] [% END %][% END %][% FOR mb_type IN mb_type_hash.keys.sort %][% IF mb_type == 1 %][%# Consolidated view of overdue billings %][% ELSE %][%# all other billings show individually %][% FOR mb IN mb_type_hash.$mb_type.billings %][% END %][% END %][% END %] + +[%- +FOR mp IN xact_mp_hash.$xact_id.payments; + SWITCH mp.payment_type; + CASE "cash_payment"; + CASE "check_payment"; + CASE "credit_payment"; + CASE "forgive_payment"; + CASE "goods_payment"; + CASE "work_payment"; + CASE "credit_card_payment"; + # Default to XXXX when card number has been cleared. + cc_number = 'XXXX'; + IF mp.credit_card_payment.cc_number; + cc_number = mp.credit_card_payment.cc_number; + END %] +Card Ending: [% cc_number %] +Transaction #: [% mp.credit_card_payment.cc_order_number -%] + [% END; # SWITCH +END; # FOR +-%] +[% END -%] + +Paid Charges + +[% SET xact_mp_hash = {} %][% FOR mp IN target %][%# Template is hooked around payments, but let us make the receipt focused on transactions %][% SET xact_id = mp.xact.id %][% IF ! xact_mp_hash.defined( xact_id ) %][% xact_mp_hash.$xact_id = { 'xact' => mp.xact, 'payments' => [] } %][% END %][% xact_mp_hash.$xact_id.payments.push(mp) %][% END %][% FOR xact_id IN xact_mp_hash.keys.sort %][% SET xact = xact_mp_hash.$xact_id.xact %] +[% IF xact.circulation %]Title: [% helpers.get_copy_bib_basics(xact.circulation.target_copy.id).title %] -- Item Barcode: [% xact.circulation.target_copy.barcode %][% ELSE %]Type: Miscellaneous[% END %] +Charges: [% SET mb_type_hash = {} %][% FOR mb IN xact.billings %][%# Group billings by their btype %][% IF mb.voided == 'f' %][% SET mb_type = mb.btype.id %][% IF ! mb_type_hash.defined( mb_type ) %][% mb_type_hash.$mb_type = { 'sum' => 0.00, 'billings' => [] } %][% END %][% IF ! mb_type_hash.$mb_type.defined( 'first_ts' ) %][% mb_type_hash.$mb_type.first_ts = mb.billing_ts %][% END %][% mb_type_hash.$mb_type.last_ts = mb.billing_ts %][% mb_type_hash.$mb_type.sum = mb_type_hash.$mb_type.sum + mb.amount %][% mb_type_hash.$mb_type.billings.push( mb ) %][% END %][% END %][% FOR mb_type IN mb_type_hash.keys.sort %][% IF mb_type == 1 %][%# Consolidated view of overdue billings %]$[% money(mb_type_hash.$mb_type.sum) %] for [% mb_type_hash.$mb_type.billings.0.btype.name %] on [% mkdate(mb_type_hash.$mb_type.first_ts) %] through [% mkdate(mb_type_hash.$mb_type.last_ts) %][% ELSE %][%# all other billings show individually %][% FOR mb IN mb_type_hash.$mb_type.billings %]$[% money(mb.amount) %] for "[% mb.btype.name %]" on [% mkdate(mb.billing_ts) %][% IF mb.note %]([% mb.note %])[% END %][% END %][% END %][% END %] +Payments:[% FOR mp IN xact_mp_hash.$xact_id.payments %]$[% money(mp.amount) %] paid by [% SWITCH mp.payment_type -%][% CASE "cash_payment" %]Cash[% CASE "check_payment" %]Check[% CASE "credit_card_payment" %]Credit Card[% CASE "credit_payment" %]Credit[% CASE "forgive_payment" %]Forgiveness[% CASE "goods_payment" %]Goods[% CASE "work_payment" %]Work[%- END %] on [% mkdate(mp.payment_ts) %] +[% END %][% END %] + +If the items listed on this receipt are returned within 12 months of the receipt date, you may request a refund within 12 months of the receipt date for the cost of the item minus any outstanding charges on your account. The usual overdue fee will still be in effect for the returned item. You may choose to pay this overdue fee at the time you request a refund or have the overdue fee deducted from the amount of the refund. Patrons requesting a refund must present this receipt at any KCLS location. + +Refunds are not available for parts and pieces, overdue fines, or items that do not display a specific title in My Account. For a list of refundable and nonrefundable items, visit http://www.kcls.org/usingthelibrary/borrowing/ + +**END OF RECEIPT** +$$ +WHERE id = 29; + + + +UPDATE action_trigger.event_definition SET template = +$$ +[%- USE date -%][%- SET user = target.0.xact.usr -%] +[% USE money=format('%.2f') -%] +[% MACRO mkdate(ts) GET date.format(helpers.format_date(ts), '%m/%d/%Y') %] + + +
+
[% date.format(date.now, '%m/%d/%Y') %]

+
+Please print ALL PAGES of this receipt for your records.
If you are paying for a lost item, and you return the item within 12 months of this date, +this receipt will be REQUIRED to request a refund.
+ +
+
+
+Billing Info +[% SET xact_mp_hash = {} %] + [% FOR mp IN target %][%# Template is hooked around payments, but let us make the receipt focused on transactions %] + [% SET xact_id = mp.xact.id %] + [% IF ! xact_mp_hash.defined( xact_id ) %][% xact_mp_hash.$xact_id = { 'xact' => mp.xact, 'payments' => [] } %][% END %] + [% xact_mp_hash.$xact_id.payments.push(mp) %] + [% END %] + [% FOR xact_id IN xact_mp_hash.keys.sort %] + [% SET xact = xact_mp_hash.$xact_id.xact %] + + [% SET mb_type_hash = {} %] + [% FOR mb IN xact.billings %][%# Group billings by their btype %] + [% IF mb.voided == 'f' %] + [% SET mb_type = mb.btype.id %] + [% IF ! mb_type_hash.defined( mb_type ) %][% mb_type_hash.$mb_type = { 'sum' => 0.00, 'billings' => [] } %][% END %] + [% IF ! mb_type_hash.$mb_type.defined( 'first_ts' ) %][% mb_type_hash.$mb_type.first_ts = mb.billing_ts %][% END %] + [% mb_type_hash.$mb_type.last_ts = mb.billing_ts %] + [% mb_type_hash.$mb_type.sum = mb_type_hash.$mb_type.sum + mb.amount %] + + [% END %] + [% END %] + [% FOR mb_type IN mb_type_hash.keys.sort %] + [% IF mb_type == 1 %][%# Consolidated view of overdue billings %] + + [% ELSE %][%# all other billings show individually %] + [% FOR mb IN mb_type_hash.$mb_type.billings %] + + [% END %] + [% END %] + [% END %] + + + [% FOR mp IN xact_mp_hash.$xact_id.payments %] + [% SWITCH mp.payment_type -%] + [% CASE "cash_payment" %] + [% CASE "check_payment" %] + [% CASE "credit_payment" %] + [% CASE "forgive_payment" %] + [% CASE "goods_payment" %] + [% CASE "work_payment" %] + [% CASE "credit_card_payment"; + # cc_number may have been cleared + IF mp.credit_card_payment.cc_number; + SET cc_number = mp.credit_card_payment.cc_number; + END; + # all CC payments have an order number + SET cc_order_number = mp.credit_card_payment.cc_order_number; + END %] + [% END %] + [% END %] + + +[% IF cc_order_number %] + [% SET cc_number = 'XXXX' UNLESS cc_number %] + + +[% END %] +
Card Ending:[% cc_number %]
Transaction #:[% cc_order_number %]
+
+
Paid Charges
+
+
    + [% SET xact_mp_hash = {} %] + [% FOR mp IN target %][%# Template is hooked around payments, but let us make the receipt focused on transactions %] + [% SET xact_id = mp.xact.id %] + [% IF ! xact_mp_hash.defined( xact_id ) %][% xact_mp_hash.$xact_id = { 'xact' => mp.xact, 'payments' => [] } %][% END %] + [% xact_mp_hash.$xact_id.payments.push(mp) %] + [% END %] + [% FOR xact_id IN xact_mp_hash.keys.sort %] + [% SET xact = xact_mp_hash.$xact_id.xact %] +
  1. + + [% IF xact.circulation %][% helpers.get_copy_bib_basics(xact.circulation.target_copy.id).title %]
    Item Barcode: [% xact.circulation.target_copy.barcode %] + [% ELSE %]Miscellaneous + [% END %]
    +
    + +Charges: + + [% SET mb_type_hash = {} %] + [% FOR mb IN xact.billings %][%# Group billings by their btype %] + [% IF mb.voided == 'f' %] + [% SET mb_type = mb.btype.id %] + [% IF ! mb_type_hash.defined( mb_type ) %][% mb_type_hash.$mb_type = { 'sum' => 0.00, 'billings' => [] } %][% END %] + [% IF ! mb_type_hash.$mb_type.defined( 'first_ts' ) %][% mb_type_hash.$mb_type.first_ts = mb.billing_ts %][% END %] + [% mb_type_hash.$mb_type.last_ts = mb.billing_ts %] + [% mb_type_hash.$mb_type.sum = mb_type_hash.$mb_type.sum + mb.amount %] + [% mb_type_hash.$mb_type.billings.push( mb ) %] + + [% END %] + [% END %] + [% FOR mb_type IN mb_type_hash.keys.sort %] + + [% IF mb_type == 1 %][%# Consolidated view of overdue billings %] + $[% money(mb_type_hash.$mb_type.sum) %] for [% mb_type_hash.$mb_type.billings.0.btype.name %] + on [% mkdate(mb_type_hash.$mb_type.first_ts) %] through [% mkdate(mb_type_hash.$mb_type.last_ts) %] + [% ELSE %][%# all other billings show individually %] + [% FOR mb IN mb_type_hash.$mb_type.billings %] + $[% money(mb.amount) %] for "[% mb.btype.name %]" on [% mkdate(mb.billing_ts) %] + [% IF mb.note %]([% mb.note %])[% END %] + + [% END %] + [% END %] + [% END %] +
    +Payments: + + [% FOR mp IN xact_mp_hash.$xact_id.payments %] + $[% money(mp.amount) %] paid by [% SWITCH mp.payment_type -%] + [% CASE "cash_payment" %]Cash + [% CASE "check_payment" %]Check + [% CASE "credit_card_payment" %]Credit Card + [% CASE "credit_payment" %]Credit + [% CASE "forgive_payment" %]Forgiveness + [% CASE "goods_payment" %]Goods + [% CASE "work_payment" %]Work + [%- END %] on [% mkdate(mp.payment_ts) %]
    + + + [% END %] + +
    + [% END %] +
+
+
+If the items listed on this receipt are returned within 12 months of the receipt date, you may request a refund within 12 months of the receipt date for the cost of the item minus any outstanding charges on your account. The usual overdue fee will still be in effect for the returned item. You may choose to pay this overdue fee at the time you request a refund or have the overdue fee deducted from the amount of the refund. Patrons requesting a refund must present this receipt at any KCLS location.
+Refunds are not available for parts and pieces, overdue fines, or items that do not display a specific title in My Account. For a list of refundable and nonrefundable items, visit http://www.kcls.org/usingthelibrary/borrowing/
+**END OF RECEIPT** +
+
+

+$$ +WHERE id = 30; + + + +COMMIT; diff --git a/KCLS/sql/schema/revert/drop-cc-cols.sql b/KCLS/sql/schema/revert/drop-cc-cols.sql new file mode 100644 index 0000000000..b3344141c5 --- /dev/null +++ b/KCLS/sql/schema/revert/drop-cc-cols.sql @@ -0,0 +1,222 @@ +-- Revert kcls-evergreen:drop-cc-cols from pg + +BEGIN; + +ALTER TABLE money.credit_card_payment + ADD COLUMN cc_type TEXT, + ADD COLUMN expire_month INT, + ADD COLUMN expire_year INT, + ADD COLUMN cc_first_name TEXT, + ADD COLUMN cc_last_name TEXT; + +UPDATE action_trigger.event_definition SET template = +$$ +[%- USE date -%] +[%- SET user = target.xact.usr -%][% USE money=format('%.2f') -%] +To: [%- params.recipient_email || user.email %] +From: [%- params.sender_email || default_sender %] +Subject: KCLS Payment Receipt + +[% MACRO mkdate(ts) GET date.format(helpers.format_date(ts), '%m/%d/%Y') %][% date.format(date.now, '%m/%d/%Y') %] + +Please print ALL PAGES of this receipt for your records. +If you are paying for a lost item, and you return the item within 12 months of this date, +this receipt will be REQUIRED to request a refund. + +Billing Info +[% SET xact_mp_hash = {} %][% FOR mp IN target %][%# Template is hooked around payments, but let us make the receipt focused on transactions %][% SET xact_id = mp.xact.id %][% IF ! xact_mp_hash.defined( xact_id ) %][% xact_mp_hash.$xact_id = { 'xact' => mp.xact, 'payments' => [] } %][% END %][% xact_mp_hash.$xact_id.payments.push(mp) %][% END %][% FOR xact_id IN xact_mp_hash.keys.sort %][% SET xact = xact_mp_hash.$xact_id.xact %][% SET mb_type_hash = {} %][% FOR mb IN xact.billings %][%# Group billings by their btype %][% IF mb.voided == 'f' %][% SET mb_type = mb.btype.id %][% IF ! mb_type_hash.defined( mb_type ) %][% mb_type_hash.$mb_type = { 'sum' => 0.00, 'billings' => [] } %][% END %][% IF ! mb_type_hash.$mb_type.defined( 'first_ts' ) %][% mb_type_hash.$mb_type.first_ts = mb.billing_ts %][% END %][% mb_type_hash.$mb_type.last_ts = mb.billing_ts %][% mb_type_hash.$mb_type.sum = mb_type_hash.$mb_type.sum + mb.amount %] [% END %][% END %][% FOR mb_type IN mb_type_hash.keys.sort %][% IF mb_type == 1 %][%# Consolidated view of overdue billings %][% ELSE %][%# all other billings show individually %][% FOR mb IN mb_type_hash.$mb_type.billings %][% END %][% END %][% END %][% FOR mp IN xact_mp_hash.$xact_id.payments %][% SWITCH mp.payment_type -%][% CASE "cash_payment" %][% CASE "check_payment" %][% CASE "credit_card_payment" %][% CASE "credit_payment" %][% CASE "forgive_payment" %][% CASE "goods_payment" %][% CASE "work_payment" %][%- END %][% IF mp.payment_type == 'credit_card_payment' %][% SET cc_print1 = mp.credit_card_payment.cc_number.replace(' ','').chunk(-4).last %][% SET cc_print2 = mp.credit_card_payment.cc_first_name %] [% SET cc_print3 = mp.credit_card_payment.cc_last_name %][% SET cc_print4 = mp.credit_card_payment.expire_month %][% SET cc_print5 = mp.credit_card_payment.expire_year -%][% IF mp.credit_card_payment.cc_order_number %][% SET cc_print6 = mp.credit_card_payment.cc_order_number %][% END %][% END %][% END %][% END %] +Card Ending:[% cc_print1 %] +Name:[% cc_print2 %] [% cc_print3 %] +Exp:[% cc_print4 %]/[% cc_print5 %] +Transaction #:[% cc_print6 %] + +Paid Charges + +[% SET xact_mp_hash = {} %][% FOR mp IN target %][%# Template is hooked around payments, but let us make the receipt focused on transactions %][% SET xact_id = mp.xact.id %][% IF ! xact_mp_hash.defined( xact_id ) %][% xact_mp_hash.$xact_id = { 'xact' => mp.xact, 'payments' => [] } %][% END %][% xact_mp_hash.$xact_id.payments.push(mp) %][% END %][% FOR xact_id IN xact_mp_hash.keys.sort %][% SET xact = xact_mp_hash.$xact_id.xact %] +[% IF xact.circulation %]Title: [% helpers.get_copy_bib_basics(xact.circulation.target_copy.id).title %] -- Item Barcode: [% xact.circulation.target_copy.barcode %][% ELSE %]Type: Miscellaneous[% END %] +Charges: [% SET mb_type_hash = {} %][% FOR mb IN xact.billings %][%# Group billings by their btype %][% IF mb.voided == 'f' %][% SET mb_type = mb.btype.id %][% IF ! mb_type_hash.defined( mb_type ) %][% mb_type_hash.$mb_type = { 'sum' => 0.00, 'billings' => [] } %][% END %][% IF ! mb_type_hash.$mb_type.defined( 'first_ts' ) %][% mb_type_hash.$mb_type.first_ts = mb.billing_ts %][% END %][% mb_type_hash.$mb_type.last_ts = mb.billing_ts %][% mb_type_hash.$mb_type.sum = mb_type_hash.$mb_type.sum + mb.amount %][% mb_type_hash.$mb_type.billings.push( mb ) %][% END %][% END %][% FOR mb_type IN mb_type_hash.keys.sort %][% IF mb_type == 1 %][%# Consolidated view of overdue billings %]$[% money(mb_type_hash.$mb_type.sum) %] for [% mb_type_hash.$mb_type.billings.0.btype.name %] on [% mkdate(mb_type_hash.$mb_type.first_ts) %] through [% mkdate(mb_type_hash.$mb_type.last_ts) %][% ELSE %][%# all other billings show individually %][% FOR mb IN mb_type_hash.$mb_type.billings %]$[% money(mb.amount) %] for "[% mb.btype.name %]" on [% mkdate(mb.billing_ts) %][% IF mb.note %]([% mb.note %])[% END %][% END %][% END %][% END %] +Payments:[% FOR mp IN xact_mp_hash.$xact_id.payments %]$[% money(mp.amount) %] paid by [% SWITCH mp.payment_type -%][% CASE "cash_payment" %]Cash[% CASE "check_payment" %]Check[% CASE "credit_card_payment" %]Credit Card[% CASE "credit_payment" %]Credit[% CASE "forgive_payment" %]Forgiveness[% CASE "goods_payment" %]Goods[% CASE "work_payment" %]Work[%- END %] on [% mkdate(mp.payment_ts) %] +[% END %][% END %] + +If the items listed on this receipt are returned within 12 months of the receipt date, you may request a refund within 12 months of the receipt date for the cost of the item minus any outstanding charges on your account. The usual overdue fee will still be in effect for the returned item. You may choose to pay this overdue fee at the time you request a refund or have the overdue fee deducted from the amount of the refund. Patrons requesting a refund must present this receipt at any KCLS location. + +Refunds are not available for parts and pieces, overdue fines, or items that do not display a specific title in My Account. For a list of refundable and nonrefundable items, visit http://www.kcls.org/usingthelibrary/borrowing/ + +**END OF RECEIPT** +$$ +WHERE id = 29; + + + +UPDATE action_trigger.event_definition SET template = +$$ +[%- USE date -%][%- SET user = target.0.xact.usr -%] +[% USE money=format('%.2f') -%] +[% MACRO mkdate(ts) GET date.format(helpers.format_date(ts), '%m/%d/%Y') %] + + + +
+
[% date.format(date.now, '%m/%d/%Y') %]

+
+Please print ALL PAGES of this receipt for your records.
If you are paying for a lost item, and you return the item within 12 months of this date, +this receipt will be REQUIRED to request a refund.
+ + +
+
+
+Billing Info +[% SET xact_mp_hash = {} %] + [% FOR mp IN target %][%# Template is hooked around payments, but let us make the receipt focused on transactions %] + [% SET xact_id = mp.xact.id %] + [% IF ! xact_mp_hash.defined( xact_id ) %][% xact_mp_hash.$xact_id = { 'xact' => mp.xact, 'payments' => [] } %][% END %] + [% xact_mp_hash.$xact_id.payments.push(mp) %] + [% END %] + [% FOR xact_id IN xact_mp_hash.keys.sort %] + [% SET xact = xact_mp_hash.$xact_id.xact %] + + + + + + [% SET mb_type_hash = {} %] + [% FOR mb IN xact.billings %][%# Group billings by their btype %] + [% IF mb.voided == 'f' %] + [% SET mb_type = mb.btype.id %] + [% IF ! mb_type_hash.defined( mb_type ) %][% mb_type_hash.$mb_type = { 'sum' => 0.00, 'billings' => [] } %][% END %] + [% IF ! mb_type_hash.$mb_type.defined( 'first_ts' ) %][% mb_type_hash.$mb_type.first_ts = mb.billing_ts %][% END %] + [% mb_type_hash.$mb_type.last_ts = mb.billing_ts %] + [% mb_type_hash.$mb_type.sum = mb_type_hash.$mb_type.sum + mb.amount %] + + [% END %] + [% END %] + [% FOR mb_type IN mb_type_hash.keys.sort %] + [% IF mb_type == 1 %][%# Consolidated view of overdue billings %] + + [% ELSE %][%# all other billings show individually %] + [% FOR mb IN mb_type_hash.$mb_type.billings %] + + [% END %] + [% END %] + [% END %] + + + [% FOR mp IN xact_mp_hash.$xact_id.payments %] + [% SWITCH mp.payment_type -%] + [% CASE "cash_payment" %] + [% CASE "check_payment" %] + [% CASE "credit_card_payment" %] + [% CASE "credit_payment" %] + [% CASE "forgive_payment" %] + [% CASE "goods_payment" %] + [% CASE "work_payment" %] + [%- END %] + [% IF mp.payment_type == 'credit_card_payment' %] + + [% SET cc_print1 = mp.credit_card_payment.cc_number.replace(' ','').chunk(-4).last %] + [% SET cc_print2 = mp.credit_card_payment.cc_first_name %] [% SET cc_print3 = mp.credit_card_payment.cc_last_name %] + [% SET cc_print4 = mp.credit_card_payment.expire_month %][% SET cc_print5 = mp.credit_card_payment.expire_year -%] + [% IF mp.credit_card_payment.cc_order_number %] + [% SET cc_print6 = mp.credit_card_payment.cc_order_number %] + [% END %] + + [% END %] + + [% END %] + + [% END %] + + + + + + +
Card Ending:[% cc_print1 %]
Name:[% cc_print2 %] [% cc_print3 %]
Exp:[% cc_print4 %]/[% cc_print5 %]
Transaction #:[% cc_print6 %]
+
+
Paid Charges
+
+
    + [% SET xact_mp_hash = {} %] + [% FOR mp IN target %][%# Template is hooked around payments, but let us make the receipt focused on transactions %] + [% SET xact_id = mp.xact.id %] + [% IF ! xact_mp_hash.defined( xact_id ) %][% xact_mp_hash.$xact_id = { 'xact' => mp.xact, 'payments' => [] } %][% END %] + [% xact_mp_hash.$xact_id.payments.push(mp) %] + [% END %] + [% FOR xact_id IN xact_mp_hash.keys.sort %] + [% SET xact = xact_mp_hash.$xact_id.xact %] +
  1. + + [% IF xact.circulation %][% helpers.get_copy_bib_basics(xact.circulation.target_copy.id).title %]
    Item Barcode: [% xact.circulation.target_copy.barcode %] + [% ELSE %]Miscellaneous + [% END %]
    +
    + +Charges: + + [% SET mb_type_hash = {} %] + [% FOR mb IN xact.billings %][%# Group billings by their btype %] + [% IF mb.voided == 'f' %] + [% SET mb_type = mb.btype.id %] + [% IF ! mb_type_hash.defined( mb_type ) %][% mb_type_hash.$mb_type = { 'sum' => 0.00, 'billings' => [] } %][% END %] + [% IF ! mb_type_hash.$mb_type.defined( 'first_ts' ) %][% mb_type_hash.$mb_type.first_ts = mb.billing_ts %][% END %] + [% mb_type_hash.$mb_type.last_ts = mb.billing_ts %] + [% mb_type_hash.$mb_type.sum = mb_type_hash.$mb_type.sum + mb.amount %] + [% mb_type_hash.$mb_type.billings.push( mb ) %] + + [% END %] + [% END %] + [% FOR mb_type IN mb_type_hash.keys.sort %] + + [% IF mb_type == 1 %][%# Consolidated view of overdue billings %] + $[% money(mb_type_hash.$mb_type.sum) %] for [% mb_type_hash.$mb_type.billings.0.btype.name %] + on [% mkdate(mb_type_hash.$mb_type.first_ts) %] through [% mkdate(mb_type_hash.$mb_type.last_ts) %] + [% ELSE %][%# all other billings show individually %] + [% FOR mb IN mb_type_hash.$mb_type.billings %] + $[% money(mb.amount) %] for "[% mb.btype.name %]" on [% mkdate(mb.billing_ts) %] + [% IF mb.note %]([% mb.note %])[% END %] + + [% END %] + [% END %] + [% END %] +
    +Payments: + + [% FOR mp IN xact_mp_hash.$xact_id.payments %] + $[% money(mp.amount) %] paid by [% SWITCH mp.payment_type -%] + [% CASE "cash_payment" %]Cash + [% CASE "check_payment" %]Check + [% CASE "credit_card_payment" %]Credit Card + [% CASE "credit_payment" %]Credit + [% CASE "forgive_payment" %]Forgiveness + [% CASE "goods_payment" %]Goods + [% CASE "work_payment" %]Work + [%- END %] on [% mkdate(mp.payment_ts) %]
    + + + [% END %] + +
    + [% END %] +
+
+
+If the items listed on this receipt are returned within 12 months of the receipt date, you may request a refund within 12 months of the receipt date for the cost of the item minus any outstanding charges on your account. The usual overdue fee will still be in effect for the returned item. You may choose to pay this overdue fee at the time you request a refund or have the overdue fee deducted from the amount of the refund. Patrons requesting a refund must present this receipt at any KCLS location.
+Refunds are not available for parts and pieces, overdue fines, or items that do not display a specific title in My Account. For a list of refundable and nonrefundable items, visit http://www.kcls.org/usingthelibrary/borrowing/
+**END OF RECEIPT** +
+
+

+$$ +WHERE id = 30; + + + + + +COMMIT; diff --git a/KCLS/sql/schema/sqitch.plan b/KCLS/sql/schema/sqitch.plan index 765dcfe49c..0013d982e4 100644 --- a/KCLS/sql/schema/sqitch.plan +++ b/KCLS/sql/schema/sqitch.plan @@ -23,3 +23,4 @@ patron-self-reg-mods [blanket-po-print-template] 2016-01-13T20:14:00Z Bill Erick sip-activity-types [2.7-auth-reingest] 2016-03-15T21:30:39Z Bill Erickson # User activity types for hoopla/lynda SIP auth ingram-edi-mods [sip-activity-types] 2016-05-24T16:31:46Z Bill Erickson # Ingram EDI config updates org-unit-addrs-copy [sip-activity-types] 2016-05-03T14:17:59Z Bill Erickson # Give each org unit its own mailing address +drop-cc-cols [sip-activity-types] 2016-05-03T15:26:50Z Bill Erickson # Drop unneeded CC payment columns diff --git a/KCLS/sql/schema/verify/drop-cc-cols.sql b/KCLS/sql/schema/verify/drop-cc-cols.sql new file mode 100644 index 0000000000..f28328420d --- /dev/null +++ b/KCLS/sql/schema/verify/drop-cc-cols.sql @@ -0,0 +1,7 @@ +-- Verify kcls-evergreen:drop-cc-cols on pg + +BEGIN; + +-- XXX Add verifications here. + +ROLLBACK; -- 2.11.0