From 35cbd8aa6e8f319a4bdf015b4c5a6c5cb00e9f74 Mon Sep 17 00:00:00 2001 From: wyd621 Date: Mon, 29 Jul 2013 16:31:48 +0800 Subject: [PATCH] * add resloveBy for build. --- module/action/model.php | 5 +++-- module/build/model.php | 14 ++++++++++---- module/build/view/create.html.php | 1 + module/build/view/edit.html.php | 1 + module/common/view/action.html.php | 2 +- 5 files changed, 16 insertions(+), 7 deletions(-) diff --git a/module/action/model.php b/module/action/model.php index 70a2f50577..c604bbdf50 100644 --- a/module/action/model.php +++ b/module/action/model.php @@ -25,17 +25,18 @@ class actionModel extends model * @param string $actionType * @param string $comment * @param string $extra the extra info of this action, according to different modules and actions, can set different extra. + * @param string $actor * @access public * @return int */ - public function create($objectType, $objectID, $actionType, $comment = '', $extra = '') + public function create($objectType, $objectID, $actionType, $comment = '', $extra = '', $actor = '') { $action = new stdclass(); $objectType = str_replace('`', '', $objectType); $action->objectType = strtolower($objectType); $action->objectID = $objectID; - $action->actor = $this->app->user->account; + $action->actor = $actor ? $actor : $this->app->user->account; $action->action = strtolower($actionType); $action->date = helper::now(); $action->comment = $comment; diff --git a/module/build/model.php b/module/build/model.php index 29d5f5a1a0..f8771c8c98 100644 --- a/module/build/model.php +++ b/module/build/model.php @@ -120,7 +120,7 @@ class buildModel extends model ->join('stories', ',') ->join('bugs', ',') ->remove('allchecker') - ->add('project', (int)$projectID)->get(); + ->add('project', (int)$projectID)->remove('resolvedBy')->get(); $this->dao->insert(TABLE_BUILD)->data($build)->autoCheck()->batchCheck($this->config->build->create->requiredFields, 'notempty')->check('name', 'unique', "product = {$build->product}")->exec(); if(!dao::isError()) { @@ -145,7 +145,7 @@ class buildModel extends model ->setDefault('bugs', '') ->join('stories', ',') ->join('bugs', ',') - ->remove('allchecker') + ->remove('allchecker,resolvedBy') ->get(); $this->dao->update(TABLE_BUILD)->data($build) ->autoCheck() @@ -172,12 +172,18 @@ class buildModel extends model $bugs = $this->dao->select('*')->from(TABLE_BUG)->where('id')->in($build->bugs)->fetchAll(); $now = helper::now(); + $resolvedPairs = array(); + foreach($this->post->bugs as $key => $bugID) + { + if(isset($_POST['resolvedBy'][$key]))$resolvedPairs[$bugID] = $this->post->resolvedBy[$key]; + } + $this->loadModel('action'); foreach($bugs as $bug) { if($bug->status == 'resolved') continue; - $bug->resolvedBy = $this->app->user->account; + $bug->resolvedBy = $resolvedPairs[$bug->id]; $bug->resolvedDate = $now; $bug->status = 'resolved'; $bug->confirmed = 1; @@ -188,7 +194,7 @@ class buildModel extends model $bug->resolution = 'fixed'; $bug->resolvedBuild = $build->name; $this->dao->update(TABLE_BUG)->data($bug)->where('id')->eq($bug->id)->exec(); - $this->action->create('bug', $bug->id, 'Resolved', '', 'fixed'); + $this->action->create('bug', $bug->id, 'Resolved', '', 'fixed', $bug->resolvedBy); } } } diff --git a/module/build/view/create.html.php b/module/build/view/create.html.php index f4d327c0b1..928db52764 100644 --- a/module/build/view/create.html.php +++ b/module/build/view/create.html.php @@ -86,6 +86,7 @@ title, '', "class='preview'");?> bug->statusList[$bug->status];?> + status == 'resolved' ? $bug->resolvedBy : html::select('resolvedBy[]', $users, $this->app->user->account, "class='w-70px'");?> diff --git a/module/build/view/edit.html.php b/module/build/view/edit.html.php index 5ec5a89d9b..e0ceb4703a 100644 --- a/module/build/view/edit.html.php +++ b/module/build/view/edit.html.php @@ -105,6 +105,7 @@ bugs . ',', ',' . $bug->id . ',') !== false) echo 'checked';?>> id);?> title, '', "class='preview'");?> bug->statusList[$bug->status];?> + status == 'resolved' ? $bug->resolvedBy : html::select('resolvedBy[]', $users, $this->app->user->account, "class='w-70px'");?> diff --git a/module/common/view/action.html.php b/module/common/view/action.html.php index 5d0faed96f..7910a153bd 100644 --- a/module/common/view/action.html.php +++ b/module/common/view/action.html.php @@ -55,7 +55,7 @@ function toggleShow(obj) } $('.changes').each(function(){ var box = $(this).parent(); - while($(box).attr('tagName').toLowerCase() != 'li') box = $(box).parent(); + while($(box).get(0).tagName.toLowerCase() != 'li') box = $(box).parent(); var switchButtonID = ($(box).find('span').find("span").attr('id')); switchChange(switchButtonID.replace('switchButton', '')); })