From: Kathy Lussier Date: Fri, 24 Jul 2015 00:53:33 +0000 (-0400) Subject: LP 1198465: Adapt some language in the negative balance branch X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=f7dab6352af456cf8aa5679ef34724f0372e4619;p=working%2FEvergreen.git LP 1198465: Adapt some language in the negative balance branch End users may see the term 'adjustment payment' and think that an actual payment was made. Let's use 'account adjustment' instead. Also, remove any references to credits in the description for the OU settings since it could be confused with patron credits, which aren't prohibited by the code. Signed-off-by: Kathy Lussier --- diff --git a/Open-ILS/examples/fm_IDL.xml b/Open-ILS/examples/fm_IDL.xml index cd9d697fd5..f5f25d41a1 100644 --- a/Open-ILS/examples/fm_IDL.xml +++ b/Open-ILS/examples/fm_IDL.xml @@ -81,7 +81,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - + @@ -3622,7 +3622,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - + @@ -6949,7 +6949,7 @@ SELECT usr, - + @@ -6959,7 +6959,7 @@ SELECT usr, - + @@ -6987,7 +6987,7 @@ SELECT usr, - + @@ -6997,7 +6997,7 @@ SELECT usr, - + @@ -7015,14 +7015,14 @@ SELECT usr, - + - + diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/CircCommon.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/CircCommon.pm index 572f5d9532..113e47c77b 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/CircCommon.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/CircCommon.pm @@ -680,11 +680,11 @@ sub generate_fines { # 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 @@ -720,7 +720,7 @@ sub bill_payment_map_for_xact { # 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. @@ -741,7 +741,7 @@ sub bill_payment_map_for_xact { } } @$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( [ @@ -749,7 +749,7 @@ sub bill_payment_map_for_xact { { order_by => { mp => { payment_ts => { direction => 'asc' } } }, flesh => 1, - flesh_fields => { mp => ['adjustment_payment'] } + flesh_fields => { mp => ['account_adjustment'] } } ] ); @@ -764,7 +764,7 @@ sub bill_payment_map_for_xact { 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()); @@ -982,8 +982,8 @@ sub adjust_bills_to_zero { $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); @@ -991,7 +991,7 @@ sub adjust_bills_to_zero { $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; @@ -1031,7 +1031,7 @@ sub _has_refundable_payments { 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" } diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm index 9b20a97760..61ef659223 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm @@ -3834,7 +3834,7 @@ sub checkin_handle_lost_or_lo_now_found_restore_od { 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 } 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 21b986f022..c3e65fcb1d 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 @@ -144,9 +144,9 @@ __PACKAGE__->table('money_credit_payment'); #------------------------------------------------------------------------------- -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/); diff --git a/Open-ILS/src/sql/Pg/080.schema.money.sql b/Open-ILS/src/sql/Pg/080.schema.money.sql index 2becfb5197..41c7c861c6 100644 --- a/Open-ILS/src/sql/Pg/080.schema.money.sql +++ b/Open-ILS/src/sql/Pg/080.schema.money.sql @@ -540,19 +540,19 @@ CREATE TRIGGER mat_summary_add_tgr AFTER INSERT ON money.forgive_payment FOR EAC 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); 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 97b953792e..0ce75a4821 100644 --- a/Open-ILS/src/sql/Pg/950.data.seed-values.sql +++ b/Open-ILS/src/sql/Pg/950.data.seed-values.sql @@ -5014,7 +5014,7 @@ 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'), 'bool', null) ,( 'bill.prohibit_negative_balance_on_overdues', 'finance', @@ -5024,7 +5024,7 @@ INSERT into config.org_unit_setting_type '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', @@ -5034,7 +5034,7 @@ INSERT into config.org_unit_setting_type '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', @@ -5044,7 +5044,7 @@ INSERT into config.org_unit_setting_type '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', @@ -5054,7 +5054,7 @@ INSERT into config.org_unit_setting_type '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', @@ -5064,7 +5064,7 @@ INSERT into config.org_unit_setting_type '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) ; diff --git a/Open-ILS/src/sql/Pg/live_t/lp1198465_run_this_before_livetests.sql b/Open-ILS/src/sql/Pg/live_t/lp1198465_run_this_before_livetests.sql index 194963b922..23588d19d6 100644 --- a/Open-ILS/src/sql/Pg/live_t/lp1198465_run_this_before_livetests.sql +++ b/Open-ILS/src/sql/Pg/live_t/lp1198465_run_this_before_livetests.sql @@ -155,7 +155,7 @@ INSERT INTO money.billing (id, xact, billing_ts, voided, voider, void_time, amou (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'), @@ -166,7 +166,7 @@ INSERT INTO money.billing (id, xact, billing_ts, voided, voider, void_time, amou (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), diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.data.conditional_negative_balance.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.data.conditional_negative_balance.sql index 1d03ec9881..d3ae3882ee 100644 --- a/Open-ILS/src/sql/Pg/upgrade/XXXX.data.conditional_negative_balance.sql +++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.data.conditional_negative_balance.sql @@ -2,19 +2,19 @@ BEGIN; -- 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 @@ -28,7 +28,7 @@ VALUES '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', @@ -39,7 +39,7 @@ VALUES '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', @@ -50,7 +50,7 @@ VALUES '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-overde materials', 'coust', 'description') ), ('bill.negative_balance_interval_default', @@ -61,7 +61,7 @@ VALUES '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', @@ -72,7 +72,7 @@ VALUES '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', @@ -83,7 +83,7 @@ VALUES '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') );