From dcfe09867f8f38b539ca75ea953a6884a7cec9de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E5=8D=8E=E4=BC=9F?= Date: Tue, 19 Apr 2022 15:17:50 +0800 Subject: [PATCH 1/3] *Fix bug#18898. --- module/execution/js/common.js | 2 +- module/productplan/model.php | 10 ++++++---- module/project/js/create.js | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/module/execution/js/common.js b/module/execution/js/common.js index 95c24dca12..52736ceca1 100644 --- a/module/execution/js/common.js +++ b/module/execution/js/common.js @@ -184,7 +184,7 @@ function loadPlans(product, branchID) var branchID = typeof(branchID) == 'undefined' ? 0 : branchID; var index = $(product).attr('id').replace('products', ''); - $.get(createLink('product', 'ajaxGetPlans', "productID=" + productID + '&branch=0,' + branchID + '&planID=0&fieldID&needCreate=&expired=' + (config.currentMethod == 'create' ? 'unexpired' : '') + '¶m=skipParent'), function(data) + $.get(createLink('product', 'ajaxGetPlans', "productID=" + productID + '&branch=0,' + branchID + '&planID=0&fieldID&needCreate=&expired=noclosed|' + (config.currentMethod == 'create' ? 'unexpired' : '') + '¶m=skipParent'), function(data) { if(data) { diff --git a/module/productplan/model.php b/module/productplan/model.php index 2e0ebb32f3..1be30ba3a1 100644 --- a/module/productplan/model.php +++ b/module/productplan/model.php @@ -181,12 +181,12 @@ class productplanModel extends model * * @param array|int $product * @param int|string|array $branch - * @param string $expired + * @param string $param unexpired|noclosed * @param bool $skipParent * @access public * @return array */ - public function getPairs($product = 0, $branch = '', $expired = '', $skipParent = false) + public function getPairs($product = 0, $branch = '', $param = '', $skipParent = false) { $date = date('Y-m-d'); $plans = $this->dao->select('t1.id,t1.title,t1.parent,t1.begin,t1.end,t2.name as branchName,t3.type as productType')->from(TABLE_PRODUCTPLAN)->alias('t1') @@ -195,7 +195,8 @@ class productplanModel extends model ->where('t1.product')->in($product) ->andWhere('t1.deleted')->eq(0) ->beginIF($branch !== '')->andWhere('t1.branch')->in($branch)->fi() - ->beginIF($expired == 'unexpired')->andWhere('t1.end')->ge($date)->fi() + ->beginIF(strpos($param, 'unexpired') !== false)->andWhere('t1.end')->ge($date)->fi() + ->beginIF(strpos($param, 'noclosed') !== false)->andWhere('t1.status')->ne('closed')->fi() ->orderBy('t1.begin desc') ->fetchAll('id'); @@ -223,7 +224,7 @@ class productplanModel extends model * * @param array|int $product * @param int $branch - * @param string $param skipParent|withMainPlan|unexpired + * @param string $param skipParent|withMainPlan|unexpired|noclosed * @access public * @return array */ @@ -236,6 +237,7 @@ class productplanModel extends model ->where('product')->in($product) ->andWhere('deleted')->eq(0) ->beginIF(strpos($param, 'unexpired') !== false)->andWhere('end')->ge($date)->fi() + ->beginIF(strpos($param, 'noclosed') !== false)->andWhere('status')->ne('closed')->fi() ->beginIF($branch !== 'all' or $branch !== '')->andWhere("branch")->in($branch)->fi() ->orderBy('begin desc') ->fetchAll('id'); diff --git a/module/project/js/create.js b/module/project/js/create.js index 048c9456a2..fd27145dcd 100644 --- a/module/project/js/create.js +++ b/module/project/js/create.js @@ -224,7 +224,7 @@ function loadPlans(product, branchID) if(productID != 0) { - $.get(createLink('product', 'ajaxGetPlans', "productID=" + productID + '&branch=0,' + branchID + '&planID=0&fieldID&needCreate=&expired=unexpired¶m=skipParent'), function(data) + $.get(createLink('product', 'ajaxGetPlans', "productID=" + productID + '&branch=0,' + branchID + '&planID=0&fieldID&needCreate=&expired=unexpired|noclosed¶m=skipParent'), function(data) { if(data) { From bce4e3267b4d91bdb61443f308ef856a6e2a33c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E5=8D=8E=E4=BC=9F?= Date: Tue, 19 Apr 2022 15:27:58 +0800 Subject: [PATCH 2/3] * Fix bug #18898. --- module/project/control.php | 2 +- module/story/control.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/module/project/control.php b/module/project/control.php index e687df1e20..0182096061 100644 --- a/module/project/control.php +++ b/module/project/control.php @@ -480,7 +480,7 @@ class project extends control $products = $this->product->getProducts($copyProjectID); foreach($products as $product) { - $productPlans[$product->id] = $this->loadModel('productplan')->getPairs($product->id); + $productPlans[$product->id] = $this->loadModel('productplan')->getPairs($product->id, '','noclosed'); } } diff --git a/module/story/control.php b/module/story/control.php index 1652a7d852..e14c548a59 100644 --- a/module/story/control.php +++ b/module/story/control.php @@ -347,7 +347,7 @@ class story extends control $this->view->users = $users; $this->view->moduleID = $moduleID ? $moduleID : (int)$this->cookie->lastStoryModule; $this->view->moduleOptionMenu = $moduleOptionMenu; - $this->view->plans = str_replace('2030-01-01', $this->lang->story->undetermined, $this->loadModel('productplan')->getPairsForStory($productID, $branch, 'skipParent|unexpired')); + $this->view->plans = str_replace('2030-01-01', $this->lang->story->undetermined, $this->loadModel('productplan')->getPairsForStory($productID, $branch, 'skipParent|unexpired|noclosed')); $this->view->planID = $planID; $this->view->source = $source; $this->view->sourceNote = $sourceNote; @@ -536,7 +536,7 @@ class story extends control } $this->view->titles = $titles; } - $plans = $this->loadModel('productplan')->getPairsForStory($productID, ($branch === 'all' or !in_array($branch, array_keys($branches))) ? 0 : $branch, 'skipParent|unexpired'); + $plans = $this->loadModel('productplan')->getPairsForStory($productID, ($branch === 'all' or !in_array($branch, array_keys($branches))) ? 0 : $branch, 'skipParent|unexpired|noclosed'); $plans['ditto'] = $this->lang->story->ditto; $priList = (array)$this->lang->story->priList; From 4464536c1fd146f11cc1871849d1444adc89d874 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E5=8D=8E=E4=BC=9F?= Date: Tue, 19 Apr 2022 07:34:10 +0000 Subject: [PATCH 3/3] Update control.php --- module/project/control.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/project/control.php b/module/project/control.php index 0182096061..e46b59976d 100644 --- a/module/project/control.php +++ b/module/project/control.php @@ -480,7 +480,7 @@ class project extends control $products = $this->product->getProducts($copyProjectID); foreach($products as $product) { - $productPlans[$product->id] = $this->loadModel('productplan')->getPairs($product->id, '','noclosed'); + $productPlans[$product->id] = $this->loadModel('productplan')->getPairs($product->id, '', 'noclosed'); } }