diff --git a/module/bug/model.php b/module/bug/model.php index 9f6c64d0a5..5783aed7f6 100644 --- a/module/bug/model.php +++ b/module/bug/model.php @@ -1417,10 +1417,12 @@ class bugModel extends model * @param int $account * @param bool $appendProduct * @param int $limit + * @param array $skipProductIDList + * @param array $skipProjectIDList * @access public * @return array */ - public function getUserBugPairs($account, $appendProduct = true, $limit = 0) + public function getUserBugPairs($account, $appendProduct = true, $limit = 0, $skipProductIDList = array(), $skipProjectIDList = array()) { $bugs = array(); $stmt = $this->dao->select('t1.id, t1.title, t2.name as product') @@ -1429,6 +1431,8 @@ class bugModel extends model ->on('t1.product=t2.id') ->where('t1.assignedTo')->eq($account) ->beginIF(!$this->app->user->admin)->andWhere('t1.project')->in('0,' . $this->app->user->view->projects)->fi() + ->beginIF(!empty($skipProductIDList))->andWhere('t1.product')->notin($skipProductIDList)->fi() + ->beginIF(!empty($skipProjectIDList))->andWhere('t1.project')->notin($skipProjectIDList)->fi() ->andWhere('t1.deleted')->eq(0) ->orderBy('id desc') ->beginIF($limit > 0)->limit($limit)->fi() diff --git a/module/story/model.php b/module/story/model.php index 239025abb5..cc898f8a6d 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -2346,19 +2346,21 @@ class storyModel extends model /** * Get story pairs of a user. * - * @param string $account - * @param string $limit - * @param string $type requirement|story + * @param string $account + * @param string $limit + * @param string $type requirement|story + * @param array $skipProductIDList * @access public * @return array */ - public function getUserStoryPairs($account, $limit = 10, $type = 'story') + public function getUserStoryPairs($account, $limit = 10, $type = 'story', $skipProductIDList = array()) { return $this->dao->select('id, title') ->from(TABLE_STORY) ->where('deleted')->eq(0) ->andWhere('type')->eq($type) ->andWhere('assignedTo')->eq($account) + ->beginIF(!empty($skipProductIDList))->andWhere('product')->notin($skipProductIDList)->fi() ->orderBy('id_desc') ->limit($limit) ->fetchPairs('id', 'title'); diff --git a/module/task/model.php b/module/task/model.php index fc9cd43c3a..540b892574 100644 --- a/module/task/model.php +++ b/module/task/model.php @@ -1995,10 +1995,11 @@ class taskModel extends model * * @param string $account * @param string $status + * @param array $skipProjectIDList * @access public * @return array */ - public function getUserTaskPairs($account, $status = 'all') + public function getUserTaskPairs($account, $status = 'all', $skipProjectIDList = array()) { $stmt = $this->dao->select('t1.id, t1.name, t2.name as project') ->from(TABLE_TASK)->alias('t1') @@ -2006,6 +2007,7 @@ class taskModel extends model ->where('t1.assignedTo')->eq($account) ->andWhere('t1.deleted')->eq(0) ->beginIF($status != 'all')->andWhere('t1.status')->in($status)->fi() + ->beginIF(!empty($skipProjectIDList))->andWhere('t1.project')->notin($skipProjectIDList)->fi() ->query(); $tasks = array();