[open-ils-commits] [GIT] Evergreen ILS branch master updated. 975ef969e7236ef05f642e6f88159d6668712410

Evergreen Git git at git.evergreen-ils.org
Wed Feb 26 16:25:42 EST 2020


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".

The branch, master has been updated
       via  975ef969e7236ef05f642e6f88159d6668712410 (commit)
       via  3d7a7c1c789e7c2facf9801fabf3448ae0f5d490 (commit)
      from  65ebd4874f971c52e10b48786b01f7c68c98df76 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 975ef969e7236ef05f642e6f88159d6668712410
Author: Chris Sharp <csharp at georgialibraries.org>
Date:   Wed Feb 26 16:24:54 2020 -0500

    LP#1811132 - Stamping upgrade script
    
    Signed-off-by: Chris Sharp <csharp at georgialibraries.org>

diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql
index 86b2d68676..f3e6244165 100644
--- a/Open-ILS/src/sql/Pg/002.schema.config.sql
+++ b/Open-ILS/src/sql/Pg/002.schema.config.sql
@@ -92,7 +92,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 ('1199', :eg_version); -- Bmagic/csharp
+INSERT INTO config.upgrade_log (version, applied_to) VALUES ('1200', :eg_version); -- jeffdavis/csharp
 
 CREATE TABLE config.bib_source (
 	id		SERIAL	PRIMARY KEY,
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.debit_card_payment.sql b/Open-ILS/src/sql/Pg/upgrade/1200.schema.debit_card_payment.sql
similarity index 99%
rename from Open-ILS/src/sql/Pg/upgrade/XXXX.schema.debit_card_payment.sql
rename to Open-ILS/src/sql/Pg/upgrade/1200.schema.debit_card_payment.sql
index 01a3d3f1e2..88ad356037 100644
--- a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.debit_card_payment.sql
+++ b/Open-ILS/src/sql/Pg/upgrade/1200.schema.debit_card_payment.sql
@@ -1,6 +1,6 @@
 BEGIN;
 
-SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
+SELECT evergreen.upgrade_deps_block_check('1200', :eg_version);
 
 CREATE TABLE money.debit_card_payment () INHERITS (money.bnm_desk_payment);
 ALTER TABLE money.debit_card_payment ADD PRIMARY KEY (id);

commit 3d7a7c1c789e7c2facf9801fabf3448ae0f5d490
Author: Jeff Davis <jeff.davis at bc.libraries.coop>
Date:   Fri Mar 8 14:12:04 2019 -0800

    LP#1811132: add Debit Card payment type
    
    Signed-off-by: Jeff Davis <jeff.davis at bc.libraries.coop>
    Signed-off-by: Ruth Frasur <rfrasur at gmail.com>
    Signed-off-by: Chris Sharp <csharp at georgialibraries.org>

diff --git a/Open-ILS/examples/fm_IDL.xml b/Open-ILS/examples/fm_IDL.xml
index aefd66e7fc..7622efd0db 100644
--- a/Open-ILS/examples/fm_IDL.xml
+++ b/Open-ILS/examples/fm_IDL.xml
@@ -94,6 +94,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
 			<field name="cash_payment" oils_persist:virtual="true" />
 			<field name="check_payment" oils_persist:virtual="true" />
 			<field name="credit_card_payment" oils_persist:virtual="true" />
+			<field name="debit_card_payment" oils_persist:virtual="true" />
 		</fields>
 		<links>
 			<link field="workstation" reltype="has_a" key="id" map="" class="aws"/>
@@ -7462,6 +7463,33 @@ SELECT  usr,
 			</actions>
 		</permacrud>
 	</class>
+	<class id="mdcp" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="money::debit_card_payment" oils_persist:tablename="money.debit_card_payment" reporter:label="Debit Card Payment">
+		<fields oils_persist:primary="id" oils_persist:sequence="money.payment_id_seq">
+			<field reporter:label="Accepting Staff Member" name="accepting_usr" reporter:datatype="link"/>
+			<field reporter:label="Amount" name="amount" reporter:datatype="money" />
+			<field reporter:label="Amount Collected" name="amount_collected" reporter:datatype="money" />
+			<field reporter:label="Workstation link" name="cash_drawer" reporter:datatype="link"/>
+			<field reporter:label="Payment ID" name="id" reporter:datatype="id" />
+			<field reporter:label="Note" name="note" reporter:datatype="text"/>
+			<field reporter:label="Payment Timestamp" name="payment_ts" reporter:datatype="timestamp"/>
+			<field reporter:label="Transaction link" name="xact" reporter:datatype="link"/>
+			<field reporter:label="Payment link" name="payment" oils_persist:virtual="true" reporter:datatype="link"/>
+			<field reporter:label="Payment Type" name="payment_type" oils_persist:virtual="true" reporter:datatype="text"/>
+		</fields>
+		<links>
+			<link field="payment" reltype="might_have" key="id" map="" class="mp"/>
+			<link field="accepting_usr" reltype="has_a" key="id" map="" class="au"/>
+			<link field="cash_drawer" reltype="has_a" key="id" map="" class="aws"/>
+			<link field="xact" reltype="has_a" key="id" map="" class="mbt"/>
+		</links>
+        <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
+            <actions>
+                <retrieve permission="VIEW_USER_TRANSACTIONS">
+                    <context link="xact" jump="usr" field="home_ou"/>
+                </retrieve>
+			</actions>
+		</permacrud>
+	</class>
 	<class id="acp" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="asset::copy" oils_persist:tablename="asset.copy" reporter:core="true" reporter:label="Item">
 		<fields oils_persist:primary="id" oils_persist:sequence="asset.copy_id_seq">
 			<field reporter:label="Age Hold Protection" name="age_protect" reporter:datatype="link"/>
@@ -8054,6 +8082,7 @@ SELECT  usr,
 			<field reporter:label="Forgive Payment Detail" name="forgive_payment" oils_persist:virtual="true" reporter:datatype="link"/>
 			<field reporter:label="Goods Payment Detail" name="goods_payment" oils_persist:virtual="true" reporter:datatype="link"/>
 			<field reporter:label="Account Adjustment Detail" name="account_adjustment" oils_persist:virtual="true" reporter:datatype="link"/>
+			<field reporter:label="Debit Card Payment Detail" name="debit_card_payment" oils_persist:virtual="true" reporter:datatype="link"/>
 		</fields>
 		<links>
 			<link field="cash_payment" reltype="might_have" key="id" map="" class="mcp"/>
@@ -8065,6 +8094,7 @@ SELECT  usr,
 			<link field="goods_payment" reltype="might_have" key="id" map="" class="mgp"/>
 			<link field="account_adjustment" reltype="might_have" key="id" map="" class="maa"/>
 			<link field="xact" reltype="has_a" key="id" map="" class="mbt"/>
+			<link field="debit_card_payment" reltype="might_have" key="id" map="" class="mdcp"/>
 		</links>
         <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
             <actions>
@@ -8136,6 +8166,7 @@ SELECT  usr,
 			<field reporter:label="Forgive Payment Detail" name="forgive_payment" oils_persist:virtual="true" reporter:datatype="link"/>
 			<field reporter:label="Goods Payment Detail" name="goods_payment" oils_persist:virtual="true" reporter:datatype="link"/>
 			<field reporter:label="Account Adjustment Detail" name="account_adjustment" oils_persist:virtual="true" reporter:datatype="link"/>
+			<field reporter:label="Debit Card Payment Detail" name="debit_card_payment" oils_persist:virtual="true" reporter:datatype="link"/>
 		</fields>
 		<links>
 			<link field="cash_payment" reltype="might_have" key="id" map="" class="mcp"/>
@@ -8148,6 +8179,7 @@ SELECT  usr,
 			<link field="account_adjustment" reltype="might_have" key="id" map="" class="maa"/>
 			<link field="xact" reltype="has_a" key="id" map="" class="mbt"/>
 			<link field="accepting_usr" reltype="has_a" key="id" map="" class="au"/>
+			<link field="debit_card_payment" reltype="might_have" key="id" map="" class="mdcp"/>
 		</links>
 		<permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
 			<actions>
@@ -8195,6 +8227,7 @@ SELECT  usr,
 			<field reporter:label="Cash Payment" name="cash_payment" oils_persist:virtual="true" reporter:datatype="link"/>
 			<field reporter:label="Credit Card Payment" name="credit_card_payment" oils_persist:virtual="true" reporter:datatype="link"/>
 			<field reporter:label="Check Payment" name="check_payment" oils_persist:virtual="true" reporter:datatype="link"/>
+			<field reporter:label="Debit Card Payment" name="debit_card_payment" oils_persist:virtual="true" reporter:datatype="link"/>
 		</fields>
 		<links>
 			<link field="cash_payment" reltype="might_have" key="id" map="" class="mcp"/>
@@ -8203,6 +8236,7 @@ SELECT  usr,
 			<link field="xact" reltype="has_a" key="id" map="" class="mbt"/>
 			<link field="accepting_usr" reltype="has_a" key="id" map="" class="au"/>
 			<link field="cash_drawer" reltype="has_a" key="id" map="" class="aws"/>
+			<link field="debit_card_payment" reltype="might_have" key="id" map="" class="mdcp"/>
 		</links>
 	</class>
 	<class id="cbrebi" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="container::biblio_record_entry_bucket_item" oils_persist:tablename="container.biblio_record_entry_bucket_item" reporter:label="Biblio Record Entry Bucket Item">
diff --git a/Open-ILS/src/extras/ils_events.xml b/Open-ILS/src/extras/ils_events.xml
index 7caebc720c..cc0d3f846b 100644
--- a/Open-ILS/src/extras/ils_events.xml
+++ b/Open-ILS/src/extras/ils_events.xml
@@ -762,6 +762,9 @@
 	<event code='1715' textcode='HOLD_SUSPEND_AFTER_CAPTURE'>
 		<desc xml:lang="en-US">Attempt to suspend a hold after it has been captured.</desc>
 	</event>
+	<event code='1716' textcode='MONEY_DEBIT_CARD_PAYMENT_NOT_FOUND'>
+		<desc xml:lang='en-US'>The requested money_debit_card_payment was not found</desc>
+	</event>
 
 	<event code='1900' textcode='URL_VERIFY_NOT_SESSION_CREATOR'>
 		<desc xml:lang="en-US">You did not create this URL Verify session, so you cannot change it.  You may be able to clone it.</desc>
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ.pm
index 3c40e2dabc..af9c9af9ab 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ.pm
@@ -1938,6 +1938,7 @@ sub user_payments_list {
                         'xact',
                         'cash_payment',
                         'credit_card_payment',
+                        'debit_card_payment',
                         'credit_payment',
                         'check_payment',
                         'work_payment',
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/CDBI.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/CDBI.pm
index ac5779494d..599764ff3e 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/CDBI.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/CDBI.pm
@@ -716,6 +716,7 @@ sub modify_from_fieldmapper {
     #money::payment->might_have( cash_payment => 'money::cash_payment' );
     #money::payment->might_have( check_payment => 'money::check_payment' );
     #money::payment->might_have( credit_card_payment => 'money::credit_card_payment' );
+    #money::payment->might_have( debit_card_payment => 'money::debit_card_payment' );
     #money::payment->might_have( forgive_payment => 'money::forgive_payment' );
     #money::payment->might_have( work_payment => 'money::work_payment' );
     #money::payment->might_have( credit_payment => 'money::credit_payment' );
@@ -732,6 +733,10 @@ sub modify_from_fieldmapper {
     money::credit_card_payment->has_a( accepting_usr => 'actor::user' );
     #money::credit_card_payment->might_have( payment => 'money::payment' );
 
+    money::debit_card_payment->has_a( xact => 'money::billable_transaction' );
+    money::debit_card_payment->has_a( accepting_usr => 'actor::user' );
+    #money::debit_card_payment->might_have( payment => 'money::payment' );
+
     money::forgive_payment->has_a( xact => 'money::billable_transaction' );
     money::forgive_payment->has_a( accepting_usr => 'actor::user' );
     #money::forgive_payment->might_have( payment => 'money::payment' );
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/CDBI/money.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/CDBI/money.pm
index c9d7247ae1..931b1b854f 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/CDBI/money.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/CDBI/money.pm
@@ -120,6 +120,13 @@ __PACKAGE__->columns(Essential => qw/xact amount payment_ts cash_drawer
                      approval_code note voided cc_number/);
 #-------------------------------------------------------------------------------
 
+package money::debit_card_payment;
+use base qw/money/;
+__PACKAGE__->table('money_debit_card_payment');
+__PACKAGE__->columns(Primary => 'id');
+__PACKAGE__->columns(Essential => qw/xact amount payment_ts cash_drawer accepting_usr amount_collected note/);
+#-------------------------------------------------------------------------------
+
 package money::forgive_payment;
 use base qw/money/;
 __PACKAGE__->table('money_forgive_payment');
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/dbi.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/dbi.pm
index f680b1c9d1..196c46cfdd 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/dbi.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/dbi.pm
@@ -131,6 +131,12 @@
     money::credit_card_payment->sequence( 'money.payment_id_seq' );
 
     #---------------------------------------------------------------------
+    package money::debit_card_payment;
+    
+    money::debit_card_payment->table( 'money.debit_card_payment' );
+    money::debit_card_payment->sequence( 'money.payment_id_seq' );
+
+    #---------------------------------------------------------------------
     package money::work_payment;
     
     money::work_payment->table( 'money.work_payment' );
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/money.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/money.pm
index d2db7ae8ad..e2ffb49748 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/money.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/money.pm
@@ -422,7 +422,8 @@ sub ou_desk_payments {
     SELECT  ws.id as workstation,
         SUM( CASE WHEN p.payment_type = 'cash_payment' THEN p.amount ELSE 0.0 END ) as cash_payment,
         SUM( CASE WHEN p.payment_type = 'check_payment' THEN p.amount ELSE 0.0 END ) as check_payment,
-        SUM( CASE WHEN p.payment_type = 'credit_card_payment' THEN p.amount ELSE 0.0 END ) as credit_card_payment
+        SUM( CASE WHEN p.payment_type = 'credit_card_payment' THEN p.amount ELSE 0.0 END ) as credit_card_payment,
+        SUM( CASE WHEN p.payment_type = 'debit_card_payment' THEN p.amount ELSE 0.0 END ) as debit_card_payment
       FROM  money.desk_payment_view p
         JOIN actor.workstation ws ON (ws.id = p.cash_drawer)
       WHERE p.payment_ts >= '$startdate'
@@ -442,6 +443,7 @@ sub ou_desk_payments {
         $x->cash_payment($$r[1]);
         $x->check_payment($$r[2]);
         $x->credit_card_payment($$r[3]);
+        $x->debit_card_payment($$r[4]);
 
         $client->respond($x);
     }
diff --git a/Open-ILS/src/sql/Pg/080.schema.money.sql b/Open-ILS/src/sql/Pg/080.schema.money.sql
index 7d30797b1e..88a724bdf0 100644
--- a/Open-ILS/src/sql/Pg/080.schema.money.sql
+++ b/Open-ILS/src/sql/Pg/080.schema.money.sql
@@ -668,11 +668,24 @@ CREATE TRIGGER mat_summary_upd_tgr AFTER UPDATE ON money.credit_card_payment FOR
 CREATE TRIGGER mat_summary_del_tgr BEFORE DELETE ON money.credit_card_payment FOR EACH ROW EXECUTE PROCEDURE money.materialized_summary_payment_del ('credit_card_payment');
 
 
+CREATE TABLE money.debit_card_payment () INHERITS (money.bnm_desk_payment);
+ALTER TABLE money.debit_card_payment ADD PRIMARY KEY (id);
+CREATE INDEX money_debit_card_payment_xact_idx ON money.debit_card_payment (xact);
+CREATE INDEX money_debit_card_id_idx ON money.debit_card_payment (id);
+CREATE INDEX money_debit_card_payment_ts_idx ON money.debit_card_payment (payment_ts);
+CREATE INDEX money_debit_card_payment_accepting_usr_idx ON money.debit_card_payment (accepting_usr);
+CREATE INDEX money_debit_card_payment_cash_drawer_idx ON money.debit_card_payment (cash_drawer);
+
+CREATE TRIGGER mat_summary_add_tgr AFTER INSERT ON money.debit_card_payment FOR EACH ROW EXECUTE PROCEDURE money.materialized_summary_payment_add ('debit_card_payment');
+CREATE TRIGGER mat_summary_upd_tgr AFTER UPDATE ON money.debit_card_payment FOR EACH ROW EXECUTE PROCEDURE money.materialized_summary_payment_update ('debit_card_payment');
+CREATE TRIGGER mat_summary_del_tgr BEFORE DELETE ON money.debit_card_payment FOR EACH ROW EXECUTE PROCEDURE money.materialized_summary_payment_del ('debit_card_payment');
+
+
 CREATE OR REPLACE VIEW money.non_drawer_payment_view AS
 	SELECT	p.*, c.relname AS payment_type
 	  FROM	money.bnm_payment p         
 			JOIN pg_class c ON p.tableoid = c.oid
-	  WHERE	c.relname NOT IN ('cash_payment','check_payment','credit_card_payment');
+	  WHERE	c.relname NOT IN ('cash_payment','check_payment','credit_card_payment','debit_card_payment');
 
 CREATE OR REPLACE VIEW money.cashdrawer_payment_view AS
 	SELECT	ou.id AS org_unit,
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 ee5b465e02..e7e1a377fe 100644
--- a/Open-ILS/src/sql/Pg/950.data.seed-values.sql
+++ b/Open-ILS/src/sql/Pg/950.data.seed-values.sql
@@ -11788,6 +11788,7 @@ Transaction ID: [% xact_id %]
                     [% CASE "check_payment" %]check
                     [% CASE "credit_card_payment" %]credit card
                     [%- IF mp.credit_card_payment.cc_number %] ([% mp.credit_card_payment.cc_number %])[% END %]
+                    [% CASE "debit_card_payment" %]debit card
                     [% CASE "credit_payment" %]credit
                     [% CASE "forgive_payment" %]forgiveness
                     [% CASE "goods_payment" %]goods
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.debit_card_payment.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.debit_card_payment.sql
new file mode 100644
index 0000000000..01a3d3f1e2
--- /dev/null
+++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.debit_card_payment.sql
@@ -0,0 +1,147 @@
+BEGIN;
+
+SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
+
+CREATE TABLE money.debit_card_payment () INHERITS (money.bnm_desk_payment);
+ALTER TABLE money.debit_card_payment ADD PRIMARY KEY (id);
+CREATE INDEX money_debit_card_payment_xact_idx ON money.debit_card_payment (xact);
+CREATE INDEX money_debit_card_id_idx ON money.debit_card_payment (id);
+CREATE INDEX money_debit_card_payment_ts_idx ON money.debit_card_payment (payment_ts);
+CREATE INDEX money_debit_card_payment_accepting_usr_idx ON money.debit_card_payment (accepting_usr);
+CREATE INDEX money_debit_card_payment_cash_drawer_idx ON money.debit_card_payment (cash_drawer);
+
+CREATE TRIGGER mat_summary_add_tgr AFTER INSERT ON money.debit_card_payment FOR EACH ROW EXECUTE PROCEDURE money.materialized_summary_payment_add ('debit_card_payment');
+CREATE TRIGGER mat_summary_upd_tgr AFTER UPDATE ON money.debit_card_payment FOR EACH ROW EXECUTE PROCEDURE money.materialized_summary_payment_update ('debit_card_payment');
+CREATE TRIGGER mat_summary_del_tgr BEFORE DELETE ON money.debit_card_payment FOR EACH ROW EXECUTE PROCEDURE money.materialized_summary_payment_del ('debit_card_payment');
+ 
+CREATE OR REPLACE VIEW money.non_drawer_payment_view AS
+       SELECT  p.*, c.relname AS payment_type
+         FROM  money.bnm_payment p         
+                       JOIN pg_class c ON p.tableoid = c.oid
+         WHERE c.relname NOT IN ('cash_payment','check_payment','credit_card_payment');
+         WHERE c.relname NOT IN ('cash_payment','check_payment','credit_card_payment','debit_card_payment');
+
+UPDATE action_trigger.event_definition 
+    SET template = $$
+[%- USE date -%]
+[%- SET user = target.0.xact.usr -%]
+To: [%- params.recipient_email || user.email %]
+From: [%- params.sender_email || default_sender %]
+Date: [%- date.format(date.now, '%a, %d %b %Y %T -0000', gmt => 1) %]
+Subject: Payment Receipt
+Auto-Submitted: auto-generated
+
+[% date.format -%]
+[%- 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 %]
+Transaction ID: [% xact_id %]
+    [% IF xact.circulation %][% helpers.get_copy_bib_basics(xact.circulation.target_copy).title %]
+    [% ELSE %]Miscellaneous
+    [% END %]
+    Line item billings:
+        [%- 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 -%]
+                $[% mb_type_hash.$mb_type.sum %] for [% mb_type_hash.$mb_type.billings.0.btype.name %] 
+                    on [% mb_type_hash.$mb_type.first_ts %] through [% mb_type_hash.$mb_type.last_ts %]
+            [%- ELSE -%][%# all other billings show individually %]
+                [% FOR mb IN mb_type_hash.$mb_type.billings %]
+                    $[% mb.amount %] for [% mb.btype.name %] on [% mb.billing_ts %] [% mb.note %]
+                [% END %]
+            [% END %]
+        [% END %]
+    Line item payments:
+        [% FOR mp IN xact_mp_hash.$xact_id.payments %]
+            Payment ID: [% mp.id %]
+                Paid [% mp.amount %] via [% SWITCH mp.payment_type -%]
+                    [% CASE "cash_payment" %]cash
+                    [% CASE "check_payment" %]check
+                    [% CASE "credit_card_payment" %]credit card
+                    [%- IF mp.credit_card_payment.cc_number %] ([% mp.credit_card_payment.cc_number %])[% END %]
+                    [% CASE "debit_card_payment" %]debit card
+                    [% CASE "credit_payment" %]credit
+                    [% CASE "forgive_payment" %]forgiveness
+                    [% CASE "goods_payment" %]goods
+                    [% CASE "work_payment" %]work
+                [%- END %] on [% mp.payment_ts %] [% mp.note %]
+        [% END %]
+[% END %]
+$$
+WHERE id = 29 AND template = $$
+[%- USE date -%]
+[%- SET user = target.0.xact.usr -%]
+To: [%- params.recipient_email || user.email %]
+From: [%- params.sender_email || default_sender %]
+Date: [%- date.format(date.now, '%a, %d %b %Y %T -0000', gmt => 1) %]
+Subject: Payment Receipt
+Auto-Submitted: auto-generated
+
+[% date.format -%]
+[%- 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 %]
+Transaction ID: [% xact_id %]
+    [% IF xact.circulation %][% helpers.get_copy_bib_basics(xact.circulation.target_copy).title %]
+    [% ELSE %]Miscellaneous
+    [% END %]
+    Line item billings:
+        [%- 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 -%]
+                $[% mb_type_hash.$mb_type.sum %] for [% mb_type_hash.$mb_type.billings.0.btype.name %] 
+                    on [% mb_type_hash.$mb_type.first_ts %] through [% mb_type_hash.$mb_type.last_ts %]
+            [%- ELSE -%][%# all other billings show individually %]
+                [% FOR mb IN mb_type_hash.$mb_type.billings %]
+                    $[% mb.amount %] for [% mb.btype.name %] on [% mb.billing_ts %] [% mb.note %]
+                [% END %]
+            [% END %]
+        [% END %]
+    Line item payments:
+        [% FOR mp IN xact_mp_hash.$xact_id.payments %]
+            Payment ID: [% mp.id %]
+                Paid [% mp.amount %] via [% SWITCH mp.payment_type -%]
+                    [% CASE "cash_payment" %]cash
+                    [% CASE "check_payment" %]check
+                    [% CASE "credit_card_payment" %]credit card
+                    [%- IF mp.credit_card_payment.cc_number %] ([% mp.credit_card_payment.cc_number %])[% END %]
+                    [% CASE "credit_payment" %]credit
+                    [% CASE "forgive_payment" %]forgiveness
+                    [% CASE "goods_payment" %]goods
+                    [% CASE "work_payment" %]work
+                [%- END %] on [% mp.payment_ts %] [% mp.note %]
+        [% END %]
+[% END %]
+$$;
+COMMIT;
+
diff --git a/Open-ILS/src/templates/staff/base_js.tt2 b/Open-ILS/src/templates/staff/base_js.tt2
index 14d570af7d..53e6f5f9cd 100644
--- a/Open-ILS/src/templates/staff/base_js.tt2
+++ b/Open-ILS/src/templates/staff/base_js.tt2
@@ -122,6 +122,7 @@ UpUp.start({
     s.EG_WORK_LOG_CASH_PAYMENT = '[% l('Cash Payment') %]';
     s.EG_WORK_LOG_CHECK_PAYMENT = '[% l('Check Payment') %]';
     s.EG_WORK_LOG_CREDIT_CARD_PAYMENT = '[% l('Credit Card Payment') %]';
+    s.EG_WORK_LOG_DEBIT_CARD_PAYMENT = '[% l('Debit Card Payment') %]';
     s.EG_WORK_LOG_CREDIT_PAYMENT = '[% l('Credit Payment') %]';
     s.EG_WORK_LOG_WORK_PAYMENT = '[% l('Work Payment') %]';
     s.EG_WORK_LOG_FORGIVE_PAYMENT = '[% l('Forgive Payment') %]';
diff --git a/Open-ILS/src/templates/staff/circ/patron/t_bills.tt2 b/Open-ILS/src/templates/staff/circ/patron/t_bills.tt2
index b2d41ccbc5..7ceab6ccc9 100644
--- a/Open-ILS/src/templates/staff/circ/patron/t_bills.tt2
+++ b/Open-ILS/src/templates/staff/circ/patron/t_bills.tt2
@@ -51,6 +51,7 @@
               <option value="cash_payment" selected="selected">[% l('Cash') %]</option>
               <option value="check_payment">[% l('Check') %]</option>
               <option value="credit_card_payment">[% l('Credit Card') %]</option>
+              <option value="debit_card_payment">[% l('Debit Card') %]</option>
               <option value="credit_payment">[% l('Patron Credit') %]</option>
               <option value="work_payment">[% l('Work') %]</option>
               <option value="forgive_payment">[% l('Forgive') %]</option>
diff --git a/Open-ILS/src/templates/staff/share/print_templates/t_bill_payment.tt2 b/Open-ILS/src/templates/staff/share/print_templates/t_bill_payment.tt2
index 029fa5b57f..de88c7022d 100644
--- a/Open-ILS/src/templates/staff/share/print_templates/t_bill_payment.tt2
+++ b/Open-ILS/src/templates/staff/share/print_templates/t_bill_payment.tt2
@@ -40,6 +40,7 @@ A receipt of your  transaction:<hr/>
         <div ng-switch-when="cash_payment">[% l('Cash') %]</div>
         <div ng-switch-when="check_payment">[% l('Check') %]</div>
         <div ng-switch-when="credit_card_payment">[% l('Credit Card') %]</div>
+        <div ng-switch-when="debit_card_payment">[% l('Debit Card') %]</div>
         <div ng-switch-when="credit_payment">[% l('Patron Credit') %]</div>
         <div ng-switch-when="work_payment">[% l('Work') %]</div>
         <div ng-switch-when="forgive_payment">[% l('Forgive') %]</div>
diff --git a/Open-ILS/web/js/ui/default/staff/circ/patron/bills.js b/Open-ILS/web/js/ui/default/staff/circ/patron/bills.js
index cb10593068..a0dd979a16 100644
--- a/Open-ILS/web/js/ui/default/staff/circ/patron/bills.js
+++ b/Open-ILS/web/js/ui/default/staff/circ/patron/bills.js
@@ -60,6 +60,7 @@ function($q , egCore , egWorkLog , patronSvc) {
                 case 'cash_payment' : msg = egCore.strings.EG_WORK_LOG_CASH_PAYMENT; break;
                 case 'check_payment' : msg = egCore.strings.EG_WORK_LOG_CHECK_PAYMENT; break;
                 case 'credit_card_payment' : msg = egCore.strings.EG_WORK_LOG_CREDIT_CARD_PAYMENT; break;
+                case 'debit_card_payment' : msg = egCore.strings.EG_WORK_LOG_DEBIT_CARD_PAYMENT; break;
                 case 'credit_payment' : msg = egCore.strings.EG_WORK_LOG_CREDIT_PAYMENT; break;
                 case 'work_payment' : msg = egCore.strings.EG_WORK_LOG_WORK_PAYMENT; break;
                 case 'forgive_payment' : msg = egCore.strings.EG_WORK_LOG_FORGIVE_PAYMENT; break;
diff --git a/Open-ILS/web/opac/common/js/fm_table_conf.js b/Open-ILS/web/opac/common/js/fm_table_conf.js
index c1c4c53b7f..8bb7b10687 100644
--- a/Open-ILS/web/opac/common/js/fm_table_conf.js
+++ b/Open-ILS/web/opac/common/js/fm_table_conf.js
@@ -64,12 +64,14 @@ var FM_TABLE_DISPLAY = {
 			'workstation',
 			'cash_payment',
 			'check_payment',	
-			'credit_card_payment'
+			'credit_card_payment',
+			'debit_card_payment'
 		],
 		money : [
 			'cash_payment',
 			'check_payment',	
-			'credit_card_payment'
+			'credit_card_payment',
+			'debit_card_payment'
 		]
 	},
 

-----------------------------------------------------------------------

Summary of changes:
 Open-ILS/examples/fm_IDL.xml                       |  34 +++++
 Open-ILS/src/extras/ils_events.xml                 |   3 +
 .../src/perlmods/lib/OpenILS/Application/Circ.pm   |   1 +
 .../lib/OpenILS/Application/Storage/CDBI.pm        |   5 +
 .../lib/OpenILS/Application/Storage/CDBI/money.pm  |   7 +
 .../OpenILS/Application/Storage/Driver/Pg/dbi.pm   |   6 +
 .../OpenILS/Application/Storage/Publisher/money.pm |   4 +-
 Open-ILS/src/sql/Pg/002.schema.config.sql          |   2 +-
 Open-ILS/src/sql/Pg/080.schema.money.sql           |  15 ++-
 Open-ILS/src/sql/Pg/950.data.seed-values.sql       |   1 +
 .../Pg/upgrade/1200.schema.debit_card_payment.sql  | 147 +++++++++++++++++++++
 Open-ILS/src/templates/staff/base_js.tt2           |   1 +
 .../src/templates/staff/circ/patron/t_bills.tt2    |   1 +
 .../staff/share/print_templates/t_bill_payment.tt2 |   1 +
 .../web/js/ui/default/staff/circ/patron/bills.js   |   1 +
 Open-ILS/web/opac/common/js/fm_table_conf.js       |   6 +-
 16 files changed, 230 insertions(+), 5 deletions(-)
 create mode 100644 Open-ILS/src/sql/Pg/upgrade/1200.schema.debit_card_payment.sql


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list