protected function beforeSave() { if (!empty($this->homepage)) { $this->homepage = \GO\Base\Util\Http::checkUrlForHttp($this->homepage); } if (empty($this->color)) { $this->color = "000000"; } return parent::beforeSave(); }
protected function beforeSave() { if (!empty($this->homepage)) { $this->homepage = \GO\Base\Util\Http::checkUrlForHttp($this->homepage); } $this->_autoSalutation(); if (strtolower($this->sex) == strtolower(\GO::t('female', 'addressbook'))) { $this->sex = 'F'; } $this->sex = $this->sex == 'M' || $this->sex == 'F' ? $this->sex : 'M'; //Auto create company if company_id is a String and can't be found. if (!empty($this->company_name)) { $company = Company::model()->findSingleByAttributes(array('addressbook_id' => $this->addressbook_id, 'name' => $this->company_name)); if (!$company) { $company = new Company(); $company->name = $this->company_name; $company->addressbook_id = $this->addressbook_id; $company->save(); } $this->company_id = $company->id; } $this->_prefixSocialMediaLinks(); if (empty($this->color)) { $this->color = "000000"; } return parent::beforeSave(); }