diff --git a/module/branch/model.php b/module/branch/model.php index d32b12b34a..7692f4f7ba 100644 --- a/module/branch/model.php +++ b/module/branch/model.php @@ -85,8 +85,6 @@ class branchModel extends model $mainBranch->desc = sprintf($this->lang->branch->mainBranch, $this->lang->product->branchName[$product->type]); $mainBranch->order = 0; - if($productID) $product = $this->loadModel('product')->getById($productID); - if(isset($product) and $product->type == 'normal') return $branchList; return array($mainBranch) + $branchList; } @@ -351,16 +349,69 @@ class branchModel extends model /** * Unlink branches for projects when product type is normal. * - * @param int $productIDList + * @param int|array $productIDList * @access public * @return void */ public function unlinkBranch4Project($productIDList) { + $productLinkedProject = $this->dao->select('*')->from(TABLE_PROJECTPRODUCT) + ->where('product')->in($productIDList) + ->andWhere('branch')->gt(0) + ->fetchGroup('product', 'project'); + $this->dao->delete()->from(TABLE_PROJECTPRODUCT) ->where('product')->in($productIDList) ->andWhere('branch')->gt(0) ->exec(); + + foreach($productLinkedProject as $productID => $projectList) + { + foreach($projectList as $projectID => $project) + { + $data = new stdClass(); + $data->product = $productID; + $data->project = $projectID; + $data->branch = 0; + $data->plan = 0; + + $this->dao->replace(TABLE_PROJECTPRODUCT)->data($data)->exec(); + } + } + } + + /** + * Link branches for projects when product type is not normal. + * + * @param int $productID + * @access public + * @return void + */ + public function linkBranch4Project($productID) + { + if(is_array($productID)) + { + foreach($productID as $id) $this->linkBranch4Project($id); + } + + $linkedBranchProject = $this->dao->select('project,branch')->from(TABLE_PROJECTSTORY) + ->where('product')->eq($productID) + ->andWhere('branch')->gt(0) + ->fetchGroup('project','branch'); + + foreach($linkedBranchProject as $projectID => $branchList) + { + foreach($branchList as $branchID => $branch) + { + $data = new stdClass(); + $data->product = $productID; + $data->project = $projectID; + $data->branch = $branchID; + $data->plan = 0; + + $this->dao->replace(TABLE_PROJECTPRODUCT)->data($data)->exec(); + } + } } /** diff --git a/module/bug/control.php b/module/bug/control.php index 502bedb543..e677a1b580 100644 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -89,16 +89,23 @@ class bug extends control $this->loadModel('datatable'); $productID = $this->product->saveState($productID, $this->products); + $product = $this->product->getById($productID); + if($product->type != 'normal') + { + /* Set productID, moduleID, queryID and branch. */ + $branch = ($this->cookie->preBranch !== '' and $branch === '') ? $this->cookie->preBranch : $branch; + setcookie('preProductID', $productID, $this->config->cookieLife, $this->config->webRoot, '', $this->config->cookieSecure, true); + setcookie('preBranch', $branch, $this->config->cookieLife, $this->config->webRoot, '', $this->config->cookieSecure, true); + } + else + { + $branch = 'all'; + } + $this->qa->setMenu($this->products, $productID, $branch); /* Set browse type. */ $browseType = strtolower($browseType); - - /* Set productID, moduleID, queryID and branch. */ - $branch = ($this->cookie->preBranch !== '' and $branch === '') ? $this->cookie->preBranch : $branch; - setcookie('preProductID', $productID, $this->config->cookieLife, $this->config->webRoot, '', $this->config->cookieSecure, true); - setcookie('preBranch', $branch, $this->config->cookieLife, $this->config->webRoot, '', $this->config->cookieSecure, true); - if($this->cookie->preProductID != $productID or $this->cookie->preBranch != $branch or $browseType == 'bybranch') { $_COOKIE['bugModule'] = 0; @@ -191,19 +198,22 @@ class bug extends control $showModule = !empty($this->config->datatable->bugBrowse->showModule) ? $this->config->datatable->bugBrowse->showModule : ''; $productName = ($productID and isset($this->products[$productID])) ? $this->products[$productID] : $this->lang->product->allProduct; - $product = $this->product->getById($productID); - /* Display of branch label. */ - $showBranch = $this->loadModel('branch')->showBranch($productID); - - /* Display status of branch. */ - $branches = $this->loadModel('branch')->getList($productID, 0, 'all'); + $showBranch = false; $branchOption = array(); $branchTagOption = array(); - foreach($branches as $branchInfo) + if($product and $product->type != 'normal') { - $branchOption[$branchInfo->id] = $branchInfo->name; - $branchTagOption[$branchInfo->id] = $branchInfo->name . ($branchInfo->status == 'closed' ? ' (' . $this->lang->branch->statusList['closed'] . ')' : ''); + /* Display of branch label. */ + $showBranch = $this->loadModel('branch')->showBranch($productID); + + /* Display status of branch. */ + $branches = $this->loadModel('branch')->getList($productID, 0, 'all'); + foreach($branches as $branchInfo) + { + $branchOption[$branchInfo->id] = $branchInfo->name; + $branchTagOption[$branchInfo->id] = $branchInfo->name . ($branchInfo->status == 'closed' ? ' (' . $this->lang->branch->statusList['closed'] . ')' : ''); + } } /* Set view. */ @@ -985,13 +995,26 @@ class bug extends control $branchTagOption[$branchInfo->id] = $branchInfo->name . ($branchInfo->status == 'closed' ? ' (' . $this->lang->branch->statusList['closed'] . ')' : ''); } + $moduleOptionMenu = $this->tree->getOptionMenu($productID, $viewType = 'bug', $startModuleID = 0, $bug->branch); + if(!isset($moduleOptionMenu[$bug->module])) + { + $bugModule = '/'; + $modulePath = $this->tree->getParents($bug->module); + foreach($modulePath as $key => $module) + { + $bugModule .= $module->name; + if(isset($modulePath[$key + 1])) $bugModule .= '/'; + } + $moduleOptionMenu += array($bug->module => $bugModule); + } + $this->view->bug = $bug; $this->view->productID = $productID; $this->view->product = $product; $this->view->productName = $this->products[$productID]; $this->view->plans = $this->loadModel('productplan')->getPairs($productID, $bug->branch, '', true); $this->view->projects = array(0 => '') + $this->product->getProjectPairsByProduct($productID, $bug->branch, $bug->project); - $this->view->moduleOptionMenu = $this->tree->getOptionMenu($productID, $viewType = 'bug', $startModuleID = 0, $bug->branch); + $this->view->moduleOptionMenu = $moduleOptionMenu; $this->view->currentModuleID = $currentModuleID; $this->view->executions = array(0 => '') + $this->product->getExecutionPairsByProduct($bug->product, $bug->branch, 'id_desc', $bug->project); $this->view->stories = $bug->execution ? $this->story->getExecutionStoryPairs($bug->execution) : $this->story->getProductStoryPairs($bug->product, $bug->branch); diff --git a/module/bug/view/batchedit.html.php b/module/bug/view/batchedit.html.php index 859a2abcb9..179fe2d3c7 100644 --- a/module/bug/view/batchedit.html.php +++ b/module/bug/view/batchedit.html.php @@ -92,6 +92,20 @@ $modules[$bug->product][$bug->branch] = $this->tree->getOptionMenu($bug->product, 'bug', 0, $bug->branch); } } + + $moduleList = $modules[$bug->product]; + if(!isset($moduleList[$bug->branch])) + { + $bugModule = '/'; + $modulePath = $this->tree->getParents($bug->module); + foreach($modulePath as $key => $module) + { + $bugModule .= $module->name; + if(isset($modulePath[$key + 1])) $bugModule .= '/'; + } + + $moduleList[$bug->branch] = $modules[$bug->product][0] + array($bug->module => $bugModule); + } ?> @@ -119,7 +133,7 @@ branch, "class='form-control chosen' $disabled onchange='setBranchRelated(this.value, $bug->product, $bug->id)'");?> - product][$bug->branch], $bug->module, "class='form-control chosen'");?> + branch]) ? $moduleList[$bug->branch] : array(0 => '/'), $bug->module, "class='form-control chosen'");?> ' style='overflow:visible'>plan, "class='form-control chosen'");?> ' style='overflow:visible'>assignedTo, "class='form-control chosen'");?> ' style='overflow:visible'>deadline, "class='form-control form-date'");?> diff --git a/module/execution/control.php b/module/execution/control.php index 5d73250ea5..2d999b98b4 100644 --- a/module/execution/control.php +++ b/module/execution/control.php @@ -2573,8 +2573,8 @@ class execution extends control $this->view->unmodifiableProducts = $unmodifiableProducts; $this->view->unmodifiableBranches = $unmodifiableBranches; $this->view->linkedBranches = $linkedBranches; - $this->view->branchGroups = $this->execution->getBranchByProduct(array_keys($allProducts), $this->config->systemMode == 'new' ? $execution->project : 0); - $this->view->allBranches = $this->execution->getBranchByProduct(array_keys($allProducts), $this->config->systemMode == 'new' ? $execution->project : 0, 'all'); + $this->view->branchGroups = $this->execution->getBranchByProduct(array_keys($allProducts), $this->config->systemMode == 'new' ? $execution->project : 0, 'ignoreNormal|noclosed'); + $this->view->allBranches = $this->execution->getBranchByProduct(array_keys($allProducts), $this->config->systemMode == 'new' ? $execution->project : 0, 'ignoreNormal'); $this->display(); } @@ -2748,7 +2748,6 @@ class execution extends control /* Set modules and branches. */ $modules = array(); - $branchIDList = array(BRANCH_MAIN); $branches = $this->project->getBranchesByProject($objectID); $productType = 'normal'; $this->loadModel('tree'); @@ -2762,7 +2761,8 @@ class execution extends control } if($product->type != 'normal') { - $productType = $product->type; + $productType = $product->type; + $branchIDList = array(BRANCH_MAIN); if(isset($branches[$product->id])) { foreach($branches[$product->id] as $branchID => $branch) $branchIDList[$branchID] = $branchID; @@ -2781,7 +2781,7 @@ class execution extends control } else { - $allStories = $this->story->getProductStories(array_keys($products), $branchIDList, $moduleID = '0', $status = 'active', 'story', 'id_desc', $hasParent = false, '', $pager = null); + $allStories = $this->story->getProductStories(array_keys($products), isset($branchIDList) ? $branchIDList : 'all', $moduleID = '0', $status = 'active', 'story', 'id_desc', $hasParent = false, '', $pager = null); } $linkedStories = $this->story->getExecutionStoryPairs($objectID); diff --git a/module/execution/view/linkstory.html.php b/module/execution/view/linkstory.html.php index 0a6d336e56..c529bc0e3c 100644 --- a/module/execution/view/linkstory.html.php +++ b/module/execution/view/linkstory.html.php @@ -69,6 +69,19 @@ ?> createLink('product', 'browse', "productID=$story->product&branch=$story->branch"), $products[$story->product]->name, '_blank');?> + module])) + { + $storyModule = count($products) > 1 ? $products[$story->product]->name . '/' : '/'; + $modulePath = $this->tree->getParents($story->module); + foreach($modulePath as $key => $module) + { + $storyModule .= $module->name; + if(isset($modulePath[$key + 1])) $storyModule .= '/'; + } + $modules[$story->module] = $storyModule; + } + ?> '>module, '')?> planTitle;?> story->stageList, $story->stage);?> diff --git a/module/product/control.php b/module/product/control.php index c2f9bbfb4c..e3f6a2dcea 100644 --- a/module/product/control.php +++ b/module/product/control.php @@ -135,9 +135,18 @@ class product extends control public function browse($productID = 0, $branch = '', $browseType = '', $param = 0, $storyType = 'story', $orderBy = '', $recTotal = 0, $recPerPage = 20, $pageID = 1, $projectID = 0) { $productID = $this->app->tab != 'project' ? $this->product->saveState($productID, $this->products) : $productID; - $branches = $this->loadModel('branch')->getList($productID, $projectID, 'all'); - $branch = ($this->cookie->preBranch !== '' and $branch === '' and isset($branches[$this->cookie->preBranch])) ? $this->cookie->preBranch : $branch; - $branchID = $branch; + $product = $this->product->getById($productID); + + if($product and $product->type != 'normal') + { + $branchPairs = $this->loadModel('branch')->getPairs($productID, 'all'); + $branch = ($this->cookie->preBranch !== '' and $branch === '' and isset($branchPairs[$this->cookie->preBranch])) ? $this->cookie->preBranch : $branch; + $branchID = $branch; + } + else + { + $branchID = $branch = 'all'; + } /* Set menu. */ if($this->app->tab == 'product') @@ -224,8 +233,6 @@ class product extends control /* Display of branch label. */ $showBranch = $this->loadModel('branch')->showBranch($productID); - $product = $this->product->getById($productID); - /* Get stories. */ if($this->app->rawModule == 'projectstory') { @@ -248,10 +255,14 @@ class product extends control /* Display status of branch. */ $branchOption = array(); $branchTagOption = array(); - foreach($branches as $branchInfo) + if($product and $product->type != 'normal') { - $branchOption[$branchInfo->id] = $branchInfo->name; - $branchTagOption[$branchInfo->id] = $branchInfo->name . ($branchInfo->status == 'closed' ? ' (' . $this->lang->branch->statusList['closed'] . ')' : ''); + $branches = $this->loadModel('branch')->getList($productID, $projectID, 'all'); + foreach($branches as $branchInfo) + { + $branchOption[$branchInfo->id] = $branchInfo->name; + $branchTagOption[$branchInfo->id] = $branchInfo->name . ($branchInfo->status == 'closed' ? ' (' . $this->lang->branch->statusList['closed'] . ')' : ''); + } } /* Process the sql, get the conditon partion, save it to session. */ diff --git a/module/product/model.php b/module/product/model.php index 3d2aa99eac..14494a894e 100644 --- a/module/product/model.php +++ b/module/product/model.php @@ -695,6 +695,7 @@ class productModel extends model $this->loadModel('personnel')->updateWhitelist($whitelist, 'product', $productID); if($product->acl != 'open') $this->loadModel('user')->updateUserView($productID, 'product'); if($product->type == 'normal' and $oldProduct->type != 'normal') $this->loadModel('branch')->unlinkBranch4Project($productID); + if($product->type != 'normal' and $oldProduct->type == 'normal') $this->loadModel('branch')->linkBranch4Project($productID); return common::createChanges($oldProduct, $product); } @@ -745,6 +746,7 @@ class productModel extends model if(dao::isError()) die(js::error(dao::getError())); $unlinkProducts = array(); + $linkProducts = array(); foreach($products as $productID => $product) { $oldProduct = $oldProducts[$productID]; @@ -763,11 +765,13 @@ class productModel extends model if($product->acl == 'open') $this->loadModel('personnel')->updateWhitelist('', 'product', $productID); if($product->acl != 'open') $this->loadModel('user')->updateUserView($productID, 'product'); if($product->type == 'normal' and $oldProduct->type != 'normal') $unlinkProducts[] = $productID; + if($product->type != 'normal' and $oldProduct->type == 'normal') $linkProducts[] = $productID; $allChanges[$productID] = common::createChanges($oldProduct, $product); } if(!empty($unlinkProducts)) $this->loadModel('branch')->unlinkBranch4Project($unlinkProducts); + if(!empty($linkProducts)) $this->loadModel('branch')->linkBranch4Project($linkProducts); return $allChanges; } diff --git a/module/product/view/browse.html.php b/module/product/view/browse.html.php index 6f4793f2fc..f0e66d191c 100644 --- a/module/product/view/browse.html.php +++ b/module/product/view/browse.html.php @@ -489,7 +489,8 @@ $projectIDParam = $isProjectStory ? "projectID=$projectID&" : ''; app->tab == 'project' and $browseType != 'bybranch') ? false : true;?> - + + type != 'normal' and $branchID != 'all') or $product->type == 'normal')?>
8;?> diff --git a/module/story/control.php b/module/story/control.php index e3d56248b4..95be333976 100644 --- a/module/story/control.php +++ b/module/story/control.php @@ -717,6 +717,19 @@ class story extends control $this->story->replaceURLang($story->type); + /* Process the module when branch products are switched to normal products. */ + if($product->type == 'normal' and !empty($story->branch)) + { + $storyModule = '/'; + $modulePath = $this->tree->getParents($story->module); + foreach($modulePath as $key => $module) + { + $storyModule .= $module->name; + if(isset($modulePath[$key + 1])) $storyModule .= '/'; + } + $this->view->moduleOptionMenu += array($story->module => $storyModule); + } + $this->view->title = $this->lang->story->edit . "STORY" . $this->lang->colon . $this->view->story->title; $this->view->position[] = $this->lang->story->edit; $this->view->story = $story; @@ -800,82 +813,72 @@ class story extends control $stories = $this->story->getByList($storyIdList); $this->loadModel('branch'); - if($productID or $executionID) + if($productID and !$executionID) { - if(!$executionID) + $product = $this->product->getByID($productID); + $branchProduct = $product->type == 'normal' ? false : true; + + $branches = 0; + $branchTagOption = array(); + if($branchProduct) { $branches = $this->branch->getList($productID, $executionID, 'all'); - $branchOption = array(); - $branchTagOption = array(); foreach($branches as $branchInfo) $branchTagOption[$branchInfo->id] = $branchInfo->name . ($branchInfo->status == 'closed' ? ' (' . $this->lang->branch->statusList['closed'] . ')' : ''); - - $product = $this->product->getByID($productID); - $branchProduct = $product->type == 'normal' ? false : true; - $modulePairs = $this->tree->getOptionMenu($productID, 'story', 0, array_keys($branches)); - $branchModules = $branchProduct ? $modulePairs : array('0' => $modulePairs); - $modules = array($productID => $branchModules); - $plans = array($productID => $this->productplan->getBranchPlanPairs($productID, '', true)); - $products = array($productID => $product); - $branchTagOption = array($productID => $branchTagOption); + $branches = array_keys($branches); } - else - { - $modules = array(); - $branches = array(); - $branchTagOption = array(); - $execution = $this->execution->getByID($executionID); - $branchProduct = false; - $linkedProducts = $this->loadModel('product')->getProducts($executionID); - foreach($linkedProducts as $linkedProduct) - { - $branchList = $this->branch->getList($linkedProduct->id, $executionID, 'all'); - foreach($branchList as $branchInfo) $branches[$branchInfo->id] = $branchInfo->name . ($branchInfo->status == 'closed' ? ' (' . $this->lang->branch->statusList['closed'] . ')' : ''); - $branchTagOption[$linkedProduct->id] = array(BRANCH_MAIN => $this->lang->branch->main) + $branches; + $modulePairs = $this->tree->getOptionMenu($productID, 'story', 0, $branches); + $moduleList = $branchProduct ? $modulePairs : array(0 => $modulePairs); - $moduleList = $this->tree->getOptionMenu($linkedProduct->id, 'story', 0, array_keys($branchList)); - $modules[$linkedProduct->id] = $linkedProduct->type != 'normal' ? $moduleList : array(0 => $moduleList); - - $plans[$linkedProduct->id] = $this->productplan->getBranchPlanPairs($linkedProduct->id, array_keys($branchList), true); - if(empty($plans[$linkedProduct->id])) $plans[$linkedProduct->id][0] = $plans[$linkedProduct->id]; - - if($linkedProduct->type != 'normal') $branchProduct = true; - } - $products = $linkedProducts; - } - $this->view->title = (isset($product) ? $product->name : $execution->name) . $this->lang->colon . $this->lang->story->batchEdit; - $this->view->branchTagOption = $branchTagOption; - $this->view->modules = $modules; - $this->view->productName = isset($product) ? $product->name : ''; + $modules = array($productID => $moduleList); + $plans = array($productID => $this->productplan->getBranchPlanPairs($productID, '', true)); + $products = array($productID => $product); + $branchTagOption = array($productID => $branchTagOption); } else { - /* The stories of my. */ - $branchProduct = false; - $productIdList = array(); - foreach($stories as $story) $productIdList[$story->product] = $story->product; - $products = $this->product->getByIdList($productIdList); + $branchProduct = false; + $modules = array(); + $branchTagOption = array(); + $products = array(); + + if($executionID) + { + /* The stories of project or execution. */ + $execution = $this->execution->getByID($executionID); + $products = $this->loadModel('product')->getProducts($executionID); + } + else + { + /* The stories of my. */ + $productIdList = array(); + foreach($stories as $story) $productIdList[$story->product] = $story->product; + $products = $this->product->getByIdList($productIdList); + } + foreach($products as $storyProduct) { - $branchList = array(); - $branches = $this->branch->getList($storyProduct->id, 0, 'all'); - foreach($branches as $branchInfo) $branchList[$branchInfo->id] = $branchInfo->name . ($branchInfo->status == 'closed' ? ' (' . $this->lang->branch->statusList['closed'] . ')' : ''); - $branchIdList = array_keys($branchList) ? array_keys($branchList) : 0; - $branchTagOption[$storyProduct->id] = $branchList; + $branches = 0; + if($storyProduct->type != 'normal') + { + $branches = $this->branch->getList($storyProduct->id, $executionID, 'all'); + foreach($branches as $branchInfo) $branches[$branchInfo->id] = $branchInfo->name . ($branchInfo->status == 'closed' ? ' (' . $this->lang->branch->statusList['closed'] . ')' : ''); + $branchTagOption[$storyProduct->id] = array(BRANCH_MAIN => $this->lang->branch->main) + $branches; - $modules[$storyProduct->id] = $this->tree->getOptionMenu($storyProduct->id, 'story', 0, $branchIdList); - if($storyProduct->type == 'normal') $modules[$storyProduct->id][0] = $modules[$storyProduct->id]; + $branches = array_keys($branches); + } - $plans[$storyProduct->id] = $this->productplan->getBranchPlanPairs($storyProduct->id, array_keys($branchList), true); + $modulePairs = $this->tree->getOptionMenu($storyProduct->id, 'story', 0, $branches); + $modules[$storyProduct->id] = $storyProduct->type != 'normal' ? $modulePairs : array(0 => $modulePairs); + + $plans[$storyProduct->id] = $this->productplan->getBranchPlanPairs($storyProduct->id, $branches, true); if(empty($plans[$storyProduct->id])) $plans[$storyProduct->id][0] = $plans[$storyProduct->id]; if($storyProduct->type != 'normal') $branchProduct = true; } - - $this->view->title = $this->lang->story->batchEdit; - $this->view->branchTagOption = $branchTagOption; - $this->view->modules = $modules; } + $this->view->branchTagOption = $branchTagOption; + $this->view->modules = $modules; /* Set ditto option for users. */ $users = $this->loadModel('user')->getPairs('nodeleted'); @@ -901,6 +904,7 @@ class story extends control $this->view->position[] = $this->lang->story->common; $this->view->position[] = $this->lang->story->batchEdit; + $this->view->title = $this->lang->story->batchEdit; $this->view->users = $users; $this->view->priList = array('0' => '', 'ditto' => $this->lang->story->ditto) + $this->lang->story->priList; $this->view->sourceList = array('' => '', 'ditto' => $this->lang->story->ditto) + $this->lang->story->sourceList; diff --git a/module/story/model.php b/module/story/model.php index 8f34c62857..aa87f59b2d 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -2262,20 +2262,53 @@ class storyModel extends model { if(defined('TUTORIAL')) return $this->loadModel('tutorial')->getStories(); - if(is_array($branch)) $branch = join(',', $branch); + $stories = array(); + $branchProducts = array(); + $normalProducts = array(); + $productList = $this->dao->select('*')->from(TABLE_PRODUCT)->where('id')->in($productID)->fetchAll('id'); + foreach($productList as $product) + { + if($product->type != 'normal') + { + $branchProducts[$product->id] = $product->id; + continue; + } - $stories = $this->dao->select('*')->from(TABLE_STORY) - ->where('product')->in($productID) - ->beginIF(!$hasParent)->andWhere("parent")->ge(0)->fi() - ->beginIF($branch !== 'all')->andWhere("branch")->in($branch)->fi() - ->beginIF(!empty($moduleIdList))->andWhere('module')->in($moduleIdList)->fi() - ->beginIF(!empty($excludeStories))->andWhere('id')->notIN($excludeStories)->fi() - ->beginIF($status and $status != 'all')->andWhere('status')->in($status)->fi() - ->andWhere('type')->eq($type) - ->andWhere('deleted')->eq(0) - ->orderBy($orderBy) - ->page($pager) - ->fetchAll('id'); + $normalProducts[$product->id] = $product->id; + } + + if(!empty($normalProducts)) + { + $stories += $this->dao->select('*')->from(TABLE_STORY) + ->where('product')->in($normalProducts) + ->beginIF(!$hasParent)->andWhere("parent")->ge(0)->fi() + ->beginIF(!empty($moduleIdList))->andWhere('module')->in($moduleIdList)->fi() + ->beginIF(!empty($excludeStories))->andWhere('id')->notIN($excludeStories)->fi() + ->beginIF($status and $status != 'all')->andWhere('status')->in($status)->fi() + ->andWhere('type')->eq($type) + ->andWhere('deleted')->eq(0) + ->orderBy($orderBy) + ->page($pager) + ->fetchAll('id'); + } + + if(!empty($branchProducts)) + { + if(is_array($branch)) $branch = join(',', $branch); + + $stories += $this->dao->select('*')->from(TABLE_STORY) + ->where('product')->in($branchProducts) + ->beginIF(!$hasParent)->andWhere("parent")->ge(0)->fi() + ->beginIF($branch !== 'all')->andWhere("branch")->in($branch)->fi() + ->beginIF(!empty($moduleIdList))->andWhere('module')->in($moduleIdList)->fi() + ->beginIF(!empty($excludeStories))->andWhere('id')->notIN($excludeStories)->fi() + ->beginIF($status and $status != 'all')->andWhere('status')->in($status)->fi() + ->andWhere('type')->eq($type) + ->andWhere('deleted')->eq(0) + ->orderBy($orderBy) + ->page($pager) + ->fetchAll('id'); + } return $this->mergePlanTitle($productID, $stories, $branch, $type); } diff --git a/module/story/view/batchedit.html.php b/module/story/view/batchedit.html.php index 09f99ddc88..7ef476774b 100644 --- a/module/story/view/batchedit.html.php +++ b/module/story/view/batchedit.html.php @@ -77,7 +77,21 @@ foreach(explode(',', $showFields) as $field) '> - product][$story->branch]) ? $modules[$story->product][$story->branch] : array('0' => '/'), $story->module, "class='form-control chosen'");?> + product]; + if($products[$story->product]->type == 'normal' and !empty($story->branch)) + { + $storyModule = '/'; + $modulePath = $this->tree->getParents($story->module); + foreach($modulePath as $key => $module) + { + $storyModule .= $module->name; + if(isset($modulePath[$key + 1])) $storyModule .= '/'; + } + $moduleList[$story->branch] = $modules[$story->product][0] + array($story->module => $storyModule); + } + ?> + branch]) ? $moduleList[$story->branch] : array(0 => '/'), $story->module, "class='form-control chosen'");?> '> product][$story->branch]) ? array('' => '') + $plans[$story->product][$story->branch] : '', $story->plan, "class='form-control chosen'");?>