From 03f9bca910a59e7c0c93fce1c776eaf6477fd2d7 Mon Sep 17 00:00:00 2001 From: tianshujie Date: Thu, 21 Jul 2022 08:46:07 +0800 Subject: [PATCH 1/7] * Fix bug #25465. --- module/bug/control.php | 1 + module/bug/model.php | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/module/bug/control.php b/module/bug/control.php index 23103be3ca..f7e54492da 100755 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -1147,6 +1147,7 @@ class bug extends control $assignedToList = array_filter($assignedToList); if(empty($assignedToList)) $assignedToList = $this->user->getPairs('devfirst|noclosed'); } + if($bug->status == 'closed') $assignedToList['closed'] = 'Closed'; $this->view->bug = $bug; $this->view->productID = $productID; diff --git a/module/bug/model.php b/module/bug/model.php index 80ff5ef43c..d68d6e40da 100644 --- a/module/bug/model.php +++ b/module/bug/model.php @@ -1688,7 +1688,7 @@ class bugModel extends model $query = preg_replace('/`(\w+)`/', 't1.`$1`', $query); if($type != 'bySearch' and !$this->loadModel('common')->checkField(TABLE_BUG, $type)) return array(); - $bugs = $this->dao->select('t1.*,t2.name as productName')->from(TABLE_BUG)->alias('t1') + return $this->dao->select('t1.*,t2.name as productName')->from(TABLE_BUG)->alias('t1') ->leftJoin(TABLE_PRODUCT)->alias('t2')->on('t1.product = t2.id') ->where('t1.deleted')->eq(0) ->beginIF($type == 'bySearch')->andWhere($query)->fi() @@ -1697,6 +1697,7 @@ class bugModel extends model ->beginIF($type != 'all' and $type != 'bySearch')->andWhere("t1.`$type`")->eq($account)->fi() ->beginIF($type == 'bySearch' and $moduleName == 'workBug')->andWhere("t1.assignedTo")->eq($account)->fi() ->beginIF($type == 'bySearch' and $moduleName == 'contributeBug') + ->beginIF($type == 'assignedTo' and $moduleName == 'workBug')->andWhere('t1.status')->ne('closed')->fi() ->andWhere('t1.openedBy', 1)->eq($account) ->orWhere('t1.closedBy')->eq($account) ->orWhere('t1.resolvedBy')->eq($account) @@ -1707,7 +1708,6 @@ class bugModel extends model ->beginIF($limit > 0)->limit($limit)->fi() ->page($pager) ->fetchAll(); - return $bugs ? $bugs : array(); } /** From e0537276bdb1a1eb6233d8a5b865dfdb566d5410 Mon Sep 17 00:00:00 2001 From: tianshujie Date: Thu, 21 Jul 2022 09:30:35 +0800 Subject: [PATCH 2/7] * Delete useless code. --- module/common/view/datatable.fix.html.php | 6 ----- module/datatable/control.php | 12 --------- module/execution/config.php | 22 ++--------------- module/execution/view/all.html.php | 30 +---------------------- 4 files changed, 3 insertions(+), 67 deletions(-) diff --git a/module/common/view/datatable.fix.html.php b/module/common/view/datatable.fix.html.php index 2d434fa2d0..48a26082c2 100644 --- a/module/common/view/datatable.fix.html.php +++ b/module/common/view/datatable.fix.html.php @@ -24,12 +24,6 @@ $(function() { $dropmenu.append("
  • ' data-toggle='modal' data-type='ajax'>datatable->custom?>
  • "); } - else if(typeof(from) != 'undefined') - { - - - $dropmenu.append("
  • datatable->custom?>
  • "); - } else { $dropmenu.append("
  • datatable->custom?>
  • "); diff --git a/module/datatable/control.php b/module/datatable/control.php index 1f2ba3a0c1..8c2b0c4886 100644 --- a/module/datatable/control.php +++ b/module/datatable/control.php @@ -99,18 +99,6 @@ class datatable extends control unset($cols['caseCount']); } - if($module == 'execution' and $method == 'all') - { - if($extra == 'execution' or $extra == 'project') - { - unset($cols['percent']); - unset($cols['attribute']); - unset($cols['actions']); - } - - if($extra == 'project' or $extra == 'stage') unset($cols['project']); - } - $this->view->cols = $cols; $this->view->setting = $setting; $this->display(); diff --git a/module/execution/config.php b/module/execution/config.php index a79943e81e..8f369cf79f 100644 --- a/module/execution/config.php +++ b/module/execution/config.php @@ -141,11 +141,11 @@ $config->execution->gantt->linkType['begin']['end'] = 3; $config->execution->datatable = new stdclass(); if(!isset($config->setCode) or $config->setCode == 1) { - $config->execution->datatable->defaultField = array('id', 'name', 'code', 'project', 'PM', 'status', 'progress', 'percent', 'attribute', 'begin', 'end', 'estimate', 'consumed', 'left', 'burn', 'actions'); + $config->execution->datatable->defaultField = array('id', 'name', 'code', 'project', 'PM', 'status', 'progress', 'begin', 'end', 'estimate', 'consumed', 'left', 'burn'); } else { - $config->execution->datatable->defaultField = array('id', 'name', 'project', 'PM', 'status', 'progress', 'percent', 'attribute', 'begin', 'end', 'estimate', 'consumed', 'left', 'burn', 'actions'); + $config->execution->datatable->defaultField = array('id', 'name', 'project', 'PM', 'status', 'progress', 'begin', 'end', 'estimate', 'consumed', 'left', 'burn'); } $config->execution->datatable->fieldList['id']['title'] = 'idAB'; @@ -187,18 +187,6 @@ $config->execution->datatable->fieldList['progress']['width'] = '70'; $config->execution->datatable->fieldList['progress']['required'] = 'no'; $config->execution->datatable->fieldList['progress']['sort'] = 'no'; -$config->execution->datatable->fieldList['percent']['title'] = 'percent'; -$config->execution->datatable->fieldList['percent']['fixed'] = 'no'; -$config->execution->datatable->fieldList['percent']['width'] = '85'; -$config->execution->datatable->fieldList['percent']['required'] = 'no'; -$config->execution->datatable->fieldList['percent']['sort'] = 'no'; - -$config->execution->datatable->fieldList['attribute']['title'] = 'attribute'; -$config->execution->datatable->fieldList['attribute']['fixed'] = 'no'; -$config->execution->datatable->fieldList['attribute']['width'] = '80'; -$config->execution->datatable->fieldList['attribute']['required'] = 'no'; -$config->execution->datatable->fieldList['attribute']['sort'] = 'no'; - $config->execution->datatable->fieldList['openedDate']['title'] = 'openedDate'; $config->execution->datatable->fieldList['openedDate']['fixed'] = 'no'; $config->execution->datatable->fieldList['openedDate']['width'] = '85'; @@ -249,9 +237,3 @@ $config->execution->datatable->fieldList['burn']['fixed'] = 'no'; $config->execution->datatable->fieldList['burn']['width'] = '80'; $config->execution->datatable->fieldList['burn']['required'] = 'no'; $config->execution->datatable->fieldList['burn']['sort'] = 'no'; - -$config->execution->datatable->fieldList['actions']['title'] = 'actions'; -$config->execution->datatable->fieldList['actions']['fixed'] = 'right'; -$config->execution->datatable->fieldList['actions']['width'] = '180'; -$config->execution->datatable->fieldList['actions']['required'] = 'yes'; -$config->execution->datatable->fieldList['actions']['sort'] = 'no'; diff --git a/module/execution/view/all.html.php b/module/execution/view/all.html.php index b1aa1a8181..2cca80f2ba 100644 --- a/module/execution/view/all.html.php +++ b/module/execution/view/all.html.php @@ -104,39 +104,11 @@ js::set('isCNLang', !$this->loadModel('common')->checkNotCN()) $value) - { - if($value->id == 'actions') - { - $hasActions = true; - $value->show = true; - } - } - - if(!$hasActions) - { - $data = new stdclass(); - $data->id = 'actions'; - $data->order = $value->order + 1; - $data->show = true; - $data->width = '180px'; - $data->fixed = 'right'; - $data->title = $lang->actions; - $data->sort = 'no'; - - $setting[] = $data; - } - } - foreach($setting as $key => $value) { if($value->show) { - if(!$isStage and in_array($value->id, array('percent', 'attribute', 'actions'))) continue; - if(($config->systemMode == 'classic' or ($config->systemMode == 'new' and $this->app->tab != 'execution')) and $value->id == 'project') continue; + if($config->systemMode == 'classic' and $value->id == 'project') continue; $this->datatable->printHead($value, $orderBy, $vars, $canBatchEdit); $columns ++; From 1f00ba8c032762193687a7d1c74553b0f66553cd Mon Sep 17 00:00:00 2001 From: tianshujie Date: Thu, 21 Jul 2022 09:51:50 +0800 Subject: [PATCH 3/7] * Modify the return link for the delete project method. --- module/project/control.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/module/project/control.php b/module/project/control.php index 50dd26bc59..9d8d119acf 100644 --- a/module/project/control.php +++ b/module/project/control.php @@ -1858,16 +1858,13 @@ class project extends control /* Delete the execution under the project. */ $executionIdList = $this->loadModel('execution')->getByProject($projectID); - $url = $this->createLink('project', 'browse'); - if($this->app->tab == 'program') $url = $this->createLink('program', 'browse'); - $message = $this->executeHooks($projectID); if($message) $this->lang->saveSuccess = $message; if(empty($executionIdList)) { if($this->viewType == 'json') return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess)); - return print(js::locate($url, 'parent')); + return print(js::reload('parent')); } $this->dao->update(TABLE_EXECUTION)->set('deleted')->eq(1)->where('id')->in(array_keys($executionIdList))->exec(); @@ -1877,7 +1874,7 @@ class project extends control if($this->viewType == 'json') return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess)); $this->session->set('project', ''); - return print(js::locate($url, 'parent')); + return print(js::reload('parent')); } } From f32443218cbc0161818b1d4406ddd60acfbbc783 Mon Sep 17 00:00:00 2001 From: tianshujie Date: Thu, 21 Jul 2022 09:56:25 +0800 Subject: [PATCH 4/7] * Fix bug #25461. --- module/task/model.php | 1 + 1 file changed, 1 insertion(+) diff --git a/module/task/model.php b/module/task/model.php index 857e6eef83..6e4bbfd708 100644 --- a/module/task/model.php +++ b/module/task/model.php @@ -2517,6 +2517,7 @@ class taskModel extends model ->beginIF($type == 'assignedTo' and ($this->app->rawModule == 'my' or $this->app->rawModule == 'block'))->andWhere('t2.status', true)->ne('suspended')->orWhere('t4.status')->ne('suspended')->markRight(1)->fi() ->beginIF($type != 'all' and $type != 'finishedBy' and $type != 'assignedTo')->andWhere("t1.`$type`")->eq($account)->fi() ->beginIF($type == 'assignedTo')->andWhere("(t1.assignedTo = '{$account}' or (t1.mode = 'multi' and t5.`account` = '{$account}') )")->fi() + ->beginIF($type == 'assignedTo' and $this->app->rawModule == 'my' and $this->app->rawMethod == 'work')->andWhere('t1.status')->ne('closed')->fi() ->orderBy($orderBy) ->beginIF($limit > 0)->limit($limit)->fi() ->page($pager) From e122aa3be72503b30529df2266e83c882ed4a55b Mon Sep 17 00:00:00 2001 From: tianshujie Date: Thu, 21 Jul 2022 11:11:21 +0800 Subject: [PATCH 5/7] * Fix bug #25435. --- module/testcase/control.php | 9 ++++++++- module/testcase/js/batchedit.js | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/module/testcase/control.php b/module/testcase/control.php index ce43238469..b35fe7ffdd 100644 --- a/module/testcase/control.php +++ b/module/testcase/control.php @@ -910,13 +910,20 @@ class testcase extends control $branchTagOption[$case->branch] = $case->branch == BRANCH_MAIN ? $caseBranch : ($caseBranch->name . ($caseBranch->status == 'closed' ? ' (' . $this->lang->branch->statusList['closed'] . ')' : '')); } + $moduleIdList = $case->module; + if($case->module) + { + $moduleIdList = $this->loadModel->tree->getStoryModule($case->module); + $moduleIdList = $this->tree->getAllChildID($case->module); + } + $this->view->productID = $productID; $this->view->product = $product; $this->view->products = $this->products; $this->view->branchTagOption = $branchTagOption; $this->view->productName = $this->products[$productID]; $this->view->moduleOptionMenu = $moduleOptionMenu; - $this->view->stories = $this->story->getProductStoryPairs($productID, $case->branch, 0, 'all','id_desc', 0, 'full', 'story', false); + $this->view->stories = $this->story->getProductStoryPairs($productID, $case->branch, $moduleIdList, 'all','id_desc', 0, 'full', 'story', false); } $forceNotReview = $this->testcase->forceNotReview(); if($forceNotReview) unset($this->lang->testcase->statusList['wait']); diff --git a/module/testcase/js/batchedit.js b/module/testcase/js/batchedit.js index e82c364e91..e934894af4 100644 --- a/module/testcase/js/batchedit.js +++ b/module/testcase/js/batchedit.js @@ -99,7 +99,7 @@ $(function() var id = $(this).attr('id'); var num = id.substring(5); var moduleID = $('#modules' + num).val(); - var branchID = $('#branches' + num).val(); + var branchID = typeof($('#branches' + num).val()) == 'undefined' ? 0 : $('#branches' + num).val(); var storyID = $("#story" + num).val(); var storyLink = createLink('story', 'ajaxGetProductStories', 'productID=' + productID + '&branch=' + branchID + '&moduleID=' + moduleID + '&storyID=0&onlyOption=false&status=noclosed&limit=50&type=full&hasParent=1&executionID=0&number=' + num); $.get(storyLink, function(stories) From b8124e12f492335e82412fcf6b92aaa5c7110b66 Mon Sep 17 00:00:00 2001 From: tianshujie Date: Thu, 21 Jul 2022 11:27:55 +0800 Subject: [PATCH 6/7] * Fix bug #25435. --- module/testcase/control.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/module/testcase/control.php b/module/testcase/control.php index b35fe7ffdd..3af8e4fe59 100644 --- a/module/testcase/control.php +++ b/module/testcase/control.php @@ -911,11 +911,7 @@ class testcase extends control } $moduleIdList = $case->module; - if($case->module) - { - $moduleIdList = $this->loadModel->tree->getStoryModule($case->module); - $moduleIdList = $this->tree->getAllChildID($case->module); - } + if($case->module) $moduleIdList = $this->tree->getAllChildID($case->module); $this->view->productID = $productID; $this->view->product = $product; From 68da0b31d22a1f506b5de478e3f0af7f6aeaf28e Mon Sep 17 00:00:00 2001 From: tianshujie Date: Thu, 21 Jul 2022 11:35:11 +0800 Subject: [PATCH 7/7] * Modify the return link for the delete project method. --- module/project/control.php | 9 ++++++--- module/project/model.php | 4 ++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/module/project/control.php b/module/project/control.php index 9d8d119acf..bc677940db 100644 --- a/module/project/control.php +++ b/module/project/control.php @@ -1835,16 +1835,17 @@ class project extends control * Delete a project. * * @param int $projectID - * @param string $from + * @param string $confirm + * @param string $from browse|view * @access public * @return void */ - public function delete($projectID, $confirm = 'no') + public function delete($projectID, $confirm = 'no', $from = 'browse') { if($confirm == 'no') { $project = $this->project->getByID($projectID); - return print(js::confirm(sprintf($this->lang->project->confirmDelete, $project->name), $this->createLink('project', 'delete', "projectID=$projectID&confirm=yes"))); + return print(js::confirm(sprintf($this->lang->project->confirmDelete, $project->name), $this->createLink('project', 'delete', "projectID=$projectID&confirm=yes&from=$from"))); } else { @@ -1864,6 +1865,7 @@ class project extends control if(empty($executionIdList)) { if($this->viewType == 'json') return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess)); + if($from == 'view') return print(js::locate($this->createLink('project', 'browse'), 'parent')); return print(js::reload('parent')); } @@ -1874,6 +1876,7 @@ class project extends control if($this->viewType == 'json') return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess)); $this->session->set('project', ''); + if($from == 'view') return print(js::locate($this->createLink('project', 'browse'), 'parent')); return print(js::reload('parent')); } } diff --git a/module/project/model.php b/module/project/model.php index 509bdc8618..54bc2498d5 100644 --- a/module/project/model.php +++ b/module/project/model.php @@ -2758,8 +2758,8 @@ class projectModel extends model $menu .= $this->buildFlowMenu('project', $project, 'view', 'direct'); $menu .= "
    "; - $menu .= $this->buildMenu('project', 'edit', "project=$project->id&from=view", $project, 'button', 'edit', '', '', '', '', $this->lang->edit); - $menu .= $this->buildMenu('project', 'delete', "project=$project->id", $project, 'button', 'trash', 'hiddenwin', '', '', '', $this->lang->delete); + $menu .= $this->buildMenu('project', 'edit', "project=$project->id&from=view", $project, 'button', 'edit', '', '', '', '', $this->lang->edit); + $menu .= $this->buildMenu('project', 'delete', "project=$project->id&confirm=no&from=view", $project, 'button', 'trash', 'hiddenwin', '', '', '', $this->lang->delete); return $menu; }