From 010cc8d2fc7c6d5ad27f06452dd5568ed0dc0f71 Mon Sep 17 00:00:00 2001 From: dingguodong Date: Tue, 29 Aug 2023 09:09:01 +0800 Subject: [PATCH] + Add func to check if the product has multiple branch. --- module/execution/zen.php | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/module/execution/zen.php b/module/execution/zen.php index 0f17630b99..41cb352240 100644 --- a/module/execution/zen.php +++ b/module/execution/zen.php @@ -299,4 +299,35 @@ class executionZen extends execution return $dataList; } + + /** + * Check if the product has multiple branch and check if the execution has a product with multiple branch. + * + * @param int $productID + * @param int $executionID + * @return bool + */ + protected function hasMultipleBranch(int $productID, int $executionID): bool + { + /* Check if the product is multiple branch. */ + $multiBranchProduct = false; + if($productID) + { + $product = $this->loadModel('product')->getByID($productID); + if($product->type != 'normal') $multiBranchProduct = true; + } + else + { + $executionProductList = $this->loadModel('product')->getProducts($executionID); + foreach($executionProductList as $executionProduct) + { + if($executionProduct->type != 'normal') + { + $multiBranchProduct = true; + break; + } + } + } + return $multiBranchProduct; + } }