* finish task #2344.

This commit is contained in:
wangyidong
2015-10-26 13:12:00 +08:00
parent 621684debf
commit 5029ba6b23
9 changed files with 38 additions and 37 deletions
+6 -12
View File
@@ -904,7 +904,6 @@ class project extends control
$whitelist = '';
$acl = 'open';
$productIDList = array();
if($copyProjectID)
{
$copyProject = $this->dao->select('*')->from(TABLE_PROJECT)->where('id')->eq($copyProjectID)->fetch();
@@ -914,7 +913,6 @@ class project extends control
$acl = $copyProject->acl;
$whitelist = $copyProject->whitelist;
$products = $this->project->getProducts($copyProjectID);
foreach($products as $product) $productIDList[$product->id] = $product->id;
}
if(!empty($_POST))
@@ -941,7 +939,7 @@ class project extends control
$this->view->whitelist = $whitelist;
$this->view->acl = $acl ;
$this->view->copyProjectID = $copyProjectID;
$this->view->branchGroups = $this->loadModel('branch')->getByProducts($productIDList);
$this->view->branchGroups = $this->loadModel('branch')->getByProducts(array_keys($products));
$this->display();
}
@@ -991,11 +989,9 @@ class project extends control
$allProducts = array(0 => '') + $this->loadModel('product')->getPairs('noclosed|nocode');
$linkedProducts = $this->project->getProducts($project->id);
$productIDList = array();
foreach($linkedProducts as $product)
{
if(!isset($allProducts[$product->id])) $allProducts[$product->id] = $product->name;
$productIDList[$product->id] = $product->id;
}
$this->view->title = $title;
@@ -1009,7 +1005,7 @@ class project extends control
$this->view->groups = $this->loadModel('group')->getPairs();
$this->view->allProducts = $allProducts;
$this->view->linkedProducts = $linkedProducts;
$this->view->branchGroups = $this->loadModel('branch')->getByProducts($productIDList);
$this->view->branchGroups = $this->loadModel('branch')->getByProducts(array_keys($linkedProducts));
$this->display();
}
@@ -1351,14 +1347,10 @@ class project extends control
$allProducts = $this->product->getPairs('noclosed|nocode');
$linkedProducts = $this->project->getProducts($project->id);
// Merge allProducts and linkedProducts for closed product.
$products = array();
foreach($linkedProducts as $product)
{
if(!isset($allProducts[$product->id])) $allProducts[$product->id] = $product->name;
if(!isset($products[$product->id])) $products[$product->id] = $product;
$products[$product->id]->branches[$product->branch] = $product->branch;
}
$linkedProducts = $products;
/* Assign. */
$this->view->title = $title;
@@ -1556,7 +1548,9 @@ class project extends control
}
else
{
$allStories = $this->story->getProductStories(array_keys($products), 0, $moduleID = '0', $status = 'active');
$branches = array(0 => 0);
foreach($products as $product) $branches += $product->branches;
$allStories = $this->story->getProductStories(array_keys($products), $branches, $moduleID = '0', $status = 'active');
}
$prjStories = $this->story->getProjectStoryPairs($projectID);
@@ -1709,7 +1703,7 @@ class project extends control
*/
public function ajaxGetProducts($projectID)
{
$products = $this->project->getProducts($projectID);
$products = $this->project->getProducts($projectID, false);
die(html::select('product', $products, '', 'class="form-control"'));
}