Fixed a couple small bugs with assignCredits, one of which was causing charges to get paid out of order.
git-svn-id: file:///svn-source/pmgr/branches/yafr_20090716/site@460 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
@@ -372,7 +372,7 @@ OPTION 2
|
|||||||
// Now find all unpaid charges
|
// Now find all unpaid charges
|
||||||
$lquery = $query;
|
$lquery = $query;
|
||||||
$lquery['order'] = 'StatementEntry.effective_date ASC';
|
$lquery['order'] = 'StatementEntry.effective_date ASC';
|
||||||
$charges = $this->reconciledSet('CHARGE', $query, true);
|
$charges = $this->reconciledSet('CHARGE', $lquery, true);
|
||||||
$this->pr(18, compact('charges'),
|
$this->pr(18, compact('charges'),
|
||||||
"Outstanding Charges Determined");
|
"Outstanding Charges Determined");
|
||||||
|
|
||||||
@@ -436,20 +436,15 @@ OPTION 2
|
|||||||
|
|
||||||
$this->pr(20, compact('credit'),
|
$this->pr(20, compact('credit'),
|
||||||
(($credit['balance'] > 0 ? 'Utilized' : 'Exhausted')
|
(($credit['balance'] > 0 ? 'Utilized' : 'Exhausted')
|
||||||
. (count($credits) ? '' : ' Anon')
|
' ' . (count($credits) ? 'Credit' : 'Receipt')));
|
||||||
. ' Credit'));
|
|
||||||
|
|
||||||
if ($credit['balance'] < 0)
|
if ($credit['balance'] < 0)
|
||||||
die("HOW DID WE END UP WITH NEGATIVE SURPLUS BALANCE?");
|
die("HOW DID WE END UP WITH NEGATIVE SURPLUS BALANCE?");
|
||||||
|
|
||||||
// If we've exhaused the credit, get it out of the
|
// If we've exhaused the credit, get it out of the
|
||||||
// available credit pool (but keep track of it for later).
|
// available credit pool (but keep track of it for later).
|
||||||
if ($credit['balance'] <= 0) {
|
if ($credit['balance'] <= 0 && count($credits))
|
||||||
if (count($credits))
|
$used_credits[] = array_shift($credits);
|
||||||
$used_credits[] = array_shift($credits);
|
|
||||||
else
|
|
||||||
$used_anon_credits[] = array_shift($anon_credits);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add a payment that uses the available credit to pay the charge
|
// Add a payment that uses the available credit to pay the charge
|
||||||
$payment = array('type' => 'PAYMENT',
|
$payment = array('type' => 'PAYMENT',
|
||||||
@@ -486,7 +481,7 @@ OPTION 2
|
|||||||
if (isset($credits[0]['applied']))
|
if (isset($credits[0]['applied']))
|
||||||
$used_credits[] = array_shift($credits);
|
$used_credits[] = array_shift($credits);
|
||||||
|
|
||||||
$this->pr(18, compact('credits', 'used_credits', 'anon_credits', 'used_anon_credits'),
|
$this->pr(18, compact('credits', 'used_credits', 'receipt_credit'),
|
||||||
'Payments added');
|
'Payments added');
|
||||||
|
|
||||||
// Clean up any explicit credits that have been used
|
// Clean up any explicit credits that have been used
|
||||||
|
|||||||
Reference in New Issue
Block a user