diff --git a/module/productplan/model.php b/module/productplan/model.php index cd98b7b891..39e3feb7a1 100644 --- a/module/productplan/model.php +++ b/module/productplan/model.php @@ -143,7 +143,7 @@ class productplanModel extends model } else { - $storyPairs = $this->story->getPairs(0, $plan->id, 'estimate'); + $storyPairs = $this->story->getPairs(0, $plan->id, 'estimate', true); $plan->stories = count($storyPairs); } diff --git a/module/story/model.php b/module/story/model.php index 9538c525e5..b31f770989 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -108,17 +108,18 @@ class storyModel extends model * @param int $productID * @param int $planID * @param string $field + * @param bool $hasParent true|false * @access public * @return array */ - public function getPairs(int $productID = 0, int $planID = 0, string $field = 'title'): array + public function getPairs(int $productID = 0, int $planID = 0, string $field = 'title', bool $hasParent = false): array { return $this->dao->select("id, {$field}")->from(TABLE_STORY) ->where('deleted')->eq('0') ->beginIF($productID)->andWhere('product')->eq($productID)->fi() ->beginIF($planID) ->andWhere("CONCAT(',', `plan`, ',')")->like("%,{$planID},%") - ->andWhere("isParent")->eq('0') + ->beginIF(!$hasParent)->andWhere("isParent")->eq('0')->fi() ->fi() ->fetchPairs(); }