Ejemplo n.º 1
0
 public function beforeSave($insert)
 {
     return parent::beforeSave($insert);
 }
Ejemplo n.º 2
0
 public function beforeSave($ins)
 {
     $this->is_moderated = 2;
     if ($this->isNewRecord) {
         $this->account_id = (int) Yii::$app->user->id;
     }
     return parent::beforeSave($ins);
 }
Ejemplo n.º 3
0
 public function beforeSave($insert)
 {
     $this->is_moderated = 2;
     /*
     if($this->getScenario() != 'moderate'){
         if($this->getAttributes() != $this->getOldAttributes()){
             $this->is_moderated = 0;
         }
     }
     */
     return parent::beforeSave($insert);
 }
Ejemplo n.º 4
0
 public function beforeSave($insert)
 {
     if ($this->last_name) {
         $this->full_name = $this->last_name;
     }
     if ($this->first_name) {
         $this->full_name .= ' ' . $this->first_name;
     }
     if ($this->patronymic_name) {
         $this->full_name .= ' ' . $this->patronymic_name;
     }
     if (empty($this->full_name)) {
         $this->full_name = $this->name;
     }
     if (!empty($this->license_number)) {
         $this->license_number = mb_strtoupper($this->license_number, 'UTF-8');
     }
     return parent::beforeSave($insert);
 }
Ejemplo n.º 5
0
 /**
  * @param bool $insert
  * @return bool
  */
 public function beforeSave($insert)
 {
     if ($this->isNewRecord) {
         if ($this->getScenario() === 'client-registration') {
             $this->slug_url = '';
         } else {
             $this->is_salon = '1';
         }
     } else {
         if ($this->getScenario() == 'moderate') {
             $oldAttr = $this->getAttributes();
             foreach ($oldAttr as $attr => $value) {
                 if (!in_array($attr, $this->ModeratedAttributes)) {
                     unset($oldAttr[$attr]);
                 }
             }
             if ($this->is_moderated != Account::FLAG_MODERATE_COMPLET) {
                 $this->moderated_data = serialize($oldAttr);
                 //saved last check data
             } else {
                 $this->moderated_data = null;
                 $this->moderated_text = null;
             }
         } else {
             if ($this->is_moderated == Account::FLAG_MODERATE_CANCELLED) {
                 $modAttrCheckListAr = $this->getModeratedAttributes();
                 $oldAttr = $this->getOldAttributes();
                 $newAttr = $this->getAttributes();
                 foreach ($this->getAttributes() as $attr => $value) {
                     if (in_array($attr, $modAttrCheckListAr) && $oldAttr[$attr] != $value) {
                         $this->setAttribute('is_moderated', Account::FLAG_MODERATE_WAIT);
                         break;
                     }
                 }
             }
         }
     }
     /*
     if ($this->getScenario() === 'default') {
         if(empty($this->contract)){
             $this->contract = $this->contractText;
         }
     }
     */
     return parent::beforeSave($insert);
 }