* finish task #2719,2729.

This commit is contained in:
wangyidong
2016-11-25 15:32:28 +08:00
parent cc1e0f2cf0
commit 7ac6afe616
25 changed files with 420 additions and 424 deletions
+2 -56
View File
@@ -385,7 +385,8 @@ class project extends control
$mails = $this->project->importBug($projectID);
if(dao::isError()) die(js::error(dao::getError()));
foreach($mails as $mail) $this->sendmail($mail->taskID, $mail->actionID);
$this->loadModel('task');
foreach($mails as $mail) $this->task->sendmail($mail->taskID, $mail->actionID);
/* Locate the browser. */
die(js::locate($this->createLink('project', 'importBug', "projectID=$projectID"), 'parent'));
@@ -1413,61 +1414,6 @@ class project extends control
}
}
/**
* Send email.
*
* @param int $taskID
* @param int $actionID
* @access public
* @return void
*/
public function sendmail($taskID, $actionID)
{
/* Reset $this->output. */
$this->clear();
/* Set toList and ccList. */
$task = $this->loadModel('task')->getById($taskID);
$projectName = $this->project->getById($task->project)->name;
$toList = $task->assignedTo;
$ccList = trim($task->mailto, ',');
if($toList == '')
{
if($ccList == '') return;
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;
}
/* Get action info. */
$action = $this->loadModel('action')->getById($actionID);
$history = $this->action->getHistory($actionID);
$action->history = isset($history[$actionID]) ? $history[$actionID] : array();
/* Create the email content. */
$this->view->task = $task;
$this->view->action = $action;
$mailContent = $this->parse($this->moduleName, 'sendmail');
/* Send emails. */
$this->loadModel('mail')->send($toList, 'TASK#' . $task->id . ' ' . $task->name . ' - ' . $projectName, $mailContent, $ccList);
if($this->mail->isError()) trigger_error(join("\n", $this->mail->getError()));
}
/**
* Manage products.
*
-32
View File
@@ -1,32 +0,0 @@
<?php
/**
* The mail file of task module of ZenTaoPMS.
*
* @copyright Copyright 2009-2015 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Yangyang Shi<shiyangyang@cnezsoft.com>
* @package task
* @version $Id$
* @link http://www.zentao.net
*/
?>
<?php $mailTitle = 'TASK #' . $task->id . ' ' . $task->name;?>
<?php include '../../common/view/mail.header.html.php';?>
<tr>
<td>
<table cellpadding='0' cellspacing='0' width='600' style='border: none; border-collapse: collapse;'>
<tr>
<td style='padding: 10px; background-color: #F8FAFE; border: none; font-size: 14px; font-weight: 500; border-bottom: 1px solid #e5e5e5;'><?php echo html::a(common::getSysURL() . $this->createLink('task', 'view', "taskID=$task->id"), $mailTitle, '', "style='color: #333;'");?></td>
</tr>
</table>
</td>
</tr>
<tr>
<td style='padding: 10px; border: none;'>
<fieldset style='border: 1px solid #e5e5e5'>
<legend style='color: #114f8e'><?php echo $lang->task->legendDesc;?></legend>
<div style='padding:5px;'><?php echo $task->desc;?></div>
</fieldset>
</td>
</tr>
<?php include '../../common/view/mail.footer.html.php';?>