Added support for querying only occupied or vacant units. It's working at the moment, but I'll probably move some more logic to the controller next.
git-svn-id: file:///svn-source/pmgr/branches/initial_20090526/site@29 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
@@ -12,29 +12,13 @@ class UnitsController extends AppController {
|
||||
|
||||
function vacant() {
|
||||
$this->Unit->recursive = 0;
|
||||
$this->Unit->bindModel(array('hasOne' => array('UnitsLease',
|
||||
'Lease' => array(
|
||||
'foreignKey' => false,
|
||||
'conditions' => array('Lease.id = UnitsLease.lease_id')
|
||||
))),
|
||||
false);
|
||||
|
||||
$this->set('units', $this->paginate(array('Lease.close_date IS NULL',
|
||||
'UnitsLease.type != "ALTERNATE"')));
|
||||
$this->set('units', $this->paginate(array('Unit.status < ' . $this->Unit->occupiedEnumValue())));
|
||||
$this->render('index');
|
||||
}
|
||||
|
||||
function occupied() {
|
||||
$this->Unit->recursive = 0;
|
||||
$this->Unit->bindModel(array('hasOne' => array('UnitsLease',
|
||||
'Lease' => array(
|
||||
'foreignKey' => false,
|
||||
'conditions' => array('Lease.id = UnitsLease.lease_id')
|
||||
))),
|
||||
false);
|
||||
|
||||
$this->set('units', $this->paginate(array('Lease.close_date IS NULL',
|
||||
'UnitsLease.type != "ALTERNATE"')));
|
||||
$this->set('units', $this->paginate(array('Unit.status >= ' . $this->Unit->occupiedEnumValue())));
|
||||
$this->render('index');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user