Changed the explicit receipt amount to be driven from stats instead of the assignCredits return value. This is in anticipation of creating an explicit credit directly, without even calling assignCredits. I'll do that for reversal on the next checkin.

git-svn-id: file:///svn-source/pmgr/branches/surplus_account_20090815@577 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
abijah
2009-08-16 04:43:34 +00:00
parent 8b6b8884f7
commit a968d7abe6
2 changed files with 32 additions and 11 deletions

View File

@@ -24,6 +24,7 @@ class StatementEntry extends AppModel {
);
var $default_log_level = array('log' => 30, 'show' => 15);
var $max_log_level = 10;
/**************************************************************************
**************************************************************************
@@ -413,8 +414,7 @@ class StatementEntry extends AppModel {
$this->INTERNAL_ERROR("Unable to locate receipt.");
$stats = $this->Transaction->stats($receipt_id);
$receipt_credit['balance'] =
$receipt_credit['Transaction']['amount'] - $stats['StatementEntry']['disbursements'];
$receipt_credit['balance'] = $stats['undisbursed'];
$receipt_credit['receipt'] = true;
$credits = array($receipt_credit);
@@ -610,6 +610,10 @@ class StatementEntry extends AppModel {
));
if (!empty($explicit_credit)) {
// REVISIT <AP>: 20090815
// Testing whether or not this case occurs
$this->INTERNAL_ERROR('Existing explicit credit unexpected');
// Since there IS an existing explicit credit, we must update
// its balance instead of creating a new one, since it has
// already been incorporated in the overall credit balance.