<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"/>
</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"/>
<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"/>
<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>
<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"/>
<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>
<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"/>
<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">
<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>
'xact',
'cash_payment',
'credit_card_payment',
+ 'debit_card_payment',
'credit_payment',
'check_payment',
'work_payment',
#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' );
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' );
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');
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' );
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'
$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);
}
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,
[% 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
--- /dev/null
+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;
+
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') %]';
<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>
<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>
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;
'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'
]
},