Added ability to lock unlock any unit, and to track that based on the actual locks that are on it, not the lock status.
git-svn-id: file:///svn-source/pmgr/branches/v0.3_work@1042 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
@@ -398,22 +398,10 @@ class UnitsController extends AppController {
|
|||||||
$outstanding_deposit = $this->Unit->Lease->securityDepositBalance($unit['CurrentLease']['id']);
|
$outstanding_deposit = $this->Unit->Lease->securityDepositBalance($unit['CurrentLease']['id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the unit is occupied, but not locked, provide a
|
// Add a mechanism to lock ANY unit, regardless of status
|
||||||
// mechanism to do so. This doesn't have to be restricted
|
$this->addSideMenuLink($this->Unit->lockCount($id) == 0 ? 'Lock' : 'Relock/Unlock',
|
||||||
// to past due customers. There are times we need to
|
array('action' => 'lock', $id), null,
|
||||||
// overlock customers in good standing, such as if their
|
'ACTION');
|
||||||
// lock breaks, is cut, or missing for any reason.
|
|
||||||
if ($this->Unit->occupied($unit['Unit']['status']) &&
|
|
||||||
!$this->Unit->locked($unit['Unit']['status']))
|
|
||||||
$this->addSideMenuLink('Lock',
|
|
||||||
array('action' => 'lock', $id), null,
|
|
||||||
'ACTION');
|
|
||||||
|
|
||||||
// If the unit is locked, provide an option to unlock it,
|
|
||||||
if ($this->Unit->locked($unit['Unit']['status']))
|
|
||||||
$this->addSideMenuLink('Relock/Unlock',
|
|
||||||
array('action' => 'lock', $id), null,
|
|
||||||
'ACTION');
|
|
||||||
|
|
||||||
// If the unit is locked, but not liened, give option to lien.
|
// If the unit is locked, but not liened, give option to lien.
|
||||||
if ($this->Unit->locked($unit['Unit']['status']) &&
|
if ($this->Unit->locked($unit['Unit']['status']) &&
|
||||||
|
|||||||
@@ -248,6 +248,23 @@ class Unit extends AppModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**************************************************************************
|
||||||
|
**************************************************************************
|
||||||
|
**************************************************************************
|
||||||
|
* function: lockCount
|
||||||
|
* - Number of locks on a unit
|
||||||
|
*/
|
||||||
|
function lockCount($id) {
|
||||||
|
$this->prEnter(compact('id'));
|
||||||
|
return $this->prReturn($this->find
|
||||||
|
('count', array
|
||||||
|
('fields' => array("COUNT(Lock.id) AS count"),
|
||||||
|
'link' => array('Lock'),
|
||||||
|
'conditions' => array('Unit.id' => $id),
|
||||||
|
)));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
**************************************************************************
|
**************************************************************************
|
||||||
**************************************************************************
|
**************************************************************************
|
||||||
|
|||||||
Reference in New Issue
Block a user