diff --git a/module/action/model.php b/module/action/model.php index e6bc4c8142..739c107d16 100755 --- a/module/action/model.php +++ b/module/action/model.php @@ -996,10 +996,10 @@ class actionModel extends model { $productCondition = ''; foreach(explode(',', $authedProducts) as $product) $productCondition = empty($productCondition) ? "(execution = '0' and project = '0' and (product LIKE '%,$product,%'" : "$productCondition OR product LIKE '%,$product,%'"; - $productCondition .= '))'; + if(!empty($productCondition)) $productCondition .= '))'; $projectCondition = "(execution = '0' and project != '0' and project " . helper::dbIN($authedProjects) . ')'; - $executionCondition = isset($authedExecutions) ? "(execution != 0 and execution " . helper::dbIN($authedExecutions) . ')' : ''; + $executionCondition = isset($authedExecutions) ? "(execution != 0 and execution " . helper::dbIN($authedExecutions) . ')' : "(execution != 0 and execution = '$executionID')"; } elseif($productID == 'all' and is_numeric($projectID)) { @@ -1010,7 +1010,7 @@ class actionModel extends model $productCondition = ''; foreach(array_keys($products) as $product) $productCondition = empty($productCondition) ? "(execution = '0' and project = '0' and (product LIKE '%,$product,%'" : "$productCondition OR product LIKE '%,$product,%'"; - $productCondition .= '))'; + if(!empty($productCondition)) $productCondition .= '))'; $projectCondition = "(execution = '0' and project = '$projectID')"; $executionCondition = "(execution != '0' and execution " . helper::dbIN($authedExecutions) . ')';