/**
* Retrieves all valid OphTrOperationBooking_ScheduleOperation_PatientUnavailableReason that can be used for this
* instance (i.e. includes the current value even if its no longer active).
*
* @return OphTrOperationBooking_ScheduleOperation_PatientUnavailableReason[]
*/
public function getPatientUnavailbleReasons()
{
$criteria = new CDbCriteria();
$criteria->condition = 'enabled = true';
$criteria->order = 'display_order asc';
$reasons = OphTrOperationbooking_ScheduleOperation_PatientUnavailableReason::model()->findAll($criteria);
// just use standard list
if (!$this->reason_id) {
return $reasons;
}
$all_reasons = array();
$r_ids = array();
foreach ($reasons as $reason) {
$all_reasons[] = $reason;
$r_ids[] = $reason->id;
}
if (!in_array($this->reason_id, $r_ids)) {
$all_reasons[] = $this->reason;
}
return $all_reasons;
}