diff --git a/module/action/model.php b/module/action/model.php index f66683c290..db82ae616d 100755 --- a/module/action/model.php +++ b/module/action/model.php @@ -1783,9 +1783,20 @@ class actionModel extends model } elseif(in_array($action->objectType, array('program', 'project', 'execution'))) { - $project = $this->dao->select('id,acl')->from(TABLE_PROJECT)->where('id')->eq($action->objectID)->fetch(); + $project = $this->dao->select('id,acl,name,hasProduct')->from(TABLE_PROJECT)->where('id')->eq($action->objectID)->fetch(); $objecttype = $action->objectType == 'execution' ? 'sprint' : $action->objectType; if($project->acl != 'open') $this->loadModel('user')->updateUserView($project->id, $objecttype); + + /* Reduction shadow product. */ + if(!$project->hasProduct and $action->objectType == 'project') + { + $productID = $this->loadModel('product')->getProductIDByProject($project->id);; + $this->dao->update(TABLE_PRODUCT) + ->set('name')->eq($project->name) + ->set('deleted')->eq(0) + ->where('id')->eq($productID) + ->exec(); + } } elseif($action->objectType == 'module') { diff --git a/module/block/control.php b/module/block/control.php index 870645d16a..52f0674fad 100755 --- a/module/block/control.php +++ b/module/block/control.php @@ -856,13 +856,32 @@ class block extends control $productIdList = array(); foreach($productStats as $product) $productIdList[] = $product->id; - $this->view->executions = $this->dao->select('t1.product,t2.name')->from(TABLE_PROJECTPRODUCT)->alias('t1') + $this->app->loadLang('project'); + $executions = $this->dao->select('t1.product,t2.id,t2.project,t2.name,t2.multiple')->from(TABLE_PROJECTPRODUCT)->alias('t1') ->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project=t2.id') ->where('t1.product')->in($productIdList) ->andWhere('t2.type')->in('stage,sprint') ->andWhere('t2.deleted')->eq(0) ->orderBy('t1.project') - ->fetchPairs('product', 'name'); + ->fetchAll('product'); + + $executionPairs = array(); + $noMultiples = array(); + foreach($executions as $execution) + { + if(empty($execution->multiple)) $noMultiples[$execution->product] = $execution->project; + $executionPairs[$execution->product] = $execution->name; + } + if($noMultiples) + { + $noMultipleProjects = $this->dao->select('id,name')->from(TABLE_PROJECT)->where('id')->in($noMultiples)->fetchPairs('id', 'name'); + foreach($noMultiples as $productID => $projectID) + { + if(isset($noMultipleProjects[$projectID])) $executionPairs[$productID] = $noMultipleProjects[$projectID] . "({$this->lang->project->disableExecution})"; + } + } + + $this->view->executions = $executionPairs; $this->view->productStats = $productStats; } @@ -1649,6 +1668,7 @@ class block extends control $total = 0; foreach($executions as $execution) { + if(empty($execution->multiple)) continue; if(!isset($overview[$execution->status])) $overview[$execution->status] = 0; $overview[$execution->status]++; $total++; diff --git a/module/block/view/projectstatisticblock.html.php b/module/block/view/projectstatisticblock.html.php index 7faf9838c7..73c540f536 100644 --- a/module/block/view/projectstatisticblock.html.php +++ b/module/block/view/projectstatisticblock.html.php @@ -197,7 +197,7 @@ $(function() - executions)):?> + executions) and $project->multiple):?>

block->last;?>

@@ -259,7 +259,7 @@ $(function()
cv;?>
- + diff --git a/module/bug/control.php b/module/bug/control.php index 1f854ad36e..0980e3e697 100755 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -320,10 +320,6 @@ class bug extends control parse_str($extras, $output); $from = isset($output['from']) ? $output['from'] : ''; - $project = new stdclass(); - - $productInfo = $this->product->getById($productID); - $hiddenProduct = false; if($this->app->tab == 'execution') { if(isset($output['executionID'])) $this->loadModel('execution')->setMenu($output['executionID']); @@ -342,30 +338,17 @@ class bug extends control $this->view->regionPairs = $regionPairs; $this->view->lanePairs = $lanePairs; } - - $projectID = $execution->project; - $project = $this->loadModel('project')->getByID($projectID); - $hiddenProduct = empty($project->hasProduct); } else if($this->app->tab == 'project') { if(isset($output['projectID'])) { $this->loadModel('project')->setMenu($output['projectID']); - - /* Replace language. */ - $project = $this->project->getByID($output['projectID']); - if(!empty($project->model) and $project->model == 'waterfall') - { - $this->lang->bug->execution = str_replace($this->lang->executionCommon, $this->lang->project->stage, $this->lang->bug->execution); - } - $hiddenProduct = empty($project->hasProduct); } } else { $this->qa->setMenu($this->products, $productID, $branch); - $hiddenProduct = $productInfo->shadow; } $this->view->users = $this->user->getPairs('devfirst|noclosed|nodeleted'); @@ -484,7 +467,8 @@ class bug extends control } /* Get product, then set menu. */ - $productID = $this->product->saveState($productID, $this->products); + $productID = $this->product->saveState($productID, $this->products); + $currentProduct = $this->product->getById($productID); if($branch === '') $branch = (int)$this->cookie->preBranch; @@ -561,13 +545,13 @@ class bug extends control if($this->app->tab == 'execution' or $this->app->tab == 'project') { $objectID = $this->app->tab == 'project' ? $projectID : $executionID; - $productBranches = $productInfo->type != 'normal' ? $this->loadModel('execution')->getBranchByProduct($productID, $objectID, 'noclosed|withMain') : array(); + $productBranches = $currentProduct->type != 'normal' ? $this->loadModel('execution')->getBranchByProduct($productID, $objectID, 'noclosed|withMain') : array(); $branches = isset($productBranches[$productID]) ? $productBranches[$productID] : array(); $branch = key($branches); } else { - $branches = $productInfo->type != 'normal' ? $this->loadModel('branch')->getPairs($productID, 'active') : array(); + $branches = $currentProduct->type != 'normal' ? $this->loadModel('branch')->getPairs($productID, 'active') : array(); } /* If executionID is setted, get builds and stories of this execution. */ @@ -601,12 +585,6 @@ class bug extends control $products = array(); $linkedProducts = $this->loadModel('product')->getProducts($executionID); foreach($linkedProducts as $product) $products[$product->id] = $product->name; - - if($projectID) - { - $project = $this->loadModel('project')->getByID($projectID); - if(empty($bugID) or $this->app->tab != 'qa') $projects += array($projectID => $project->name); - } } elseif($projectID) { @@ -614,9 +592,6 @@ class bug extends control $productList = $this->config->CRProduct ? $this->product->getOrderedProducts('all', 40, $projectID) : $this->product->getOrderedProducts('normal', 40, $projectID); foreach($productList as $product) $products[$product->id] = $product->name; - $project = $this->loadModel('project')->getByID($projectID); - if(empty($bugID) or $this->app->tab != 'qa') $projects += array($projectID => $project->name); - /* Set project menu. */ if($this->app->tab == 'project') $this->project->setMenu($projectID); } @@ -625,6 +600,21 @@ class bug extends control $projects += $this->product->getProjectPairsByProduct($productID, $branch); } + $projectModel = ''; + if($projectID) + { + $project = $this->loadModel('project')->getByID($projectID); + if($project) + { + if(empty($bugID) or $this->app->tab != 'qa') $projects += array($projectID => $project->name); + + /* Replace language. */ + if(!empty($project->model) and $project->model == 'waterfall') $this->lang->bug->execution = str_replace($this->lang->executionCommon, $this->lang->project->stage, $this->lang->bug->execution); + + $projectModel = $project->model; + } + } + /* Link all projects to product when copying bug under qa.*/ if(!empty($bugID) and $this->app->tab == 'qa') $projects += $this->product->getProjectPairsByProduct($productID, $branch); @@ -660,11 +650,11 @@ class bug extends control $this->view->moduleOptionMenu = $moduleOptionMenu; $this->view->stories = $stories; $this->view->projects = defined('TUTORIAL') ? $this->loadModel('tutorial')->getProjectPairs() : $projects; - $this->view->project = $project; $this->view->executions = defined('TUTORIAL') ? $this->loadModel('tutorial')->getExecutionPairs() : $executions; $this->view->builds = $builds; $this->view->moduleID = (int)$moduleID; $this->view->projectID = $projectID; + $this->view->projectModel = $projectModel; $this->view->executionID = $executionID; $this->view->taskID = $taskID; $this->view->storyID = $storyID; @@ -685,8 +675,7 @@ class bug extends control $this->view->keywords = $keywords; $this->view->severity = $severity; $this->view->type = $type; - $this->view->productInfo = $productInfo; - $this->view->hiddenProduct = $hiddenProduct; + $this->view->product = $currentProduct; $this->view->branch = $branch; $this->view->branches = $branches; $this->view->blockID = $blockID; @@ -833,6 +822,8 @@ class bug extends control } $projectID = $this->lang->navGroup->bug == 'project' ? $this->session->project : (isset($execution) ? $execution->project : 0); + $project = $this->loadModel('project')->getByID($projectID); + if(isset($project->model) && $project->model == 'kanban') $customFields['execution'] = $this->lang->bug->kanban; /* Get branches. */ if($executionID) @@ -853,7 +844,7 @@ class bug extends control $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->project = $this->loadModel('project')->getByID($projectID); + $this->view->project = $project; $this->view->product = $product; $this->view->productID = $productID; $this->view->stories = $stories; diff --git a/module/bug/model.php b/module/bug/model.php index b37f2a7a51..63d08257d6 100644 --- a/module/bug/model.php +++ b/module/bug/model.php @@ -3609,7 +3609,8 @@ class bugModel extends model if($type == 'view') $menu .= $this->buildMenu('bug', 'activate', $params, $bug, $type, '', '', "text-success iframe showinonlybody", true); if($type == 'view' && $this->app->tab != 'product') { - $menu .= $this->buildMenu('bug', 'toStory', $toStoryParams, $bug, $type, $this->lang->icons['story'], '', '', '', "data-app='product' id='tostory'", $this->lang->bug->toStory); + $tab = $this->app->tab == 'qa' ? 'product' : $this->app->tab; + $menu .= $this->buildMenu('bug', 'toStory', $toStoryParams, $bug, $type, $this->lang->icons['story'], '', '', '', "data-app='$tab' id='tostory'", $this->lang->bug->toStory); if(common::hasPriv('task', 'create') and !isonlybody()) $menu .= html::a('#toTask', "{$this->lang->bug->toTask}", '', "data-app='qa' data-toggle='modal' class='btn btn-link'"); $menu .= $this->buildMenu('bug', 'createCase', $convertParams, $bug, $type, 'sitemap'); } diff --git a/module/bug/view/batchcreate.html.php b/module/bug/view/batchcreate.html.php index 5e167e4891..11bb6edc62 100755 --- a/module/bug/view/batchcreate.html.php +++ b/module/bug/view/batchcreate.html.php @@ -57,7 +57,7 @@ foreach(explode(',', $config->bug->create->requiredFields) as $field) branchBox'> product->branch;?> '> bug->module;?> systemMode == 'new'):?> - projectBox'>model) and $project->model == 'kanban') ? $lang->bug->kanban : $lang->bug->project;?> + projectBox'>bug->project;?> executionBox'>model) and $project->model == 'kanban') ? $lang->bug->kanban : $lang->bug->execution;?> bug->openedBuild;?> diff --git a/module/bug/view/create.html.php b/module/bug/view/create.html.php index c7d22e54c7..b2117b02da 100644 --- a/module/bug/view/create.html.php +++ b/module/bug/view/create.html.php @@ -51,18 +51,18 @@ if($this->app->tab == 'project') js::set('objectID', $projectID); - - +
bug->module : $lang->bug->product;?> + shadow ? $lang->bug->module : $lang->bug->product;?>
- type != 'normal' and isset($products[$productID])):?> + type != 'normal' and isset($products[$productID])):?>
- + shadow):?> bug->module?> app->tab == 'project') js::set('objectID', $projectID);
- model) and $project->model == 'kanban') ? $lang->bug->kanban : $lang->bug->execution;?> + bug->kanban : $lang->bug->execution;?>
@@ -384,7 +384,7 @@ if($this->app->tab == 'project') js::set('objectID', $projectID); bug->module);?> -model) and $project->model == 'kanban') ? $lang->bug->kanban : $lang->bug->execution);?> +bug->kanban : $lang->bug->execution);?> systemMode);?>