diff --git a/module/message/model.php b/module/message/model.php index 3704dcdc99..83a55e3ebb 100644 --- a/module/message/model.php +++ b/module/message/model.php @@ -183,7 +183,7 @@ class messageModel extends model { /* Get notifiy persons. */ $notifyPersons = array(); - if(!empty($object->notify)) $notifyPersons = $this->loadModel('release')->getNotifyPersons($object->notify, $object->product, $object->build, $object->id); + if(!empty($object->notify)) $notifyPersons = $this->loadModel('release')->getNotifyPersons($object); if(!empty($notifyPersons)) $toList = implode(',', $notifyPersons); } diff --git a/module/release/lang/en.php b/module/release/lang/en.php index 0e4c7114b0..5ebeea5f34 100644 --- a/module/release/lang/en.php +++ b/module/release/lang/en.php @@ -89,3 +89,4 @@ $lang->release->notifyList['QD'] = 'QA Manager'; $lang->release->notifyList['SC'] = 'Story Creator'; $lang->release->notifyList['ET'] = "{$lang->execution->common} Team Members"; $lang->release->notifyList['PT'] = "Project Team Members"; +$lang->release->notifyList['CT'] = "Copy To"; diff --git a/module/release/lang/zh-cn.php b/module/release/lang/zh-cn.php index d0f59ad659..149a5921c2 100644 --- a/module/release/lang/zh-cn.php +++ b/module/release/lang/zh-cn.php @@ -89,3 +89,4 @@ $lang->release->notifyList['QD'] = '测试负责人'; $lang->release->notifyList['SC'] = '需求提交人'; $lang->release->notifyList['ET'] = "所在{$lang->execution->common}团队成员"; $lang->release->notifyList['PT'] = "所在项目团队成员"; +$lang->release->notifyList['CT'] = "抄送给"; diff --git a/module/release/model.php b/module/release/model.php index a1360ff42a..128917fcf9 100644 --- a/module/release/model.php +++ b/module/release/model.php @@ -281,21 +281,18 @@ class releaseModel extends model /** * Get notify persons. * - * @param string $notfiyList - * @param int $productID - * @param int $buildID - * @param int $releaseID + * @param object $release * @access public * @return array */ - public function getNotifyPersons($notifyList = '', $productID = 0, $buildID = 0, $releaseID = 0) + public function getNotifyPersons($release) { - if(empty($notifyList)) return array(); + if(empty($release->notify)) return array(); /* Init vars. */ $notifyPersons = array(); $managerFields = ''; - $notifyList = explode(',', $notifyList); + $notifyList = explode(',', $release->notify); foreach($notifyList as $notify) { @@ -303,10 +300,10 @@ class releaseModel extends model { $managerFields .= $notify . ','; } - elseif($notify == 'SC' and !empty($buildID)) + elseif($notify == 'SC' and !empty($release->build)) { - $stories = $this->dao->select('stories')->from(TABLE_BUILD)->where('id')->eq($buildID)->fetch('stories'); - $stories .= $this->dao->select('stories')->from(TABLE_RELEASE)->where('id')->eq($releaseID)->fetch('stories'); + $stories = $this->dao->select('stories')->from(TABLE_BUILD)->where('id')->eq($release->build)->fetch('stories'); + $stories .= $this->dao->select('stories')->from(TABLE_RELEASE)->where('id')->eq($release->id)->fetch('stories'); $stories = trim($stories, ','); if(empty($stories)) continue; @@ -314,7 +311,7 @@ class releaseModel extends model $openedByList = $this->dao->select('openedBy')->from(TABLE_STORY)->where('id')->in($stories)->fetchPairs(); $notifyPersons += $openedByList; } - elseif(($notify == 'ET' or $notify == 'PT') and !empty($buildID)) + elseif(($notify == 'ET' or $notify == 'PT') and !empty($release->build)) { $type = $notify == 'ET' ? 'execution' : 'project'; $members = $this->dao->select('t2.account')->from(TABLE_BUILD)->alias('t1') @@ -326,12 +323,16 @@ class releaseModel extends model $notifyPersons += $members; } + elseif($notify == 'CT' and !empty($release->mailto)) + { + $notifyPersons += explode(',', trim($release->mailto, ',')); + } } if(!empty($managerFields)) { $managerFields = trim($managerFields, ','); - $managerUsers = $this->dao->select($managerFields)->from(TABLE_PRODUCT)->where('id')->eq($productID)->fetch(); + $managerUsers = $this->dao->select($managerFields)->from(TABLE_PRODUCT)->where('id')->eq($release->product)->fetch(); foreach($managerUsers as $account) { if(!isset($notifyPersons[$account])) $notifyPersons[$account] = $account; @@ -577,7 +578,7 @@ class releaseModel extends model /* Get notifiy persons. */ $notifyPersons = array(); - if(!empty($release->notify)) $notifyPersons = $this->getNotifyPersons($release->notify, $release->product, $release->build, $release->id); + if(!empty($release->notify)) $notifyPersons = $this->getNotifyPersons($release); foreach($notifyPersons as $account) {