More work on handling security deposit utilizations. This is headed in the right direction, but unfortunately, there is a problem if the security deposits have not been paid. I could just ignore it, because it's a low priority problem, but I think the solution might be to just provide a waiver on the unpaid charges. Since I need to implement fee waivers anyway, I'll just move onto that next, and then finish out the security deposit work.

git-svn-id: file:///svn-source/pmgr/branches/yafr_20090716@463 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
abijah
2009-07-31 21:11:00 +00:00
parent 44e4477d38
commit 15a4528e75
6 changed files with 149 additions and 30 deletions

View File

@@ -222,13 +222,15 @@ class LeasesController extends AppController {
* to prevent feature overload on the receipt page.
*/
function apply_deposit($id) {
function apply_deposit($id = null) {
// Create some models for convenience
$A = new Account();
if ($this->data) {
// Handle the move out based on the data given
//pr($this->data);
pr($this->data);
$this->Lease->releaseSecurityDeposits($this->data['Lease']['id']);
die();
// Assume this will succeed
$ret = true;
@@ -308,8 +310,8 @@ class LeasesController extends AppController {
array('stats' => $this->Lease->stats($id)));
// Determine the lease security deposit
$deposit = $this->Lease->securityDeposits($lease['Lease']['id']);
$this->set(compact('deposit'));
$deposit_balance = $this->Lease->securityDeposits($lease['Lease']['id']);
$this->set(compact('deposit_balance'));
$this->set('customer', $lease['Customer']);
$this->set('unit', $lease['Unit']);
$this->set('lease', $lease['Lease']);
@@ -364,8 +366,8 @@ class LeasesController extends AppController {
array('stats' => $this->Lease->stats($id)));
// Determine the lease security deposit
$deposit = $this->Lease->securityDeposits($lease['Lease']['id']);
if ($deposit['summary']['balance'] > 0)
$deposit_balance = $this->Lease->securityDepositBalance($lease['Lease']['id']);
if ($deposit_balance > 0)
die("Still have un-utilized security deposit");
$this->set('customer', $lease['Customer']);
@@ -508,8 +510,7 @@ class LeasesController extends AppController {
$outstanding_balance = $lease['Lease']['stats']['balance'];
// Determine the lease security deposit
$deposits = $this->Lease->securityDeposits($lease['Lease']['id']);
$outstanding_deposit = $deposits['summary']['balance'];
$outstanding_deposit = $this->Lease->securityDepositBalance($lease['Lease']['id']);
// Set up dynamic menu items
if (!isset($lease['Lease']['close_date'])) {