<field name="work_payment" oils_persist:virtual="true" />
<field name="credit_payment" oils_persist:virtual="true" />
<field name="goods_payment" oils_persist:virtual="true" />
- <field name="adjustment_payment" oils_persist:virtual="true" />
+ <field name="account_adjustment" oils_persist:virtual="true" />
</fields>
<links>
<link field="usr" reltype="has_a" key="id" map="" class="au"/>
</actions>
</permacrud>
</class>
- <class id="map" controller="open-ils.cstore" oils_obj:fieldmapper="money::adjustment_payment" oils_persist:tablename="money.adjustment_payment" reporter:label="Adjustment Payment">
+ <class id="map" controller="open-ils.cstore" oils_obj:fieldmapper="money::account_adjustment" oils_persist:tablename="money.account_adjustment" reporter:label="Account Adjustment">
<fields oils_persist:primary="id" oils_persist:sequence="money.payment_id_seq">
<field name="accepting_usr" reporter:datatype="link"/>
<field name="amount" reporter:datatype="money" />
<field reporter:label="Work Payment Detail" name="work_payment" oils_persist:virtual="true" 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="Adjustment Payment Detail" name="adjustment_payment" oils_persist:virtual="true" reporter:datatype="link"/>
+ <field reporter:label="Account Adjustment Detail" name="account_adjustment" oils_persist:virtual="true" reporter:datatype="link"/>
</fields>
<links>
<link field="cash_payment" reltype="might_have" key="id" map="" class="mcp"/>
<link field="work_payment" reltype="might_have" key="id" map="" class="mwp"/>
<link field="forgive_payment" reltype="might_have" key="id" map="" class="mfp"/>
<link field="goods_payment" reltype="might_have" key="id" map="" class="mgp"/>
- <link field="adjustment_payment" reltype="might_have" key="id" map="" class="map"/>
+ <link field="account_adjustment" reltype="might_have" key="id" map="" class="map"/>
<link field="xact" reltype="has_a" key="id" map="" class="mbt"/>
</links>
<permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
<field reporter:label="Work Payment Detail" name="work_payment" oils_persist:virtual="true" 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="Adjustment Payment Detail" name="adjustment_payment" oils_persist:virtual="true" reporter:datatype="link"/>
+ <field reporter:label="Account Adjustment Detail" name="account_adjustment" oils_persist:virtual="true" reporter:datatype="link"/>
</fields>
<links>
<link field="cash_payment" reltype="might_have" key="id" map="" class="mcp"/>
<link field="work_payment" reltype="might_have" key="id" map="" class="mwp"/>
<link field="forgive_payment" reltype="might_have" key="id" map="" class="mfp"/>
<link field="goods_payment" reltype="might_have" key="id" map="" class="mgp"/>
- <link field="adjustment_payment" reltype="might_have" key="id" map="" class="mvp"/>
+ <link field="account_adjustment" reltype="might_have" key="id" map="" class="mvp"/>
<link field="xact" reltype="has_a" key="id" map="" class="mbt"/>
<link field="accepting_usr" reltype="has_a" key="id" map="" class="au"/>
</links>
<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="Credit Payment Detail" name="credit_payment" oils_persist:virtual="true" reporter:datatype="link"/>
- <field reporter:label="Adjustment Payment Detail" name="adjustment_payment" oils_persist:virtual="true" reporter:datatype="link"/>
+ <field reporter:label="Account Adjustment Detail" name="account_adjustment" oils_persist:virtual="true" reporter:datatype="link"/>
</fields>
<links>
<link field="work_payment" reltype="might_have" key="id" map="" class="mwp"/>
<link field="forgive_payment" reltype="might_have" key="id" map="" class="mfp"/>
<link field="goods_payment" reltype="might_have" key="id" map="" class="mgp"/>
<link field="credit_payment" reltype="might_have" key="id" map="" class="mcrp"/>
- <link field="adjustment_payment" reltype="might_have" key="id" map="" class="mvp"/>
+ <link field="account_adjustment" reltype="might_have" key="id" map="" class="mvp"/>
<link field="xact" reltype="has_a" key="id" map="" class="mbt"/>
</links>
</class>
# following fields:
#
# bill => the adjusted bill object
-# adjustments => an arrayref of adjustment payments that apply directly
+# adjustments => an arrayref of account adjustments that apply directly
# to the bill
# payments => an arrayref of payment objects applied to the bill
# bill_amount => original amount from the billing object
-# adjustment_amount => total of the adjustment payments that apply
+# adjustment_amount => total of the account adjustments that apply
# directly to the bill
#
# Each bill is only mapped to payments one time. However, a single
# the fieldmapper, only the mp object, based on the money.payment
# view, does. However, I want to leave that complication for
# later. I wonder if I'm not slowing things down too much with
- # the current adjustment_payment logic. It would probably be faster if
+ # the current account_adjustment logic. It would probably be faster if
# we had direct Pg access at this layer. I can probably wrangle
# something via the drivers or store interfaces, but I haven't
# really figured those out, yet.
}
} @$bills;
- # Find all unvoided payments in order. Flesh adjustment payments
+ # Find all unvoided payments in order. Flesh account adjustments
# so that we don't have to retrieve them later.
my $payments = $e->search_money_payment(
[
{
order_by => { mp => { payment_ts => { direction => 'asc' } } },
flesh => 1,
- flesh_fields => { mp => ['adjustment_payment'] }
+ flesh_fields => { mp => ['account_adjustment'] }
}
]
);
foreach my $entry (@entries) {
my $bill = $entry->{bill};
# Find only the adjustments that apply to individual bills.
- my @adjustments = map {$_->adjustment_payment()} grep {$_->payment_type() eq 'adjustment_payment' && $_->adjustment_payment()->billing() == $bill->id()} @$payments;
+ my @adjustments = map {$_->account_adjustment()} grep {$_->payment_type() eq 'account_adjustment' && $_->account_adjustment()->billing() == $bill->id()} @$payments;
if (@adjustments) {
foreach my $adjustment (@adjustments) {
my $new_amount = $U->fpdiff($bill->amount(),$adjustment->amount());
$amount_to_adjust = $xact_total;
}
- # Create the adjustment payment
- my $payobj = Fieldmapper::money::adjustment_payment->new;
+ # Create the account adjustment
+ my $payobj = Fieldmapper::money::account_adjustment->new;
$payobj->amount($amount_to_adjust);
$payobj->amount_collected($amount_to_adjust);
$payobj->xact($xactid);
$payobj->payment_ts('now');
$payobj->billing($bill->id());
$payobj->note($note) if ($note);
- $e->create_money_adjustment_payment($payobj) or return $e->die_event;
+ $e->create_money_account_adjustment($payobj) or return $e->die_event;
# Adjust our bill_payment_map
$bpentry->{adjustment_amount} += $amount_to_adjust;
push @{$bpentry->{adjustments}}, $payobj;
my $last_payment = $e->search_money_payment(
{
xact => $xactid,
- payment_type => {"!=" => 'adjustment_payment'}
+ payment_type => {"!=" => 'account_adjustment'}
},{
limit => 1,
order_by => { mp => "payment_ts DESC" }
my $void_max = $self->circ->max_fine();
# search for overdues voided the new way (aka "adjusted")
my @billings = map {$_->id()} @$ods;
- my $voids = $self->editor->search_money_adjustment_payment(
+ my $voids = $self->editor->search_money_account_adjustment(
{
billing => \@billings
}
#-------------------------------------------------------------------------------
-package money::adjustment_payment;
+package money::account_adjustment;
use base qw/money/;
-__PACKAGE__->table('money_adjustment_payment');
+__PACKAGE__->table('money_account_adjustment');
__PACKAGE__->columns(Primary => 'id');
__PACKAGE__->columns(Essential => qw/xact amount payment_ts note accepting_usr
amount_collected voided billing/);
CREATE TRIGGER mat_summary_upd_tgr AFTER UPDATE ON money.forgive_payment FOR EACH ROW EXECUTE PROCEDURE money.materialized_summary_payment_update ('forgive_payment');
CREATE TRIGGER mat_summary_del_tgr BEFORE DELETE ON money.forgive_payment FOR EACH ROW EXECUTE PROCEDURE money.materialized_summary_payment_del ('forgive_payment');
-CREATE TABLE money.adjustment_payment (
+CREATE TABLE money.account_adjustment (
billing BIGINT REFERENCES money.billing (id) ON DELETE SET NULL
) INHERITS (money.bnm_payment);
-ALTER TABLE money.adjustment_payment ADD PRIMARY KEY (id);
-CREATE INDEX money_adjustment_id_idx ON money.adjustment_payment (id);
-CREATE INDEX money_adjustment_payment_xact_idx ON money.adjustment_payment (xact);
-CREATE INDEX money_adjustment_payment_bill_idx ON money.adjustment_payment (billing);
-CREATE INDEX money_adjustment_payment_payment_ts_idx ON money.adjustment_payment (payment_ts);
-CREATE INDEX money_adjustment_payment_accepting_usr_idx ON money.adjustment_payment (accepting_usr);
-
-CREATE TRIGGER mat_summary_add_tgr AFTER INSERT ON money.adjustment_payment FOR EACH ROW EXECUTE PROCEDURE money.materialized_summary_payment_add ('adjustment_payment');
-CREATE TRIGGER mat_summary_upd_tgr AFTER UPDATE ON money.adjustment_payment FOR EACH ROW EXECUTE PROCEDURE money.materialized_summary_payment_update ('adjustment_payment');
-CREATE TRIGGER mat_summary_del_tgr BEFORE DELETE ON money.adjustment_payment FOR EACH ROW EXECUTE PROCEDURE money.materialized_summary_payment_del ('adjustment_payment');
+ALTER TABLE money.account_adjustment ADD PRIMARY KEY (id);
+CREATE INDEX money_adjustment_id_idx ON money.account_adjustment (id);
+CREATE INDEX money_account_adjustment_xact_idx ON money.account_adjustment (xact);
+CREATE INDEX money_account_adjustment_bill_idx ON money.account_adjustment (billing);
+CREATE INDEX money_account_adjustment_payment_ts_idx ON money.account_adjustment (payment_ts);
+CREATE INDEX money_account_adjustment_accepting_usr_idx ON money.account_adjustment (accepting_usr);
+
+CREATE TRIGGER mat_summary_add_tgr AFTER INSERT ON money.account_adjustment FOR EACH ROW EXECUTE PROCEDURE money.materialized_summary_payment_add ('account_adjustment');
+CREATE TRIGGER mat_summary_upd_tgr AFTER UPDATE ON money.account_adjustment FOR EACH ROW EXECUTE PROCEDURE money.materialized_summary_payment_update ('account_adjustment');
+CREATE TRIGGER mat_summary_del_tgr BEFORE DELETE ON money.account_adjustment FOR EACH ROW EXECUTE PROCEDURE money.materialized_summary_payment_del ('account_adjustment');
CREATE TABLE money.work_payment () INHERITS (money.bnm_payment);
'coust', 'label'),
oils_i18n_gettext(
'bill.prohibit_negative_balance_default',
- 'Default setting to prevent credits on circulation related bills',
+ 'Default setting to prevent negative balances (refunds) on circulation related bills',
'coust', 'description'),
'bool', null)
,( 'bill.prohibit_negative_balance_on_overdues', 'finance',
'coust', 'label'),
oils_i18n_gettext(
'bill.prohibit_negative_balance_on_overdues',
- 'Prevent credits on bills for overdue materials',
+ 'Prevent negative balances (refunds) on bills for overdue materials',
'coust', 'description'),
'bool', null)
,( 'bill.prohibit_negative_balance_on_lost', 'finance',
'coust', 'label'),
oils_i18n_gettext(
'bill.prohibit_negative_balance_on_lost',
- 'Prevent credits on bills for lost/long overdue materials',
+ 'Prevent negative balances (refunds) on bills for lost/long overdue materials',
'coust', 'description'),
'bool', null)
,( 'bill.negative_balance_interval_default', 'finance',
'coust', 'label'),
oils_i18n_gettext(
'bill.negative_balance_interval_default',
- 'Amount of time after which no negative balances or credits are allowed on circulation bills',
+ 'Amount of time after which no negative balances (refunds) are allowed on circulation bills',
'coust', 'description'),
'interval', null)
,( 'bill.negative_balance_interval_on_overdues', 'finance',
'coust', 'label'),
oils_i18n_gettext(
'bill.negative_balance_interval_on_overdues',
- 'Amount of time after which no negative balances or credits are allowed on bills for overdue materials',
+ 'Amount of time after which no negative balances (refunds) are allowed on bills for overdue materials',
'coust', 'description'),
'interval', null)
,( 'bill.negative_balance_interval_on_lost', 'finance',
'coust', 'label'),
oils_i18n_gettext(
'bill.negative_balance_interval_on_lost',
- 'Amount of time after which no negative balances or credits are allowed on bills for lost/long overdue materials',
+ 'Amount of time after which no negative balances (refunds) are allowed on bills for lost/long overdue materials',
'coust', 'description'),
'interval', null)
;
(DEFAULT, 16, '2014-05-26 23:59:59-04', false, NULL, NULL, 0.10, 'Overdue materials', 1, 'System Generated Overdue Fine'),
(DEFAULT, 16, '2014-05-27 23:59:59-04', false, NULL, NULL, 0.10, 'Overdue materials', 1, 'System Generated Overdue Fine'),
(DEFAULT, 16, '2014-05-28 23:59:59-04', false, NULL, NULL, 0.10, 'Overdue materials', 1, 'System Generated Overdue Fine'),
- -- XACT 10 must be last, because we use CURRVAL() to put their IDs in the adjustment payments
+ -- XACT 10 must be last, because we use CURRVAL() to put their IDs in the account adjustments
(DEFAULT, 10, (DATE(NOW() - '9 days'::interval) || ' 23:59:59')::TIMESTAMP, false, NULL, NULL, 0.10, 'Overdue materials', 1, 'System Generated Overdue Fine'),
(DEFAULT, 10, (DATE(NOW() - '8 days'::interval) || ' 23:59:59')::TIMESTAMP, false, NULL, NULL, 0.10, 'Overdue materials', 1, 'System Generated Overdue Fine'),
(DEFAULT, 10, (DATE(NOW() - '7 days'::interval) || ' 23:59:59')::TIMESTAMP, false, NULL, NULL, 0.10, 'Overdue materials', 1, 'System Generated Overdue Fine'),
(DEFAULT, 10, NOW() - '3 days'::interval, false, NULL, NULL, 50.00, 'Lost Materials', 3, 'SYSTEM GENERATED');
-INSERT INTO money.adjustment_payment (id, xact, payment_ts, voided, amount, note, amount_collected, accepting_usr, billing) VALUES
+INSERT INTO money.account_adjustment (id, xact, payment_ts, voided, amount, note, amount_collected, accepting_usr, billing) VALUES
(DEFAULT, 10, NOW() - '3 days'::interval, false, 0.10, '', 0.10, 1, CURRVAL('money.billing_id_seq') - 7),
(DEFAULT, 10, NOW() - '3 days'::interval, false, 0.10, '', 0.10, 1, CURRVAL('money.billing_id_seq') - 6),
(DEFAULT, 10, NOW() - '3 days'::interval, false, 0.10, '', 0.10, 1, CURRVAL('money.billing_id_seq') - 5),
-- SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
-CREATE TABLE money.adjustment_payment (
+CREATE TABLE money.account_adjustment (
billing BIGINT REFERENCES money.billing (id) ON DELETE SET NULL
) INHERITS (money.bnm_payment);
-ALTER TABLE money.adjustment_payment ADD PRIMARY KEY (id);
-CREATE INDEX money_adjustment_id_idx ON money.adjustment_payment (id);
-CREATE INDEX money_adjustment_payment_xact_idx ON money.adjustment_payment (xact);
-CREATE INDEX money_adjustment_payment_bill_idx ON money.adjustment_payment (billing);
-CREATE INDEX money_adjustment_payment_payment_ts_idx ON money.adjustment_payment (payment_ts);
-CREATE INDEX money_adjustment_payment_accepting_usr_idx ON money.adjustment_payment (accepting_usr);
+ALTER TABLE money.account_adjustment ADD PRIMARY KEY (id);
+CREATE INDEX money_adjustment_id_idx ON money.account_adjustment (id);
+CREATE INDEX money_account_adjustment_xact_idx ON money.account_adjustment (xact);
+CREATE INDEX money_account_adjustment_bill_idx ON money.account_adjustment (billing);
+CREATE INDEX money_account_adjustment_payment_ts_idx ON money.account_adjustment (payment_ts);
+CREATE INDEX money_account_adjustment_accepting_usr_idx ON money.account_adjustment (accepting_usr);
-CREATE TRIGGER mat_summary_add_tgr AFTER INSERT ON money.adjustment_payment FOR EACH ROW EXECUTE PROCEDURE money.materialized_summary_payment_add ('adjustment_payment');
-CREATE TRIGGER mat_summary_upd_tgr AFTER UPDATE ON money.adjustment_payment FOR EACH ROW EXECUTE PROCEDURE money.materialized_summary_payment_update ('adjustment_payment');
-CREATE TRIGGER mat_summary_del_tgr BEFORE DELETE ON money.adjustment_payment FOR EACH ROW EXECUTE PROCEDURE money.materialized_summary_payment_del ('adjustment_payment');
+CREATE TRIGGER mat_summary_add_tgr AFTER INSERT ON money.account_adjustment FOR EACH ROW EXECUTE PROCEDURE money.materialized_summary_payment_add ('account_adjustment');
+CREATE TRIGGER mat_summary_upd_tgr AFTER UPDATE ON money.account_adjustment FOR EACH ROW EXECUTE PROCEDURE money.materialized_summary_payment_update ('account_adjustment');
+CREATE TRIGGER mat_summary_del_tgr BEFORE DELETE ON money.account_adjustment FOR EACH ROW EXECUTE PROCEDURE money.materialized_summary_payment_del ('account_adjustment');
-- Insert new org. unit settings.
INSERT INTO config.org_unit_setting_type
'coust', 'label'),
oils_i18n_gettext(
'bill.prohibit_negative_balance_default',
- 'Default setting to prevent credits on circulation related bills',
+ 'Default setting to prevent negative balances (refunds) on circulation related bills',
'coust', 'description')
),
('bill.prohibit_negative_balance_on_overdues',
'coust', 'label'),
oils_i18n_gettext(
'bill.prohibit_negative_balance_on_overdues',
- 'Prevent credits on bills for overdue materials',
+ 'Prevent negative balances (refunds) on bills for overdue materials',
'coust', 'description')
),
('bill.prohibit_negative_balance_on_lost',
'coust', 'label'),
oils_i18n_gettext(
'bill.prohibit_negative_balance_on_lost',
- 'Prevent credits on bills for lost/long-overde materials',
+ 'Prevent negative balances (refunds) on bills for lost/long-overdue materials',
'coust', 'description')
),
('bill.negative_balance_interval_default',
'coust', 'label'),
oils_i18n_gettext(
'bill.negative_balance_interval_default',
- 'Amount of time after which no negative balances or credits are allowed on circulation bills',
+ 'Amount of time after which no negative balances (refunds) are allowed on circulation bills',
'coust', 'description')
),
('bill.negative_balance_interval_on_overdues',
'coust', 'label'),
oils_i18n_gettext(
'bill.negative_balance_interval_on_overdues',
- 'Amount of time after which no negative balances or credits are allowed on bills for overdue materials',
+ 'Amount of time after which no negative balances (refunds) are allowed on bills for overdue materials',
'coust', 'description')
),
('bill.negative_balance_interval_on_lost',
'coust', 'label'),
oils_i18n_gettext(
'bill.negative_balance_interval_on_lost',
- 'Amount of time after which no negative balances or credits are allowed on bills for lost/long overdue materials',
+ 'Amount of time after which no negative balances (refunds) are allowed on bills for lost/long overdue materials',
'coust', 'description')
);