diff --git a/module/execution/model.php b/module/execution/model.php index ad24abe015..c61f96af9b 100755 --- a/module/execution/model.php +++ b/module/execution/model.php @@ -2394,10 +2394,11 @@ class executionModel extends model public function updateProducts(int $executionID, object|array $postData): bool { $this->loadModel('user'); - $products = array_filter(array_merge(zget($postData, 'products', array()), zget($postData, 'otherProducts', array()))); - $branches = zget($postData, 'branch', array(0)); - $plans = zget($postData, 'plans', array()); - $oldProducts = $this->dao->select('*')->from(TABLE_PROJECTPRODUCT)->where('project')->eq($executionID)->fetchGroup('product', 'branch'); + $otherProducts = zget($postData, 'otherProducts', array()); + $products = !empty($otherProducts) ? array_filter(array_merge(zget($postData, 'products', array()), $otherProducts)) : zget($postData, 'products', array()); + $branches = zget($postData, 'branch', array(0)); + $plans = zget($postData, 'plans', array()); + $oldProducts = $this->dao->select('*')->from(TABLE_PROJECTPRODUCT)->where('project')->eq($executionID)->fetchGroup('product', 'branch'); if(empty($_POST['otherProducts'])) $this->dao->delete()->from(TABLE_PROJECTPRODUCT)->where('project')->eq($executionID)->exec(); $members = array_keys($this->getTeamMembers($executionID)); if(empty($products))