diff --git a/module/build/control.php b/module/build/control.php index 91353e2f9d..0abe7eb54e 100644 --- a/module/build/control.php +++ b/module/build/control.php @@ -119,7 +119,7 @@ class build extends control $this->view->executionID = $executionID; $this->view->products = $products; $this->view->projectID = $projectID; - $this->view->lastBuild = $this->build->getLast($executionID); + $this->view->lastBuild = $this->build->getLast($executionID, $projectID); $this->view->productGroups = $productGroups; $this->view->users = $this->user->getPairs('nodeleted|noclosed'); $this->display(); diff --git a/module/build/model.php b/module/build/model.php index 7a137cfe63..85e09241a4 100644 --- a/module/build/model.php +++ b/module/build/model.php @@ -284,14 +284,16 @@ class buildModel extends model * Get last build. * * @param int $executionID + * @param int $projectID * @access public * @return bool | object */ - public function getLast($executionID) + public function getLast($executionID = 0, $projectID = 0) { return $this->dao->select('id, name')->from(TABLE_BUILD) - ->where('execution')->eq((int)$executionID) - ->andWhere('deleted')->eq(0) + ->where('deleted')->eq(0) + ->beginIF($executionID)->andWhere('execution')->eq((int)$executionID)->fi() + ->beginIF($projectID)->andWhere('project')->eq((int)$projectID)->fi() ->orderBy('date DESC,id DESC') ->limit(1) ->fetch();