diff --git a/module/branch/control.php b/module/branch/control.php index 177ddf17a4..3e1a3d550e 100644 --- a/module/branch/control.php +++ b/module/branch/control.php @@ -54,7 +54,7 @@ class branch extends control if(empty($product) or $product->type == 'normal') die(); $branches = $this->branch->getPairs($productID); - die(html::select('branch', $branches, '', "class='form-control'")); + die(html::select('branch', $branches, '', "class='form-control' onchange='loadBranch()'")); } } diff --git a/module/bug/config.php b/module/bug/config.php index d5217f2307..8f8c1baa82 100644 --- a/module/bug/config.php +++ b/module/bug/config.php @@ -61,6 +61,7 @@ $config->bug->search['fields']['status'] = $lang->bug->status; $config->bug->search['fields']['confirmed'] = $lang->bug->confirmed; $config->bug->search['fields']['product'] = $lang->bug->product; +$config->bug->search['fields']['branch'] = $lang->bug->branch; $config->bug->search['fields']['plan'] = $lang->bug->productplan; $config->bug->search['fields']['module'] = $lang->bug->module; $config->bug->search['fields']['project'] = $lang->bug->project; @@ -102,6 +103,7 @@ $config->bug->search['params']['status'] = array('operator' => '=', $config->bug->search['params']['confirmed'] = array('operator' => '=', 'control' => 'select', 'values' => $lang->bug->confirmedList); $config->bug->search['params']['product'] = array('operator' => '=', 'control' => 'select', 'values' => ''); +$config->bug->search['params']['branch'] = array('operator' => '=', 'control' => 'select', 'values' => ''); $config->bug->search['params']['plan'] = array('operator' => '=', 'control' => 'select', 'values' => ''); $config->bug->search['params']['module'] = array('operator' => 'belong', 'control' => 'select', 'values' => 'modules'); $config->bug->search['params']['project'] = array('operator' => '=', 'control' => 'select', 'values' => 'projects'); diff --git a/module/bug/control.php b/module/bug/control.php index 610c07f756..7dd41dbfd5 100644 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -61,7 +61,7 @@ class bug extends control * @access public * @return void */ - public function browse($productID = 0, $browseType = 'unclosed', $param = 0, $orderBy = '', $recTotal = 0, $recPerPage = 20, $pageID = 1) + public function browse($productID = 0, $branch = 0, $browseType = 'unclosed', $param = 0, $orderBy = '', $recTotal = 0, $recPerPage = 20, $pageID = 1) { /* Set browseType, productID, moduleID and queryID. */ $browseType = strtolower($browseType); @@ -70,7 +70,7 @@ class bug extends control $queryID = ($browseType == 'bysearch') ? (int)$param : 0; /* Set menu and save session. */ - $this->bug->setMenu($this->products, $productID); + $this->bug->setMenu($this->products, $productID, $branch); $this->session->set('bugList', $this->app->getURI(true)); /* Process the order by field. */ @@ -90,23 +90,23 @@ class bug extends control /* Get bugs. */ $bugs = array(); - if($browseType == 'all') $bugs = $this->bug->getAllBugs($productID, $projects, $sort, $pager); + if($browseType == 'all') $bugs = $this->bug->getAllBugs($productID, $branch, $projects, $sort, $pager); elseif($browseType == "bymodule") { $childModuleIds = $this->tree->getAllChildId($moduleID); - $bugs = $this->bug->getModuleBugs($productID, $childModuleIds, $projects, $sort, $pager); + $bugs = $this->bug->getModuleBugs($productID, $branch, $childModuleIds, $projects, $sort, $pager); } - elseif($browseType == 'assigntome') $bugs = $this->bug->getByAssigntome($productID, $projects, $sort, $pager); - elseif($browseType == 'openedbyme') $bugs = $this->bug->getByOpenedbyme($productID, $projects, $sort, $pager); - elseif($browseType == 'resolvedbyme') $bugs = $this->bug->getByResolvedbyme($productID, $projects, $sort, $pager); - elseif($browseType == 'assigntonull') $bugs = $this->bug->getByAssigntonull($productID, $projects, $sort, $pager); - elseif($browseType == 'unconfirmed') $bugs = $this->bug->getUnconfirmed($productID, $projects, $sort, $pager); - elseif($browseType == 'unresolved') $bugs = $this->bug->getByStatus($productID, $projects, 'unresolved', $sort, $pager); - elseif($browseType == 'unclosed') $bugs = $this->bug->getByStatus($productID, $projects, 'unclosed', $sort, $pager); - elseif($browseType == 'toclosed') $bugs = $this->bug->getByStatus($productID, $projects, 'toclosed', $sort, $pager); - elseif($browseType == 'longlifebugs') $bugs = $this->bug->getByLonglifebugs($productID, $projects, $sort, $pager); - elseif($browseType == 'postponedbugs') $bugs = $this->bug->getByPostponedbugs($productID, $projects, $sort, $pager); - elseif($browseType == 'needconfirm') $bugs = $this->bug->getByNeedconfirm($productID, $projects, $sort, $pager); + elseif($browseType == 'assigntome') $bugs = $this->bug->getByAssigntome($productID, $branch, $projects, $sort, $pager); + elseif($browseType == 'openedbyme') $bugs = $this->bug->getByOpenedbyme($productID, $branch, $projects, $sort, $pager); + elseif($browseType == 'resolvedbyme') $bugs = $this->bug->getByResolvedbyme($productID, $branch, $projects, $sort, $pager); + elseif($browseType == 'assigntonull') $bugs = $this->bug->getByAssigntonull($productID, $branch, $projects, $sort, $pager); + elseif($browseType == 'unconfirmed') $bugs = $this->bug->getUnconfirmed($productID, $branch, $projects, $sort, $pager); + elseif($browseType == 'unresolved') $bugs = $this->bug->getByStatus($productID, $branch, $projects, 'unresolved', $sort, $pager); + elseif($browseType == 'unclosed') $bugs = $this->bug->getByStatus($productID, $branch, $projects, 'unclosed', $sort, $pager); + elseif($browseType == 'toclosed') $bugs = $this->bug->getByStatus($productID, $branch, $projects, 'toclosed', $sort, $pager); + elseif($browseType == 'longlifebugs') $bugs = $this->bug->getByLonglifebugs($productID, $branch, $projects, $sort, $pager); + elseif($browseType == 'postponedbugs') $bugs = $this->bug->getByPostponedbugs($productID, $branch, $projects, $sort, $pager); + elseif($browseType == 'needconfirm') $bugs = $this->bug->getByNeedconfirm($productID, $branch, $projects, $sort, $pager); elseif($browseType == 'bysearch') $bugs = $this->bug->getBySearch($productID, $queryID, $sort, $pager); /* Process the sql, get the conditon partion, save it to session. */ @@ -116,7 +116,7 @@ class bug extends control $bugs = $this->loadModel('story')->checkNeedConfirm($bugs); /* Build the search form. */ - $this->config->bug->search['actionURL'] = $this->createLink('bug', 'browse', "productID=$productID&browseType=bySearch&queryID=myQueryID"); + $this->config->bug->search['actionURL'] = $this->createLink('bug', 'browse', "productID=$productID&branch=$branch&browseType=bySearch&queryID=myQueryID"); $this->config->bug->search['queryID'] = $queryID; $this->config->bug->search['params']['product']['values'] = array($productID => $this->products[$productID], 'all' => $this->lang->bug->allProduct); $this->config->bug->search['params']['plan']['values'] = $this->loadModel('productplan')->getPairs($productID); @@ -124,6 +124,15 @@ class bug extends control $this->config->bug->search['params']['project']['values'] = $this->product->getProjectPairs($productID); $this->config->bug->search['params']['openedBuild']['values'] = $this->loadModel('build')->getProductBuildPairs($productID); $this->config->bug->search['params']['resolvedBuild']['values'] = $this->build->getProductBuildPairs($productID); + if($this->session->currentProductType == 'normal') + { + unset($this->config->bug->search['fields']['branch']); + unset($this->config->bug->search['params']['branch']); + } + else + { + $this->config->bug->search['params']['branch']['values'] = array('' => '') + $this->loadModel('branch')->getPairs($productID, 'noempty'); + } $this->loadModel('search')->setSearchParams($this->config->bug->search); $users = $this->user->getPairs('noletter'); @@ -165,6 +174,7 @@ class bug extends control $this->view->orderBy = $orderBy; $this->view->moduleID = $moduleID; $this->view->memberPairs = $memberPairs; + $this->view->branch = $branch; $this->display(); } @@ -253,8 +263,7 @@ class bug extends control /* Get product, then set menu. */ $productID = $this->product->saveState($productID, $this->products); - $product = $this->product->getById($productID); - $branches = $product->type == 'normal' ? array() : $this->loadModel('branch')->getPairs($productID); + $branches = $this->session->currentProductType == 'normal' ? array() : $this->loadModel('branch')->getPairs($productID); $this->bug->setMenu($this->products, $productID, $branch); /* Init vars. */ @@ -336,9 +345,9 @@ class bug extends control $this->view->productID = $productID; $this->view->productName = $this->products[$productID]; - $this->view->moduleOptionMenu = $this->tree->getOptionMenu($productID, $viewType = 'bug', $startModuleID = 0); + $this->view->moduleOptionMenu = $this->tree->getOptionMenu($productID, $viewType = 'bug', $startModuleID = 0, $branch); $this->view->stories = $stories; - $this->view->projects = $this->product->getProjectPairs($productID, $params = 'nodeleted'); + $this->view->projects = $this->product->getProjectPairs($productID, $branch, $params = 'nodeleted'); $this->view->builds = $builds; $this->view->moduleID = $moduleID; $this->view->projectID = $projectID; @@ -360,7 +369,6 @@ class bug extends control $this->view->keywords = $keywords; $this->view->severity = $severity; $this->view->type = $type; - $this->view->product = $product; $this->view->branch = $branch; $this->view->branches = $branches; @@ -380,24 +388,24 @@ class bug extends control { if(!empty($_POST)) { - $actions = $this->bug->batchCreate($productID); + $actions = $this->bug->batchCreate($productID, $branch); foreach($actions as $bugID => $actionID) $this->sendmail($bugID, $actionID); die(js::locate($this->session->bugList, 'parent')); } /* Get product, then set menu. */ $productID = $this->product->saveState($productID, $this->products); - $this->bug->setMenu($this->products, $productID); + $this->bug->setMenu($this->products, $productID, $branch); /* If projectID is setted, get builds and stories of this project. */ if($projectID) { - $builds = $this->loadModel('build')->getProjectBuildPairs($projectID, $productID, 'noempty'); + $builds = $this->loadModel('build')->getProjectBuildPairs($projectID, $productID, $branch, 'noempty'); $stories = $this->story->getProjectStoryPairs($projectID); } else { - $builds = $this->loadModel('build')->getProductBuildPairs($productID, 'noempty'); + $builds = $this->loadModel('build')->getProductBuildPairs($productID, $branch, 'noempty'); $stories = $this->story->getProductStoryPairs($productID, $branch); } @@ -419,7 +427,7 @@ class bug extends control } $this->view->title = $this->products[$productID] . $this->lang->colon . $this->lang->bug->batchCreate; - $this->view->position[] = html::a($this->createLink('bug', 'browse', "productID=$productID"), $this->products[$productID]); + $this->view->position[] = html::a($this->createLink('bug', 'browse', "productID=$productID&branch=$branch"), $this->products[$productID]); $this->view->position[] = $this->lang->bug->batchCreate; $this->view->productID = $productID; @@ -428,8 +436,9 @@ class bug extends control $this->view->users = $this->user->getPairs('nodeleted,devfirst'); $this->view->projects = $this->product->getProjectPairs($productID, $params = 'nodeleted'); $this->view->projectID = $projectID; - $this->view->moduleOptionMenu = $this->tree->getOptionMenu($productID, $viewType = 'bug', $startModuleID = 0); + $this->view->moduleOptionMenu = $this->tree->getOptionMenu($productID, $viewType = 'bug', $startModuleID = 0, $branch); $this->view->moduleID = $moduleID; + $this->view->branch = $branch; $this->display(); } @@ -456,7 +465,7 @@ class bug extends control if($bug->assignedTo == $this->app->user->account) $this->loadModel('action')->read('bug', $bugID); /* Set menu. */ - $this->bug->setMenu($this->products, $bug->product); + $this->bug->setMenu($this->products, $bug->product, $bug->branch); /* Get product info. */ $productID = $bug->product; @@ -472,6 +481,7 @@ class bug extends control $this->view->productName = $productName; $this->view->modulePath = $this->tree->getParents($bug->module); $this->view->bug = $bug; + $this->view->branchName = $this->session->currentProductType == 'normal' ? '' : $this->loadModel('branch')->getById($bug->branch); $this->view->users = $this->user->getPairs('noletter'); $this->view->actions = $this->action->getList('bug', $bugID); $this->view->builds = $this->loadModel('build')->getProductBuildPairs($productID); @@ -532,7 +542,7 @@ class bug extends control $currentModuleID = $bug->module; /* Set the menu. */ - $this->bug->setMenu($this->products, $productID); + $this->bug->setMenu($this->products, $productID, $bug->branch); /* Set header and position. */ $this->view->title = $this->lang->bug->edit . "BUG #$bug->id $bug->title - " . $this->products[$productID]; @@ -542,13 +552,13 @@ class bug extends control /* Assign. */ if($projectID) { - $openedBuilds = $this->loadModel('build')->getProjectBuildPairs($projectID, $productID, 'noempty,noterminate,nodone'); - $allBuilds = $this->loadModel('build')->getProjectBuildPairs($projectID, $productID, 'noempty'); + $openedBuilds = $this->loadModel('build')->getProjectBuildPairs($projectID, $productID, $bug->branch, 'noempty,noterminate,nodone'); + $allBuilds = $this->loadModel('build')->getProjectBuildPairs($projectID, $productID, $bug->branch, 'noempty'); } else { - $openedBuilds = $this->loadModel('build')->getProductBuildPairs($productID, 'noempty,noterminate,nodone'); - $allBuilds = $this->loadModel('build')->getProductBuildPairs($productID, 'noempty'); + $openedBuilds = $this->loadModel('build')->getProductBuildPairs($productID, $bug->branch, 'noempty,noterminate,nodone'); + $allBuilds = $this->loadModel('build')->getProductBuildPairs($productID, $bug->branch, 'noempty'); } /* Set the openedBuilds list*/ @@ -563,10 +573,11 @@ class bug extends control $this->view->productID = $productID; $this->view->productName = $this->products[$productID]; $this->view->plans = $this->loadModel('productplan')->getPairs($productID, $bug->branch); - $this->view->moduleOptionMenu = $this->tree->getOptionMenu($productID, $viewType = 'bug', $startModuleID = 0); + $this->view->moduleOptionMenu = $this->tree->getOptionMenu($productID, $viewType = 'bug', $startModuleID = 0, $bug->branch); $this->view->currentModuleID = $currentModuleID; $this->view->projects = $this->product->getProjectPairs($bug->product); $this->view->stories = $bug->project ? $this->story->getProjectStoryPairs($bug->project) : $this->story->getProductStoryPairs($bug->product, $bug->branch); + $this->view->branches = $this->session->currentProductType == 'normal' ? array() : $this->loadModel('branch')->getPairs($bug->product); $this->view->tasks = $this->task->getProjectTaskPairs($bug->project); $this->view->users = $this->user->getPairs('nodeleted', "$bug->assignedTo,$bug->resolvedBy,$bug->closedBy,$bug->openedBy"); $this->view->openedBuilds = $openedBuilds; @@ -584,7 +595,7 @@ class bug extends control * @access public * @return void */ - public function batchEdit($productID = 0) + public function batchEdit($productID = 0, $branch = 0) { if($this->post->titles) { @@ -623,9 +634,9 @@ class bug extends control $product = $this->product->getByID($productID); /* Set product menu. */ - $this->bug->setMenu($this->products, $productID); + $this->bug->setMenu($this->products, $productID, $branch); $this->view->title = $product->name . $this->lang->colon . "BUG" . $this->lang->bug->batchEdit; - $this->view->position[] = html::a($this->createLink('bug', 'browse', "productID=$productID"), $this->products[$productID]); + $this->view->position[] = html::a($this->createLink('bug', 'browse', "productID=$productID&branch=$branch"), $this->products[$productID]); } /* The bugs of my. */ else @@ -652,6 +663,7 @@ class bug extends control $this->view->bugIDList = $bugIDList; $this->view->productID = $productID; $this->view->bugs = $bugs; + $this->view->branch = $branch; $this->view->users = $this->user->getPairs('nodeleted,devfirst'); $this->display(); diff --git a/module/bug/js/common.js b/module/bug/js/common.js index 80098c9d2d..b734cd7f38 100644 --- a/module/bug/js/common.js +++ b/module/bug/js/common.js @@ -43,6 +43,7 @@ function loadAll(productID) { $('#taskIdBox').innerHTML = ''; // Reset the task. $('#task').chosen(defaultChosenOptions); + loadProductBranches(productID) loadProductModules(productID); loadProductProjects(productID); loadProductBuilds(productID); @@ -51,6 +52,18 @@ function loadAll(productID) } } +function loadBranch() +{ + $('#taskIdBox').innerHTML = ''; // Reset the task. + $('#task').chosen(defaultChosenOptions); + productID = $('#product').val(); + loadProductModules(productID); + loadProductProjects(productID); + loadProductBuilds(productID); + loadProductplans(productID); + loadProductStories(productID); +} + /** *Load all builds of one project or product. * @@ -80,9 +93,11 @@ function loadAllBuilds() */ function loadAllProjectBuilds(projectID, productID) { + branch = $('#branch').val(); + if(typeof(branch) == 'undefined') branch = 0; if(page == 'create') oldOpenedBuild = $('#openedBuild').val() ? $('#openedBuild').val() : 0; - link = createLink('build', 'ajaxGetAllProjectBuilds', 'projectID=' + projectID + '&productID=' + productID + '&varName=openedBuild&build=' + oldOpenedBuild); + link = createLink('build', 'ajaxGetAllProjectBuilds', 'projectID=' + projectID + '&productID=' + productID + '&varName=openedBuild&build=' + oldOpenedBuild + '&branch=' + branch); if(page == 'create') { $('#buildBox').load(link, function(){ notice(); $('#openedBuild').chosen(defaultChosenOptions);}); @@ -91,7 +106,7 @@ function loadAllProjectBuilds(projectID, productID) { $('#openedBuildBox').load(link, function(){$(this).find('select').chosen(defaultChosenOptions)}); - buildLink = createLink('build', 'ajaxGetAllProjectBuilds', 'projectID=' + projectID + '&productID=' + productID + '&varName=resolvedBuild&build=' + oldResolvedBuild); + buildLink = createLink('build', 'ajaxGetAllProjectBuilds', 'projectID=' + projectID + '&productID=' + productID + '&varName=resolvedBuild&build=' + oldResolvedBuild + '&branch=' + branch); $('#resolvedBuildBox').load(buildLink, function(){$(this).find('select').chosen(defaultChosenOptions)}); } } @@ -105,7 +120,9 @@ function loadAllProjectBuilds(projectID, productID) */ function loadAllProductBuilds(productID) { - link = createLink('build', 'ajaxGetAllProductBuilds', 'productID=' + productID + '&varName=openedBuild&build=' + oldOpenedBuild); + branch = $('#branch').val(); + if(typeof(branch) == 'undefined') branch = 0; + link = createLink('build', 'ajaxGetAllProductBuilds', 'productID=' + productID + '&varName=openedBuild&build=' + oldOpenedBuild + '&branch=' + branch); if(page == 'create') { $('#buildBox').load(link, function(){ notice(); $('#openedBuild').chosen(defaultChosenOptions);}); @@ -114,7 +131,7 @@ function loadAllProductBuilds(productID) { $('#openedBuildBox').load(link, function(){$(this).find('select').chosen(defaultChosenOptions)}); - buildLink = createLink('build', 'ajaxGetAllProductBuilds', 'productID=' + productID + '&varName=resolvedBuild&build=' + oldResolvedBuild); + buildLink = createLink('build', 'ajaxGetAllProductBuilds', 'productID=' + productID + '&varName=resolvedBuild&build=' + oldResolvedBuild + '&branch=' + branch); $('#resolvedBuildBox').load(buildLink, function(){$(this).find('select').chosen(defaultChosenOptions)}); } } @@ -128,7 +145,9 @@ function loadAllProductBuilds(productID) */ function loadProductModules(productID) { - link = createLink('tree', 'ajaxGetOptionMenu', 'productID=' + productID + '&viewtype=bug&rootModuleID=0&returnType=html&needManage=true'); + branch = $('#branch').val(); + if(typeof(branch) == 'undefined') branch = 0; + link = createLink('tree', 'ajaxGetOptionMenu', 'productID=' + productID + '&viewtype=bug&branch=' + branch + '&rootModuleID=0&returnType=html&needManage=true'); $('#moduleIdBox').load(link, function(){$(this).find('select').chosen(defaultChosenOptions)}); } @@ -141,7 +160,9 @@ function loadProductModules(productID) */ function loadProductStories(productID) { - link = createLink('story', 'ajaxGetProductStories', 'productID=' + productID + '&branch=0&moduleId=0&storyID=' + oldStoryID); + branch = $('#branch').val(); + if(typeof(branch) == 'undefined') branch = 0; + link = createLink('story', 'ajaxGetProductStories', 'productID=' + productID + '&branch=' + branch + '&moduleId=0&storyID=' + oldStoryID); $('#storyIdBox').load(link, function(){$('#story').chosen(defaultChosenOptions);}); } @@ -154,7 +175,9 @@ function loadProductStories(productID) */ function loadProductProjects(productID) { - link = createLink('product', 'ajaxGetProjects', 'productID=' + productID + '&projectID=' + oldProjectID); + branch = $('#branch').val(); + if(typeof(branch) == 'undefined') branch = 0; + link = createLink('product', 'ajaxGetProjects', 'productID=' + productID + '&projectID=' + oldProjectID + '&branch=' + branch); $('#projectIdBox').load(link, function(){$(this).find('select').chosen(defaultChosenOptions)}); } @@ -167,7 +190,9 @@ function loadProductProjects(productID) */ function loadProductplans(productID) { - link = createLink('productplan', 'ajaxGetProductplans', 'productID=' + productID); + branch = $('#branch').val(); + if(typeof(branch) == 'undefined') branch = 0; + link = createLink('productplan', 'ajaxGetProductplans', 'productID=' + productID + '&branch=' + branch); $('#planIdBox').load(link, function(){$(this).find('select').chosen(defaultChosenOptions)}); } @@ -180,7 +205,9 @@ function loadProductplans(productID) */ function loadProductBuilds(productID) { - link = createLink('build', 'ajaxGetProductBuilds', 'productID=' + productID + '&varName=openedBuild&build=' + oldOpenedBuild); + branch = $('#branch').val(); + if(typeof(branch) == 'undefined') branch = 0; + link = createLink('build', 'ajaxGetProductBuilds', 'productID=' + productID + '&varName=openedBuild&build=' + oldOpenedBuild + '&branch=' + branch); if(page == 'create') { @@ -189,7 +216,7 @@ function loadProductBuilds(productID) else { $('#openedBuildBox').load(link, function(){$(this).find('select').chosen(defaultChosenOptions)}); - link = createLink('build', 'ajaxGetProductBuilds', 'productID=' + productID + '&varName=resolvedBuild&build=' + oldResolvedBuild); + link = createLink('build', 'ajaxGetProductBuilds', 'productID=' + productID + '&varName=resolvedBuild&build=' + oldResolvedBuild + '&branch=' + branch); $('#resolvedBuildBox').load(link, function(){$(this).find('select').chosen(defaultChosenOptions)}); } } @@ -240,7 +267,9 @@ function loadProjectTasks(projectID) */ function loadProjectStories(projectID) { - link = createLink('story', 'ajaxGetProjectStories', 'projectID=' + projectID + '&productID=' + $('#product').val() + '&moduleID=0&storyID=' + oldStoryID); + branch = $('#branch').val(); + if(typeof(branch) == 'undefined') branch = 0; + link = createLink('story', 'ajaxGetProjectStories', 'projectID=' + projectID + '&productID=' + $('#product').val() + '&branch=' + branch + '&moduleID=0&storyID=' + oldStoryID); $('#storyIdBox').load(link, function(){$('#story').chosen(defaultChosenOptions);}); } @@ -253,20 +282,22 @@ function loadProjectStories(projectID) */ function loadProjectBuilds(projectID) { + branch = $('#branch').val(); + if(typeof(branch) == 'undefined') branch = 0; productID = $('#product').val(); if(page == 'create') oldOpenedBuild = $('#openedBuild').val() ? $('#openedBuild').val() : 0; if(page == 'create') { - link = createLink('build', 'ajaxGetProjectBuilds', 'projectID=' + projectID + '&productID=' + productID + '&varName=openedBuild&build=' + oldOpenedBuild + "&index=0&needCreate=true"); + link = createLink('build', 'ajaxGetProjectBuilds', 'projectID=' + projectID + '&productID=' + productID + '&varName=openedBuild&build=' + oldOpenedBuild + "&branch=" + branch + "&index=0&needCreate=true"); $('#buildBox').load(link, function(){ notice(); $('#openedBuild').chosen(defaultChosenOptions);}); } else { - link = createLink('build', 'ajaxGetProjectBuilds', 'projectID=' + projectID + '&productID=' + productID + '&varName=openedBuild&build=' + oldOpenedBuild); + link = createLink('build', 'ajaxGetProjectBuilds', 'projectID=' + projectID + '&productID=' + productID + '&varName=openedBuild&build=' + oldOpenedBuild + '&branch=' + branch); $('#openedBuildBox').load(link, function(){$(this).find('select').chosen(defaultChosenOptions)}); - link = createLink('build', 'ajaxGetProjectBuilds', 'projectID=' + projectID + '&productID=' + productID + '&varName=resolvedBuild&build=' + oldResolvedBuild); + link = createLink('build', 'ajaxGetProjectBuilds', 'projectID=' + projectID + '&productID=' + productID + '&varName=resolvedBuild&build=' + oldResolvedBuild + '&branch=' + branch); $('#resolvedBuildBox').load(link, function(){$(this).find('select').chosen(defaultChosenOptions)}); } } @@ -293,6 +324,19 @@ function setStories(moduleID, productID) }); } +function loadProductBranches(productID) +{ + $('#branch').remove(); + $.get(createLink('branch', 'ajaxGetBranches', "productID=" + productID), function(data) + { + if(data) + { + $('#product').closest('.input-group').append(data); + $('#branch').css('width', page == 'create' ? '100px' : '65px'); + } + }) +} + /** * notice for create build. * diff --git a/module/bug/lang/zh-cn.php b/module/bug/lang/zh-cn.php index 142387c24e..584bdf4013 100644 --- a/module/bug/lang/zh-cn.php +++ b/module/bug/lang/zh-cn.php @@ -14,6 +14,7 @@ $lang->bug->common = 'Bug'; $lang->bug->id = 'Bug编号'; $lang->bug->product = '所属' . $lang->productCommon; $lang->bug->productplan = '所属计划'; +$lang->bug->branch = '所属分支'; $lang->bug->module = '所属模块'; $lang->bug->path = '模块路径'; $lang->bug->project = '所属' . $lang->projectCommon; diff --git a/module/bug/model.php b/module/bug/model.php index ead85f75b5..b1a9f171ce 100644 --- a/module/bug/model.php +++ b/module/bug/model.php @@ -21,10 +21,10 @@ class bugModel extends model * @access public * @return void */ - public function setMenu($products, $productID) + public function setMenu($products, $productID, $branch = 0) { - $this->loadModel('product')->setMenu($products, $productID); - $selectHtml = $this->product->select($products, $productID, 'bug', 'browse'); + $this->loadModel('product')->setMenu($products, $productID, $branch); + $selectHtml = $this->product->select($products, $productID, 'bug', 'browse', '', $branch); foreach($this->lang->bug->menu as $key => $menu) { $replace = ($key == 'product') ? $selectHtml : $productID; @@ -76,7 +76,7 @@ class bugModel extends model * @access public * @return void */ - public function batchCreate($productID) + public function batchCreate($productID, $branch = 0) { $this->loadModel('action'); $now = helper::now(); @@ -84,7 +84,7 @@ class bugModel extends model $data = fixer::input('post')->get(); $batchNum = count(reset($data)); - $result = $this->loadModel('common')->removeDuplicate('bug', $data, "product=$productID"); + $result = $this->loadModel('common')->removeDuplicate('bug', $data, "product=$productID&branch=$branch"); $data = $result['data']; for($i = 0; $i < $batchNum; $i++) @@ -93,7 +93,7 @@ class bugModel extends model } /* Get pairs(moduleID => moduleOwner) for bug. */ - $stmt = $this->dbh->query($this->loadModel('tree')->buildMenuQuery($productID, 'bug', $startModuleID = 0)); + $stmt = $this->dbh->query($this->loadModel('tree')->buildMenuQuery($productID, 'bug', $startModuleID = 0, $branch)); $moduleOwners = array(); while($module = $stmt->fetch()) $moduleOwners[$module->id] = $module->owner; @@ -126,6 +126,7 @@ class bugModel extends model $bug->openedBy = $this->app->user->account; $bug->openedDate = $now; $bug->product = $productID; + $bug->branch = $branch; $bug->module = $data->modules[$i]; $bug->project = $data->projects[$i]; $bug->openedBuild = implode(',', $data->openedBuilds[$i]); @@ -209,10 +210,11 @@ class bugModel extends model * @access public * @return array */ - public function getModuleBugs($productID, $moduleIds = 0, $projects, $orderBy = 'id_desc', $pager = null) + public function getModuleBugs($productID, $branch, $moduleIds = 0, $projects, $orderBy = 'id_desc', $pager = null) { return $this->dao->select('*')->from(TABLE_BUG) ->where('product')->eq((int)$productID) + ->beginIF(!empty($branch))->andWhere('branch')->in($branch)->fi() ->beginIF(!empty($moduleIds))->andWhere('module')->in($moduleIds)->fi() ->andWhere('project')->in(array_keys($projects)) ->andWhere('deleted')->eq(0) @@ -1353,13 +1355,13 @@ class bugModel extends model * @access public * @return array */ - public function getAllBugs($productID, $projects, $orderBy, $pager = null) + public function getAllBugs($productID, $branch, $projects, $orderBy, $pager = null) { - $bugs = $this->dao->select('t1.*, t2.title as planTitle') - ->from(TABLE_BUG)->alias('t1') + $bugs = $this->dao->select('t1.*, t2.title as planTitle')->from(TABLE_BUG)->alias('t1') ->leftJoin(TABLE_PRODUCTPLAN)->alias('t2')->on('t1.plan = t2.id') ->where('t1.product')->eq($productID) ->andWhere('t1.project')->in(array_keys($projects)) + ->beginIF($branch)->andWhere('t1.branch')->in($branch)->fi() ->andWhere('t1.deleted')->eq(0) ->orderBy($orderBy)->page($pager)->fetchAll(); @@ -1379,9 +1381,10 @@ class bugModel extends model * @access public * @return array */ - public function getByAssigntome($productID, $projects, $orderBy, $pager) + public function getByAssigntome($productID, $branch, $projects, $orderBy, $pager) { return $this->dao->findByAssignedTo($this->app->user->account)->from(TABLE_BUG)->andWhere('product')->eq($productID) + ->beginIF($branch)->andWhere('branch')->in($branch)->fi() ->andWhere('project')->in(array_keys($projects)) ->andWhere('deleted')->eq(0) ->orderBy($orderBy)->page($pager)->fetchAll(); @@ -1398,9 +1401,10 @@ class bugModel extends model * @access public * @return array */ - public function getByOpenedbyme($productID, $projects, $orderBy, $pager) + public function getByOpenedbyme($productID, $branch, $projects, $orderBy, $pager) { return $this->dao->findByOpenedBy($this->app->user->account)->from(TABLE_BUG)->andWhere('product')->eq($productID) + ->beginIF($branch)->andWhere('branch')->in($branch)->fi() ->andWhere('project')->in(array_keys($projects)) ->andWhere('deleted')->eq(0) ->orderBy($orderBy)->page($pager)->fetchAll(); @@ -1417,9 +1421,10 @@ class bugModel extends model * @access public * @return array */ - public function getByResolvedbyme($productID, $projects, $orderBy, $pager) + public function getByResolvedbyme($productID, $branch, $projects, $orderBy, $pager) { return $this->dao->findByResolvedBy($this->app->user->account)->from(TABLE_BUG)->andWhere('product')->eq($productID) + ->beginIF($branch)->andWhere('branch')->in($branch)->fi() ->andWhere('project')->in(array_keys($projects)) ->andWhere('deleted')->eq(0) ->orderBy($orderBy)->page($pager)->fetchAll(); @@ -1436,10 +1441,11 @@ class bugModel extends model * @access public * @return array */ - public function getByAssigntonull($productID, $projects, $orderBy, $pager) + public function getByAssigntonull($productID, $branch, $projects, $orderBy, $pager) { return $this->dao->findByAssignedTo('')->from(TABLE_BUG)->andWhere('product')->eq($productID) + ->beginIF($branch)->andWhere('branch')->in($branch)->fi() ->andWhere('project')->in(array_keys($projects)) ->andWhere('deleted')->eq(0) ->orderBy($orderBy)->page($pager)->fetchAll(); @@ -1455,10 +1461,11 @@ class bugModel extends model * @access public * @return void */ - public function getUnconfirmed($productID, $projects, $orderBy, $pager) + public function getUnconfirmed($productID, $branch, $projects, $orderBy, $pager) { return $this->dao->select('*')->from(TABLE_BUG) ->where('confirmed')->eq(0) + ->beginIF($branch)->andWhere('branch')->in($branch)->fi() ->andWhere('product')->eq($productID) ->andWhere('project')->in(array_keys($projects)) ->andWhere('deleted')->eq(0) @@ -1477,11 +1484,12 @@ class bugModel extends model * @access public * @return array */ - public function getByStatus($productID, $projects, $status, $orderBy, $pager) + public function getByStatus($productID, $branch, $projects, $status, $orderBy, $pager) { return $this->dao->select('*')->from(TABLE_BUG) ->where('project')->in(array_keys($projects)) ->andWhere('product')->eq($productID) + ->beginIF($branch)->andWhere('branch')->in($branch)->fi() ->beginIF($status == 'unclosed')->andWhere('status')->ne('closed')->fi() ->beginIF($status == 'unresolved')->andWhere('status')->eq('active')->fi() ->beginIF($status == 'toclosed')->andWhere('status')->eq('resolved')->fi() @@ -1500,10 +1508,11 @@ class bugModel extends model * @access public * @return array */ - public function getByLonglifebugs($productID, $projects, $orderBy, $pager) + public function getByLonglifebugs($productID, $branch, $projects, $orderBy, $pager) { return $this->dao->findByLastEditedDate("<", date(DT_DATE1, strtotime('-7 days')))->from(TABLE_BUG)->andWhere('product')->eq($productID) ->andWhere('project')->in(array_keys($projects)) + ->beginIF($branch)->andWhere('branch')->in($branch)->fi() ->andWhere('openedDate')->lt(date(DT_DATE1,strtotime('-7 days'))) ->andWhere('deleted')->eq(0) ->andWhere('status')->ne('closed')->orderBy($orderBy)->page($pager)->fetchAll(); @@ -1520,9 +1529,10 @@ class bugModel extends model * @access public * @return array */ - public function getByPostponedbugs($productID, $projects, $orderBy, $pager) + public function getByPostponedbugs($productID, $branch, $projects, $orderBy, $pager) { return $this->dao->findByResolution('postponed')->from(TABLE_BUG)->andWhere('product')->eq($productID) + ->beginIF($branch)->andWhere('branch')->in($branch)->fi() ->andWhere('project')->in(array_keys($projects)) ->andWhere('deleted')->eq(0) ->orderBy($orderBy)->page($pager)->fetchAll(); @@ -1539,11 +1549,12 @@ class bugModel extends model * @access public * @return array */ - public function getByNeedconfirm($productID, $projects, $orderBy, $pager) + public function getByNeedconfirm($productID, $branch, $projects, $orderBy, $pager) { return $this->dao->select('t1.*, t2.title AS storyTitle')->from(TABLE_BUG)->alias('t1')->leftJoin(TABLE_STORY)->alias('t2')->on('t1.story = t2.id') ->where("t2.status = 'active'") ->andWhere('t1.product')->eq($productID) + ->beginIF($branch)->andWhere('t1.branch')->in($branch)->fi() ->andWhere('t2.version > t1.storyVersion') ->andWhere('t1.project')->in(array_keys($projects)) ->andWhere('t1.deleted')->eq(0) diff --git a/module/bug/view/browse.html.php b/module/bug/view/browse.html.php index b5902ca725..f268eb9924 100644 --- a/module/bug/view/browse.html.php +++ b/module/bug/view/browse.html.php @@ -19,18 +19,18 @@ js::set('moduleID', $moduleID);
@@ -55,8 +55,8 @@ js::set('moduleID', $moduleID);
@@ -82,7 +82,7 @@ js::set('moduleID', $moduleID);
- recTotal}&recPerPage={$pager->recPerPage}"; ?> + recTotal}&recPerPage={$pager->recPerPage}"; ?> @@ -154,7 +154,7 @@ js::set('moduleID', $moduleID); common::printIcon('bug', 'resolve', $params, $bug, 'list', '', '', 'iframe', true); common::printIcon('bug', 'close', $params, $bug, 'list', '', '', 'iframe', true); common::printIcon('bug', 'edit', $params, $bug, 'list'); - common::printIcon('bug', 'create', "product=$bug->product&extra=bugID=$bug->id", $bug, 'list', 'copy'); + common::printIcon('bug', 'create', "product=$bug->product&branch=$bug->branch&extra=bugID=$bug->id", $bug, 'list', 'copy'); ?> @@ -175,7 +175,7 @@ js::set('moduleID', $moduleID);
createLink('bug', 'batchEdit', "productID=$productID"); + $actionLink = $this->createLink('bug', 'batchEdit', "productID=$productID&branch=$branch"); $misc = common::hasPriv('bug', 'batchEdit') ? "onclick=\"setFormAction('$actionLink')\"" : "disabled='disabled'"; echo html::commonButton($lang->edit, $misc); ?> diff --git a/module/bug/view/create.html.php b/module/bug/view/create.html.php index ea0dea59c8..b769af99f5 100644 --- a/module/bug/view/create.html.php +++ b/module/bug/view/create.html.php @@ -32,7 +32,10 @@ js::set('refresh', $lang->refresh);
idAB);?>
bug->lblProductAndModule;?> - +
+ + session->currentProductType != 'normal') echo html::select('branch', $branches, $branch, "onchange='loadBranch()' class='form-control' style='width:100px'");?> +
diff --git a/module/bug/view/edit.html.php b/module/bug/view/edit.html.php index 318fccfe0e..5c614bea78 100644 --- a/module/bug/view/edit.html.php +++ b/module/bug/view/edit.html.php @@ -71,12 +71,17 @@ js::set('oldResolvedBuild' , $bug->resolvedBuild); - + diff --git a/module/bug/view/view.html.php b/module/bug/view/view.html.php index 91aefb6273..36b8c8b104 100644 --- a/module/bug/view/view.html.php +++ b/module/bug/view/view.html.php @@ -24,8 +24,8 @@ session->bugList != false ? $app->session->bugList : inlink('browse', "productID=$bug->product"); $params = "bugID=$bug->id"; - $copyParams = "productID=$productID&extras=bugID=$bug->id"; - $convertParams = "productID=$productID&moduleID=0&from=bug&bugID=$bug->id"; + $copyParams = "productID=$productID&branch=$bug->branch&extras=bugID=$bug->id"; + $convertParams = "productID=$productID&branch=$bug->branch&moduleID=0&from=bug&bugID=$bug->id"; if(!$bug->deleted) { ob_start(); @@ -36,7 +36,7 @@ common::printIcon('bug', 'close', $params, $bug, 'button', '', '', 'text-danger iframe showinonlybody', true); common::printIcon('bug', 'activate', $params, $bug, 'button', '', '', 'text-success iframe showinonlybody', true); - common::printIcon('bug', 'toStory', "product=$bug->product&module=0&story=0&project=0&bugID=$bug->id", $bug, 'button', $lang->icons['story']); + common::printIcon('bug', 'toStory', "product=$bug->product&branch=$bug->branch&module=0&story=0&project=0&bugID=$bug->id", $bug, 'button', $lang->icons['story']); common::printIcon('bug', 'createCase', $convertParams, '', 'button', 'sitemap'); echo ''; @@ -110,6 +110,12 @@ + session->currentProductType != 'normal'):?> + + + + + build->getProductBuildPairs($productID, 'noempty,release,noterminate,nodone'), $build, 'size=4 class=form-control multiple')); - if($varName == 'openedBuilds' ) die(html::select($varName . "[$index][]", $this->build->getProductBuildPairs($productID, 'noempty,release'), $build, 'size=4 class=form-control multiple')); - if($varName == 'resolvedBuild') die(html::select($varName, $this->build->getProductBuildPairs($productID, 'noempty,release,noterminate,nodone'), $build, "class='form-control'")); + if($varName == 'openedBuild' ) die(html::select($varName . '[]', $this->build->getProductBuildPairs($productID, $branch, 'noempty,release,noterminate,nodone'), $build, 'size=4 class=form-control multiple')); + if($varName == 'openedBuilds' ) die(html::select($varName . "[$index][]", $this->build->getProductBuildPairs($productID, $branch, 'noempty,release'), $build, 'size=4 class=form-control multiple')); + if($varName == 'resolvedBuild') die(html::select($varName, $this->build->getProductBuildPairs($productID, $branch, 'noempty,release,noterminate,nodone'), $build, "class='form-control'")); } /** @@ -224,17 +224,17 @@ class build extends control * @access public * @return string */ - public function ajaxGetProjectBuilds($projectID, $productID, $varName, $build = '', $index = 0, $needCreate = false) + public function ajaxGetProjectBuilds($projectID, $productID, $varName, $build = '', $branch = 0, $index = 0, $needCreate = false) { if($varName == 'openedBuild') { - $builds = $this->build->getProjectBuildPairs($projectID, $productID, 'noempty,release,noterminate,nodone'); + $builds = $this->build->getProjectBuildPairs($projectID, $productID, $branch, 'noempty,release,noterminate,nodone'); $output = html::select($varName . '[]', $builds , $build, 'size=4 class=form-control multiple'); die($output); } - if($varName == 'openedBuilds') die(html::select($varName . "[$index][]", $this->build->getProjectBuildPairs($projectID, $productID, 'noempty'), $build, 'size=4 class=form-control multiple')); - if($varName == 'resolvedBuild') die(html::select($varName, $this->build->getProjectBuildPairs($projectID, $productID, 'noempty,noterminate,nodone'), $build, "class='form-control'")); - if($varName == 'testTaskBuild') die(html::select('build', $this->build->getProjectBuildPairs($projectID, $productID, 'noempty'), $build, "class='form-control'")); + if($varName == 'openedBuilds') die(html::select($varName . "[$index][]", $this->build->getProjectBuildPairs($projectID, $productID, $branch, 'noempty'), $build, 'size=4 class=form-control multiple')); + if($varName == 'resolvedBuild') die(html::select($varName, $this->build->getProjectBuildPairs($projectID, $productID, $branch, 'noempty,noterminate,nodone'), $build, "class='form-control'")); + if($varName == 'testTaskBuild') die(html::select('build', $this->build->getProjectBuildPairs($projectID, $productID, $branch, 'noempty'), $build, "class='form-control'")); } /** @@ -246,10 +246,10 @@ class build extends control * @access public * @return string */ - public function ajaxGetAllProductBuilds($productID, $varName, $build = '') + public function ajaxGetAllProductBuilds($productID, $varName, $build = '', $branch = 0) { - if($varName == 'openedBuild' ) die(html::select($varName . '[]', $this->build->getProductBuildPairs($productID, 'noempty,release'), $build, 'size=4 class=form-control multiple')); - if($varName == 'resolvedBuild') die(html::select($varName, $this->build->getProductBuildPairs($productID, 'noempty,release'), $build, "class='form-control'")); + if($varName == 'openedBuild' ) die(html::select($varName . '[]', $this->build->getProductBuildPairs($productID, $branch, 'noempty,release'), $build, 'size=4 class=form-control multiple')); + if($varName == 'resolvedBuild') die(html::select($varName, $this->build->getProductBuildPairs($productID, $branch, 'noempty,release'), $build, "class='form-control'")); } /** @@ -261,15 +261,15 @@ class build extends control * @access public * @return string */ - public function ajaxGetAllProjectBuilds($projectID, $productID, $varName, $build = '') + public function ajaxGetAllProjectBuilds($projectID, $productID, $varName, $build = '', $branch = 0) { if($varName == 'openedBuild') { - $builds = $this->build->getProjectBuildPairs($projectID, $productID, 'noempty,release'); + $builds = $this->build->getProjectBuildPairs($projectID, $productID, $branch, 'noempty,release'); $output = html::select($varName . '[]', $builds , $build, 'size=4 class=form-control multiple'); die($output); } - if($varName == 'resolvedBuild') die(html::select($varName, $this->build->getProjectBuildPairs($projectID, $productID, 'noempty'), $build, "class='form-control'")); + if($varName == 'resolvedBuild') die(html::select($varName, $this->build->getProjectBuildPairs($projectID, $productID, $branch, 'noempty'), $build, "class='form-control'")); } /** diff --git a/module/build/model.php b/module/build/model.php index 77ddde7c01..e50bd063a9 100644 --- a/module/build/model.php +++ b/module/build/model.php @@ -64,17 +64,17 @@ class buildModel extends model * @access public * @return array */ - public function getProjectBuildPairs($projectID, $productID, $params = '') + public function getProjectBuildPairs($projectID, $productID, $branch = 0, $params = '') { $sysBuilds = array(); if(strpos($params, 'noempty') === false) $sysBuilds = array('' => ''); if(strpos($params, 'notrunk') === false) $sysBuilds = $sysBuilds + array('trunk' => 'Trunk'); $builds = $this->dao->select('t1.id, t1.name')->from(TABLE_BUILD)->alias('t1') - ->leftJoin(TABLE_PROJECT)->alias('t2') - ->on('t1.project = t2.id') + ->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project = t2.id') ->where('t1.project')->eq((int)$projectID) ->beginIF($productID)->andWhere('t1.product')->eq((int)$productID)->fi() + ->beginIF($branch)->andWhere('t1.branch')->in($branch)->fi() ->beginIF(strpos($params, 'nodone') !== false)->andWhere('t2.status')->ne('done')->fi() ->andWhere('t1.deleted')->eq(0) ->orderBy('t1.date desc, t1.id desc')->fetchPairs(); @@ -82,6 +82,7 @@ class buildModel extends model $releases = $this->dao->select('build,name')->from(TABLE_RELEASE) ->where('build')->in(array_keys($builds)) ->beginIF(strpos($params, 'noterminate') !== false)->andWhere('status')->ne('terminate')->fi() + ->beginIF($branch)->andWhere('branch')->in($branch)->fi() ->andWhere('deleted')->eq(0) ->fetchPairs(); foreach($releases as $buildID => $releaseName) $builds[$buildID] = $releaseName; @@ -96,22 +97,23 @@ class buildModel extends model * @access public * @return string */ - public function getProductBuildPairs($products, $params = '') + public function getProductBuildPairs($products, $branch = 0, $params = '') { $sysBuilds = array(); if(strpos($params, 'noempty') === false) $sysBuilds = array('' => ''); if(strpos($params, 'notrunk') === false) $sysBuilds = $sysBuilds + array('trunk' => 'Trunk'); $productBuilds = $this->dao->select('t1.id, t1.name, t1.project')->from(TABLE_BUILD)->alias('t1') - ->leftJoin(TABLE_PROJECT)->alias('t2') - ->on('t1.project = t2.id') + ->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project = t2.id') ->where('t1.product')->in($products) + ->beginIF($branch)->andWhere('t1.branch')->in($branch)->fi() ->beginIF(strpos($params, 'nodone') !== false)->andWhere('t2.status')->ne('done')->fi() ->andWhere('t1.deleted')->eq(0) ->orderBy('t1.date desc, t1.id desc')->fetchAll('id'); $releases = $this->dao->select('build,name,deleted')->from(TABLE_RELEASE) ->where('product')->in($products) ->beginIF(strpos($params, 'noterminate') !== false)->andWhere('status')->ne('terminate')->fi() + ->beginIF($branch)->andWhere('branch')->in($branch)->fi() ->fetchAll('build'); $builds = array(); diff --git a/module/product/control.php b/module/product/control.php index d6627d343a..3196173e3e 100644 --- a/module/product/control.php +++ b/module/product/control.php @@ -501,9 +501,9 @@ class product extends control * @access public * @return void */ - public function ajaxGetProjects($productID, $projectID = 0) + public function ajaxGetProjects($productID, $projectID = 0, $branch = 0) { - $projects = $this->product->getProjectPairs($productID, $params = 'nodeleted'); + $projects = $this->product->getProjectPairs($productID, $branch, $params = 'nodeleted'); die(html::select('project', $projects, $projectID, 'class=form-control onchange=loadProjectRelated(this.value)')); } diff --git a/module/product/model.php b/module/product/model.php index cac8e7b950..dd1af775ef 100644 --- a/module/product/model.php +++ b/module/product/model.php @@ -349,14 +349,14 @@ class productModel extends model * @access public * @return array */ - public function getProjectPairs($productID, $param = 'all') + public function getProjectPairs($productID, $branch = 0, $param = 'all') { $projectList = array_keys($this->loadModel('project')->getPairs()); $projects = array(); - $datas = $this->dao->select('t2.id, t2.name, t2.deleted') - ->from(TABLE_PROJECTPRODUCT)->alias('t1')->leftJoin(TABLE_PROJECT)->alias('t2') - ->on('t1.project = t2.id') + $datas = $this->dao->select('t2.id, t2.name, t2.deleted')->from(TABLE_PROJECTPRODUCT) + ->alias('t1')->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project = t2.id') ->where('t1.product')->eq((int)$productID) + ->beginIF($branch)->andWhere('t1.branch')->in($branch)->fi() ->andWhere('t2.id')->in($projectList) ->orderBy('t1.project desc') ->fetchAll(); @@ -698,7 +698,7 @@ class productModel extends model } else { - $link = helper::createLink($module, $method, "productID=%s&branch=%s"); + $link = helper::createLink($module, $method, "productID=%s" . ($branch ? "&branch=%s" : '')); } } else if($module == 'productplan' || $module == 'release') diff --git a/module/product/view/browse.html.php b/module/product/view/browse.html.php index e1bc979f21..444c6ffa80 100644 --- a/module/product/view/browse.html.php +++ b/module/product/view/browse.html.php @@ -115,7 +115,7 @@ common::printIcon('story', 'review', $vars, $story, 'list', 'search'); common::printIcon('story', 'close', $vars, $story, 'list', 'off', '', 'iframe', true); common::printIcon('story', 'edit', $vars, $story, 'list', 'pencil'); - common::printIcon('story', 'createCase', "productID=$story->product&module=0&from=¶m=0&$vars", $story, 'list', 'sitemap'); + common::printIcon('story', 'createCase', "productID=$story->product&branch=$story->branch&module=0&from=¶m=0&$vars", $story, 'list', 'sitemap'); ?> diff --git a/module/project/view/bug.html.php b/module/project/view/bug.html.php index 717fc8c5a2..c8e8e2e679 100644 --- a/module/project/view/bug.html.php +++ b/module/project/view/bug.html.php @@ -18,7 +18,7 @@
- id");?> + id");?>
diff --git a/module/story/control.php b/module/story/control.php index b99951f1fd..4391a92271 100644 --- a/module/story/control.php +++ b/module/story/control.php @@ -166,7 +166,7 @@ class story extends control $this->view->contactLists = $this->user->getContactLists($this->app->user->account, 'withnote'); $this->view->moduleID = $moduleID; $this->view->moduleOptionMenu = $moduleOptionMenu; - $this->view->plans = $this->loadModel('productplan')->getPairs($productID, 'unexpired'); + $this->view->plans = $this->loadModel('productplan')->getPairs($productID, $branch, 'unexpired'); $this->view->planID = $planID; $this->view->source = $source; $this->view->pri = $pri; @@ -896,14 +896,14 @@ class story extends control * @access public * @return void */ - public function ajaxGetProjectStories($projectID, $productID = 0, $moduleID = 0, $storyID = 0, $number = '', $type= 'full') + public function ajaxGetProjectStories($projectID, $productID = 0, $branch = 0, $moduleID = 0, $storyID = 0, $number = '', $type= 'full') { if($moduleID) { $moduleID = $this->loadModel('tree')->getStoryModule($moduleID); $moduleID = $this->tree->getAllChildID($moduleID); } - $stories = $this->story->getProjectStoryPairs($projectID, $productID, $moduleID, $type); + $stories = $this->story->getProjectStoryPairs($projectID, $productID, $branch, $moduleID, $type); $storyName = $number === '' ? 'story' : "story[$number]"; die(html::select($storyName, empty($stories) ? array('' => '') : $stories, $storyID, 'class=form-control onchange=setStoryRelated(' . $number . ');')); } diff --git a/module/story/model.php b/module/story/model.php index 8412f9f798..62cc810a2a 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -215,23 +215,20 @@ class storyModel extends model $stories = fixer::input('post')->get(); $batchNum = count(reset($stories)); - $result = $this->loadModel('common')->removeDuplicate('story', $stories, "product={$productID}"); + $result = $this->loadModel('common')->removeDuplicate('story', $stories, "product={$productID}&branch=$branch"); $stories = $result['data']; $module = 0; $plan = 0; $pri = 0; - $branch = 0; for($i = 0; $i < $batchNum; $i++) { $module = $stories->module[$i] == 'same' ? $module : $stories->module[$i]; $plan = $stories->plan[$i] == 'same' ? $plan : $stories->plan[$i]; $pri = $stories->pri[$i] == 'same' ? $pri : $stories->pri[$i]; - $branch = $stories->pri[$i] == 'same' ? $branch : $stories->branch[$i]; $stories->module[$i] = (int)$module; $stories->plan[$i] = (int)$plan; $stories->pri[$i] = (int)$pri; - $stories->branch[$i] = (int)$branch; } if(isset($stories->uploadImage)) $this->loadModel('file'); @@ -1220,17 +1217,16 @@ class storyModel extends model * @access public * @return array */ - public function getProjectStoryPairs($projectID = 0, $productID = 0, $moduleIds = 0, $type = 'full') + public function getProjectStoryPairs($projectID = 0, $productID = 0, $branch = 0, $moduleIds = 0, $type = 'full') { $stories = $this->dao->select('t2.id, t2.title, t2.module, t2.pri, t2.estimate, t3.name AS product') ->from(TABLE_PROJECTSTORY)->alias('t1') - ->leftJoin(TABLE_STORY)->alias('t2') - ->on('t1.story = t2.id') - ->leftJoin(TABLE_PRODUCT)->alias('t3') - ->on('t1.product = t3.id') + ->leftJoin(TABLE_STORY)->alias('t2')->on('t1.story = t2.id') + ->leftJoin(TABLE_PRODUCT)->alias('t3')->on('t1.product = t3.id') ->where('t1.project')->eq((int)$projectID) ->andWhere('t2.deleted')->eq(0) ->beginIF($productID)->andWhere('t1.product')->eq((int)$productID)->fi() + ->beginIF($branch)->andWhere('t2.branch')->eq((int)$branch)->fi() ->beginIF($moduleIds)->andWhere('t2.module')->in($moduleIds)->fi() ->fetchAll(); if(!$stories) return array(); diff --git a/module/testcase/control.php b/module/testcase/control.php index b007b44c7e..57233641d3 100644 --- a/module/testcase/control.php +++ b/module/testcase/control.php @@ -265,7 +265,6 @@ class testcase extends control /* Set productID and currentModuleID. */ $productID = $this->product->saveState($productID, $this->products); - $product = $this->product->getById($productID); if($storyID and empty($moduleID)) { $story = $this->loadModel('story')->getByID($storyID); @@ -354,9 +353,8 @@ class testcase extends control $this->view->precondition = $precondition; $this->view->keywords = $keywords; $this->view->steps = $steps; - $this->view->product = $product; $this->view->branch = $branch; - $this->view->branches = $product->type != 'normal' ? $this->loadModel('branch')->getPairs($productID) : array(); + $this->view->branches = $this->session->currentProductType != 'normal' ? $this->loadModel('branch')->getPairs($productID) : array(); $this->display(); } @@ -376,7 +374,7 @@ class testcase extends control $this->loadModel('story'); if(!empty($_POST)) { - $caseID = $this->testcase->batchCreate($productID, $storyID); + $caseID = $this->testcase->batchCreate($productID, $branch, $storyID); if(dao::isError()) die(js::error(dao::getError())); die(js::locate($this->createLink('testcase', 'browse', "productID=$productID&branch=$branch&browseType=byModule¶m=$moduleID"), 'parent')); } @@ -539,7 +537,6 @@ class testcase extends control $case->steps[] = $step; } $productID = $case->product; - $product = $this->loadModel('product')->getById($productID); $currentModuleID = $case->module; $title = $this->products[$productID] . $this->lang->colon . $this->lang->testcase->edit; $position[] = html::a($this->createLink('testcase', 'browse', "productID=$productID"), $this->products[$productID]); @@ -552,8 +549,7 @@ class testcase extends control $this->view->title = $title; $this->view->position = $position; $this->view->productID = $productID; - $this->view->product = $product; - $this->view->branches = $product->type == 'normal' ? array() : $this->loadModel('branch')->getPairs($productID); + $this->view->branches = $this->session->currentProductType == 'normal' ? array() : $this->loadModel('branch')->getPairs($productID); $this->view->productName = $this->products[$productID]; $this->view->moduleOptionMenu = $this->tree->getOptionMenu($productID, $viewType = 'case', $startModuleID = 0, $case->branch); $this->view->currentModuleID = $currentModuleID; diff --git a/module/testcase/model.php b/module/testcase/model.php index 1127b1e4ef..0293dadc7e 100644 --- a/module/testcase/model.php +++ b/module/testcase/model.php @@ -86,13 +86,13 @@ class testcaseModel extends model * @access public * @return void */ - function batchCreate($productID, $storyID) + function batchCreate($productID, $branch, $storyID) { $now = helper::now(); $cases = fixer::input('post')->get(); $batchNum = count(reset($cases)); - $result = $this->loadModel('common')->removeDuplicate('case', $cases, "product=$productID"); + $result = $this->loadModel('common')->removeDuplicate('case', $cases, "product=$productID&branch=$branch"); $cases = $result['data']; for($i = 0; $i < $batchNum; $i++) @@ -119,6 +119,7 @@ class testcaseModel extends model { $data[$i] = new stdclass(); $data[$i]->product = $productID; + $data[$i]->branch = $branch; $data[$i]->module = $cases->module[$i]; $data[$i]->type = $cases->type[$i]; $data[$i]->story = $storyID ? $storyID : $cases->story[$i]; diff --git a/module/testcase/view/browse.html.php b/module/testcase/view/browse.html.php index c096d544e3..1c9aa483a7 100644 --- a/module/testcase/view/browse.html.php +++ b/module/testcase/view/browse.html.php @@ -38,7 +38,7 @@ js::set('batchDelete', $lang->testcase->confirmBatchDelete);
bug->product;?> +
+ + session->currentProductType != 'normal') echo html::select('branch', $branches, $bug->branch, "onchange='loadBranch();' class='form-control' style='width:65px'");?> +
+
bug->module;?> - +
bug->product;?> product", $productName)) echo $productName;?>
bug->branch;?>product&branch=$bug->branch", $branchName)) echo $branchName;?>
bug->module;?>
- recTotal}&recPerPage={$pager->recPerPage}"; ?> + recTotal}&recPerPage={$pager->recPerPage}"; ?> @@ -82,7 +82,7 @@ js::set('batchDelete', $lang->testcase->confirmBatchDelete); common::printIcon('testtask', 'runCase', "runID=0&caseID=$case->id&version=$case->version", '', 'list', 'play', '', 'runCase iframe'); common::printIcon('testtask', 'results', "runID=0&caseID=$case->id", '', 'list', 'flag-checkered', '', 'results iframe'); common::printIcon('testcase', 'edit', "caseID=$case->id", $case, 'list'); - common::printIcon('testcase', 'create', "productID=$case->product&moduleID=$case->module&from=testcase¶m=$case->id", $case, 'list', 'copy'); + common::printIcon('testcase', 'create', "productID=$case->product&branch=$case->branch&moduleID=$case->module&from=testcase¶m=$case->id", $case, 'list', 'copy'); if(common::hasPriv('testcase', 'delete')) { diff --git a/module/testcase/view/create.html.php b/module/testcase/view/create.html.php index 8a4f56fe75..8c74066b1d 100644 --- a/module/testcase/view/create.html.php +++ b/module/testcase/view/create.html.php @@ -29,7 +29,7 @@ diff --git a/module/testtask/lang/zh-cn.php b/module/testtask/lang/zh-cn.php index 61a869fe8d..31504c1a78 100644 --- a/module/testtask/lang/zh-cn.php +++ b/module/testtask/lang/zh-cn.php @@ -35,13 +35,13 @@ $lang->testtask->wait = "待测版本"; $lang->testtask->done = "已测版本"; $lang->testtask->common = '测试视图版本'; -$lang->testtask->id = '版本编号'; +$lang->testtask->id = '编号'; $lang->testtask->product = '所属' . $lang->productCommon; $lang->testtask->project = '所属' . $lang->projectCommon; $lang->testtask->build = '版本'; $lang->testtask->owner = '负责人'; $lang->testtask->pri = '优先级'; -$lang->testtask->name = '版本名称'; +$lang->testtask->name = '名称'; $lang->testtask->begin = '开始日期'; $lang->testtask->end = '结束日期'; $lang->testtask->desc = '描述';
idAB);?>
- type != 'normal') echo html::select('branch', $branches, $branch, "onchange='loadBranch();' class='form-control' style='width:65px'");?> + session->currentProductType != 'normal') echo html::select('branch', $branches, $branch, "onchange='loadBranch();' class='form-control' style='width:65px'");?>
diff --git a/module/testcase/view/edit.html.php b/module/testcase/view/edit.html.php index 8a0020b659..c5da37b5e9 100644 --- a/module/testcase/view/edit.html.php +++ b/module/testcase/view/edit.html.php @@ -15,7 +15,7 @@ testcase->deleteStep);?> testcase->insertBefore);?> testcase->insertAfter);?> - +
icons['testcase']);?> id;?> @@ -92,7 +92,7 @@
- type != 'normal') echo html::select('branch', $branches, $case->branch, "onchange='loadBranch();' class='form-control' style='width:65px'");?> + session->currentProductType != 'normal') echo html::select('branch', $branches, $case->branch, "onchange='loadBranch();' class='form-control' style='width:65px'");?>