More work with security deposits, reversals, and balances. I've tried to work many different corner cases, but know that not everything has been tested. I think the next steps for testing will be to put in some real data.

git-svn-id: file:///svn-source/pmgr/branches/yafr_20090716/site@499 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
abijah
2009-08-07 00:10:28 +00:00
parent f900853163
commit c3e60a65c1
9 changed files with 199 additions and 189 deletions

View File

@@ -99,9 +99,9 @@ class Lease extends AppModel {
// Since security deposits are being released, this also means
// any unpaid (or only partially paid) security deposit should
// have the remaining balance simply waived.
// have the remaining balance reversed.
if ($charge['StatementEntry']['balance'] > 0)
$this->StatementEntry->waive($charge['StatementEntry']['id'], $stamp);
$this->StatementEntry->reverse($charge['StatementEntry']['id'], true, $stamp);
$release['Entry'][] =
array('amount' => $charge['StatementEntry']['reconciled'],
@@ -521,10 +521,14 @@ class Lease extends AppModel {
if (!$id)
return $this->prReturn(null);
$this->queryInit($query);
$query['conditions'][] = array('StatementEntry.lease_id' => $id);
$stats = $this->StatementEntry->stats(null, $query);
return $this->prReturn($stats);
$find_stats = $this->StatementEntry->find
('first', array
('contain' => false,
'fields' => $this->StatementEntry->chargeDisbursementFields(true),
'conditions' => array('StatementEntry.lease_id' => $id),
));
$find_stats = $find_stats[0];
return $this->prReturn($find_stats);
}
}