public static function MaestroEngine::completeTask in Maestro 8.2
Same name and namespace in other branches
- 3.x src/Engine/MaestroEngine.php \Drupal\maestro\Engine\MaestroEngine::completeTask()
CompleteTask Completes the queue record by setting the status bit to true/1.
Parameters
int $queueID: The Maestro Queue ID.
int $userID: The optional userID of the individual who completed this task.
7 calls to MaestroEngine::completeTask()
- MaestroContentTypeCompleteTask::submitForm in src/
Form/ MaestroContentTypeCompleteTask.php - Form submission handler.
- MaestroInteractiveFormBase::submitForm in src/
Form/ MaestroInteractiveFormBase.php - Form submission handler.
- MaestroInteractiveTask::handleExecuteSubmit in src/
Plugin/ EngineTasks/ MaestroInteractiveTask.php - Interactive tasks, or tasks that signal themselves as requiring human interaction will have the resulting form submissions sent to their own handler for processing to determine if the task should be completed or not or to carry out any task processing…
- MaestroWebformTask::handleExecuteSubmit in modules/
maestro_webform/ src/ Plugin/ EngineTasks/ MaestroWebformTask.php - Interactive tasks, or tasks that signal themselves as requiring human interaction will have the resulting form submissions sent to their own handler for processing to determine if the task should be completed or not or to carry out any task processing…
- maestro_content_type_task_submit in ./
maestro.module - Handling the submission from a content type task. This will offload the saving from the content type task plugin.
File
- src/
Engine/ MaestroEngine.php, line 451
Class
- MaestroEngine
- Class MaestroEngine.
Namespace
Drupal\maestro\EngineCode
public static function completeTask($queueID, $userID = 0) {
$task_completion_time = time();
$queueRecord = \Drupal::entityTypeManager()
->getStorage('maestro_queue')
->load($queueID);
$queueRecord
->set('status', TASK_STATUS_SUCCESS);
$queueRecord
->set('uid', $userID);
$queueRecord
->set('completed', $task_completion_time);
$queueRecord
->save();
// Set the flag in the production assignments if it exists.
$query = \Drupal::entityQuery('maestro_production_assignments');
$query
->condition('queue_id', $queueID);
$assignmentIDs = $query
->execute();
foreach ($assignmentIDs as $assignmentID) {
$assignmentRecord = \Drupal::entityTypeManager()
->getStorage('maestro_production_assignments')
->load($assignmentID);
$assignmentRecord
->set('task_completed', 1);
$assignmentRecord
->save();
}
// If this task participates in setting of process status, set the completion time.
$task = MaestroEngine::getTemplateTaskByQueueID($queueID);
if (isset($task['participate_in_workflow_status_stage']) && $task['participate_in_workflow_status_stage'] == 1) {
// Query the maestro_process_status for the state entry.
$process_id = MaestroEngine::getProcessIdFromQueueId($queueID);
$query = \Drupal::entityQuery('maestro_process_status')
->condition('process_id', $process_id)
->condition('stage_number', $task['workflow_status_stage_number']);
$statusEntityIDs = $query
->execute();
foreach ($statusEntityIDs as $entity_id) {
$statusRecord = \Drupal::entityTypeManager()
->getStorage('maestro_process_status')
->load($entity_id);
if ($statusRecord) {
$statusRecord
->set('completed', $task_completion_time);
$statusRecord
->save();
}
}
}
}