Merge branch 'sprint/201_zhouxin_my_work' into 'master'
* Finish task #56461,56462,56458,56465. See merge request easycorp/zentaopms!3819
This commit is contained in:
+48
-4
@@ -1601,18 +1601,62 @@ class bugModel extends model
|
||||
* @param int $limit
|
||||
* @param object $pager
|
||||
* @param int $executionID
|
||||
* @param int $queryID
|
||||
* @access public
|
||||
* @return void
|
||||
* @return array
|
||||
*/
|
||||
public function getUserBugs($account, $type = 'assignedTo', $orderBy = 'id_desc', $limit = 0, $pager = null, $executionID = 0)
|
||||
public function getUserBugs($account, $type = 'assignedTo', $orderBy = 'id_desc', $limit = 0, $pager = null, $executionID = 0, $queryID = 0)
|
||||
{
|
||||
if(!$this->loadModel('common')->checkField(TABLE_BUG, $type)) return array();
|
||||
$moduleName = $this->app->rawMethod == 'work' ? 'workBug' : 'contributeBug';
|
||||
$queryName = $moduleName . 'Query';
|
||||
$formName = $moduleName . 'Form';
|
||||
|
||||
$bugIDList = array();
|
||||
if($moduleName == 'contributeBug')
|
||||
{
|
||||
$bugsAssignedByMe = $this->loadModel('my')->getAssignedByMe($account, 0, $pager, $orderBy, 0, 'bug');
|
||||
foreach($bugsAssignedByMe as $bugID => $bug)
|
||||
{
|
||||
$bugIDList[$bugID] = $bugID;
|
||||
}
|
||||
}
|
||||
|
||||
if($queryID)
|
||||
{
|
||||
$query = $this->loadModel('search')->getQuery($queryID);
|
||||
if($query)
|
||||
{
|
||||
$this->session->set($queryName, $query->sql);
|
||||
$this->session->set($formName, $query->form);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->session->set($queryName, ' 1 = 1');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if($this->session->$queryName == false) $this->session->set($queryName, ' 1 = 1');
|
||||
}
|
||||
$query = $this->session->$queryName;
|
||||
$query = preg_replace('/`(\w+)`/', 't1.`$1`', $query);
|
||||
|
||||
if($type != 'bySearch' and !$this->loadModel('common')->checkField(TABLE_BUG, $type)) return array();
|
||||
$bugs = $this->dao->select('t1.*,t2.name as productName')->from(TABLE_BUG)->alias('t1')
|
||||
->leftJoin(TABLE_PRODUCT)->alias('t2')->on('t1.product = t2.id')
|
||||
->where('t1.deleted')->eq(0)
|
||||
->beginIF($type == 'bySearch')->andWhere($query)->fi()
|
||||
->beginIF($executionID)->andWhere('t1.execution')->eq($executionID)->fi()
|
||||
->beginIF($type != 'closedBy' and $this->app->moduleName == 'block')->andWhere('t1.status')->ne('closed')->fi()
|
||||
->beginIF($type != 'all')->andWhere("t1.`$type`")->eq($account)->fi()
|
||||
->beginIF($type != 'all' and $type != 'bySearch')->andWhere("t1.`$type`")->eq($account)->fi()
|
||||
->beginIF($type == 'bySearch' and $moduleName == 'workBug')->andWhere("t1.assignedTo")->eq($account)->fi()
|
||||
->beginIF($type == 'bySearch' and $moduleName == 'contributeBug')
|
||||
->andWhere('t1.openedBy', 1)->eq($account)
|
||||
->orWhere('t1.closedBy')->eq($account)
|
||||
->orWhere('t1.resolvedBy')->eq($account)
|
||||
->orWhere('t1.id')->in($bugIDList)
|
||||
->markRight(1)
|
||||
->fi()
|
||||
->orderBy($orderBy)
|
||||
->beginIF($limit > 0)->limit($limit)->fi()
|
||||
->page($pager)
|
||||
|
||||
Reference in New Issue
Block a user