rendered paste body function add($firm_id = null) {
if(!empty($this->data)) {
$this->cleanUpFields();
$this->Correspondence->create();
if($this->Correspondence->save($this->data)) {
$this->flash('Correspondence saved.', array('controller'=>'firms','action'=>'view', 'id'=>$this->data['Correspondence']['firm_id']));
exit();
} else {
}
}
$users = $this->Correspondence->User->generateList();
$firms = $this->Correspondence->Firm->generateList();
$this->set('types', array('Internal' => 'Internal', 'Incoming' => 'Incoming', 'Outgoing' => 'Outgoing'));
$this->set('firm_id', $firm_id);
$activeUser = $this->Session->check('activeUser') ?
$this->Session->read('activeUser') :
null;
$this->set('activeUser', $activeUser);
$this->set(compact('users', 'firms'));
}