+ Add func to check if the product has multiple branch.

This commit is contained in:
dingguodong
2023-08-29 09:11:35 +08:00
parent 76dc8da552
commit 010cc8d2fc
+31
View File
@@ -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;
}
}