Preventing moved-out leases in sitelink data from being closed, since the security deposit hasn't been released. Added a temporary function to release the deposit, so I can manually release and close the few leases needed.
git-svn-id: file:///svn-source/pmgr/branches/yafr_20090716/site@510 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
@@ -329,9 +329,23 @@ class LeasesController extends AppController {
|
||||
* - Closes a lease to any further action
|
||||
*/
|
||||
|
||||
// REVISIT <AP>: 20090809
|
||||
// While cleaning up the sitelink data, then delete reldep()
|
||||
function reldep($id) {
|
||||
$this->Lease->id = $id;
|
||||
$stamp = $this->Lease->field('moveout_date');
|
||||
$this->Lease->releaseSecurityDeposits($id, $stamp);
|
||||
$this->redirect(array('action'=>'view', $id));
|
||||
}
|
||||
|
||||
function close($id) {
|
||||
// REVISIT <AP>: 20090708
|
||||
// We should probably seek confirmation first...
|
||||
if (!$this->Lease->closeable($id)) {
|
||||
INTERNAL_ERROR("This lease is not ready to close");
|
||||
$this->redirect(array('action'=>'view', $id));
|
||||
}
|
||||
|
||||
$this->Lease->close($id);
|
||||
$this->redirect(array('action'=>'view', $id));
|
||||
}
|
||||
|
||||
@@ -700,12 +700,13 @@ class Lease extends AppModel {
|
||||
if (isset($this->data['Lease']['close_date']))
|
||||
return $this->prReturn(false);
|
||||
|
||||
$deposit_balance = $this->securityDepositBalance($id);
|
||||
$stats = $this->stats($id);
|
||||
|
||||
// A lease can only be closed if there are no outstanding
|
||||
// security deposits, and if the account balance is zero.
|
||||
if ($deposit_balance != 0)
|
||||
// security deposits ...
|
||||
if ($this->securityDepositBalance($id) != 0)
|
||||
return $this->prReturn(false);
|
||||
|
||||
// ... and if the account balance is zero.
|
||||
if ($this->balance($id) != 0)
|
||||
return $this->prReturn(false);
|
||||
|
||||
// Apparently this lease meets all the criteria!
|
||||
|
||||
Reference in New Issue
Block a user