* Finish task #115134.

This commit is contained in:
sunguangming
2024-04-08 13:40:30 +08:00
parent 6da70ae1f2
commit 19cb708a28
5 changed files with 33 additions and 18 deletions
+2
View File
@@ -650,6 +650,8 @@ class mailModel extends model
if($objectType == 'story' or $objectType == 'bug') $suffix = empty($object->product) ? '' : ' - ' . $this->loadModel('product')->getById($object->product)->name;
if($objectType == 'task') $suffix = empty($object->execution) ? '' : ' - ' . $this->loadModel('execution')->getById($object->execution)->name;
if($objectType == 'story') $objectType = $object->type; // 业务需求和用户需求的邮件标题不同。
return strtoupper($objectType) . ' #' . $object->id . ' ' . $title . $suffix;
}
+19 -13
View File
@@ -1,6 +1,8 @@
<?php
$config->message->objectTypes = array();
$config->message->objectTypes['product'] = array('opened', 'edited', 'closed', 'undeleted');
if($config->enableER) $config->message->objectTypes['epic'] = array('opened', 'edited', 'commented', 'changed', 'reviewed', 'closed', 'activated', 'assigned');
if($config->URAndSR) $config->message->objectTypes['requirement'] = array('opened', 'edited', 'commented', 'changed', 'reviewed', 'closed', 'activated', 'assigned');
$config->message->objectTypes['story'] = array('opened', 'edited', 'commented', 'frombug', 'changed', 'reviewed', 'closed', 'activated', 'assigned');
$config->message->objectTypes['productplan'] = array('opened', 'edited');
$config->message->objectTypes['project'] = array('opened', 'edited', 'started', 'delayed', 'suspended', 'closed', 'activated', 'undeleted');
@@ -13,22 +15,26 @@ $config->message->objectTypes['doc'] = array('created', 'edited');
$config->message->objectTypes['kanbancard'] = array('created', 'edited', 'finished', 'activated', 'archived', 'restore', 'deleted', 'moved');
$config->message->available = array();
$config->message->available['mail']['story'] = $config->message->objectTypes['story'];
$config->message->available['mail']['task'] = $config->message->objectTypes['task'];
$config->message->available['mail']['bug'] = $config->message->objectTypes['bug'];
$config->message->available['mail']['testtask'] = array('opened', 'edited', 'closed');
$config->message->available['mail']['doc'] = $config->message->objectTypes['doc'];
$config->message->available['mail']['kanbancard'] = $config->message->objectTypes['kanbancard'];
if($config->enableER) $config->message->available['mail']['epic'] = $config->message->objectTypes['epic'];
if($config->URAndSR) $config->message->available['mail']['requirement'] = $config->message->objectTypes['requirement'];
$config->message->available['mail']['story'] = $config->message->objectTypes['story'];
$config->message->available['mail']['task'] = $config->message->objectTypes['task'];
$config->message->available['mail']['bug'] = $config->message->objectTypes['bug'];
$config->message->available['mail']['testtask'] = array('opened', 'edited', 'closed');
$config->message->available['mail']['doc'] = $config->message->objectTypes['doc'];
$config->message->available['mail']['kanbancard'] = $config->message->objectTypes['kanbancard'];
$config->message->available['webhook'] = $config->message->objectTypes;
$config->message->available['message']['bug'] = $config->message->objectTypes['bug'];
$config->message->available['message']['story'] = $config->message->objectTypes['story'];
$config->message->available['message']['task'] = $config->message->objectTypes['task'];
$config->message->available['message']['testtask'] = $config->message->objectTypes['testtask'];
$config->message->available['message']['todo'] = $config->message->objectTypes['todo'];
$config->message->available['message']['doc'] = $config->message->objectTypes['doc'];
$config->message->available['message']['kanbancard'] = $config->message->objectTypes['kanbancard'];
$config->message->available['message']['bug'] = $config->message->objectTypes['bug'];
if($config->enableER) $config->message->available['message']['epic'] = $config->message->objectTypes['epic'];
if($config->URAndSR) $config->message->available['message']['requirement'] = $config->message->objectTypes['requirement'];
$config->message->available['message']['story'] = $config->message->objectTypes['story'];
$config->message->available['message']['task'] = $config->message->objectTypes['task'];
$config->message->available['message']['testtask'] = $config->message->objectTypes['testtask'];
$config->message->available['message']['todo'] = $config->message->objectTypes['todo'];
$config->message->available['message']['doc'] = $config->message->objectTypes['doc'];
$config->message->available['message']['kanbancard'] = $config->message->objectTypes['kanbancard'];
$config->message->typeLink = array();
$config->message->typeLink['mail'] = 'mail|index';
+9 -2
View File
@@ -82,6 +82,13 @@ class messageModel extends model
$messageSetting = $this->config->message->setting;
if(is_string($messageSetting)) $messageSetting = json_decode($messageSetting, true);
/* 如果是业需和用需,则使用它们的发信配置。*/
if($objectType == 'story')
{
$story = $this->loadModel('story')->fetchByID($objectID);
$objectType = $story->type;
}
if(isset($messageSetting['mail']))
{
$actions = $messageSetting['mail']['setting'];
@@ -212,10 +219,10 @@ class messageModel extends model
if($toList == 'closed') $toList = '';
if($objectType == 'feedback' && $object->status == 'replied') $toList = ',' . $object->openedBy . ',';
if($objectType == 'story' && $actionID)
if(in_array($objectType, array('story', 'epic', 'requirement')) && $actionID)
{
$action = $this->loadModel('action')->getById($actionID);
list($toList, $ccList) = $this->loadModel($objectType)->getToAndCcList($object, $action->action);
list($toList, $ccList) = $this->loadModel('story')->getToAndCcList($object, $action->action);
$toList = $toList . $ccList;
}
+1 -1
View File
@@ -3629,7 +3629,7 @@ class storyModel extends model
$ccList = isset($story->mailto) ? str_replace(' ', '', trim($story->mailto, ',')) : '';
/* If the action is changed or reviewed, mail to the project or execution team. */
if(strtolower($actionType) == 'changed' or strtolower($actionType) == 'reviewed')
if((strtolower($actionType) == 'changed' or strtolower($actionType) == 'reviewed') && $story->type == 'story')
{
$teamMembers = $this->getTeamMembers($story->id, $actionType);
if($teamMembers)
+2 -2
View File
@@ -10,7 +10,7 @@
* @link https://www.zentao.net
*/
?>
<?php $mailTitle = 'STORY #' . $object->id . ' ' . $object->title;?>
<?php $mailTitle = strtoupper($object->type) . ' #' . $object->id . ' ' . $object->title;?>
<?php include $this->app->getModuleRoot() . 'common/view/mail.header.html.php';?>
<tr>
<td>
@@ -18,7 +18,7 @@
<tr>
<td style='padding: 10px; background-color: #F8FAFE; border: none; font-size: 14px; font-weight: 500; border-bottom: 1px solid #e5e5e5;'>
<?php $color = empty($object->color) ? '#333' : $object->color;?>
<?php echo html::a($domain . helper::createLink('story', 'view', "storyID=$object->id", 'html'), $mailTitle, '', "style='color: {$color}; text-decoration: underline;'");?>
<?php echo html::a($domain . helper::createLink($object->type, 'view', "storyID=$object->id", 'html'), $mailTitle, '', "style='color: {$color}; text-decoration: underline;'");?>
</td>
</tr>
</table>