diff --git a/module/task/model.php b/module/task/model.php index 74249c2727..c886cc1c14 100755 --- a/module/task/model.php +++ b/module/task/model.php @@ -2635,6 +2635,49 @@ class taskModel extends model echo !common::hasPriv('task', 'assignTo', $task) ? "{$assignedToText}" : $assignToHtml; } + /** + * 获取指派用户和抄送给用户列表。 + * Get toList and ccList. + * + * @param object $task + * @access public + * @return array|false + */ + public function getToAndCcList(object $task): array|false + { + /* Set toList and ccList. */ + $toList = $task->assignedTo; + $ccList = trim($task->mailto, ','); + $toTeamTaskList = ''; + if($task->mode == 'multi') + { + $toTeamTaskList = $this->getTeamMembers($task->id); + $toTeamTaskList = implode(',', $toTeamTaskList); + $toList = $toTeamTaskList; + } + + if(empty($toList)) + { + if(empty($ccList)) return false; + if(strpos($ccList, ',') === false) + { + $toList = $ccList; + $ccList = ''; + } + else + { + $commaPos = strpos($ccList, ','); + $toList = substr($ccList, 0, $commaPos); + $ccList = substr($ccList, $commaPos + 1); + } + } + elseif(strtolower($toList) == 'closed') + { + $toList = $task->finishedBy; + } + + return array($toList, $ccList); + } /** * Get task's team member pairs.