Beispiel #1
0
 public function beforeSave()
 {
     if (!$this->end_date) {
         $this->stop_reason_id = null;
     }
     return parent::beforeSave();
 }
 protected function beforeSave()
 {
     if (!parent::beforeSave() || !$this->getPatientMeasurement()->save()) {
         return false;
     }
     $this->patient_measurement_id = $this->getPatientMeasurement()->id;
     return true;
 }
 protected function beforeSave()
 {
     foreach ($this->findAll('patient_measurement_id = ?', array($this->patient_measurement_id)) as $existing) {
         if ($this->episode_id && $this->episode_id == $existing->episode_id) {
             throw new Exception("Measurement reference already exists from episode {$this->episode_id} to patient measurement {$this->patient_measurement_id}");
         }
         if ($this->event_id && $this->event_id == $existing->event_id) {
             throw new Exception("Measurement reference already exists from event {$this->event_id} to patient measurement {$this->patient_measurement_id}");
         }
         if ($this->origin && $existing->origin) {
             throw new Exception("Origin reference already exists for patient measurement {$this->patient_measurement_id}");
         }
     }
     return parent::beforeSave();
 }
Beispiel #4
0
 protected function beforeSave()
 {
     if ($this->is_automated && !is_string($this->automated_source)) {
         $this->automated_source = json_encode($this->automated_source);
     }
     return parent::beforeSave();
 }
Beispiel #5
0
 protected function beforeSave()
 {
     return parent::beforeSave();
 }
Beispiel #6
0
 /**
  * @return bool
  */
 public function beforeSave()
 {
     if ($this->subspecialty_id) {
         $this->service_subspecialty_assignment_id = ServiceSubspecialtyAssignment::model()->find('subspecialty_id=?', array($this->subspecialty_id))->id;
     }
     return parent::beforeSave();
 }
Beispiel #7
0
 public function beforeSave()
 {
     foreach (array('first_name', 'last_name', 'dob', 'title', 'primary_phone') as $property) {
         if ($randomised = $this->randomData($property)) {
             $this->{$property} = $randomised;
         }
     }
     return parent::beforeSave();
 }
Beispiel #8
0
 public function beforeSave()
 {
     switch ($this->type) {
         case 'site':
             $this->firm_id = null;
             $this->subspecialty = null;
             break;
         case 'subspecialty':
             $this->firm_id = null;
             $this->site_id = null;
             break;
         case 'firm':
             $this->subspecialty_id = null;
             $this->site_id = null;
             break;
     }
     return parent::beforeSave();
 }
Beispiel #9
0
 public function beforeSave()
 {
     if (parent::beforeSave()) {
         if ($this->isNewRecord && !$this->address_type_id) {
             // make correspondence the default address type
             $this->address_type_id = AddressType::CORRESPOND;
         }
         return true;
     }
     return false;
 }
 public function beforeSave()
 {
     $this->primary_gender = $this->primary_gender;
     return parent::beforeSave();
 }
 protected function beforeSave()
 {
     if ($this->date && !preg_match('/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/', $this->date)) {
         $this->date = date('Y-m-d', strtotime($this->date));
     }
     $this->default_admission_time = $this->setDefaultAdmissionTime($this->default_admission_time, $this->start_time);
     return parent::beforeSave();
 }