Merge branch 'sprint/170_hufangzhou_16169' into 'sprint/170'
* Fix bug #16169, bug#16179. See merge request easycorp/zentaopms!412
This commit is contained in:
@@ -155,19 +155,19 @@ class product extends control
|
||||
|
||||
if($this->cookie->preProductID != $productID or $this->cookie->preBranch != $branch or $browseType == 'bybranch')
|
||||
{
|
||||
$_COOKIE['storyModule'] = 0;
|
||||
setcookie('storyModule', 0, 0, $this->config->webRoot, '', $this->config->cookieSecure, false);
|
||||
$_COOKIE['storyModule'] = 'all';
|
||||
setcookie('storyModule', 'all', 0, $this->config->webRoot, '', $this->config->cookieSecure, false);
|
||||
}
|
||||
|
||||
if($browseType == 'bymodule' or $browseType == '')
|
||||
{
|
||||
setcookie('storyModule', (int)$param, 0, $this->config->webRoot, '', $this->config->cookieSecure, false);
|
||||
if($this->app->tab == 'project') setcookie('storyModuleParam', (int)$param, 0, $this->config->webRoot, '', $this->config->cookieSecure, false);
|
||||
$_COOKIE['storyBranch'] = 0;
|
||||
setcookie('storyBranch', 0, 0, $this->config->webRoot, '', $this->config->cookieSecure, false);
|
||||
$_COOKIE['storyBranch'] = 'all';
|
||||
setcookie('storyBranch', 'all', 0, $this->config->webRoot, '', $this->config->cookieSecure, false);
|
||||
if($browseType == '') setcookie('treeBranch', $branch, 0, $this->config->webRoot, '', $this->config->cookieSecure, false);
|
||||
}
|
||||
if($browseType == 'bybranch') setcookie('storyBranch', (int)$branch, 0, $this->config->webRoot, '', $this->config->cookieSecure, false);
|
||||
if($browseType == 'bybranch') setcookie('storyBranch', $branch, 0, $this->config->webRoot, '', $this->config->cookieSecure, false);
|
||||
|
||||
$cookieModule = $this->app->tab == 'project' ? $this->cookie->storyModuleParam : $this->cookie->storyModule;
|
||||
$moduleID = ($browseType == 'bymodule') ? (int)$param : (($browseType == 'bysearch' or $browseType == 'bybranch') ? 0 : ($cookieModule ? $cookieModule : 0));
|
||||
@@ -297,7 +297,7 @@ class product extends control
|
||||
$this->view->browseType = $browseType;
|
||||
$this->view->modules = $this->tree->getOptionMenu($productID, 'story', 0, $branch);
|
||||
$this->view->moduleID = $moduleID;
|
||||
$this->view->moduleName = $moduleID ? $this->tree->getById($moduleID)->name : $this->lang->tree->all;
|
||||
$this->view->moduleName = ($moduleID and $moduleID !== 'all') ? $this->tree->getById($moduleID)->name : $this->lang->tree->all;
|
||||
$this->view->branch = $branch;
|
||||
$this->view->branches = $this->loadModel('branch')->getPairs($productID);
|
||||
$this->view->storyStages = $this->product->batchGetStoryStage($stories);
|
||||
|
||||
@@ -2027,6 +2027,7 @@ class productModel extends model
|
||||
{
|
||||
$branchLink = $this->lang->product->menu->settings['subMenu']->branch['link'];
|
||||
$this->lang->product->menu->settings['subMenu']->branch['link'] = str_replace('@branch@', $this->lang->product->branchName[$product->type], $branchLink);
|
||||
$this->lang->product->branch = sprintf($this->lang->product->branch, $this->lang->product->branchName[$product->type]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ $projectIDParam = $isProjectStory ? "projectID=$projectID&" : '';
|
||||
<div class="title" title="<?php echo $moduleName;?>">
|
||||
<?php
|
||||
echo $moduleName;
|
||||
if($moduleID)
|
||||
if($moduleID and $moduleID !== 'all')
|
||||
{
|
||||
$removeLink = $browseType == 'bymodule' ? $this->createLink($this->app->rawModule, $this->app->rawMethod, $projectIDParam . "productID=$productID&branch=$branch&browseType=$browseType¶m=0&storyType=$storyType&orderBy=$orderBy&recTotal=0&recPerPage={$pager->recPerPage}") : 'javascript:removeCookieByKey("storyModule")';
|
||||
echo html::a($removeLink, "<i class='icon icon-sm icon-close'></i>", '', "class='text-muted'");
|
||||
|
||||
@@ -65,6 +65,7 @@ class treeModel extends model
|
||||
* @param int $rootID
|
||||
* @param string $type
|
||||
* @param int $startModule
|
||||
* @param int $branch
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
@@ -86,7 +87,7 @@ class treeModel extends model
|
||||
->beginIF($type != 'task')->andWhere('type')->in("story,$type")->fi()
|
||||
->beginIF($startModulePath)->andWhere('path')->like($startModulePath)->fi()
|
||||
->beginIF($branch === 'null')->andWhere('branch')->eq(0)->fi()
|
||||
->beginIF((!empty($branch) and $branch != 'null'))->andWhere("branch")->eq($branch)->fi()
|
||||
->beginIF((($branch or $branch === 0) and $branch !== 'null'))->andWhere("branch")->eq($branch)->fi()
|
||||
->andWhere('deleted')->eq(0)
|
||||
->orderBy('grade desc, `order`, type desc')
|
||||
->get();
|
||||
@@ -98,7 +99,7 @@ class treeModel extends model
|
||||
->andWhere('type')->eq($type)
|
||||
->beginIF($startModulePath)->andWhere('path')->like($startModulePath)->fi()
|
||||
->beginIF($branch === 'null')->andWhere('branch')->eq(0)->fi()
|
||||
->beginIF((!empty($branch) and $branch != 'null'))->andWhere("branch")->eq($branch)->fi()
|
||||
->beginIF((($branch or $branch === 0) and $branch !== 'null'))->andWhere("branch")->eq($branch)->fi()
|
||||
->andWhere('deleted')->eq(0)
|
||||
->orderBy('grade desc, `order`')
|
||||
->get();
|
||||
@@ -381,11 +382,11 @@ class treeModel extends model
|
||||
$extra = array('rootID' => $rootID, 'branch' => $branch);
|
||||
}
|
||||
|
||||
$manage = $userFunc[1] == 'createManageLink' ? true : false;
|
||||
$product = $this->loadModel('product')->getById($rootID);
|
||||
if(strpos('story|bug|case', $type) !== false and empty($branch))
|
||||
$manage = $userFunc[1] == 'createManageLink' ? true : false;
|
||||
$product = $this->loadModel('product')->getById($rootID);
|
||||
if(strpos('story|bug|case', $type) !== false and $branch === 'all')
|
||||
{
|
||||
if($product->type != 'normal') $branches = array('null' => '') + $this->loadModel('branch')->getPairs($rootID, 'noempty');
|
||||
if($product->type != 'normal') $branches = array('null' => '', BRANCH_MAIN => $this->lang->branch->main) + $this->loadModel('branch')->getPairs($rootID, 'noempty');
|
||||
}
|
||||
|
||||
/* Add for task #1945. check the module has case or no. */
|
||||
@@ -395,12 +396,11 @@ class treeModel extends model
|
||||
foreach($branches as $branchID => $branch)
|
||||
{
|
||||
$treeMenu = array();
|
||||
if($branchID == 0) $branchID = 'null';
|
||||
$stmt = $this->dbh->query($this->buildMenuQuery($rootID, $type, $startModule, $branchID));
|
||||
while($module = $stmt->fetch()) $this->buildTree($treeMenu, $module, $type, $userFunc, $extra, $branchID);
|
||||
if(!empty($extra) and empty($treeMenu)) continue;
|
||||
ksort($treeMenu);
|
||||
if(!empty($branchID) and $branch and $branchID != 'null')
|
||||
if((!empty($branchID) or $branchID === 0) and $branch and $branchID !== 'null')
|
||||
{
|
||||
$linkHtml = ($type == 'case' and !empty($extra)) ? '<a>' . $branch . '</a>' : $this->createBranchLink($type, $rootID, $branchID, $branch);
|
||||
$linkHtml = $manage ? html::a(inlink('browse', "root=$rootID&viewType=$type¤tModuleID=0&branch=$branchID"), $branch) : $linkHtml;
|
||||
@@ -887,7 +887,7 @@ class treeModel extends model
|
||||
public function buildTree(& $treeMenu, $module, $type, $userFunc, $extra, $branch = 0)
|
||||
{
|
||||
/* Add for task #1945. check the module has case or no. */
|
||||
if((isset($extra['rootID']) and isset($extra['branch']) and $branch == 'null') or ($type == 'case' and is_numeric($extra)))
|
||||
if((isset($extra['rootID']) and isset($extra['branch']) and $branch === 'null') or ($type == 'case' and is_numeric($extra)))
|
||||
{
|
||||
static $objects = array();
|
||||
if(empty($objects))
|
||||
|
||||
Reference in New Issue
Block a user