From 97ab0099ecdf129bc1926efa9d3d740a557d1df2 Mon Sep 17 00:00:00 2001 From: xieqiyu Date: Wed, 18 Sep 2024 15:04:11 +0800 Subject: [PATCH] * [bug#48352] Hidden the button batch create story when product is empty. --- module/execution/control.php | 1 + module/execution/ui/story.html.php | 19 +++++++++++-------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/module/execution/control.php b/module/execution/control.php index 5b86378ab9..0e809eebd0 100644 --- a/module/execution/control.php +++ b/module/execution/control.php @@ -479,6 +479,7 @@ class execution extends control $this->executionZen->assignCountForStory($executionID, $stories, $storyType); $this->executionZen->assignRelationForStory($execution, $products, $productID, $type, $storyType, $param, $orderBy, $pager); + $this->view->productID = $productID; $this->view->project = $project; $this->view->linkedProductCount = count($products); $this->display(); diff --git a/module/execution/ui/story.html.php b/module/execution/ui/story.html.php index d9338dda23..71b84d4942 100644 --- a/module/execution/ui/story.html.php +++ b/module/execution/ui/story.html.php @@ -132,14 +132,17 @@ if(in_array($execution->attribute, array('mix', 'request', 'design')) || !$execu if($canOpreate['batchCreateEpic']) $batchItems[] = array('text' => $lang->ERCommon, 'url' => $batchCreateEpicLink); } -if(count($batchItems) > 1) +if($productID > 0) { - $createItems[] = array('text' => $lang->story->batchCreate, 'items' => $batchItems); -} -else -{ - $batchItems[0]['text'] = $lang->story->batchCreate; - $createItems = array_merge($createItems, $batchItems); + if(count($batchItems) > 1) + { + $createItems[] = array('text' => $lang->story->batchCreate, 'items' => $batchItems); + } + else + { + $batchItems[0]['text'] = $lang->story->batchCreate; + $createItems = array_merge($createItems, $batchItems); + } } $canLinkStory = ($execution->hasProduct || $app->tab == 'execution') && $canModifyProduct && $canModifyExecution && hasPriv('execution', 'linkStory'); @@ -168,7 +171,7 @@ if($canOpreate['create']) set::url($createLink), $lang->story->create ), - dropdown + empty($createItems) ? null : dropdown ( btn(setClass('btn secondary dropdown-toggle'), setStyle(array('padding' => '6px', 'border-radius' => '0 2px 2px 0'))),