* adjust code for bug#230
This commit is contained in:
@@ -377,7 +377,7 @@ class bug extends control
|
||||
$this->view->productName = $this->products[$productID];
|
||||
$this->view->moduleOptionMenu = $this->tree->getOptionMenu($productID, $viewType = 'bug', $startModuleID = 0);
|
||||
$this->view->stories = $stories;
|
||||
$this->view->projects = $this->loadModel('project')->filterDeleted($this->product->getProjectPairs($productID));
|
||||
$this->view->projects = $this->product->getProjectPairs($productID, $params = 'nodeleted');
|
||||
$this->view->builds = $builds;
|
||||
$this->view->tasks = $this->loadModel('task')->getProjectTaskPairs($projectID);
|
||||
$this->view->moduleID = $moduleID;
|
||||
|
||||
@@ -221,15 +221,17 @@ class productModel extends model
|
||||
* Get projects of a product in pairs.
|
||||
*
|
||||
* @param int $productID
|
||||
* @param string $param
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getProjectPairs($productID)
|
||||
public function getProjectPairs($productID, $param = 'all')
|
||||
{
|
||||
$projects = $this->dao->select('t2.id, t2.name')
|
||||
->from(TABLE_PROJECTPRODUCT)->alias('t1')->leftJoin(TABLE_PROJECT)->alias('t2')
|
||||
->on('t1.project = t2.id')
|
||||
->where('t1.product')->eq((int)$productID)
|
||||
->beginIF($param == 'nodeleted')->andWhere('t2.deleted')->eq('0')->fi()
|
||||
->orderBy('t1.project desc')
|
||||
->fetchPairs();
|
||||
$projects = array('' => '') + $projects;
|
||||
|
||||
@@ -821,26 +821,4 @@ class projectModel extends model
|
||||
->fetchAll();
|
||||
return $tasks;
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter deleted projects
|
||||
*
|
||||
* @param array $projects
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function filterDeleted($projects)
|
||||
{
|
||||
$unDeletedProjects = array();
|
||||
foreach($projects as $projectID => $project)
|
||||
{
|
||||
if($projectID == '') $unDeletedProjects[''] = '';
|
||||
else
|
||||
{
|
||||
$isDeleted = $this->dao->select('deleted')->from(TABLE_PROJECT)->where('id')->eq($projectID)->fetch(false);
|
||||
if($isDeleted->deleted == '0') $unDeletedProjects[$projectID] = $project;
|
||||
}
|
||||
}
|
||||
return $unDeletedProjects;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ class testtask extends control
|
||||
$this->view->position[] = html::a($this->createLink('testtask', 'browse', "productID=$productID"), $this->products[$productID]);
|
||||
$this->view->position[] = $this->lang->testtask->create;
|
||||
|
||||
$this->view->projects = $this->loadModel('project')->filterDeleted($this->product->getProjectPairs($productID));
|
||||
$this->view->projects = $this->product->getProjectPairs($productID, $params = 'nodeleted');
|
||||
$this->view->builds = $this->loadModel('build')->getProductBuildPairs($productID);
|
||||
$this->view->users = $this->loadModel('user')->getPairs('noclosed|nodeleted');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user