git-svn-id: file:///svn-source/pmgr/branches/initial_20090526/site@23 97e9348a-65ac-dc4b-aefc-98561f571b83
52 lines
1.6 KiB
PHP
52 lines
1.6 KiB
PHP
<?php
|
|
|
|
class ContactsController extends AppController {
|
|
var $helpers = array('Html');
|
|
|
|
var $paginate = array('limit' => 100,
|
|
'order' => array('Contact.last_name' => 'ASC',
|
|
'Contact.first_name' => 'ASC'));
|
|
|
|
function index() {
|
|
$this->all();
|
|
}
|
|
|
|
function current() {
|
|
$this->Contact->recursive = 0;
|
|
$this->Contact->bindModel(array('hasOne' => array('ContactsLease',
|
|
'Lease' => array(
|
|
'foreignKey' => false,
|
|
'conditions' => array('Lease.id = ContactsLease.lease_id')
|
|
))),
|
|
false);
|
|
|
|
$this->set('contacts', $this->paginate(array('Lease.close_date IS NULL',
|
|
'ContactsLease.type != "ALTERNATE"')));
|
|
$this->render('index');
|
|
}
|
|
|
|
function all() {
|
|
$this->Contact->recursive = 0;
|
|
$this->Contact->bindModel(array('hasOne' => array('ContactsLease')),
|
|
false);
|
|
|
|
$this->set('contacts', $this->paginate(array('ContactsLease.type != "ALTERNATE"')));
|
|
$this->render('index');
|
|
}
|
|
|
|
function view($id = null) {
|
|
if (!$id) {
|
|
$this->Session->setFlash(__('Invalid Item.', true));
|
|
$this->redirect(array('action'=>''));
|
|
}
|
|
$this->Contact->recursive = 4;
|
|
$this->Contact->Lease->LeaseType->unbindModel(array('hasMany' => array('Lease')));
|
|
$this->Contact->Lease->Charge->unbindModel(array('belongsTo' => array('Lease')));
|
|
$this->Contact->Lease->Charge->ChargeType->unbindModel(array('hasMany' => array('Charge')));
|
|
$this->Contact->Lease->Charge->Receipt->unbindModel(array('hasMany' => array('ChargesReceipt')));
|
|
|
|
$this->set('tenant', $this->Contact->read(null, $id));
|
|
}
|
|
}
|
|
|
|
?>
|