function handle_milestone_completed($params)
{
    $milestone_id = get_form_param($params, 'objectId');
    $milestone = get_milestone($milestone_id);
    $project_name = trim($milestone['project-name']);
    $milestone_name = trim($milestone['title']);
    error_log('project name is ' . $project_name);
    error_log('milestone name is ' . $milestone_name);
    $task = find_task(['where' => json_encode(['taskTemplate.name' => ['_eq' => $milestone_name], 'checklistRevision.checklist.name' => ['_eq' => $project_name], 'checklistRevision.checklist.status' => ['_eq' => 'Active'], 'checklistRevision.status' => ['_eq' => 'Active']]), 'include' => 'taskTemplate,checklistRevision.checklist', 'orderBy' => '+checklistRevision.createdDate', 'limit' => 1]);
    if (!empty($task)) {
        update_task($task['id'], ['status' => 'Completed']);
        error_log("succeeded to update task '{$task['id']}'");
    } else {
        error_log("no task found in Process Street for milestone '{$milestone_name}' in project '{$project_name}'");
    }
    http_response_code(200);
    exit;
}
Ejemplo n.º 2
0
     login();
     break;
 case 2:
     getAllNurseTasks();
     break;
 case 3:
     getAllNurseSpecTasks();
     break;
 case 4:
     getAllAdminTasks();
     break;
 case 5:
     getAllAdminSpecTasks();
     break;
 case 6:
     find_task();
     break;
 case 7:
     getAllHospitals();
     break;
 case 8:
     addNurse();
     break;
 case 9:
     getAllNurses();
     break;
 case 10:
     addTask();
     break;
 case 11:
     accept_completion();