Active Collab notify user when create , close or reopen task using API

不打扰是莪最后的温柔 提交于 2019-12-24 01:18:06

问题


I have created task using Active Collab API also working with close task and reopen task using API. Now if I create or close or reopen task then want to notify user but I don't know how to do this using Active Collab API.

Below is my code for create task , close task and reopen task.

/* create task using API */

try {
    $res = API::call('projects/60/tasks/add', null, array(
    'task[name]' => $_POST['name'],
    'task[body]' => $_POST['message'],
    'task[priority]' => $priority,  
    'task[due_on]' => $date,
    'task[assignee_id]' => 21,      
    ));

    $GLOBALS['$mytask'] = $res['task_id'];      
    $GLOBALS['$myValue'] = $res['permalink']; 
    echo $GLOBALS['$myValue']."+=";  
    echo $GLOBALS['$mytask'];
    //echo 'Ticket Created Successfully.';  


} catch(AppException $e) {
  print $e->getMessage() . '<br><br>';
  // var_dump($e->getServerResponse()); (need more info?)
}

/*close task using API */

try {

    $res = API::call('projects/60/tasks/200/complete', null, array(
    'submitted' => 'submitted',     
    ));

    echo 'Ticket Updated Successfully.';        
} catch(AppException $e) {
  print $e->getMessage() . '<br><br>';
}

/* Reopen task using API*/

try {
    $res = API::call('projects/60/tasks/200/reopen', null, array(
    'task[body]' => $_POST['message'],
    'submitted' => 'submitted',     
    ));
    echo 'Ticket Updated Successfully.';        
} catch(AppException $e) {
  print $e->getMessage() . '<br><br>';
}

What I need is to notify user when create or close or reopen task.For that what I need to change or add in above code?

And I also want to send mail to user who is responsible for this task(assign user).

I hope someone know the answer and may be someone who is Active Collab developer (Ilija) will help me to solve my problem.

Thanks in Advance.


回答1:


Active Collab 4 has its own logic when sending emails. When you create a task, all assignees and subscribers will receive a notification. When you complete or reopen a task, system will also notify all subscribers. Note that person who performs the action is not notified (it's redundant to notify you about something that you did).

That being said, I feel that you should and notifications to your PHP code, instead of relying on Active Collab to send notifications for you. That way you control the behavior, even when Active Collab changes (for example, version 5 does not notify subscribers that tasks are completed or reopened, you need to leave a comment to do that).



来源:https://stackoverflow.com/questions/36997075/active-collab-notify-user-when-create-close-or-reopen-task-using-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!