From 35a4af824fcae2aed46a5683539f9192a3382f2d Mon Sep 17 00:00:00 2001 From: songchenxuan Date: Wed, 22 Dec 2021 08:50:10 +0800 Subject: [PATCH 1/8] *Finish task #46100. --- module/story/control.php | 16 ++++++++++------ module/story/view/edit.html.php | 8 ++++---- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/module/story/control.php b/module/story/control.php index e957e5dac9..20539e138a 100644 --- a/module/story/control.php +++ b/module/story/control.php @@ -669,15 +669,18 @@ class story extends control if($this->app->tab == 'project' or $this->app->tab == 'execution') { $objectID = $this->app->tab == 'project' ? $this->session->project : $this->session->execution; - $productBranches = $product->type != 'normal' ? $this->loadModel('execution')->getBranchByProduct($story->product, $objectID, 'all') : array(); - $branches = isset($productBranches[$story->product]) ? array(BRANCH_MAIN => $this->lang->branch->main) + $productBranches[$story->product] : array(); $products = $this->product->getProductPairsByProject($objectID); - $this->view->objectID = $objectID; } - else + + /* Display status of branch. */ + $branches = $this->loadModel('branch')->getList($product->id, isset($objectID) ? $objectID : 0, 'all'); + $branchOption = array(); + $branchTagOption = array(); + foreach($branches as $branchInfo) { - $branches = $product->type != 'normal' ? $this->loadModel('branch')->getPairs($product->id) : array(); + $branchOption[$branchInfo->id] = $branchInfo->name; + $branchTagOption[$branchInfo->id] = $branchInfo->name . ($branchInfo->status == 'closed' ? ' (' . $this->lang->branch->statusList['closed'] . ')' : ''); } /* Get product reviewers. */ @@ -694,7 +697,8 @@ class story extends control $this->view->product = $product; $this->view->plans = $this->loadModel('productplan')->getPairsForStory($story->product, $story->branch, 'skipParent'); $this->view->products = $products; - $this->view->branches = $branches; + $this->view->branchOption = $branchOption; + $this->view->branchTagOption = $branchTagOption; $this->view->reviewers = implode(',', $reviewerList); $this->view->reviewedReviewer = $reviewedReviewer; $this->view->productReviewers = $this->user->getPairs('noclosed|nodeleted', $reviewerList, 0, $productReviewers); diff --git a/module/story/view/edit.html.php b/module/story/view/edit.html.php index 6f222e95cd..baa1d04c68 100644 --- a/module/story/view/edit.html.php +++ b/module/story/view/edit.html.php @@ -83,7 +83,7 @@
product, "onchange='loadProduct(this.value);' class='form-control chosen control-product'");?> - type != 'normal') echo html::select('branch', $branches, $story->branch, "onchange='loadBranch();' class='form-control chosen control-branch'");?> + type != 'normal') echo html::select('branch', $branchTagOption, $story->branch, "onchange='loadBranch();' class='form-control chosen control-branch'");?>
@@ -91,7 +91,7 @@ product->branch = sprintf($lang->product->branch, $lang->product->branchName['branch']);?> -
type != 'normal') echo html::select('branch', $branches, $story->branch, "onchange='loadBranch();' class='form-control chosen control-branch'");?>
+
type != 'normal') echo html::select('branch', $branchTagOption, $story->branch, "onchange='loadBranch();' class='form-control chosen control-branch'");?>
@@ -157,11 +157,11 @@ story->stage;?> stages and $branches) + if($story->stages and $branchTagOption) { foreach($story->stages as $branch => $stage) { - if(isset($branches[$branch])) echo '

' . $branches[$branch] . html::select("stages[$branch]", $lang->story->stageList, $stage, "class='form-control chosen'") . '

'; + if(isset($branchTagOption[$branch])) echo '

' . $branchTagOption[$branch] . html::select("stages[$branch]", $lang->story->stageList, $stage, "class='form-control chosen'") . '

'; } } else From 1c8df7822a5cfc6c0f6a3ed9911709f997b20cef Mon Sep 17 00:00:00 2001 From: songchenxuan Date: Wed, 22 Dec 2021 10:48:55 +0800 Subject: [PATCH 2/8] *Finish task #46100. --- module/story/control.php | 61 ++++++++++++++++------------ module/story/view/batchedit.html.php | 4 +- 2 files changed, 36 insertions(+), 29 deletions(-) diff --git a/module/story/control.php b/module/story/control.php index 20539e138a..c03158e02e 100644 --- a/module/story/control.php +++ b/module/story/control.php @@ -776,39 +776,44 @@ class story extends control { if(!$executionID) { - $branches = $this->branch->getPairs($productID); - $product = $this->product->getByID($productID); - $branchProduct = $product->type == 'normal' ? false : true; - $modules = array($productID => $this->tree->getOptionMenu($productID, 'story', 0, array_keys($branches))); - $plans = array($productID => $this->productplan->getBranchPlanPairs($productID, '', true)); - $products = array($productID => $product); - $branches = array($productID => $branches); + $branches = $this->branch->getList($productID, $executionID, 'all'); + $branchOption = array(); + $branchTagOption = array(); + foreach($branches as $branchInfo) $branchTagOption[$branchInfo->id] = $branchInfo->name . ($branchInfo->status == 'closed' ? ' (' . $this->lang->branch->statusList['closed'] . ')' : ''); + + $product = $this->product->getByID($productID); + $branchProduct = $product->type == 'normal' ? false : true; + $modules = array($productID => $this->tree->getOptionMenu($productID, 'story', 0, array_keys($branches))); + $plans = array($productID => $this->productplan->getBranchPlanPairs($productID, '', true)); + $products = array($productID => $product); + $branchTagOption = array($productID => $branchTagOption); } else { - $modules = array(); - $branches = array(); - $execution = $this->execution->getByID($executionID); - $branchProduct = false; - $linkedProducts = $this->loadModel('product')->getProducts($executionID); + $modules = array(); + $branches = array(); + $branchTagOption = array(); + $execution = $this->execution->getByID($executionID); + $branchProduct = false; + $linkedProducts = $this->loadModel('product')->getProducts($executionID); foreach($linkedProducts as $linkedProduct) { - $branchList = $this->branch->getPairs($linkedProduct->id, '', $executionID); - $branches[$linkedProduct->id] = array(BRANCH_MAIN => $this->lang->branch->main) + $branchList; - $modules[$linkedProduct->id] = $this->tree->getOptionMenu($linkedProduct->id, 'story', 0, array_keys($branchList)); - $plans[$linkedProduct->id] = $this->productplan->getBranchPlanPairs($linkedProduct->id, array_keys($branchList), true); + $branchList = $this->branch->getList($linkedProduct->id, $executionID, 'all'); + foreach($branchList as $branchInfo) $branches[$branchInfo->id] = $branchInfo->name . ($branchInfo->status == 'closed' ? ' (' . $this->lang->branch->statusList['closed'] . ')' : ''); + + $branchTagOption[$linkedProduct->id] = array(BRANCH_MAIN => $this->lang->branch->main) + $branches; + $modules[$linkedProduct->id] = $this->tree->getOptionMenu($linkedProduct->id, 'story', 0, array_keys($branchList)); + $plans[$linkedProduct->id] = $this->productplan->getBranchPlanPairs($linkedProduct->id, array_keys($branchList), true); if(empty($plans[$linkedProduct->id])) $plans[$linkedProduct->id][0] = $plans[$linkedProduct->id]; if($linkedProduct->type != 'normal') $branchProduct = true; } - $products = $linkedProducts; } - - $this->view->title = (isset($product) ? $product->name : $execution->name) . $this->lang->colon . $this->lang->story->batchEdit; - $this->view->branches = $branches; - $this->view->modules = $modules; - $this->view->productName = isset($product) ? $product->name : ''; + $this->view->title = (isset($product) ? $product->name : $execution->name) . $this->lang->colon . $this->lang->story->batchEdit; + $this->view->branchTagOption = $branchTagOption; + $this->view->modules = $modules; + $this->view->productName = isset($product) ? $product->name : ''; } else { @@ -819,9 +824,11 @@ class story extends control $products = $this->product->getByIdList($productIdList); foreach($products as $storyProduct) { - $branchList = $this->branch->getPairs($storyProduct->id); + $branchList = array(); + $branches = $this->branch->getList($storyProduct->id, 0, 'all'); + foreach($branches as $branchInfo) $branchList[$branchInfo->id] = $branchInfo->name . ($branchInfo->status == 'closed' ? ' (' . $this->lang->branch->statusList['closed'] . ')' : ''); $branchIdList = array_keys($branchList) ? array_keys($branchList) : 0; - $branches[$storyProduct->id] = $branchList; + $branchTagOption[$storyProduct->id] = $branchList; $modules[$storyProduct->id] = $this->tree->getOptionMenu($storyProduct->id, 'story', 0, $branchIdList); if($storyProduct->type == 'normal') $modules[$storyProduct->id][0] = $modules[$storyProduct->id]; @@ -832,9 +839,9 @@ class story extends control if($storyProduct->type != 'normal') $branchProduct = true; } - $this->view->title = $this->lang->story->batchEdit; - $this->view->branches = $branches; - $this->view->modules = $modules; + $this->view->title = $this->lang->story->batchEdit; + $this->view->branchTagOption = $branchTagOption; + $this->view->modules = $modules; } /* Set ditto option for users. */ diff --git a/module/story/view/batchedit.html.php b/module/story/view/batchedit.html.php index dfda3626ff..09f99ddc88 100644 --- a/module/story/view/batchedit.html.php +++ b/module/story/view/batchedit.html.php @@ -72,8 +72,8 @@ foreach(explode(',', $showFields) as $field) '> product]->type == 'normal' ? "disabled='disabled'" : '';?> - product]->type == 'normal') $branches[$story->product] = array();?> - product], $story->branch, "class='form-control chosen' onchange='loadBranches($story->product, this.value, $storyID);' $disabled");?> + product]->type == 'normal') $branchTagOption[$story->product] = array();?> + product], $story->branch, "class='form-control chosen' onchange='loadBranches($story->product, this.value, $storyID);' $disabled");?> '> From a7258e471b80510a229d306bfb15c640e0e6812d Mon Sep 17 00:00:00 2001 From: songchenxuan Date: Wed, 22 Dec 2021 14:28:28 +0800 Subject: [PATCH 3/8] *Finish task #46100. --- module/branch/control.php | 19 +++++----- module/branch/model.php | 2 ++ module/bug/control.php | 38 ++++++++++++-------- module/bug/view/batchedit.html.php | 15 +++++--- module/bug/view/edit.html.php | 2 +- module/productplan/control.php | 18 +++++++--- module/productplan/view/batchedit.html.php | 2 +- module/productplan/view/browse.html.php | 2 +- module/productplan/view/edit.html.php | 2 +- module/story/control.php | 4 +-- module/testcase/control.php | 41 ++++++++++++---------- module/testcase/view/batchedit.html.php | 17 +++++---- module/testcase/view/edit.html.php | 2 +- 13 files changed, 99 insertions(+), 65 deletions(-) diff --git a/module/branch/control.php b/module/branch/control.php index 5eb63fae30..4f0bb89663 100644 --- a/module/branch/control.php +++ b/module/branch/control.php @@ -258,22 +258,19 @@ class branch extends control */ public function ajaxGetBranches($productID, $oldBranch = 0, $param = '', $projectID = 0) { + $param = $param ? $param : 'all'; $product = $this->loadModel('product')->getById($productID); if(empty($product) or $product->type == 'normal') die(); - $branches = $this->branch->getPairs($productID, $param); - - /* Remove unlinked branches of the project. */ - if($projectID) + $branches = $this->loadModel('branch')->getList($productID, $projectID, $param); + $branchOption = array(); + $branchTagOption = array(); + foreach($branches as $branchInfo) { - $projectProducts = $this->loadModel('project')->getBranchesByProject($projectID); - foreach($branches as $branchID => $branchName) - { - if(!isset($projectProducts[$productID][$branchID])) unset($branches[$branchID]); - } + $branchOption[$branchInfo->id] = $branchInfo->name; + $branchTagOption[$branchInfo->id] = $branchInfo->name . ($branchInfo->status == 'closed' ? ' (' . $this->lang->branch->statusList['closed'] . ')' : ''); } - - die(html::select('branch', $branches, $oldBranch, "class='form-control' onchange='loadBranch(this)'")); + die(html::select('branch', strpos($param, 'active') !== false ? $branchOption : $branchTagOption, $oldBranch, "class='form-control' onchange='loadBranch(this)'")); } /** diff --git a/module/branch/model.php b/module/branch/model.php index 4d27e1ed7e..4b1a59861d 100644 --- a/module/branch/model.php +++ b/module/branch/model.php @@ -85,6 +85,8 @@ class branchModel extends model $mainBranch->desc = sprintf($this->lang->branch->mainBranch, $this->lang->product->branchName[$product->type]); $mainBranch->order = 0; + if($productID) $product = $this->loadModel('product')->getById($productID); + if(isset($product) and $product->type == 'normal') return $branchList; return array($mainBranch) + $branchList; } diff --git a/module/bug/control.php b/module/bug/control.php index ae7ec573e1..b8d1a5fe28 100644 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -965,13 +965,17 @@ class bug extends control if($this->app->tab == 'execution' or $this->app->tab == 'project') { - $objectID = $this->app->tab == 'project' ? $bug->project : $bug->execution; - $productBranches = (isset($product->type) and $product->type != 'normal') ? $this->loadModel('execution')->getBranchByProduct($productID, $objectID, 'all') : array(); - $branches = isset($productBranches[$productID]) ? array(BRANCH_MAIN => $this->lang->branch->main) + $productBranches[$productID] : array(); + $objectID = $this->app->tab == 'project' ? $bug->project : $bug->execution; } - else + + /* Display status of branch. */ + $branches = $this->loadModel('branch')->getList($productID, isset($objectID) ? $objectID : 0, 'all'); + $branchOption = array(); + $branchTagOption = array(); + foreach($branches as $branchInfo) { - $branches = (isset($product->type) and $product->type != 'normal') ? $this->loadModel('branch')->getPairs($productID) : array(); + $branchOption[$branchInfo->id] = $branchInfo->name; + $branchTagOption[$branchInfo->id] = $branchInfo->name . ($branchInfo->status == 'closed' ? ' (' . $this->lang->branch->statusList['closed'] . ')' : ''); } $this->view->bug = $bug; @@ -984,7 +988,8 @@ class bug extends control $this->view->currentModuleID = $currentModuleID; $this->view->executions = array(0 => '') + $this->product->getExecutionPairsByProduct($bug->product, $bug->branch, 'id_desc', $bug->project); $this->view->stories = $bug->execution ? $this->story->getExecutionStoryPairs($bug->execution) : $this->story->getProductStoryPairs($bug->product, $bug->branch); - $this->view->branches = $branches; + $this->view->branchOption = $branchOption; + $this->view->branchTagOption = $branchTagOption; $this->view->tasks = $this->task->getExecutionTaskPairs($bug->execution); $this->view->testtasks = $this->loadModel('testtask')->getPairs($bug->product, $bug->execution, $bug->testtask); $this->view->users = $this->user->getPairs('nodeleted', "$bug->assignedTo,$bug->resolvedBy,$bug->closedBy,$bug->openedBy"); @@ -1053,12 +1058,17 @@ class bug extends control $plans = array('' => '', 'ditto' => $this->lang->bug->ditto) + $plans; /* Set branches and modules. */ - $branches = array(); + $branches = array(); + $branchTagOption = array(); $modules = array(); if($product->type != 'normal') { - $branches = $this->loadModel('branch')->getPairs($productID); - foreach($branches as $branchID => $branchName) + $branches = $this->loadModel('branch')->getList($productID, 0 ,'all'); + foreach($branches as $branchInfo) + { + $branchTagOption[$branchInfo->id] = $branchInfo->name . ($branchInfo->status == 'closed' ? ' (' . $this->lang->branch->statusList['closed'] . ')' : ''); + } + foreach($branchTagOption as $branchID => $branchName) { $modules[$productID][$branchID] = $this->tree->getOptionMenu($productID, 'bug', 0, $branchID); } @@ -1071,11 +1081,11 @@ class bug extends control /* Set product menu. */ $this->qa->setMenu($this->products, $productID, $branch); - $this->view->title = $product->name . $this->lang->colon . "BUG" . $this->lang->bug->batchEdit; - $this->view->position[] = html::a($this->createLink('bug', 'browse', "productID=$productID&branch=$branch"), $this->products[$productID]); - $this->view->plans = $plans; - $this->view->branches = $branches; - $this->view->modules = $modules; + $this->view->title = $product->name . $this->lang->colon . "BUG" . $this->lang->bug->batchEdit; + $this->view->position[] = html::a($this->createLink('bug', 'browse', "productID=$productID&branch=$branch"), $this->products[$productID]); + $this->view->plans = $plans; + $this->view->branchTagOption = $branchTagOption; + $this->view->modules = $modules; } /* The bugs of my. */ else diff --git a/module/bug/view/batchedit.html.php b/module/bug/view/batchedit.html.php index caad3f41c6..90affd48f8 100644 --- a/module/bug/view/batchedit.html.php +++ b/module/bug/view/batchedit.html.php @@ -76,14 +76,19 @@ if(!empty($this->config->user->moreLink)) $this->config->moreLinks["assignedTos[$bugID]"] = $this->config->user->moreLink; if(!$productID) { - $product = $this->product->getByID($bug->product); - $plans = $this->loadModel('productplan')->getPairs($bug->product, $branch); - $branches = $product->type == 'normal' ? array('' => '') : $this->loadModel('branch')->getPairs($product->id); + $branchTagOption = array(); + $product = $this->product->getByID($bug->product); + $plans = $this->loadModel('productplan')->getPairs($bug->product, $branch); + $branches = $product->type == 'normal' ? array('' => '') : $this->loadModel('branch')->getList($product->id, 0 ,'all');; + foreach($branches as $branchInfo) + { + $branchTagOption[$branchInfo->id] = $branchInfo->name . ($branchInfo->status == 'closed' ? ' (' . $this->lang->branch->statusList['closed'] . ')' : ''); + } $modules[$bug->product][0] = $this->tree->getOptionMenu($bug->product, 'bug'); if($product->type != 'normal') { - foreach($branches as $branchID => $branchName) $branches[$branchID] = '/' . $product->name . '/' . $branchName; + foreach($branchTagOption as $branchID => $branchName) $branchTagOption[$branchID] = '/' . $product->name . '/' . $branchName; $modules[$bug->product][$bug->branch] = $this->tree->getOptionMenu($bug->product, 'bug', 0, $bug->branch); } } @@ -111,7 +116,7 @@ id;?> type == 'normal') ? "disabled='disabled'" : '';?> - branch, "class='form-control chosen' $disabled onchange='setBranchRelated(this.value, $bug->product, $bug->id)'");?> + branch, "class='form-control chosen' $disabled onchange='setBranchRelated(this.value, $bug->product, $bug->id)'");?> product][$bug->branch], $bug->module, "class='form-control chosen'");?> diff --git a/module/bug/view/edit.html.php b/module/bug/view/edit.html.php index 1c1d21ae3e..6e35f16513 100644 --- a/module/bug/view/edit.html.php +++ b/module/bug/view/edit.html.php @@ -95,7 +95,7 @@ if($this->app->tab == 'project') js::set('objectID', $bug->project);
- type != 'normal') echo html::select('branch', $branches, $bug->branch, "onchange='loadBranch();' class='form-control'");?> + type != 'normal') echo html::select('branch', $branchTagOption, $bug->branch, "onchange='loadBranch();' class='form-control'");?>
diff --git a/module/productplan/control.php b/module/productplan/control.php index 3661cf7fac..a2b22d0268 100644 --- a/module/productplan/control.php +++ b/module/productplan/control.php @@ -31,10 +31,20 @@ class productplan extends control $this->product->setMenu($productID, $branch); $this->session->set('currentProductType', $product->type); - $this->view->product = $product; - $this->view->branch = $branch; - $this->view->branches = $product->type == 'normal' ? array() : $this->loadModel('branch')->getPairs($productID); - $this->view->position[] = html::a($this->createLink('product', 'browse', "productID={$productID}&branch=$branch"), $product->name); + $branches = $this->loadModel('branch')->getList($productID, 0, 'all'); + $branchOption = array(); + $branchTagOption = array(); + foreach($branches as $branchInfo) + { + $branchOption[$branchInfo->id] = $branchInfo->name; + $branchTagOption[$branchInfo->id] = $branchInfo->name . ($branchInfo->status == 'closed' ? ' (' . $this->lang->branch->statusList['closed'] . ')' : ''); + } + + $this->view->product = $product; + $this->view->branch = $branch; + $this->view->branchOption = $branchOption; + $this->view->branchTagOption = $branchTagOption; + $this->view->position[] = html::a($this->createLink('product', 'browse', "productID={$productID}&branch=$branch"), $product->name); } /** diff --git a/module/productplan/view/batchedit.html.php b/module/productplan/view/batchedit.html.php index ceb1320f8c..1ae2d1b8d5 100644 --- a/module/productplan/view/batchedit.html.php +++ b/module/productplan/view/batchedit.html.php @@ -45,7 +45,7 @@ id . html::hidden("id[$plan->id]", $plan->id);?> - id]", $branches, $plan->branch, "onchange='getConflictStories($plan->id, this.value); 'class='form-control chosen' ");?> + id]", $branchTagOption, $plan->branch, "onchange='getConflictStories($plan->id, this.value); 'class='form-control chosen' ");?> id]", $plan->title, "class='form-control'")?> diff --git a/module/productplan/view/browse.html.php b/module/productplan/view/browse.html.php index c91b87623b..0e1488ae10 100644 --- a/module/productplan/view/browse.html.php +++ b/module/productplan/view/browse.html.php @@ -115,7 +115,7 @@ ?> session->currentProductType != 'normal'):?> - branch];?> + branch];?> begin == '2030-01-01' ? $lang->productplan->future : $plan->begin;?> end == '2030-01-01' ? $lang->productplan->future : $plan->end;?> diff --git a/module/productplan/view/edit.html.php b/module/productplan/view/edit.html.php index dec563d8bd..e36e484e1b 100644 --- a/module/productplan/view/edit.html.php +++ b/module/productplan/view/edit.html.php @@ -31,7 +31,7 @@ type != 'normal'):?> product->branch;?> - branch, "onchange='getConflictStories($plan->id, this.value); 'class='form-control'");?> + branch, "onchange='getConflictStories($plan->id, this.value); 'class='form-control'");?> diff --git a/module/story/control.php b/module/story/control.php index c03158e02e..6eda829b32 100644 --- a/module/story/control.php +++ b/module/story/control.php @@ -668,8 +668,8 @@ class story extends control if($this->app->tab == 'project' or $this->app->tab == 'execution') { - $objectID = $this->app->tab == 'project' ? $this->session->project : $this->session->execution; - $products = $this->product->getProductPairsByProject($objectID); + $objectID = $this->app->tab == 'project' ? $this->session->project : $this->session->execution; + $products = $this->product->getProductPairsByProject($objectID); $this->view->objectID = $objectID; } diff --git a/module/testcase/control.php b/module/testcase/control.php index 106c116573..f0c9b2396e 100644 --- a/module/testcase/control.php +++ b/module/testcase/control.php @@ -864,18 +864,19 @@ class testcase extends control $product = $this->product->getById($productID); if($this->app->tab == 'execution' or $this->app->tab == 'project') { - $objectID = $this->app->tab == 'project' ? $case->project : $executionID; - $productBranches = (isset($product->type) and $product->type != 'normal') ? $this->execution->getBranchByProduct($productID, $objectID, 'all') : array(); - $branches = isset($productBranches[$productID]) ? $productBranches[$productID] : array(); - } - else - { - $branches = (isset($product->type) and $product->type != 'normal') ? $this->loadModel('branch')->getPairs($productID) : array(); + $objectID = $this->app->tab == 'project' ? $case->project : $executionID; } + /* Display status of branch. */ + $branches = $this->loadModel('branch')->getList($productID, isset($objectID) ? $objectID : 0, 'all'); + $branchTagOption = array(); + foreach($branches as $branchInfo) + { + $branchTagOption[$branchInfo->id] = $branchInfo->name . ($branchInfo->status == 'closed' ? ' (' . $this->lang->branch->statusList['closed'] . ')' : ''); + } $this->view->productID = $productID; $this->view->product = $product; - $this->view->branches = $branches; + $this->view->branchTagOption = $branchTagOption; $this->view->productName = $this->products[$productID]; $this->view->moduleOptionMenu = $moduleOptionMenu; $this->view->stories = $this->story->getProductStoryPairs($productID, $case->branch); @@ -959,28 +960,32 @@ class testcase extends control if($product->type != 'normal') $branchProduct = true; /* Set branches and modules. */ - $branches = array(); + $branches = array(); + $branchTagOption = array(); $modules = array(); if($product->type != 'normal') { - $branches = $this->loadModel('branch')->getPairs($productID); - + $branches = $this->loadModel('branch')->getList($productID, 0, 'all'); + foreach($branches as $branchInfo) + { + $branchTagOption[$branchInfo->id] = $branchInfo->name . ($branchInfo->status == 'closed' ? ' (' . $this->lang->branch->statusList['closed'] . ')' : ''); + } if($this->app->tab == 'project') { - $branches = $this->loadModel('branch')->getPairsByProjectProduct($this->session->project, $productID); + $branchTagOption = $this->loadModel('branch')->getPairsByProjectProduct($this->session->project, $productID); } - foreach($branches as $branchID => $branchName) $modules[$productID][$branchID] = $this->tree->getOptionMenu($productID, 'case', 0, $branchID); + foreach($branchTagOption as $branchID => $branchName) $modules[$productID][$branchID] = $this->tree->getOptionMenu($productID, 'case', 0, $branchID); } else { $modules[$productID][BRANCH_MAIN] = $this->tree->getOptionMenu($productID, 'case'); } - $this->view->branches = $branches; - $this->view->modules = $modules; - $this->view->position[] = html::a($this->createLink('testcase', 'browse', "productID=$productID"), $this->products[$productID]); - $this->view->title = $product->name . $this->lang->colon . $this->lang->testcase->batchEdit; - $this->view->product = $product; + $this->view->branchTagOption = $branchTagOption; + $this->view->modules = $modules; + $this->view->position[] = html::a($this->createLink('testcase', 'browse', "productID=$productID"), $this->products[$productID]); + $this->view->title = $product->name . $this->lang->colon . $this->lang->testcase->batchEdit; + $this->view->product = $product; } } else diff --git a/module/testcase/view/batchedit.html.php b/module/testcase/view/batchedit.html.php index cfd189d6aa..40762934a6 100644 --- a/module/testcase/view/batchedit.html.php +++ b/module/testcase/view/batchedit.html.php @@ -71,13 +71,18 @@ $caseBranch = isset($cases[$caseID]->branch) ? $cases[$caseID]->branch : 0; if(!$productID and !$cases[$caseID]->lib) { - $caseProductID = $cases[$caseID]->product; - $product = $products[$caseProductID]; - $branches = isset($branches) ? $branches : array('' => ''); + $caseProductID = $cases[$caseID]->product; + $product = $products[$caseProductID]; + $branchTagOption = isset($branches) ? $branches : array('' => ''); if($product->type != 'normal') { - $branches = isset($productBranches[$product->id]) ? $productBranches[$product->id] : $branches; - foreach($branches as $branchID => $branchName) $branches[$branchID] = '/' . $product->name . '/' . $branchName; + //$branchTagOption = isset($productBranches[$product->id]) ? $productBranches[$product->id] : $branchTagOption; + $branches = $this->loadModel('branch')->getList($product->id, 0, 'all'); + foreach($branches as $branchInfo) + { + $branchTagOption[$branchInfo->id] = $branchInfo->name . ($branchInfo->status == 'closed' ? ' (' . $this->lang->branch->statusList['closed'] . ')' : ''); + } + foreach($branchTagOption as $branchID => $branchName) $branchTagOption[$branchID] = '/' . $product->name . '/' . $branchName; } $modules[$caseProductID][$caseBranch] = $this->tree->getOptionMenu($cases[$caseID]->product, 'case', 0, $caseBranch); @@ -103,7 +108,7 @@ id;?> type == 'normal') ? "disabled='disabled'" : '';?> - type == 'normal' ? '' : $cases[$caseID]->branch, "class='form-control chosen' onchange='loadBranches($branchProductID, this.value, $caseID)', $disabled");?> + type == 'normal' ? '' : $cases[$caseID]->branch, "class='form-control chosen' onchange='loadBranches($branchProductID, this.value, $caseID)', $disabled");?> diff --git a/module/testcase/view/edit.html.php b/module/testcase/view/edit.html.php index ca6d349c47..14e52afea3 100644 --- a/module/testcase/view/edit.html.php +++ b/module/testcase/view/edit.html.php @@ -173,7 +173,7 @@
- type) and $product->type != 'normal') echo html::select('branch', $branches, $case->branch, "onchange='loadBranch();' class='form-control'");?> + type) and $product->type != 'normal') echo html::select('branch', $branchTagOption, $case->branch, "onchange='loadBranch();' class='form-control'");?>
From 055df23f69c82e7f4838fffae1ad117609693a99 Mon Sep 17 00:00:00 2001 From: songchenxuan Date: Wed, 22 Dec 2021 17:32:44 +0800 Subject: [PATCH 4/8] *Finish task #46100. --- module/testcase/view/batchedit.html.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/module/testcase/view/batchedit.html.php b/module/testcase/view/batchedit.html.php index 40762934a6..da3355dbb1 100644 --- a/module/testcase/view/batchedit.html.php +++ b/module/testcase/view/batchedit.html.php @@ -73,10 +73,9 @@ { $caseProductID = $cases[$caseID]->product; $product = $products[$caseProductID]; - $branchTagOption = isset($branches) ? $branches : array('' => ''); + $branchTagOption = array(); if($product->type != 'normal') { - //$branchTagOption = isset($productBranches[$product->id]) ? $productBranches[$product->id] : $branchTagOption; $branches = $this->loadModel('branch')->getList($product->id, 0, 'all'); foreach($branches as $branchInfo) { From c0e1f91e9a4cb720d6c145e46cc68e707b632fe2 Mon Sep 17 00:00:00 2001 From: songchenxuan Date: Thu, 23 Dec 2021 09:29:34 +0800 Subject: [PATCH 5/8] *Finish task #46100. --- module/build/control.php | 30 +++++++++++---------------- module/build/view/edit.html.php | 2 +- module/productplan/view/view.html.php | 2 +- 3 files changed, 14 insertions(+), 20 deletions(-) diff --git a/module/build/control.php b/module/build/control.php index 4dd0b32a2f..4433ef29cf 100644 --- a/module/build/control.php +++ b/module/build/control.php @@ -169,29 +169,23 @@ class build extends control $productGroups[$build->product] = $product; } - $branchGroups = $this->loadModel('project')->getBranchesByProject($build->execution); - $branchPairs = $this->loadModel('branch')->getPairs($build->product); - $products = array(); - $branches = array(); - - /* Set branches and products. */ - if($productGroups[$build->product]->type != 'normal' and isset($branchGroups[$build->product])) + /* Display status of branch. */ + $branches = $this->loadModel('branch')->getList($build->product, $build->execution, 'all'); + $branchTagOption = array(); + foreach($branches as $branchInfo) { - foreach($branchGroups[$build->product] as $branchID => $branch) - { - $branches[$branchID] = $branchPairs[$branchID]; - } + $branchTagOption[$branchInfo->id] = $branchInfo->name . ($branchInfo->status == 'closed' ? ' (' . $this->lang->branch->statusList['closed'] . ')' : ''); } foreach($productGroups as $product) $products[$product->id] = $product->name; - $this->view->title = $execution->name . $this->lang->colon . $this->lang->build->edit; - $this->view->position[] = html::a($this->createLink('execution', 'task', "executionID=$build->execution"), $execution->name); - $this->view->position[] = $this->lang->build->edit; - $this->view->product = isset($productGroups[$build->product]) ? $productGroups[$build->product] : ''; - $this->view->branches = $branches; - $this->view->executions = $executions; - $this->view->orderBy = $orderBy; + $this->view->title = $execution->name . $this->lang->colon . $this->lang->build->edit; + $this->view->position[] = html::a($this->createLink('execution', 'task', "executionID=$build->execution"), $execution->name); + $this->view->position[] = $this->lang->build->edit; + $this->view->product = isset($productGroups[$build->product]) ? $productGroups[$build->product] : ''; + $this->view->branchTagOption = $branchTagOption; + $this->view->executions = $executions; + $this->view->orderBy = $orderBy; $this->view->productGroups = $productGroups; $this->view->products = $products; diff --git a/module/build/view/edit.html.php b/module/build/view/edit.html.php index 1426cbe396..7745491568 100644 --- a/module/build/view/edit.html.php +++ b/module/build/view/edit.html.php @@ -35,7 +35,7 @@ productType != 'normal') { - echo "" . html::select('branch', $branches, $build->branch, "class='form-control chosen' $disabled"); + echo "" . html::select('branch', $branchTagOption, $build->branch, "class='form-control chosen' $disabled"); } ?> diff --git a/module/productplan/view/view.html.php b/module/productplan/view/view.html.php index 142eaa38fc..295a0f78e3 100644 --- a/module/productplan/view/view.html.php +++ b/module/productplan/view/view.html.php @@ -27,7 +27,7 @@
id;?> title;?> - type !== 'normal') echo "" . $branches[$branch] . '';?> + type !== 'normal') echo "" . $branchOption[$branch] . '';?> begin == '2030-01-01' || $plan->end == '2030-01-01') ? $lang->productplan->future : $plan->begin . '~' . $plan->end;?> From 25a2e79f43fb8c64cfefeafb01122c906b2dfc1f Mon Sep 17 00:00:00 2001 From: tianshujie Date: Thu, 23 Dec 2021 09:59:34 +0800 Subject: [PATCH 6/8] * Finish task #46242. --- module/group/lang/resource.php | 86 ++++++++------- module/kanban/control.php | 50 ++++++++- module/kanban/lang/en.php | 6 +- module/kanban/lang/zh-cn.php | 12 ++- module/kanban/model.php | 77 +++++++++---- module/kanban/view/view.html.php | 18 +++- module/kanban/view/viewarchivedcard.html.php | 102 ++++++++++++++++++ .../kanban/view/viewarchivedcolumn.html.php | 12 ++- 8 files changed, 285 insertions(+), 78 deletions(-) create mode 100644 module/kanban/view/viewarchivedcard.html.php diff --git a/module/group/lang/resource.php b/module/group/lang/resource.php index 0daa262844..7d1bb57f52 100644 --- a/module/group/lang/resource.php +++ b/module/group/lang/resource.php @@ -621,45 +621,48 @@ $lang->release->methodOrder[75] = 'notify'; /* Kanban */ $lang->resource->kanban = new stdclass(); -$lang->resource->kanban->space = 'spaceCommon'; -$lang->resource->kanban->createSpace = 'createSpace'; -$lang->resource->kanban->editSpace = 'editSpace'; -$lang->resource->kanban->closeSpace = 'closeSpace'; -$lang->resource->kanban->deleteSpace = 'deleteSpace'; -$lang->resource->kanban->sortSpace = 'sortSpace'; -$lang->resource->kanban->create = 'create'; -$lang->resource->kanban->edit = 'edit'; -$lang->resource->kanban->view = 'view'; -$lang->resource->kanban->close = 'close'; -$lang->resource->kanban->delete = 'delete'; -$lang->resource->kanban->createRegion = 'createRegion'; -$lang->resource->kanban->editRegion = 'editRegion'; -$lang->resource->kanban->sortRegion = 'sortRegion'; -$lang->resource->kanban->sortGroup = 'sortGroup'; -$lang->resource->kanban->deleteRegion = 'deleteRegion'; -$lang->resource->kanban->createLane = 'createLane'; -$lang->resource->kanban->setLane = 'setLane'; -$lang->resource->kanban->sortLane = 'sortLane'; -$lang->resource->kanban->deleteLane = 'deleteLane'; -$lang->resource->kanban->createColumn = 'createColumn'; -$lang->resource->kanban->splitColumn = 'splitColumn'; -$lang->resource->kanban->restoreColumn = 'restoreColumn'; -$lang->resource->kanban->setColumn = 'setColumn'; -$lang->resource->kanban->setWIP = 'setWIP'; -$lang->resource->kanban->sortColumn = 'sortColumn'; -$lang->resource->kanban->deleteColumn = 'deleteColumn'; -$lang->resource->kanban->createCard = 'createCard'; -$lang->resource->kanban->editCard = 'editCard'; -$lang->resource->kanban->viewCard = 'viewCard'; -$lang->resource->kanban->sortCard = 'sortCard'; -$lang->resource->kanban->archiveCard = 'archiveCard'; -$lang->resource->kanban->assigntoCard = 'assigntoCard'; -$lang->resource->kanban->copyCard = 'copyCard'; -$lang->resource->kanban->deleteCard = 'deleteCard'; -$lang->resource->kanban->moveCard = 'moveCard'; -$lang->resource->kanban->setCardColor = 'setCardColor'; -$lang->resource->kanban->laneMove = 'laneMove'; -$lang->resource->kanban->cardsSort = 'cardsSort'; +$lang->resource->kanban->space = 'spaceCommon'; +$lang->resource->kanban->createSpace = 'createSpace'; +$lang->resource->kanban->editSpace = 'editSpace'; +$lang->resource->kanban->closeSpace = 'closeSpace'; +$lang->resource->kanban->deleteSpace = 'deleteSpace'; +$lang->resource->kanban->sortSpace = 'sortSpace'; +$lang->resource->kanban->create = 'create'; +$lang->resource->kanban->edit = 'edit'; +$lang->resource->kanban->view = 'view'; +$lang->resource->kanban->close = 'close'; +$lang->resource->kanban->delete = 'delete'; +$lang->resource->kanban->createRegion = 'createRegion'; +$lang->resource->kanban->editRegion = 'editRegion'; +$lang->resource->kanban->sortRegion = 'sortRegion'; +$lang->resource->kanban->sortGroup = 'sortGroup'; +$lang->resource->kanban->deleteRegion = 'deleteRegion'; +$lang->resource->kanban->createLane = 'createLane'; +$lang->resource->kanban->setLane = 'setLane'; +$lang->resource->kanban->sortLane = 'sortLane'; +$lang->resource->kanban->deleteLane = 'deleteLane'; +$lang->resource->kanban->createColumn = 'createColumn'; +$lang->resource->kanban->splitColumn = 'splitColumn'; +$lang->resource->kanban->archiveColumn = 'archiveColumn'; +$lang->resource->kanban->restoreColumn = 'restoreColumn'; +$lang->resource->kanban->setColumn = 'setColumn'; +$lang->resource->kanban->setWIP = 'setWIP'; +$lang->resource->kanban->sortColumn = 'sortColumn'; +$lang->resource->kanban->deleteColumn = 'deleteColumn'; +$lang->resource->kanban->createCard = 'createCard'; +$lang->resource->kanban->editCard = 'editCard'; +$lang->resource->kanban->viewCard = 'viewCard'; +$lang->resource->kanban->sortCard = 'sortCard'; +$lang->resource->kanban->archiveCard = 'archiveCard'; +$lang->resource->kanban->assigntoCard = 'assigntoCard'; +//$lang->resource->kanban->copyCard = 'copyCard'; +$lang->resource->kanban->deleteCard = 'deleteCard'; +$lang->resource->kanban->moveCard = 'moveCard'; +$lang->resource->kanban->setCardColor = 'setCardColor'; +$lang->resource->kanban->laneMove = 'laneMove'; +$lang->resource->kanban->cardsSort = 'cardsSort'; +$lang->resource->kanban->viewArchivedColumn = 'viewArchivedColumn'; +$lang->resource->kanban->viewArchivedCard = 'viewArchivedCard'; $lang->kanban->methodOrder[5] = 'space'; $lang->kanban->methodOrder[10] = 'createSpace'; @@ -693,13 +696,16 @@ $lang->kanban->methodOrder[140] = 'editCard'; $lang->kanban->methodOrder[145] = 'viewCard'; $lang->kanban->methodOrder[150] = 'sortCard'; $lang->kanban->methodOrder[155] = 'archivedCard'; -$lang->kanban->methodOrder[160] = 'copyCard'; +//$lang->kanban->methodOrder[160] = 'copyCard'; $lang->kanban->methodOrder[165] = 'deleteCard'; $lang->kanban->methodOrder[170] = 'assigntoCard'; $lang->kanban->methodOrder[175] = 'moveCard'; $lang->kanban->methodOrder[180] = 'setCardColor'; $lang->kanban->methodOrder[185] = 'laneMove'; $lang->kanban->methodorder[190] = 'cardsSort'; +$lang->kanban->methodOrder[195] = 'viewArchivedColumn'; +$lang->kanban->methodorder[200] = 'viewArchivedCard'; +$lang->kanban->methodorder[205] = 'archiveColumn'; /* Execution. */ $lang->resource->execution = new stdclass(); diff --git a/module/kanban/control.php b/module/kanban/control.php index 80e5205508..0654a5717c 100644 --- a/module/kanban/control.php +++ b/module/kanban/control.php @@ -583,7 +583,7 @@ class kanban extends control */ public function viewArchivedColumn($regionID) { - $columns = $this->kanban->getColumnsByRegion($regionID); + $columns = $this->kanban->getColumnsByObject('region', $regionID, '', ''); $columnsData = array(); foreach($columns as $column) { @@ -768,6 +768,54 @@ class kanban extends control } } + /** + * View archived cards. + * + * @param int $regionID + * @access public + * @return void + */ + public function viewArchivedCard($regionID) + { + $this->view->cards = $this->kanban->getCardsByObject('region', $regionID, 1); + $this->view->users = $this->loadModel('user')->getPairs('noletter|nodeleted'); + $this->view->usersAvatar = $this->user->getAvatarPairs(); + + $this->display(); + } + + /** + * Restore a card. + * + * @param int $cardID + * @param string $confirm no|yes + * @access public + * @return void + */ + public function restoreCard($cardID, $confirm = 'no') + { + if($confirm == 'no') + { + $card = $this->kanban->getCardByID($cardID); + $column = $this->dao->select('*')->from(TABLE_KANBANCOLUMN)->where('id')->eq($card->column)->fetch(); + if($column->archived) die(js::alert(sprintf($this->lang->kanbancard->confirmRestoreTip, $column->name))); + + die(js::confirm(sprintf($this->lang->kanbancard->confirmRestore, $column->name), $this->createLink('kanban', 'restoreCard', "cardID=$cardID&confirm=yes"), '')); + } + else + { + $this->kanban->restoreCard($cardID); + + $changes = $this->kanban->restoreCard($cardID); + if(dao::isError()) die(js::error(dao::getError())); + + $actionID = $this->loadModel('action')->create('kanbancard', $cardID, 'restore'); + $this->action->logHistory($actionID, $changes); + + die(js::reload('parent')); + } + } + /** * Delete a card. * diff --git a/module/kanban/lang/en.php b/module/kanban/lang/en.php index 3db5f33945..5b337dda8f 100644 --- a/module/kanban/lang/en.php +++ b/module/kanban/lang/en.php @@ -287,8 +287,10 @@ $lang->kanbancard->deadlineAB = 'DL'; $lang->kanbancard->beginAB = 'Begin'; $lang->kanbancard->to = 'to'; -$lang->kanbancard->confirmArchive = 'Are you sure to archive this card? After archiving the card, it will be hidden from the column and you can view it in the Region - Archived.'; -$lang->kanbancard->confirmDelete = 'Are you sure to delete this card? After deleting the card, it will be deleted from the Kanban. You can only view it in the system recycle bin.'; +$lang->kanbancard->confirmArchive = 'Are you sure to archive this card? After archiving the card, it will be hidden from the column and you can view it in the Region - Archived.'; +$lang->kanbancard->confirmDelete = 'Are you sure to delete this card? After deleting the card, it will be deleted from the Kanban. You can only view it in the system recycle bin.'; +$lang->kanbancard->confirmRestore = 'Are you sure you want to restore this card? After the card is restored, the card will be restored to the "%s" Kanban column.'; +$lang->kanbancard->confirmRestoreTip = "The card's column has been archived, please restore '%s' column first."; $lang->kanbancard->priList[1] = 1; $lang->kanbancard->priList[2] = 2; diff --git a/module/kanban/lang/zh-cn.php b/module/kanban/lang/zh-cn.php index 6657b20921..099189b0eb 100644 --- a/module/kanban/lang/zh-cn.php +++ b/module/kanban/lang/zh-cn.php @@ -79,12 +79,12 @@ $lang->kanban->createColumnOnRight = '在右侧添加看板列'; $lang->kanban->accessDenied = '您无权访问该看板'; $lang->kanban->confirmDelete = '您确认删除吗?'; -$lang->kanban->aclList['extend'] = '继承空间访问权限(能访问当前空间,即可访问)'; -$lang->kanban->aclList['private'] = '私有(看板团队成员、白名单、空间负责人可访问)'; - $lang->kanban->aclGroup['open'] = '公开'; $lang->kanban->aclGroup['private'] = '私有'; +$lang->kanban->aclList['extend'] = '继承空间访问权限(能访问当前空间,即可访问)'; +$lang->kanban->aclList['private'] = '私有(看板团队成员、白名单、空间负责人可访问)'; + $lang->kanban->enableArchived['0'] = '不启用'; $lang->kanban->enableArchived['1'] = '启用'; @@ -287,8 +287,10 @@ $lang->kanbancard->deadlineAB = '截止'; $lang->kanbancard->beginAB = '开始'; $lang->kanbancard->to = '至'; -$lang->kanbancard->confirmArchive = '您确认归档该卡片吗?归档卡片后,该卡片将从列中隐藏,您可以在区域-已归档中查看。'; -$lang->kanbancard->confirmDelete = '您确认删除该卡片吗?删除卡片后,该卡片将从看板中删除,您只能通过系统回收站查看。'; +$lang->kanbancard->confirmArchive = '您确认归档该卡片吗?归档卡片后,该卡片将从列中隐藏,您可以在区域-已归档中查看。'; +$lang->kanbancard->confirmDelete = '您确认删除该卡片吗?删除卡片后,该卡片将从看板中删除,您只能通过系统回收站查看。'; +$lang->kanbancard->confirmRestore = '您确定要还原该卡片吗?还原卡片后,该卡片将还原到“%s”看板列中。'; +$lang->kanbancard->confirmRestoreTip = '该卡片所属的看板列已被归档,请先还原“%s”看板列。'; $lang->kanbancard->priList[1] = 1; $lang->kanbancard->priList[2] = 2; diff --git a/module/kanban/model.php b/module/kanban/model.php index abde9cf16f..6f95a8f41a 100644 --- a/module/kanban/model.php +++ b/module/kanban/model.php @@ -266,7 +266,7 @@ class kanbanModel extends model return false; } - $childColumns = $this->getColumnsByParent($column->parent); + $childColumns = $this->getColumnsByObject('parent', $column->parent); foreach($childColumns as $childColumn) { $limit += (int)$childColumn->limit; @@ -594,7 +594,7 @@ class kanbanModel extends model ->orderBy('order') ->fetchGroup('group'); - $actions = array('createColumn', 'copyColumn', 'editColumn', 'splitColumn', 'setWIP', 'archiveColumn', 'restoreColumn', 'deleteColumn', 'createCard', 'splitColumn'); + $actions = array('createColumn', 'editColumn', 'splitColumn', 'setWIP', 'archiveColumn', 'restoreColumn', 'deleteColumn', 'createCard', 'splitColumn'); /* Group by parent. */ $parentColumnGroup = array(); @@ -2055,6 +2055,29 @@ class kanbanModel extends model if(!dao::isError()) return common::createChanges($oldCard, $card); } + /** + * Restore a card. + * + * @param int $cardID + * @access public + * @return array + */ + public function restoreCard($cardID) + { + $oldCard = $this->getCardByID($cardID); + + $this->dao->update(TABLE_KANBANCARD) + ->set('archived')->eq(0) + ->set('archivedBy')->eq('') + ->set('archivedDate')->eq('') + ->where('id')->eq($cardID) + ->exec(); + + $card = $this->getCardByID($cardID); + + if(!dao::isError()) return common::createChanges($oldCard, $card); + } + /** * Get space by id. * @@ -2139,35 +2162,22 @@ class kanbanModel extends model } /** - * Get child columns by parent id. + * Get columns by object id. * - * @param int $parentID + * @param string $objectType + * @param int $objectID * @param string $archived * @param string $deleted * @access public * @return array */ - public function getColumnsByParent($parentID, $archived = '0', $deleted = '0') + public function getColumnsByObject($objectType = '', $objectID = 0, $archived = 0, $deleted = 0) { return $this->dao->select('*')->from(TABLE_KANBANCOLUMN) - ->where('parent')->eq($parentID) - ->andWhere('archived')->eq($archived) - ->andWhere('deleted')->eq($deleted) - ->orderBy('order') - ->fetchAll('id'); - } - - /** - * Get columns by region id. - * - * @param int $regionID - * @access public - * @return array - */ - public function getColumnsByRegion($regionID) - { - return $this->dao->select('*')->from(TABLE_KANBANCOLUMN) - ->where('region')->eq($regionID) + ->where(true) + ->beginIF($objectType)->andWhere($objectType)->eq($objectID)->fi() + ->beginIF($archived != '')->andWhere('archived')->eq($archived)->fi() + ->beginIF($deleted != '')->andWhere('deleted')->eq($deleted)->fi() ->orderBy('order') ->fetchAll('id'); } @@ -2246,6 +2256,27 @@ class kanbanModel extends model return $card; } + /** + * Get cards by object id. + * + * @param string $objectType + * @param int $objectID + * @param string $archived + * @param string $deleted + * @access public + * @return array + */ + public function getCardsByObject($objectType = '', $objectID = 0, $archived = 0, $deleted = 0) + { + return $this->dao->select('*')->from(TABLE_KANBANCARD) + ->where(true) + ->beginIF($objectType)->andWhere($objectType)->eq($objectID)->fi() + ->beginIF($archived != '')->andWhere('archived')->eq($archived)->fi() + ->beginIF($deleted != '')->andWhere('deleted')->eq($deleted)->fi() + ->orderBy('order') + ->fetchAll('id'); + } + /** * Get Kanban cards menus by execution id. * diff --git a/module/kanban/view/view.html.php b/module/kanban/view/view.html.php index 98dfef7f26..f8065e056e 100644 --- a/module/kanban/view/view.html.php +++ b/module/kanban/view/view.html.php @@ -62,10 +62,20 @@ $canCreateLane = commonModel::hasPriv('kanban', 'createLane'); - + + + + + + + +