From f055b3ffc0481073f6baf69c9b71312413fb5574 Mon Sep 17 00:00:00 2001 From: wangyuting <851424971@qq.com> Date: Wed, 16 Nov 2022 01:54:15 +0000 Subject: [PATCH] * Fix bug #29825. --- module/build/control.php | 2 +- module/build/model.php | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) 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 0f98597790..81fdc0b6bc 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();