adb = $adb; } /** * Queue a task for execution. * * @param $taskId The id of the task to queue * @param $entityId The id of the crm entity the task is assiciated with. * @param $when The time after which the task should be executed. This is * an optional value with a default value of 0. */ public function queueTask($taskId, $entityId, $when=0, $taskContents = false){ $adb = $this->adb; $adb->pquery('INSERT INTO com_vtiger_workflowtask_queue (task_id, entity_id, do_after, task_contents) VALUES(?, ?, ?, ?)', array($taskId, $entityId, $when, $taskContents)); return true; } /** * Get a list of taskId/entityId pairs ready for execution. * * The method fetches task id/entity id where the when timestamp * is less than the current time when the method was called. * * @return A list of pairs of the form array(taskId, entityId) */ public function getReadyTasks(){ $adb = $this->adb; $time = time(); $result = $adb->pquery('SELECT task_id, entity_id, task_contents FROM com_vtiger_workflowtask_queue WHERE do_aftertask_id, $row->entity_id, $row->task_contents); } $adb->pquery("delete from com_vtiger_workflowtask_queue where do_after