New org unit setting circ.disable_patron_credit.
This prevents "patron_credit" payments in the payment creation API and
hides all patron credit related actions in the patron payment interface.
Signed-off-by: Bill Erickson <berick@esilibrary.com>
Conflicts:
Open-ILS/src/sql/Pg/950.data.seed-values.sql
Signed-off-by: Chris Sharp <csharp@georgialibraries.org>
<!-- ================================================================ -->
+ <event code='11105' textcode='PATRON_CREDIT_DISABLED'>
+ <desc xml:lang="en-US">Payments by patron credit are not allowed
+ for the selected transaction</desc>
+ </event>
+
+
</ils_events>
my $this_ou = $e->requestor->ws_ou || $e->requestor->home_ou;
my %orgs;
+
# unless/until determined by payment processor API
my ($approval_code, $cc_processor, $cc_type, $cc_order_number) = (undef,undef,undef, undef);
$total_paid += $amount;
- $orgs{$U->xact_org($transid, $e)} = 1;
+ my $org_id = $U->xact_org($transid, $e);
+
+ if (!$orgs{$org_id}) {
+ $orgs{$org_id} = 1;
+
+ # patron credit has to be allowed at all orgs receiving payment
+ if ($type eq 'credit_payment' and $U->ou_ancestor_setting_value(
+ $org_id, 'circ.disable_patron_credit', $e)) {
+ $e->rollback;
+ return OpenILS::Event->new('PATRON_CREDIT_DISABLED');
+ }
+ }
# A negative payment is a refund.
if( $amount < 0 ) {
TRUE
);
+
+-- YAOUS patron credit disable
+INSERT INTO config.org_unit_setting_type
+ (grp, name, datatype, label, description)
+VALUES (
+ 'finance',
+ 'circ.disable_patron_credit',
+ 'bool',
+ oils_i18n_gettext(
+ 'circ.disable_patron_credit',
+ 'Disable Patron Credit',
+ 'coust',
+ 'label'
+ ),
+ oils_i18n_gettext(
+ 'circ.disable_patron_credit',
+ 'Do not allow patrons to accrue credit or pay fines/fees with accrued credit',
+ 'coust',
+ 'description'
+ )
+);
+
--- /dev/null
+BEGIN;
+
+-- SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
+
+INSERT INTO config.org_unit_setting_type
+ (grp, name, datatype, label, description)
+VALUES (
+ 'finance',
+ 'circ.disable_patron_credit',
+ 'bool',
+ oils_i18n_gettext(
+ 'circ.disable_patron_credit',
+ 'Disable Patron Credit',
+ 'coust',
+ 'label'
+ ),
+ oils_i18n_gettext(
+ 'circ.disable_patron_credit',
+ 'Do not allow patrons to accrue credit or pay fines/fees with accrued credit',
+ 'coust',
+ 'description'
+ )
+);
+
+COMMIT;
$('credit_forward').setAttribute('value',util.money.sanitize( g.patron.credit_forward_balance() ));
}
+ if (g.data.hash.aous['circ.disable_patron_credit']) {
+ var nodes = document.getElementsByClassName('hide_patron_credit');
+ for (var i = 0; i < nodes.length; i++)
+ nodes[i].setAttribute('hidden', true);
+ }
+
if (g.data.hash.aous['ui.circ.billing.uncheck_bills_and_unfocus_payment_box']) {
g.funcs.push(
function() {
case 'INVALID_USER_XACT_ID' :
refresh(); default_focus();
alert($("patronStrings").getFormattedString('staff.patron.bills.pay.invalid_user_xact_id', [robj.desc])); return false; break;
+ case 'PATRON_CREDIT_DISABLED' :
+ refresh();
+ default_focus();
+ alert(robj.desc);
+ return false;
+ break;
+
default: throw(robj); break;
}
}