diff --git a/module/message/model.php b/module/message/model.php index 72ca92a564..9312d318a5 100755 --- a/module/message/model.php +++ b/module/message/model.php @@ -114,7 +114,6 @@ class messageModel extends model $this->loadModel('webhook')->send($objectType, $objectID, $actionType, $actionID, $actor); } } - if(isset($messageSetting['message'])) { $actions = $messageSetting['message']['setting']; @@ -201,6 +200,14 @@ class messageModel extends model if(!empty($notifyPersons)) $toList = implode(',', $notifyPersons); } + if(empty($toList) and $objectType == 'task' and $object->mode == 'multi') + { + $assignedTo = $this->loadModel('task')->getTeamTaskAssignedTo($object->id); + $toList = array_filter($assignedTo, function($account){ + return $account != $this->app->user->account; + }); + $toList = implode(',', $toList); + } if($toList == 'closed') $toList = ''; if($objectType == 'feedback' and $object->status == 'replied') $toList = ',' . $object->openedBy . ','; diff --git a/module/task/model.php b/module/task/model.php index dd57730843..9bf08e1551 100755 --- a/module/task/model.php +++ b/module/task/model.php @@ -3921,8 +3921,15 @@ class taskModel extends model public function getToAndCcList($task) { /* Set toList and ccList. */ - $toList = $task->assignedTo; - $ccList = trim($task->mailto, ','); + $toList = $task->assignedTo; + $ccList = trim($task->mailto, ','); + $toTeamTaskList = ''; + if($task->mode == 'multi') + { + $toTeamTaskList = $this->getTeamTaskAssignedTo($task->id); + $toTeamTaskList = implode(',', $toTeamTaskList); + $toList = $toTeamTaskList; + } if(empty($toList)) { @@ -4339,4 +4346,19 @@ class taskModel extends model $order ++; } } + + /** + * Get teamTask assignedTo. + * + * @param int $taskID + * @access public + * @return array + */ + public function getTeamTaskAssignedTo($taskID) + { + $taskType = $this->dao->select('mode')->from(TABLE_TASK)->where('id')->eq($taskID)->fetch('mode'); + if($taskType != 'multi') return array(); + $assignedToList = $this->dao->select('account')->from(TABLE_TASKTEAM)->where('task')->eq($taskID)->fetchPairs(); + return empty($assignedToList) ? array() : array_keys($assignedToList); + } }