OEModule\PatientTicketing\services\PatientTicketing_QueueSetService::canAddPatientToQueueSet PHP Method

canAddPatientToQueueSet() public method

Returns true if current rules allow the patient to be added to the given queueset.
public canAddPatientToQueueSet ( Patient $patient, $queueset_id ) : boolean
$patient Patient
$queueset_id
return boolean
    public function canAddPatientToQueueSet(\Patient $patient, $queueset_id)
    {
        $tickets = models\Ticket::model()->with('current_queue')->findAllByAttributes(array('patient_id' => $patient->id));
        $q_rs = $this->getQueueSetQueues($this->read($queueset_id), false);
        $q_ids = array_map(function ($a) {
            return $a->id;
        }, $q_rs);
        foreach ($tickets as $t) {
            if (in_array($t->current_queue->id, $q_ids)) {
                return false;
            }
        }
        return true;
    }