This commit is contained in:
王怡栋
2024-04-10 13:03:48 +08:00
parent 72a768062e
commit e4792d23cc
2 changed files with 10 additions and 7 deletions
+1 -1
View File
@@ -2643,7 +2643,7 @@ class bug extends control
$product = $this->loadModel('product')->getById($productID);
$bug = $this->bug->getById($bugID);
$branch = $product->type == 'branch' ? ($bug->branch > 0 ? $bug->branch . ',0' : '0') : '';
$productBugs = $this->bug->getProductBugPairs($productID, $branch, $search, $limit);
$productBugs = $this->bug->getProductBugPairs($productID, $branch, $search, $limit, 'all');
unset($productBugs[$bugID]);
+9 -6
View File
@@ -2049,24 +2049,27 @@ class bugModel extends model
* @param int|string $branch
* @param string $search
* @param int $limit
* @param string $range single|all
* @access public
* @return void
*/
public function getProductBugPairs($productID, $branch = '', $search = '', $limit = 0)
public function getProductBugPairs($productID, $branch = '', $search = '', $limit = 0, $range = 'single')
{
$bugs = $this->dao->select("id, CONCAT(id, ':', title) AS title")->from(TABLE_BUG)
->where('product')->eq((int)$productID)
$productID = (int)$productID;
$bugs = $this->dao->select("id, CONCAT(IF(product = $productID, '', CONCAT('{$this->lang->product->common}#', product, '@')), id, ':', title) AS title, IF(product = $productID, 0, product) AS `order`")->from(TABLE_BUG)
->where('deleted')->eq(0)
->beginIF($range == 'single')->andWhere('product')->eq($productID)->fi()
->beginIF(!$this->app->user->admin)->andWhere('execution')->in('0,' . $this->app->user->view->sprints)->fi()
->beginIF($range == 'all' && !$this->app->user->admin)->andWhere('product')->in($this->app->user->view->products)->fi()
->beginIF($branch !== '')->andWhere('branch')->in($branch)->fi()
->beginIF(strlen(trim($search)))
->andWhere('id', true)->like('%' . $search . '%')
->orWhere('title')->like('%' . $search . '%')
->markRight(1)
->fi()
->andWhere('deleted')->eq(0)
->orderBy('id desc')
->orderBy('`order`, id desc')
->beginIF($limit)->limit($limit)->fi()
->fetchPairs();
->fetchPairs('id', 'title');
return array('' => '') + $bugs;
}