From d0bb42f98bf4c81a7d848fc756ac51d93b81133e Mon Sep 17 00:00:00 2001 From: "chencongzhi520@gmail.com" Date: Fri, 26 Apr 2013 08:02:28 +0000 Subject: [PATCH] * finish task#1305. --- module/project/model.php | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/module/project/model.php b/module/project/model.php index c9f7dbaa10..58d659cfd8 100644 --- a/module/project/model.php +++ b/module/project/model.php @@ -949,11 +949,28 @@ class projectModel extends model $taskID = $this->dao->lastInsertID(); if($task->story != false) $this->story->setStage($task->story); $actionID = $this->loadModel('action')->create('task', $taskID, 'Opened', ''); - $this->action->create('bug', $key, 'Totask', '', $taskID); - $this->dao->update(TABLE_BUG)->set('toTask')->eq($taskID)->where('id')->eq($key)->exec(); $mails[$key]->taskID = $taskID; $mails[$key]->actionID = $actionID; + + $this->action->create('bug', $key, 'Totask', '', $taskID); + $this->dao->update(TABLE_BUG)->set('toTask')->eq($taskID)->where('id')->eq($key)->exec(); + + if($task->assignedTo and $task->assignedTo != $bug->assignedTo) + { + $newBug = new stdClass(); + $newBug->lastEditedBy = $this->app->user->account; + $newBug->lastEditedDate = $now; + $newBug->assignedTo = $task->assignedTo; + $newBug->assignedDate = $now; + $this->dao->update(TABLE_BUG)->data($newBug)->where('id')->eq($key)->exec(); + if(dao::isError()) die(js::error(dao::getError())); + $changes = common::createChanges($bug, $newBug); + + $actionID = $this->action->create('bug', $key, 'Assigned', '', $newBug->assignedTo); + $this->action->logHistory($actionID, $changes); + } } + return $mails; }