Merge branch 'master_bug_#29980' into 'master'
* Fix bug #29980. See merge request easycorp/zentaopms!6274
This commit is contained in:
@@ -1228,6 +1228,28 @@ class productModel extends model
|
||||
$this->loadModel('search')->setSearchParams($this->config->product->all->search);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get project pairs by product.
|
||||
*
|
||||
* @param array $productIDList
|
||||
* @param int $branch
|
||||
* @param int $appendProject
|
||||
* @param string $status all|closed|unclosed
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getProjectPairsByProductIDList($productIDList, $branch = 0, $appendProject = 0, $status = '')
|
||||
{
|
||||
$projectParis = array();
|
||||
foreach($productIDList as $productID)
|
||||
{
|
||||
$projects = $this->getProjectPairsByProduct($productID, $branch, $appendProject, $status);
|
||||
$projectParis = $projectParis + $projects;
|
||||
}
|
||||
|
||||
return $projectParis;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get project pairs by product.
|
||||
*
|
||||
|
||||
@@ -139,8 +139,8 @@ class repo extends control
|
||||
|
||||
$this->app->loadLang('action');
|
||||
|
||||
$products = $this->loadModel('product')->getProductPairsByProject($objectID);
|
||||
$products = $this->dao->select('*')->from(TABLE_PRODUCT)->where('id')->in(array_keys($products))->andWhere('shadow')->eq(0)->fetchPairs('id', 'name'); /* Remove shadow products. */
|
||||
$products = $this->loadModel('product')->getProductPairsByProject($objectID);
|
||||
$products = $this->dao->select('*')->from(TABLE_PRODUCT)->where('id')->in(array_keys($products))->andWhere('shadow')->eq(0)->fetchPairs('id', 'name'); // Remove shadow products.
|
||||
|
||||
$shadowProduct = null;
|
||||
if($this->app->tab == 'project' && $objectID) $shadowProduct = $this->loadModel('product')->getShadowProductByProject($objectID);
|
||||
@@ -150,7 +150,8 @@ class repo extends control
|
||||
$this->view->groups = $this->loadModel('group')->getPairs();
|
||||
$this->view->users = $this->loadModel('user')->getPairs('noletter|noempty|nodeleted|noclosed');
|
||||
$this->view->products = $products;
|
||||
$this->view->relatedProjects = array();
|
||||
$this->view->projects = $this->loadModel('product')->getProjectPairsByProductIDList(array_keys($products));
|
||||
$this->view->relatedProjects = $this->app->tab == 'project' ? array($objectID) : array();
|
||||
$this->view->serviceHosts = $this->loadModel('gitlab')->getPairs();
|
||||
$this->view->objectID = $objectID;
|
||||
$this->view->shadowProduct = $shadowProduct;
|
||||
@@ -1250,12 +1251,7 @@ class repo extends control
|
||||
->get();
|
||||
|
||||
/* Get all projects that can be accessed. */
|
||||
$accessProjects = array();
|
||||
foreach($postData->products as $productID)
|
||||
{
|
||||
$projects = $this->loadModel('product')->getProjectPairsByProduct($productID);
|
||||
$accessProjects = $accessProjects + $projects;
|
||||
}
|
||||
$accessProjects = $this->loadModel('product')->getProjectPairsByProductIDList($postData->products);
|
||||
|
||||
$selectedProjects = array_intersect(array_keys($accessProjects), $postData->projects);
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->repo->projects;?></th>
|
||||
<td id='projectContainer'><?php echo html::select('projects[]', $relatedProjects, array(), "class='form-control chosen' multiple");?></td>
|
||||
<td id='projectContainer'><?php echo html::select('projects[]', $projects, $relatedProjects, "class='form-control chosen' multiple");?></td>
|
||||
</tr>
|
||||
<?php endif;?>
|
||||
<tr>
|
||||
|
||||
Reference in New Issue
Block a user