From 5850589edcbcc4affa454e46a4f3405c2bd9bb26 Mon Sep 17 00:00:00 2001 From: liumengyi Date: Fri, 10 Feb 2023 16:35:45 +0800 Subject: [PATCH] * Fix bug #30137. --- module/kanban/control.php | 2 +- module/productplan/model.php | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/module/kanban/control.php b/module/kanban/control.php index ad818eafd1..46fe640001 100644 --- a/module/kanban/control.php +++ b/module/kanban/control.php @@ -1216,7 +1216,7 @@ class kanban extends control $this->view->products = $productPairs; $this->view->selectedProductID = $selectedProductID; $this->view->lanePairs = $this->kanban->getLanePairsByGroup($groupID); - $this->view->plans2Imported = $this->productplan->getList($selectedProductID, 0, 'all', $pager, 'begin_desc', 'skipparent'); + $this->view->plans2Imported = $this->productplan->getList($selectedProductID, 0, 'all', $pager, 'begin_desc', 'skipparent|noproduct'); $this->view->pager = $pager; $this->view->kanbanID = $kanbanID; $this->view->regionID = $regionID; diff --git a/module/productplan/model.php b/module/productplan/model.php index c063da4ec4..f4a4ac9cb0 100644 --- a/module/productplan/model.php +++ b/module/productplan/model.php @@ -115,8 +115,9 @@ class productplanModel extends model $productplanQuery = $this->session->productplanQuery; $date = date('Y-m-d'); - $plans = $this->dao->select('*')->from(TABLE_PRODUCTPLAN)->where('product')->eq($product) - ->andWhere('deleted')->eq(0) + $plans = $this->dao->select('*')->from(TABLE_PRODUCTPLAN) + ->where('deleted')->eq(0) + ->beginIF(strpos($param, 'noproduct') === false or !empty($product))->andWhere('product')->eq($product)->fi() ->beginIF(!empty($branch) and $branch != 'all')->andWhere('branch')->eq($branch)->fi() ->beginIF(strpos(',all,undone,bySearch,review,', ",$browseType,") === false)->andWhere('status')->eq($browseType)->fi() ->beginIF($browseType == 'undone')->andWhere('status')->in('wait,doing')->fi() @@ -137,7 +138,8 @@ class productplanModel extends model { $planProjects[$planID] = $this->dao->select('t1.project,t2.name')->from(TABLE_PROJECTPRODUCT)->alias('t1') ->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project=t2.id') - ->where('t1.product')->eq($product) + ->where('1=1') + ->beginIF(strpos($param, 'noproduct') === false or !empty($product))->andWhere('product')->eq($product)->fi() ->andWhere('t2.deleted')->eq(0) ->andWhere('t1.plan')->like(",$planID,") ->andWhere('t2.type')->in('sprint,stage,kanban') @@ -147,7 +149,7 @@ class productplanModel extends model $storyCountInTable = $this->dao->select('plan,count(story) as count')->from(TABLE_PLANSTORY)->where('plan')->in($planIdList)->groupBy('plan')->fetchPairs('plan', 'count'); $product = $this->loadModel('product')->getById($product); - if($product->type == 'normal') + if(!empty($product) and $product->type == 'normal') { $storyGroups = $this->dao->select('id,plan,estimate')->from(TABLE_STORY) ->where("plan")->in($planIdList) @@ -159,7 +161,7 @@ class productplanModel extends model $parentStories = $parentBugs = $parentHour = array(); foreach($plans as $plan) { - if($product->type == 'normal') + if(!empty($product) and $product->type == 'normal') { $stories = zget($storyGroups, $plan->id, array()); $storyPairs = array();