protected function afterValidate()
{
if ($this->booking) {
if ($this->consultant_required && !$this->booking->session->consultant) {
$this->addError('consultant', 'The booked session does not have a consultant present, you must change the session or cancel the booking before making this change');
}
if ($anaesthetic = AnaestheticType::model()->findByPk($this->anaesthetic_type_id)->name) {
if (in_array($anaesthetic, array('LAC', 'LAS', 'GA')) && !$this->booking->session->anaesthetist) {
$this->addError('anaesthetist', 'The booked session does not have an anaesthetist present, you must change the session or cancel the booking before making this change');
}
if ($anaesthetic == 'GA' && !$this->booking->session->general_anaesthetic) {
$this->addError('ga', 'General anaesthetic is not available for the booked session, you must change the session or cancel the booking before making this change');
}
}
}
return parent::afterValidate();
}