diff --git a/module/product/config.php b/module/product/config.php index e22220eb29..638ca8db21 100644 --- a/module/product/config.php +++ b/module/product/config.php @@ -2,11 +2,13 @@ $config->product = new stdclass(); $config->product->orderBy = 'isClosed,order_desc'; -$config->product->customBatchEditFields = 'PO,QD,RD,status,type,desc,acl'; +$config->product->customBatchEditFields = 'line,PO,QD,RD,status,type,acl'; +if($config->systemMode == 'new') $config->product->customBatchEditFields = 'program,' . $config->product->customBatchEditFields; $config->product->browse = new stdclass(); $config->product->custom = new stdclass(); -$config->product->custom->batchEditFields = 'program,PO,QD,RD,status,type,acl'; +$config->product->custom->batchEditFields = 'line,PO,QD,RD'; +if($config->systemMode == 'new') $config->product->custom->batchEditFields .= ',program'; $config->product->list = new stdclass(); $config->product->list->exportFields = 'id,name,line,activeStories,changedStories,draftStories,closedStories,plans,releases,bugs,unResolvedBugs,assignToNullBugs'; diff --git a/module/product/control.php b/module/product/control.php index 83326be98b..0dd8659e71 100644 --- a/module/product/control.php +++ b/module/product/control.php @@ -586,15 +586,23 @@ class product extends control $rdUsers = $this->user->getPairs('nodeleted|devfirst', $appendRdUsers); if(!empty($this->config->user->moreLink)) $this->config->moreLinks["RD"] = $this->config->user->moreLink; + /* Get product lines by programs.*/ + $programs = $this->program->getPairs(); + $lines = array(); + foreach($programs as $programID => $program) + { + $lines[$programID] = array('') + $this->product->getLinePairs($programID); + } + $this->view->title = $this->lang->product->batchEdit; $this->view->position[] = $this->lang->product->batchEdit; - $this->view->lines = array('') + $this->product->getLinePairs(); + $this->view->lines = $lines; $this->view->productIDList = $productIDList; $this->view->products = $products; $this->view->poUsers = $poUsers; $this->view->qdUsers = $qdUsers; $this->view->rdUsers = $rdUsers; - $this->view->programs = array('') + $this->program->getTopPairs(); + $this->view->programs = array('') + $programs; unset($this->lang->product->typeList['']); $this->display(); @@ -929,13 +937,17 @@ class product extends control * Ajax get product lines. * * @param int $programID + * @param int $productID * @access public * @return void */ - public function ajaxGetLine($programID) + public function ajaxGetLine($programID, $productID = 0) { - $lines = $this->product->getLinePairs($programID); - die(html::select('line', array('' => '') + $lines, '', "class='form-control chosen'")); + $lines = array(); + if(empty($productID) or $programID) $lines = $this->product->getLinePairs($programID); + + if($productID) die(html::select("lines[$productID]", array('' => '') + $lines, '', "class='form-control chosen'")); + if(!$productID) die(html::select('line', array('' => '') + $lines, '', "class='form-control chosen'")); } /** diff --git a/module/product/js/all.js b/module/product/js/all.js index ddcf360e3f..be3d533764 100644 --- a/module/product/js/all.js +++ b/module/product/js/all.js @@ -35,7 +35,7 @@ $(function() } }); - $(".check-all, [id^='productIDList']").click(function() + $('#productListForm').on('click', '.check-all, [id^="productIDList"]', function() { setTimeout(function() { @@ -48,5 +48,5 @@ $(function() if(checkedProduct) $('.check-all').addClass('checked'); if(!checkedProduct) $('.check-all').removeClass('checked'); }, 100) - }) + }); }); diff --git a/module/product/js/batchedit.js b/module/product/js/batchedit.js index b29f827ccb..f5e929189b 100644 --- a/module/product/js/batchedit.js +++ b/module/product/js/batchedit.js @@ -10,3 +10,20 @@ $(function() this.title = privateTip; }); }) + +/** + * Load product lines by program. + * + * @param int $programID + * @param int $productID + * @access public + * @return void + */ +function loadProductLines(programID, productID) +{ + var link = createLink('product', 'ajaxGetLine', 'programID=' + programID + '&productID=' + productID); + $('#line_' + productID).load(link, function() + { + $('#lines' + productID).chosen(); + }); +} diff --git a/module/product/model.php b/module/product/model.php index 406f487e98..076d2cf379 100644 --- a/module/product/model.php +++ b/module/product/model.php @@ -659,6 +659,7 @@ class productModel extends model $products[$productID] = new stdClass(); $products[$productID]->program = $data->programs[$productID]; $products[$productID]->name = $productName; + $products[$productID]->line = (int)$data->lines[$productID]; $products[$productID]->PO = $data->POs[$productID]; $products[$productID]->QD = $data->QDs[$productID]; $products[$productID]->RD = $data->RDs[$productID]; @@ -666,7 +667,6 @@ class productModel extends model $products[$productID]->status = $data->statuses[$productID]; $products[$productID]->desc = strip_tags($this->post->descs[$productID], $this->config->allowedTags); $products[$productID]->acl = $data->acls[$productID]; - $products[$productID]->order = $data->orders[$productID]; /* Check unique name for edited products. */ if(isset($nameList[$productName])) dao::$errors['name'][] = 'product#' . $productID . sprintf($this->lang->error->unique, $this->lang->product->name, $productName); @@ -677,7 +677,6 @@ class productModel extends model foreach($products as $productID => $product) { $oldProduct = $oldProducts[$productID]; - if($oldProduct->program != $product->program) $product->line = 0; $this->dao->update(TABLE_PRODUCT) ->data($product) diff --git a/module/product/view/batchedit.html.php b/module/product/view/batchedit.html.php index d2d2893bc1..0a4bda918b 100755 --- a/module/product/view/batchedit.html.php +++ b/module/product/view/batchedit.html.php @@ -12,6 +12,7 @@ product->aclTips['open']);?> product->aclTips['private']);?> +