function ajaxComplete($appointmentId, $nextStationId, $fromStationId) { $app = ORDataObject::factory('Appointment', (int) $appointmentId); if ($app->get('patient_id') > 0) { $this->ajaxNextStation((int) $appointmentId, (int) $nextStationId, (int) $fromStationId); $personId = $app->get('patient_id'); $db = Celini::dbInstance(); $sql = "INSERT into routing_archive select * from routing where person_id = " . (int) $personId; $db->execute($sql); $sql = "DELETE from routing where person_id = " . (int) $personId; $db->execute($sql); } }