コード例 #1
0
 public function setName()
 {
     if (!isset(Yii::app()->settings) || $this->owner instanceof X2Leads && !$this->owner->firstName && !$this->owner->lastName) {
         return;
     }
     $admin = Yii::app()->settings;
     if (!empty($admin->contactNameFormat)) {
         $str = $admin->contactNameFormat;
         $str = str_replace('firstName', $this->owner->firstName, $str);
         $str = str_replace('lastName', $this->owner->lastName, $str);
     } else {
         $str = $this->owner->firstName . ' ' . $this->owner->lastName;
     }
     if ($admin->properCaseNames) {
         $str = Formatter::ucwordsSpecific($str, array('-', "'", '.'), 'UTF-8');
     }
     $this->owner->name = $str;
 }