Fixed problem with units that are vacant, and thus have no current lease.

git-svn-id: file:///svn-source/pmgr/branches/ledger_transactions_20090605@87 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
abijah
2009-06-10 09:10:09 +00:00
parent d60c9721ca
commit fb48baf575

View File

@@ -169,14 +169,18 @@ class UnitsController extends AppController {
$lease['balance'] = $stats['Account']['Ledger']['balance']; $lease['balance'] = $stats['Account']['Ledger']['balance'];
} }
// Figure out the outstanding balance of the current lease. $outstanding_balance = 0;
$stats = $this->Unit->stats($id); $outstanding_deposit = 0;
$outstanding_balance = if (isset($unit['CurrentLease']['id'])) {
$stats['CurrentLease']['Account']['Ledger']['balance']; // Figure out the outstanding balance of the current lease.
$stats = $this->Unit->stats($id);
$outstanding_balance =
$stats['CurrentLease']['Account']['Ledger']['balance'];
// Figure out the total security deposit for the current lease. // Figure out the total security deposit for the current lease.
$deposits = $this->Unit->Lease->findSecurityDeposits($unit['CurrentLease']['id']); $deposits = $this->Unit->Lease->findSecurityDeposits($unit['CurrentLease']['id']);
$outstanding_deposit = $deposits['summary']['balance']; $outstanding_deposit = $deposits['summary']['balance'];
}
$this->sidemenu_links[] = $this->sidemenu_links[] =
array('name' => 'Operations', 'header' => true); array('name' => 'Operations', 'header' => true);