function beforeSave($options = array()) { // create contact's "display title" from name and surname if (isset($this->data['Contact']['kind']) && strtoupper($this->data['Contact']['kind']) == 'T' && isset($this->data['Contact']['name']) && isset($this->data['Contact']['surname'])) { $this->data['Contact']['title'] = implode(' ', Set::filter(array($this->data['Contact']['name'], $this->data['Contact']['surname']))); } return parent::beforeSave(); }
/** * __construct method * * @param mixed $id * @param mixed $table * @param mixed $ds * @access private * @return void */ function __construct($id = false, $table = null, $ds = null) { if (CakePlugin::loaded('LilInvoices')) { $this->belongsTo['Invoice'] = array('className' => 'LilInvoices.Invoice', 'foreignKey' => 'foreign_id', 'conditions' => array('Task.model' => 'Invoice')); } if (CakePlugin::loaded('LilTravelOrders')) { $this->belongsTo['TravelOrder'] = array('className' => 'LilTravelOrders.TravelOrder', 'foreignKey' => 'foreign_id', 'conditions' => array('Task.model' => 'TravelOrder')); } parent::__construct($id, $table, $ds); }