From 88e093ccbdba6201e7f41291f710d32cdd52b9f8 Mon Sep 17 00:00:00 2001 From: chentao Date: Fri, 12 May 2023 14:46:47 +0800 Subject: [PATCH] * product: replace ?? with ?:. --- module/product/control.php | 5 +++-- module/product/zen.php | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/module/product/control.php b/module/product/control.php index eab1af6bd1..7f920c0071 100755 --- a/module/product/control.php +++ b/module/product/control.php @@ -121,9 +121,10 @@ class product extends control $browseType = strtolower($browseType); /* Pre process. */ - $isProjectStory = $this->app->rawModule == 'projectstory'; $this->loadModel('datatable'); $this->loadModel('execution'); + $isProjectStory = $this->app->rawModule == 'projectstory'; + $cookieOrderBy = $this->cookie->productStoryOrder ? $this->cookie->productStoryOrder : 'id_desc'; /* Generate data. */ $showModule = !empty($this->config->datatable->productBrowse->showModule) ? $this->config->datatable->productBrowse->showModule : ''; @@ -131,7 +132,7 @@ class product extends control $product = $this->productZen->getBrowseProduct($productID); $project = $this->loadModel('project')->getByID($projectID); list($branch, $branchID) = $this->productZen->getBranchAndBranchID($product, $branch); - $orderBy = $orderBy ?? ($this->cookie->productStoryOrder ? $this->cookie->productStoryOrder : 'id_desc'); + $orderBy = $orderBy ? $orderBy : $cookieOrderBy; /* ATTENTION: be careful to change the order of follow sentencies. */ $this->productZen->setMenu4Browse($projectID, $productID, $branch, $storyType); diff --git a/module/product/zen.php b/module/product/zen.php index 55a52d12f4..abea7af37f 100644 --- a/module/product/zen.php +++ b/module/product/zen.php @@ -1014,7 +1014,7 @@ class productZen extends product /* If product does not exist in $this->products list, then attach it to the list. */ if($product && !isset($this->products[$product->id])) $this->products[$product->id] = $product->name; - return $product ?? false; + return $product ? $product : false; } /**