From 4e73e16d1a0606c418808b10739ef445aa61697d Mon Sep 17 00:00:00 2001 From: wyd621 Date: Tue, 11 Mar 2014 03:36:49 +0000 Subject: [PATCH] * finish task #1826. --- module/bug/model.php | 11 +++++++++++ module/story/control.php | 3 +-- module/story/model.php | 2 ++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/module/bug/model.php b/module/bug/model.php index b80ffbed54..e607c89bb8 100644 --- a/module/bug/model.php +++ b/module/bug/model.php @@ -77,6 +77,11 @@ class bugModel extends model $now = helper::now(); $data = fixer::input('post')->get(); $actions = array(); + + $stmt = $this->dbh->query($this->loadModel('tree')->buildMenuQuery($productID, 'bug', $startModuleID = 0)); + $moduleOwners = array(); + while($module = $stmt->fetch()) $moduleOwners[$module->id] = $module->owner; + for($i = 0; $i < $this->config->bug->batchCreate; $i++) { if(empty($data->titles[$i])) continue; @@ -94,6 +99,12 @@ class bugModel extends model $bug->os = $data->oses[$i]; $bug->browser = $data->browsers[$i]; + if(!empty($moduleOwners[$bug->module])) + { + $bug->assignedTo = $moduleOwners[$bug->module]; + $bug->assignedDate = $now; + } + $this->dao->insert(TABLE_BUG)->data($bug)->autoCheck()->batchCheck($this->config->bug->create->requiredFields, 'notempty')->exec(); $bugID = $this->dao->lastInsertID(); diff --git a/module/story/control.php b/module/story/control.php index ddd4a9c36e..9dde7dc7e1 100644 --- a/module/story/control.php +++ b/module/story/control.php @@ -434,7 +434,6 @@ class story extends control $this->story->activate($storyID); if(dao::isError()) die(js::error(dao::getError())); $actionID = $this->action->create('story', $storyID, 'Activated', $this->post->comment); - $this->action->logHistory($actionID, $changes); $this->sendmail($storyID, $actionID); if(isonlybody()) die(js::closeColorbox('parent.parent')); @@ -655,7 +654,7 @@ class story extends control foreach($allChanges as $storyID => $changes) { $actionID = $this->action->create('story', $storyID, 'Closed', htmlspecialchars($this->post->comments[$storyID]), ucfirst($this->post->closedReasons[$storyID])); - $this->action->logHistory($actionID); + $this->action->logHistory($actionID, $changes); $this->sendmail($storyID, $actionID); } } diff --git a/module/story/model.php b/module/story/model.php index ced3738f85..12d7f9763f 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -148,6 +148,7 @@ class storyModel extends model if($bugID > 0) { + $bug = new stdclass(); $bug->toStory = $storyID; $bug->status = 'closed'; $bug->resolution = 'tostory'; @@ -595,6 +596,7 @@ class storyModel extends model $oldStory = $this->getById($storyID); if($oldStory->status == 'closed') continue; + $story = new stdclass(); $story->lastEditedBy = $this->app->user->account; $story->lastEditedDate = $now; $story->closedBy = $this->app->user->account;