Merge branch 'master_xieqiyu_21550' into 'master'
* Fix bug#21550. See merge request easycorp/zentaopms!2807
This commit is contained in:
@@ -253,15 +253,16 @@ class branch extends control
|
||||
* @param int $oldBranch
|
||||
* @param string $param
|
||||
* @param int $projectID
|
||||
* @param bool $withMainBranch
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function ajaxGetBranches($productID, $oldBranch = 0, $param = 'all', $projectID = 0)
|
||||
public function ajaxGetBranches($productID, $oldBranch = 0, $param = 'all', $projectID = 0, $withMainBranch = true)
|
||||
{
|
||||
$product = $this->loadModel('product')->getById($productID);
|
||||
if(empty($product) or $product->type == 'normal') return;
|
||||
|
||||
$branches = $this->loadModel('branch')->getList($productID, $projectID, $param);
|
||||
$branches = $this->loadModel('branch')->getList($productID, $projectID, $param, 'order', null, $withMainBranch);
|
||||
$branchOption = array();
|
||||
$branchTagOption = array();
|
||||
foreach($branches as $branchInfo)
|
||||
|
||||
@@ -43,10 +43,11 @@ class branchModel extends model
|
||||
* @param string $browseType
|
||||
* @param string $orderBy
|
||||
* @param object $pager
|
||||
* @param bool $withMainBranch
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getList($productID, $executionID = 0, $browseType = 'active', $orderBy = 'order', $pager = null)
|
||||
public function getList($productID, $executionID = 0, $browseType = 'active', $orderBy = 'order', $pager = null, $withMainBranch = true)
|
||||
{
|
||||
$executionBranches = array();
|
||||
if($executionID)
|
||||
@@ -54,7 +55,8 @@ class branchModel extends model
|
||||
$executionBranches = $this->dao->select('branch')->from(TABLE_PROJECTPRODUCT)
|
||||
->where('project')->eq($executionID)
|
||||
->andWhere('product')->eq($productID)
|
||||
->fetchAll('branch');
|
||||
->fetchPairs('branch');
|
||||
if(in_array(BRANCH_MAIN, $executionBranches)) $withMainBranch = true;
|
||||
if(empty($executionBranches)) return array();
|
||||
}
|
||||
|
||||
@@ -73,6 +75,8 @@ class branchModel extends model
|
||||
$defaultBranch = BRANCH_MAIN;
|
||||
foreach($branchList as $branch) $defaultBranch = $branch->default ? $branch->id : $defaultBranch;
|
||||
|
||||
if(!$withMainBranch) return $branchList;
|
||||
|
||||
/* Display the main branch under all and active page. */
|
||||
$mainBranch = new stdclass();
|
||||
$mainBranch->id = BRANCH_MAIN;
|
||||
|
||||
@@ -155,7 +155,7 @@ function loadBranches(product)
|
||||
var projectID = (typeof(systemMode) != 'undefined' && systemMode == 'new') ? $('#project').val() : 0;
|
||||
|
||||
var index = $inputgroup.find('select:first').attr('id').replace('products' , '');
|
||||
$.get(createLink('branch', 'ajaxGetBranches', "productID=" + $(product).val() + "&oldBranch=0¶m=active&projectID=" + projectID), function(data)
|
||||
$.get(createLink('branch', 'ajaxGetBranches', "productID=" + $(product).val() + "&oldBranch=0¶m=active&projectID=" + projectID + "&withMainBranch="), function(data)
|
||||
{
|
||||
if(data)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user