From bf29f5e61e6f48a73a61279b8927dfc4c9d17f6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E5=8D=8E=E4=BC=9F?= Date: Fri, 13 May 2022 14:47:13 +0800 Subject: [PATCH 1/4] *Fix bug #22397. --- module/testtask/control.php | 1 + 1 file changed, 1 insertion(+) diff --git a/module/testtask/control.php b/module/testtask/control.php index 13b8418a7e..ce9251dd69 100644 --- a/module/testtask/control.php +++ b/module/testtask/control.php @@ -97,6 +97,7 @@ class testtask extends control $endTime = $endTime ? date('Y-m-d', strtotime($endTime)) : ''; /* Set menu. */ + if(empty($this->products[$productID])) $productID = array_key_first($this->products); $productID = $this->product->saveState($productID, $this->products); $branch = ($this->cookie->preBranch !== '' and $branch === '') ? $this->cookie->preBranch : $branch; $this->loadModel('qa')->setMenu($this->products, $productID, $branch, $type); From c8d4a93bbf86a396eda57b4c49c768e64963f213 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E5=8D=8E=E4=BC=9F?= Date: Fri, 13 May 2022 17:28:39 +0800 Subject: [PATCH 2/4] *Optemizi the code --- module/product/model.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/product/model.php b/module/product/model.php index d92ec088e7..df8afb5501 100644 --- a/module/product/model.php +++ b/module/product/model.php @@ -157,7 +157,7 @@ class productModel extends model if(!isset($products[$this->session->product])) { $product = $this->getById($productID); - if(empty($product)) $productID = key($products); + if(empty($product) or $product->delete == 1) $productID = key($products); $this->session->set('product', (int)$productID, $this->app->tab); if($productID && strpos(",{$this->app->user->view->products},", ",{$productID},") === false) { From fc63dceb72fffd39dbffd48b61db4e4edf22ea62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E5=8D=8E=E4=BC=9F?= Date: Fri, 13 May 2022 17:29:44 +0800 Subject: [PATCH 3/4] *Optimize the code. --- module/testtask/control.php | 1 - 1 file changed, 1 deletion(-) diff --git a/module/testtask/control.php b/module/testtask/control.php index ce9251dd69..13b8418a7e 100644 --- a/module/testtask/control.php +++ b/module/testtask/control.php @@ -97,7 +97,6 @@ class testtask extends control $endTime = $endTime ? date('Y-m-d', strtotime($endTime)) : ''; /* Set menu. */ - if(empty($this->products[$productID])) $productID = array_key_first($this->products); $productID = $this->product->saveState($productID, $this->products); $branch = ($this->cookie->preBranch !== '' and $branch === '') ? $this->cookie->preBranch : $branch; $this->loadModel('qa')->setMenu($this->products, $productID, $branch, $type); From 2a33fd3830b1266eeaae81254fbbac2bfcf9a4f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E5=8D=8E=E4=BC=9F?= Date: Fri, 13 May 2022 17:32:26 +0800 Subject: [PATCH 4/4] *Fix bug. --- module/product/model.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/product/model.php b/module/product/model.php index df8afb5501..d7cc4528a7 100644 --- a/module/product/model.php +++ b/module/product/model.php @@ -157,7 +157,7 @@ class productModel extends model if(!isset($products[$this->session->product])) { $product = $this->getById($productID); - if(empty($product) or $product->delete == 1) $productID = key($products); + if(empty($product) or $product->deleted == 1) $productID = key($products); $this->session->set('product', (int)$productID, $this->app->tab); if($productID && strpos(",{$this->app->user->view->products},", ",{$productID},") === false) {