public function afterValidate() { if ($this->drug_id && $this->medication_drug_id) { $this->addError('drug_id', "Cannot have two different drug types in the same medication record"); } return parent::afterValidate(); }
public function afterValidate() { if (!$this->reading_id && !$this->qualitative_reading_id) { $this->addError('reading_id', 'Either a numerical reading or a qualitative reading must be specified.'); } return parent::afterValidate(); }
protected function afterValidate() { $this->getPatientMeasurement()->validate(); foreach ($this->getPatientMeasurement()->getErrors() as $attribute => $errors) { foreach ($errors as $error) { $this->addError($attribute, $error); } } parent::afterValidate(); }
/** * assignment field validation. */ public function afterValidate() { // validate any widget fields in the assignment_fields attribute foreach ($this->getAssignmentFieldDefinitions() as $i => $fld) { if (!($id = @$fld['id'])) { $this->addError('assignment_fields', 'ID required for assignment field ' . ($i + 1)); continue; } if (@$fld['type'] == 'widget') { if (!@$fld['widget_name']) { $this->addError('assignment_fields', 'Widget Name missing for ' . $id); } elseif (!is_file(\Yii::getPathOfAlias('application.modules.PatientTicketing.widgets.' . $fld['widget_name']) . '.php')) { $this->addError('assignment_fields', 'Widget with name ' . $fld['widget_name'] . ' for ' . $id . ' not defined'); } } } parent::afterValidate(); }
/** * Hashes the user password for insertion into the db. */ protected function afterValidate() { parent::afterValidate(); if (!preg_match('/^[0-9a-f]{32}$/', $this->password)) { $this->password = $this->hashPassword($this->password, $this->salt); } }
/** * Only set when for scheduled worklist entries. */ public function afterValidate() { if ($this->worklist->scheduled) { if (empty($this->when)) { $this->addError('when', $this->getAttributeLabel('when') . ' is required when the Worklist is scheduled.'); } } else { if (!empty($this->when)) { $this->addError('when', $this->getAttributeLabel('when') . ' cannot be set when the Worklist not scheduled.'); } } parent::afterValidate(); }
protected function afterValidate() { if (preg_match('/^([0-9]{1,2}).*?([0-9]{2})$/', $this->admission_time, $m)) { if ((int) $m[1] > 23 || (int) $m[2] > 59) { $this->addError('admission_time', 'Please enter a valid admission time in the 24-hour clock format'); } } return parent::afterValidate(); }