From 4899b3680a2ff4150cdb24325dc4e26def19f18f Mon Sep 17 00:00:00 2001 From: liumengyi Date: Sat, 23 Dec 2023 10:50:38 +0800 Subject: [PATCH] * Assign switcherObjectID, and all products are displayed only if multiple products exist. --- module/execution/control.php | 11 ++++++----- module/execution/ui/ajaxswitchermenu.html.php | 17 +++++++++++------ 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/module/execution/control.php b/module/execution/control.php index f8752cd74b..5017d6c42d 100644 --- a/module/execution/control.php +++ b/module/execution/control.php @@ -609,11 +609,12 @@ class execution extends control $this->executionZen->assignTestcaseVars($executionID, $productID, $branchID, $moduleID, $orderBy, $type, $pager); - $this->view->execution = $execution; - $this->view->productOption = $productOption; - $this->view->branchOption = $branchOption; - $this->view->switcherParams = "executionID={$executionID}&productID={$productID}¤tMethod=testcase"; - $this->view->switcherText = isset($products[$productID]) ? $products[$productID]->name : $this->lang->product->all; + $this->view->execution = $execution; + $this->view->productOption = $productOption; + $this->view->branchOption = $branchOption; + $this->view->switcherParams = "executionID={$executionID}&productID={$productID}¤tMethod=testcase"; + $this->view->switcherText = isset($products[$productID]) ? $products[$productID]->name : $this->lang->product->all; + $this->view->switcherObjectID = $productID; $this->display(); } diff --git a/module/execution/ui/ajaxswitchermenu.html.php b/module/execution/ui/ajaxswitchermenu.html.php index 9a4ec6ee30..6c06a75e2b 100644 --- a/module/execution/ui/ajaxswitchermenu.html.php +++ b/module/execution/ui/ajaxswitchermenu.html.php @@ -15,13 +15,18 @@ namespace zin; * Define the grouped data list. */ -$defaultItem = array(); -$defaultItem['id'] = 0; -$defaultItem['text'] = $lang->product->all; -$defaultItem['active'] = $productID == 0; -$defaultItem['type'] = 'product'; +$data = array('normal' => array(), 'closed' => array()); -$data = array('normal' => array($defaultItem), 'closed' => array()); +if(count($products) > 1) +{ + $defaultItem = array(); + $defaultItem['id'] = 0; + $defaultItem['text'] = $lang->product->all; + $defaultItem['active'] = $productID == 0; + $defaultItem['type'] = 'product'; + + $data['normal'][] = $defaultItem; +} foreach($products as $product) {