public function beforeSave() { if (!$this->hasMultiSelectValue('assessment', 'Other')) { $this->other = null; } return parent::beforeSave(); }
protected function beforeSave() { // Need to clear any "sided" fields if that side isn't active if ($this->eye->id != Eye::BOTH) { foreach ($this->sidedFields() as $field_suffix) { if ($this->eye->id == Eye::LEFT) { $this->{'right_' . $field_suffix} = null; } else { $this->{'left_' . $field_suffix} = null; } } } return parent::beforeSave(); }
protected function beforeSave() { return parent::beforeSave(); }
protected function beforeSave() { if ($this->anaesthetist_select == self::NONCONSULTANT) { $this->non_consultant = true; $this->no_anaesthetist = false; $this->anaesthetist_id = null; } elseif ($this->anaesthetist_select == self::NOANAESTHETIST) { $this->no_anaesthetist = true; $this->non_consultant = false; $this->anaesthetist_id = null; } else { $this->anaesthetist_id = $this->anaesthetist_select; $this->no_anaesthetist = false; $this->non_consultant = false; } return parent::beforeSave(); }
public function beforeSave() { if (in_array(Yii::app()->getController()->getAction()->id, array('create', 'update'))) { if (!$this->draft) { $this->print = 1; } } return parent::beforeSave(); }
public function beforeSave() { if (in_array(Yii::app()->getController()->getAction()->id, array('create', 'update'))) { if (!$this->draft) { $this->print = 1; $this->print_all = 1; } } foreach (array('address', 'introduction', 're', 'body', 'footer', 'cc') as $field) { $this->{$field} = trim($this->{$field}); } if (!$this->clinic_date) { $this->clinic_date = null; } return parent::beforeSave(); }
/** * Sets flags based on element properties. * * @return bool */ protected function beforeSave() { $anaesthetistRequired = array('LAC', 'LAS', 'GA'); $this->anaesthetist_required = in_array($this->anaesthetic_type->name, $anaesthetistRequired); if (!$this->status_id) { $this->status_id = 1; } if (!$this->stop_medication) { $this->stop_medication_details = null; } if (!$this->fast_track) { $this->fast_track_discussed_with_patient = null; } if (!$this->special_equipment) { $this->special_equipment_details = null; } return parent::beforeSave(); }
public function beforeSave() { !$this->witness_required && ($this->witness_name = ''); !$this->interpreter_required && ($this->interpreter_name = ''); return parent::beforeSave(); }