From d7a829325c909e49c60110f2bf623bb49a4ea561 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BB=94=E5=93=A5?= Date: Tue, 16 Jan 2018 14:59:22 +0800 Subject: [PATCH] * Fix Bug. --- module/bug/view/sendmail.html.php | 5 +++-- module/project/model.php | 2 +- module/report/control.php | 3 +-- module/report/js/workload.js | 4 ++-- module/report/lang/en.php | 4 ++-- module/report/lang/zh-cn.php | 4 ++-- module/report/model.php | 30 ++++++++++++++++++++------ module/report/view/workload.html.php | 2 +- module/story/view/sendmail.html.php | 5 +++-- module/task/view/sendmail.html.php | 5 +++-- module/testtask/control.php | 1 + module/testtask/view/sendmail.html.php | 3 ++- module/todo/model.php | 2 +- 13 files changed, 45 insertions(+), 25 deletions(-) diff --git a/module/bug/view/sendmail.html.php b/module/bug/view/sendmail.html.php index cb7e4f2f30..f949c6399e 100644 --- a/module/bug/view/sendmail.html.php +++ b/module/bug/view/sendmail.html.php @@ -16,8 +16,9 @@ -
color;?>'> - config->mail, 'domain', common::getSysURL()) . helper::createLink('bug', 'view', "bugID=$bug->id"), $mailTitle, '', "style='color: #333; text-decoration: underline;'");?> + + color) ? '#333' : $bug->color;?> + config->mail, 'domain', common::getSysURL()) . helper::createLink('bug', 'view', "bugID=$bug->id"), $mailTitle, '', "style='color: {$color}; text-decoration: underline;'");?>
diff --git a/module/project/model.php b/module/project/model.php index b5c7f261b1..995250acfb 100644 --- a/module/project/model.php +++ b/module/project/model.php @@ -1487,7 +1487,7 @@ class projectModel extends model { foreach($plans as $planID => $productID) { - $planStory = $this->loadModel('story')->getPlanStories($planID); + $planStory = $this->loadModel('story')->getPlanStories($planID, 'active'); if(!empty($planStory)) { $planStories = array_merge($planStories, array_keys($planStory)); diff --git a/module/report/control.php b/module/report/control.php index eeabacfdcb..b3c45f224f 100644 --- a/module/report/control.php +++ b/module/report/control.php @@ -120,7 +120,7 @@ class report extends control * @access public * @return void */ - public function workload($begin = '', $end = '', $days = 0, $workday = 0, $dept = 0, $assign = 1) + public function workload($begin = '', $end = '', $days = 0, $workday = 0, $dept = 0, $assign = 'assign') { if($_POST) { @@ -140,7 +140,6 @@ class report extends control $beginWeekDay = date('w', $begin); $begin = date('Y-m-d', $begin); $end = date('Y-m-d', $end); - $assign = empty($assign) ? 0 : 1; if(empty($workday))$workday = $this->config->project->defaultWorkhours; $diffDays = helper::diffDate($end, $begin); diff --git a/module/report/js/workload.js b/module/report/js/workload.js index 2fda97f533..469da28ebe 100644 --- a/module/report/js/workload.js +++ b/module/report/js/workload.js @@ -18,7 +18,7 @@ function changeParams(obj) { var beginarray = begin.split("-"); var begin = ''; - for(i=0 ; i < beginarray.length ; i++) begin = begin + beginarray[i]; + for(i = 0; i < beginarray.length; i++) begin = begin + beginarray[i]; } if(end.indexOf('-') != -1) { @@ -27,7 +27,7 @@ function changeParams(obj) for(i=0 ; i < endarray.length ; i++) end = end + endarray[i]; } - link = createLink('report', 'workload', 'begin=' + begin + '&end=' + end + '&days=' + days + '&workday=' + workday + '&dept=' + dept + '&assign=' + assign); + var link = createLink('report', 'workload', 'begin=' + begin + '&end=' + end + '&days=' + days + '&workday=' + workday + '&dept=' + dept + '&assign=' + assign); location.href=link; } diff --git a/module/report/lang/en.php b/module/report/lang/en.php index 67b02162f2..d7a56b7a91 100644 --- a/module/report/lang/en.php +++ b/module/report/lang/en.php @@ -31,8 +31,8 @@ $lang->report->colors[] = '008ED6'; $lang->report->colors[] = '9D080D'; $lang->report->colors[] = 'A186BE'; -$lang->report->isAssign[0] = 'Not assigned'; -$lang->report->isAssign[1] = 'Assigned'; +$lang->report->assign['noassign'] = 'Not assigned'; +$lang->report->assign['assign'] = 'Assigned'; $lang->report->singleColor[] = 'F6BD0F'; diff --git a/module/report/lang/zh-cn.php b/module/report/lang/zh-cn.php index 985f243a1d..e638c08276 100644 --- a/module/report/lang/zh-cn.php +++ b/module/report/lang/zh-cn.php @@ -31,8 +31,8 @@ $lang->report->colors[] = '008ED6'; $lang->report->colors[] = '9D080D'; $lang->report->colors[] = 'A186BE'; -$lang->report->isAssign[0] = '未指派'; -$lang->report->isAssign[1] = '已指派'; +$lang->report->assign['noassign'] = '未指派'; +$lang->report->assign['assign'] = '已指派'; $lang->report->singleColor[] = 'F6BD0F'; diff --git a/module/report/model.php b/module/report/model.php index 99230d8fb3..5ae74e5d12 100644 --- a/module/report/model.php +++ b/module/report/model.php @@ -238,18 +238,18 @@ class reportModel extends model /** * Get workload. * - * @param int $dept - * @param int $assign + * @param int $dept + * @param string $assign * * @access public * @return array */ - public function getWorkload($dept = 0, $assign = 1) + public function getWorkload($dept = 0, $assign = 'assign') { $depts = array(); if($dept) $depts = $this->loadModel('dept')->getAllChildId($dept); - if($assign == 0) + if($assign == 'noassign') { $project = $this->dao->select('id')->from(TABLE_PROJECT) ->where('deleted')->eq(0) @@ -291,7 +291,22 @@ class reportModel extends model ->andWhere('t2.deleted')->eq(0) ->andWhere('t2.status')->notin('cancel, closed, done, suspended') ->beginIF($dept)->andWhere('t3.dept')->in($depts)->fi() - ->fetchGroup('assignedTo'); + ->fetchGroup('assignedTo', 'id'); + + if(empty($tasks)) return array(); + + $parents = array(); + foreach($tasks as $user => $userTasks) + { + if($user) + { + foreach($userTasks as $task) + { + if(!empty($task->parent)) $parents[$task->parent] = $task->parent; + } + } + } + $workload = array(); foreach($tasks as $user => $userTasks) { @@ -299,11 +314,12 @@ class reportModel extends model { foreach($userTasks as $task) { + if(!empty($parents) && in_array($task->id, $parents)) continue; $workload[$user]['task'][$task->projectName]['count'] = isset($workload[$user]['task'][$task->projectName]['count']) ? $workload[$user]['task'][$task->projectName]['count'] + 1 : 1; $workload[$user]['task'][$task->projectName]['manhour'] = isset($workload[$user]['task'][$task->projectName]['manhour']) ? $workload[$user]['task'][$task->projectName]['manhour'] + $task->left : $task->left; $workload[$user]['task'][$task->projectName]['projectID'] = $task->project; - $workload[$user]['total']['count'] = isset($workload[$user]['total']['count']) ? $workload[$user]['total']['count'] + 1 : 1; - if($task->parent == 0) $workload[$user]['total']['manhour'] = isset($workload[$user]['total']['manhour']) ? $workload[$user]['total']['manhour'] + $task->left : $task->left; + $workload[$user]['total']['count'] = isset($workload[$user]['total']['count']) ? $workload[$user]['total']['count'] + 1 : 1; + $workload[$user]['total']['manhour'] = isset($workload[$user]['total']['manhour']) ? $workload[$user]['total']['manhour'] + $task->left : $task->left; } } } diff --git a/module/report/view/workload.html.php b/module/report/view/workload.html.php index 2d19d9e141..2b2bd0fd88 100644 --- a/module/report/view/workload.html.php +++ b/module/report/view/workload.html.php @@ -44,7 +44,7 @@
- report->isAssign, $assign, "class='form-control' onchange='changeParams(this)' style='width:90px'");?> + report->assign, $assign, "class='form-control' onchange='changeParams(this)' style='width:90px'");?>
report->query);?>
diff --git a/module/story/view/sendmail.html.php b/module/story/view/sendmail.html.php index a89fb3e0f3..eaf864d652 100644 --- a/module/story/view/sendmail.html.php +++ b/module/story/view/sendmail.html.php @@ -16,8 +16,9 @@ -
color;?>'> - config->mail, 'domain', common::getSysURL()) . helper::createLink('story', 'view', "storyID=$story->id"), $mailTitle, '', "style='color: #333; text-decoration: underline;'");?> + + color) ? '#333' : $story->color;?> + config->mail, 'domain', common::getSysURL()) . helper::createLink('story', 'view', "storyID=$story->id"), $mailTitle, '', "style='color: {$color}; text-decoration: underline;'");?>
diff --git a/module/task/view/sendmail.html.php b/module/task/view/sendmail.html.php index 4c29d4bbf5..acdb53ed49 100644 --- a/module/task/view/sendmail.html.php +++ b/module/task/view/sendmail.html.php @@ -16,8 +16,9 @@ -
color;?>'> - config->mail, 'domain', common::getSysURL()) . helper::createLink('task', 'view', "taskID=$task->id"), $mailTitle, '', "style='color: #333; text-decoration: underline;'");?> + + color) ? '#333' : $task->color;?> + config->mail, 'domain', common::getSysURL()) . helper::createLink('task', 'view', "taskID=$task->id"), $mailTitle, '', "style='color: {$color}; text-decoration: underline;'");?>
diff --git a/module/testtask/control.php b/module/testtask/control.php index f31feed99a..03e2e57660 100644 --- a/module/testtask/control.php +++ b/module/testtask/control.php @@ -405,6 +405,7 @@ class testtask extends control $this->view->groupBy = $groupBy; $this->view->groupByList = $groupByList; $this->view->cases = $groupCases; + $this->view->account = 'all'; $this->display(); } diff --git a/module/testtask/view/sendmail.html.php b/module/testtask/view/sendmail.html.php index 437cb4dcbc..d688899982 100644 --- a/module/testtask/view/sendmail.html.php +++ b/module/testtask/view/sendmail.html.php @@ -17,7 +17,8 @@
- config->mail, 'domain', common::getSysURL()) . helper::createLink('testtask', 'view', "testtaskID=$testtask->id"), $mailTitle, '', "style='color: #333; text-decoration: underline;'");?> + color) ? '#333' : $testtask->color;?> + config->mail, 'domain', common::getSysURL()) . helper::createLink('testtask', 'view', "testtaskID=$testtask->id"), $mailTitle, '', "style='color: {$color}; text-decoration: underline;'");?>
diff --git a/module/todo/model.php b/module/todo/model.php index 1c95418afa..37fc1ec092 100644 --- a/module/todo/model.php +++ b/module/todo/model.php @@ -552,7 +552,7 @@ class todoModel extends model ->get(); $this->dao->update(TABLE_TODO)->data($todo)->where('id')->eq((int)$todoID)->exec(); - $this->loadModel('action')->create('todo', $todoID, 'assigned', '', 'assigned'); + $this->loadModel('action')->create('todo', $todoID, 'assigned', '', $todo->assignedTo); return !dao::isError(); } }