@@ -30,17 +31,7 @@ productplan->product;?> name;?> - type != 'normal' and $plan->parent != '-1'):?> - - product->branch;?> - branch, "onchange='getConflictStories($plan->id);' class='form-control chosen' multiple");?> - - - - productplan->title;?> - title, "class='form-control' required");?> - parent == '-1'):?> parent);?> @@ -49,6 +40,16 @@ '') + $parentPlanPairs, $plan->parent, "class='form-control chosen'");?> + shadow and $product->type != 'normal' and $plan->parent != '-1'):?> + + product->branch;?> + branch, "class='form-control chosen' multiple");?> + + + + productplan->title;?> + title, "class='form-control' required");?> + productplan->status;?> parent == -1 ? "disabled='disabled'" : '' ;?> diff --git a/module/project/control.php b/module/project/control.php index 653339f752..76f901238a 100755 --- a/module/project/control.php +++ b/module/project/control.php @@ -1278,6 +1278,7 @@ class project extends control $this->view->branchOption = $branchOption; $this->view->branchTagOption = $branchTagOption; $this->view->executions = $executions; + $this->view->plans = $this->loadModel('productplan')->getPairs($productID ? $productID : array_keys($products)); $this->view->stories = $storyList; $this->view->tasks = $taskList; $this->view->projectPairs = $this->project->getPairsByProgram(); diff --git a/module/project/js/create.js b/module/project/js/create.js index 1d1cdb8c1e..92e09db510 100644 --- a/module/project/js/create.js +++ b/module/project/js/create.js @@ -162,17 +162,16 @@ function setParentProgram(parentProgram) var productSelectHtml = data.allProducts; var planSelectHtml = data.plans; - $('.productsBox .row .col-sm-4 .input-group').each(function(index) + $('.productsBox .row .col-sm-6 .input-group').each(function(index) { var selectedProduct = $(this).find('[name^=products]').val(); var selectedBranch = $(this).find('[name^=branch]').val(); var selectedPlan = $('#plan' + index ).find('[name^=plans]').val(); - $(this).html(productSelectHtml); + $(this).find('[name^=products]').html(productSelectHtml); $(this).find('[name^=products]').attr('name', 'products[' + index + ']').attr('id', 'products' + index).attr('data-branch', selectedBranch).attr('data-plan', selectedPlan); $(this).find('[name^=products]').val(selectedProduct).chosen().change(); }); - $('.productsBox .row .col-sm-4:last').find('.input-group').append($('.productsBox .addProduct .input-group:first .input-group-addon').prop('outerHTML')); } if(parentProgram != 0) @@ -245,7 +244,7 @@ function addNewProduct(obj) $('.newLine').removeClass('hidden'); $('.productsBox .row').removeClass('hidden'); $('.productsBox .row .input-group').find('select').removeAttr('disabled').trigger("chosen:updated"); - if($('#plansBox .col-sm-4').find('select').length > 1) $('.division').removeClass('hide'); + if($('.productsBox').find("select[name^=products]").length > 1) $('.division').removeClass('hide'); /* Hide the input box for creating a product. */ $(obj).closest('td').attr('colspan', 3); diff --git a/module/project/js/edit.js b/module/project/js/edit.js index e676a6a499..d9abb1e438 100644 --- a/module/project/js/edit.js +++ b/module/project/js/edit.js @@ -18,13 +18,13 @@ $(function() var productSelectHtml = data.allProducts; var planSelectHtml = data.plans; - $('#productsBox .row .col-sm-4 .input-group').each(function(index) + $('.productsBox .row .col-sm-6 .input-group').each(function(index) { var selectedProduct = $(this).find('[name^=products]').val(); var selectedBranch = $(this).find('[name^=branch]').val(); var selectedPlan = $('#plan' + index ).find('[name^=plans]').val(); - $(this).html(productSelectHtml); + $(this).find('[name^=products]').html(productSelectHtml); $(this).find('[name^=products]').attr('name', 'products[' + index + ']').attr('id', 'products' + index).attr('data-branch', selectedBranch).attr('data-plan', selectedPlan); $(this).find('[name^=products]').val(selectedProduct).chosen().change(); }); diff --git a/module/project/model.php b/module/project/model.php index b2ab359b66..21467dd1af 100644 --- a/module/project/model.php +++ b/module/project/model.php @@ -1583,7 +1583,7 @@ class projectModel extends model ->exec(); if(dao::isError()) return false; - if(!$oldProject->hasProduct && $oldProject->name != $project->name) $this->updateProductName($project->name, $projectID); + if(!$oldProject->hasProduct and ($oldProject->name != $project->name or $oldProject->parent != $project->parent)) $this->updateShadowProduct($project); /* Get team and language item. */ $this->loadModel('user'); @@ -1744,7 +1744,7 @@ class projectModel extends model if(!dao::isError()) { - if(!$oldProject->hasProduct && $oldProject->name != $project->name) $this->updateProductName($project->name, $projectID); + if(!$oldProject->hasProduct and ($oldProject->name != $project->name or $oldProject->parent != $project->parent)) $this->updateShadowProduct($project); if(isset($project->parent)) { @@ -2038,17 +2038,18 @@ class projectModel extends model } /** - * Update a product's name as its project. + * Update shadow product for its project. * - * @param string $projectName - * @param int $projectID + * @param object $project * @access public * @return bool */ - public function updateProductName($projectName, $projectID) + public function updateShadowProduct($project) { - $product = $this->dao->select('product')->from(TABLE_PROJECTPRODUCT)->where('project')->eq($projectID)->fetch('product'); - $this->dao->update(TABLE_PRODUCT)->set('name')->eq($projectName)->where('id')->eq($product)->exec(); + $product = $this->dao->select('product')->from(TABLE_PROJECTPRODUCT)->where('project')->eq($project->id)->fetch('product'); + $topProgram = !empty($project->parent) ? $this->loadModel('program')->getTopByID($project->parent) : 0; + $this->dao->update(TABLE_PRODUCT)->set('name')->eq($project->name)->set('program')->eq($topProgram)->where('id')->eq($product)->exec(); + return !dao::isError(); } diff --git a/module/project/view/build.html.php b/module/project/view/build.html.php index 67c4814aeb..124480f679 100644 --- a/module/project/view/build.html.php +++ b/module/project/view/build.html.php @@ -48,7 +48,7 @@ build->id;?> - build->name;?> + build->name;?> hasProduct):?> build->product;?> @@ -56,8 +56,8 @@ executionCommon;?> build->url;?> - build->date;?> - build->builder;?> + build->date;?> + build->builder;?> actions;?> diff --git a/module/projectrelease/control.php b/module/projectrelease/control.php index c1f353dd97..e69975257a 100644 --- a/module/projectrelease/control.php +++ b/module/projectrelease/control.php @@ -804,13 +804,12 @@ class projectrelease extends control * * @param int $projectID * @param int $productID - * @param int $branch * @access public * @return void */ - public function ajaxLoadBuilds($projectID, $productID, $branch = 0) + public function ajaxLoadBuilds($projectID, $productID) { - $builds = $this->loadModel('build')->getBuildPairs($productID, $branch, 'notrunk,withbranch,hasproject', $projectID, 'project', '', false); + $builds = $this->loadModel('build')->getBuildPairs($productID, 'all', 'notrunk,withbranch,hasproject', $projectID, 'project', '', false); $releasedBuilds = $this->projectrelease->getReleasedBuilds($projectID); foreach($releasedBuilds as $build) unset($builds[$build]); diff --git a/module/projectrelease/js/create.js b/module/projectrelease/js/create.js index 1cd106dcdb..21925ba77f 100644 --- a/module/projectrelease/js/create.js +++ b/module/projectrelease/js/create.js @@ -7,36 +7,8 @@ function loadBuilds() { var productID = $('#product').val(); - var branch = $('#branch').length == 0 ? 0 : $('#branch').val(); - $('#buildBox').load(createLink('projectrelease', 'ajaxLoadBuilds', "projectID=" + projectID + "&productID=" + productID + "&branch=" + branch), function() + $('#buildBox').load(createLink('projectrelease', 'ajaxLoadBuilds', "projectID=" + projectID + "&productID=" + productID), function() { $('#build').attr('data-placeholder', multipleSelect).chosen(); }); } - -/** - * Flush the branch when switching products. - * - * @param int $productID - * @access public - * @return void - */ -function loadBranches(productID) -{ - $('#branch').remove(); - $('#branch_chosen').remove(); - $.get(createLink('branch', 'ajaxGetBranches', "productID=" + productID + '&oldBranch=0¶ms=active&projectID=' + projectID), function(data) - { - var $product = $('#product'); - var $inputGroup = $product.closest('.input-group'); - $inputGroup.find('.input-group-addon').toggleClass('hidden', !data); - if(data) - { - $inputGroup.append(data); - $inputGroup.find('#branch').attr('onchange', 'loadBuilds()'); - $('#branch').css('width', '120px').chosen(); - } - loadBuilds(); - $inputGroup.fixInputGroup(); - }) -} diff --git a/module/projectrelease/view/create.html.php b/module/projectrelease/view/create.html.php index 7de52be52c..a06d0bb92d 100644 --- a/module/projectrelease/view/create.html.php +++ b/module/projectrelease/view/create.html.php @@ -39,12 +39,7 @@ release->product;?> - -
- id, "onchange='loadBranches(this.value)' class='form-control chosen'");?> - type != 'normal') echo html::select('branch', $branches, $branch, "onchange='loadBuilds()' class='form-control chosen control-branch'");?> -
- + id, "onchange='loadBuilds()' class='form-control chosen'");?> diff --git a/module/transfer/config.php b/module/transfer/config.php index 35deafb6c1..c53f3b1d84 100644 --- a/module/transfer/config.php +++ b/module/transfer/config.php @@ -18,6 +18,7 @@ $config->transfer->listFields = ''; $config->transfer->sysLangFields = ',pri,status,type,mode,severity,os,browser,resolution,confirmed,source,reviewResult,stage,change,category'; $config->transfer->sysDataFields = 'execution,product,user'; $config->transfer->userFields = 'assignedTo,openedBy,finishedBy,canceledBy,closedBy,lastEditedBy,lastRunner,resolvedBy,reviewedBy,mailto'; +$config->transfer->textareaFields = 'spec,desc'; $config->transfer->defaultZeroField = 'severity,pri'; $config->transfer->defaultEmptyField = ''; diff --git a/module/transfer/control.php b/module/transfer/control.php index b9b7851107..65d13bbc52 100755 --- a/module/transfer/control.php +++ b/module/transfer/control.php @@ -163,13 +163,17 @@ class transfer extends control if($product->type == 'normal') unset($fields['branch']); if($this->session->storyType == 'requirement') unset($fields['plan']); } - if($model == 'bug') { $product = $this->loadModel('product')->getByID($this->session->bugTransferParams['productID']); if($product->type == 'normal') unset($fields['branch']); if($product->shadow and ($this->app->tab == 'execution' or $this->app->tab == 'project')) unset($fields['product']); } + if($model == 'testcase') + { + $product = $this->loadModel('product')->getByID($this->session->testcaseTransferParams['productID']); + if($product->type == 'normal') unset($fields['branch']); + } if($model == 'task') $datas = $this->task->processDatas4Task($datas); $html = $this->transfer->buildNextList($datas->datas, $lastID, $fields, $pagerID, $model); die($html); diff --git a/module/transfer/model.php b/module/transfer/model.php index 1cee8c3173..0721b4d5af 100644 --- a/module/transfer/model.php +++ b/module/transfer/model.php @@ -1473,6 +1473,7 @@ class transferModel extends model } $html .= ''; } + elseif(strpos($this->transferConfig->textareaFields, $field) !== false) $html .= '' . html::textarea("$name", $selected, "class='form-control' style='overflow:hidden;'") . ''; else $html .= '' . html::input("$name", $selected, "class='form-control autocomplete='off'") . ''; } diff --git a/www/js/my.full.js b/www/js/my.full.js index 24a60642db..ca19375a73 100644 --- a/www/js/my.full.js +++ b/www/js/my.full.js @@ -1203,7 +1203,7 @@ function showCheckedFields(fields) else if(!$fieldBox.hasClass('hidden')) { $fieldBox.addClass('hidden'); - $field.attr('disabled', true); + if($(this).val() != 'branch') $field.attr('disabled', true); } if(config.currentModule == 'story' && $(this).val() == 'source')