public function validateAnaesthetic($attribute, $params)
{
$anaesthetics = Yii::app()->request->getPost('Element_OphTrOperationnote_Anaesthetic');
if ($anaesthetics['anaesthetic_type_id'] != 5) {
$complications = Yii::app()->request->getPost('OphTrOperationnote_AnaestheticComplications');
if ($attribute == 'anaesthetist_id' && empty($anaesthetics['anaesthetist_id'])) {
$this->addError('anaesthetist_id', 'Anaesthetic Given by cannot be blank');
}
if ($attribute == 'anaesthetic_delivery_id' && empty($anaesthetics['anaesthetic_delivery_id'])) {
$this->addError('anaesthetic_delivery_id', 'Anaesthetic Delivery cannot be blank');
}
if ($attribute == 'anaesthetic_complications' && (!$complications || !count($complications))) {
$this->addError('anaesthetic_complications', 'Anaesthetic Complications cannot be blank.');
}
} else {
$this->anaesthetist_id = 5;
$this->anaesthetic_delivery_id = 7;
}
}