diff --git a/module/product/config.php b/module/product/config.php index c42c6ce6bd..5f2be2d5cc 100644 --- a/module/product/config.php +++ b/module/product/config.php @@ -97,8 +97,11 @@ $config->product->all->search['module'] = 'product'; $config->product->all->search['fields']['name'] = $lang->product->name; if(!isset($config->setCode) or $config->setCode == 1) $config->product->all->search['fields']['code'] = $lang->product->code; $config->product->all->search['fields']['id'] = $lang->product->id; -if($config->systemMode == 'new') $config->product->all->search['fields']['program'] = $lang->product->program; -$config->product->all->search['fields']['line'] = $lang->product->line; +if($config->systemMode == 'new') +{ + $config->product->all->search['fields']['program'] = $lang->product->program; + $config->product->all->search['fields']['line'] = $lang->product->line; +} $config->product->all->search['fields']['desc'] = $lang->product->desc; $config->product->all->search['fields']['PO'] = $lang->product->PO; $config->product->all->search['fields']['QD'] = $lang->product->QD; diff --git a/module/product/control.php b/module/product/control.php index 91aa699f50..444e07a238 100644 --- a/module/product/control.php +++ b/module/product/control.php @@ -1440,12 +1440,14 @@ class product extends control { $fieldName = trim($fieldName); $fields[$fieldName] = zget($productLang, $fieldName); + unset($fields[$key]); + if($this->config->systemMode != 'new' and ($fieldName == 'line' or $fieldName == 'program')) unset($fields[$fieldName]); } - $lastProgram = $lastLine = ''; - $lines = $this->product->getLinePairs(); - $productStats = $this->product->getStats('program_desc,line_desc,' . $orderBy, null, $status); + $lastProgram = $lastLine = ''; + $lines = $this->product->getLinePairs(); + $productStats = $this->product->getStats($orderBy, null, $status); foreach($productStats as $i => $product) { $product->line = zget($lines, $product->line, ''); @@ -1476,13 +1478,19 @@ class product extends control $rowspan[$i]['rows']['program'] = 1; $programI = $i; } - else $rowspan[$programI]['rows']['program'] ++; + else + { + $rowspan[$programI]['rows']['program'] ++; + } if($lastLine == '' or $product->line != $lastLine) { $rowspan[$i]['rows']['line'] = 1; $lineI = $i; } - else $rowspan[$lineI]['rows']['line'] ++; + else + { + $rowspan[$lineI]['rows']['line'] ++; + } $lastProgram = $product->program; $lastLine = $product->line; diff --git a/module/product/model.php b/module/product/model.php index 2137a29efa..60662885e0 100644 --- a/module/product/model.php +++ b/module/product/model.php @@ -659,14 +659,16 @@ class productModel extends model ->get(); $this->lang->error->unique = $this->lang->error->repeat; - $product = $this->loadModel('file')->processImgURL($product, $this->config->product->editor->create['id'], $this->post->uid); - $programID = isset($product->program) ? $product->program : 0; + $product = $this->loadModel('file')->processImgURL($product, $this->config->product->editor->create['id'], $this->post->uid); + /* Lean mode relation defaultProgram. */ + $programID = isset($product->program) ? $product->program : 0; if($this->config->systemMode == 'lean') { $programID = $this->config->global->defaultProgram; $product->program = $this->config->global->defaultProgram; } + $this->dao->insert(TABLE_PRODUCT)->data($product)->autoCheck() ->batchCheck($this->config->product->create->requiredFields, 'notempty') ->checkIF(!empty($product->name), 'name', 'unique', "`program` = $programID and `deleted` = '0'") @@ -758,7 +760,7 @@ class productModel extends model $this->lang->error->unique = $this->lang->error->repeat; $product = $this->loadModel('file')->processImgURL($product, $this->config->product->editor->edit['id'], $this->post->uid); - $programID = isset($product->program) ? $product->program : 0; + $programID = isset($product->program) ? $product->program : $oldProduct->program; $this->dao->update(TABLE_PRODUCT)->data($product)->autoCheck() ->batchCheck($this->config->product->edit->requiredFields, 'notempty') ->checkIF(!empty($product->name), 'name', 'unique', "id != $productID and `program` = $programID and `deleted` = '0'") @@ -1127,13 +1129,13 @@ class productModel extends model $this->config->product->all->search['queryID'] = $queryID; $this->config->product->all->search['actionURL'] = $actionURL; - $linePairs = $this->getLinePairs(); - $this->config->product->all->search['params']['line']['values'] = array('' => '') + $linePairs; - if($this->config->systemMode == 'new') { $programPairs = $this->loadModel('program')->getTopPairs('', 'noclosed'); $this->config->product->all->search['params']['program']['values'] = array('' => '') + $programPairs; + + $linePairs = $this->getLinePairs(); + $this->config->product->all->search['params']['line']['values'] = array('' => '') + $linePairs; } $this->loadModel('search')->setSearchParams($this->config->product->all->search); diff --git a/module/product/view/all.html.php b/module/product/view/all.html.php index 9e5ece751d..08b819c776 100644 --- a/module/product/view/all.html.php +++ b/module/product/view/all.html.php @@ -22,7 +22,9 @@
" . $lang->export, '', "class='btn btn-link export'", true, true)?> + systemMode == 'new'):?>  " . $lang->product->line, '', 'class="btn btn-link iframe"', '', true);?> + ' . $lang->product->create, '', 'class="btn btn-primary create-product-btn"');?>
@@ -102,7 +104,7 @@ } } } - ;?> + ?> systemMode == 'new'):?> > @@ -136,7 +138,7 @@ $line):?> - + systemMode == 'new'):?> config->systemMode == 'new' and $programID) @@ -189,7 +191,7 @@ $totalRequirements = $product->requirements['active'] + $product->requirements['closed'] + $product->requirements['draft'] + $product->requirements['changing'] + $product->requirements['reviewing']; $trClass = ''; - if($product->line) + if($product->line and $this->config->systemMode == 'new') { $path = "line.$product->line,$product->id"; if($this->config->systemMode == 'new' and $product->program) $path = "program.$product->program,$path"; diff --git a/module/product/view/create.html.php b/module/product/view/create.html.php index 3cf28e8393..a8441bdf56 100644 --- a/module/product/view/create.html.php +++ b/module/product/view/create.html.php @@ -29,7 +29,6 @@ program->common;?> - product->line;?> @@ -52,6 +51,7 @@ + product->name;?> diff --git a/module/product/view/edit.html.php b/module/product/view/edit.html.php index b9cd9254ae..8aabdf5392 100644 --- a/module/product/view/edit.html.php +++ b/module/product/view/edit.html.php @@ -43,11 +43,11 @@ program);?> program, "class='form-control chosen' $attr");?> - product->line;?> line, "class='form-control chosen'");?> + product->name;?> name, "class='form-control' required");?>