{ order_by => { mb => { billing_ts => { direction => 'asc' } } } },
];
- # find all unvoided payments in order
- my $payment_search = [
- { xact => $xact->id, voided=>'f' },
- { order_by => { mp => { payment_ts => { direction => 'asc' } } } },
- ];
-
# At some point, we should get rid of the voided column on
# money.payment and family. It is not exposed in the client at
# the moment, and should be replaced with a void_bill type. The
}
} @$bills;
- # Retrieve the payments. Flesh voids do that we don't have to
- # retrieve them later.
+ # Find all unvoided payments in order. Flesh voids do that we
+ # don't have to retrieve them later.
my $payments = $e->search_money_payment(
[
- $payment_search,
+ { xact => $xact->id, voided=>'f' },
{
- flesh=>1,
- flesh_fields => {
- mp => ['void_payment']
- }
+ order_by => { mp => { payment_ts => { direction => 'asc' } } },
+ flesh => 1,
+ flesh_fields => { mp => ['void_payment'] }
}
- ]);
+ ]
+ );
# If there were no payments, then we just return the bills.
return \@entries unless ($payments && @$payments);
# Retrieve settings based on transaction location and copy
# location if we have a circulation.
- my ($neg_balance_default, $neg_balance_overdues,
- $neg_balance_lost, $neg_balance_interval_default,
+ my ($prohibit_neg_balance_default, $prohibit_neg_balance_overdues,
+ $prohibit_neg_balance_lost, $neg_balance_interval_default,
$neg_balance_interval_overdues, $neg_balance_interval_lost);
if ($circ) {
# defaults and overdue settings come from transaction org unit.
- $neg_balance_default = $U->ou_ancestor_setting(
+ $prohibit_neg_balance_default = $U->ou_ancestor_setting(
$circ->circ_lib(), 'bill.prohibit_negative_balance_default');
- $neg_balance_overdues = (
+ $prohibit_neg_balance_overdues = (
$U->ou_ancestor_setting($circ->circ_lib(), 'bill.prohibit_negative_balance_on_overdues')
||
$U->ou_ancestor_setting($circ->circ_lib(), 'bill.prohibit_netgative_balance_default')
$U->ou_ancestor_setting($circ->circ_lib(), 'bill.negative_balance_interval_default')
);
# settings for lost come from copy circlib.
- $neg_balance_lost = (
+ $prohibit_neg_balance_lost = (
$U->ou_ancestor_setting($copy->circ_lib(), 'bill.prohibit_negative_balance_on_lost')
||
$U->ou_ancestor_setting($copy->circ_lib(), 'bill.prohibit_negative_balance_default')
} else {
# We only care about defaults, and they come from the
# billing location.
- $neg_balance_default = $U->ou_ancestor_setting(
+ $prohibit_neg_balance_default = $U->ou_ancestor_setting(
$grocery->billing_location(), 'bill.prohibit_negative_balance_default');
$neg_balance_interval_default = $U->ou_ancestor_setting(
$grocery->billing_location(), 'bill.negative_balance_interval_default');
if ($btype == 1) {
# Overdues
$amount_to_void = $xact_total unless(_check_payment_interval($bpentry, $neg_balance_interval_overdues));
- $amount_to_void = $xact_total if ($U->is_true($neg_balance_overdues));
+ $amount_to_void = $xact_total if ($U->is_true($prohibit_neg_balance_overdues));
} elsif ($btype == 3 || $btype == 10) {
# Lost or Long Overdue
$amount_to_void = $xact_total unless(_check_payment_interval($bpentry, $neg_balance_interval_lost));
- $amount_to_void = $xact_total if ($U->is_true($neg_balance_lost));
+ $amount_to_void = $xact_total if ($U->is_true($prohibit_neg_balance_lost));
} else {
# Any other bill that we're trying to void.
$amount_to_void = $xact_total unless(_check_payment_interval($bpentry, $neg_balance_interval_default));
- $amount_to_void = $xact_total if ($U->is_true($neg_balance_default));
+ $amount_to_void = $xact_total if ($U->is_true($prohibit_neg_balance_default));
}
}
} else {
# Grocery bills are simple by comparison.
if ($amount_to_void > $xact_total) {
$amount_to_void = $xact_total unless(_check_payment_interval($bpentry, $neg_balance_interval_default));
- $amount_to_void = $xact_total if ($U->is_true($neg_balance_default));
+ $amount_to_void = $xact_total if ($U->is_true($prohibit_neg_balance_default));
}
}