* code for task #70540.

This commit is contained in:
wangyidong
2022-09-28 09:25:52 +08:00
parent e21ba0f6ca
commit 4d9856be14
6 changed files with 33 additions and 18 deletions
+5 -2
View File
@@ -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;
+13 -5
View File
@@ -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;
+8 -6
View File
@@ -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);
+5 -3
View File
@@ -22,7 +22,9 @@
</div>
<div class="btn-toolbar pull-right">
<?php common::printLink('product', 'export', "status=$browseType&orderBy=$orderBy", "<i class='icon-export muted'> </i>" . $lang->export, '', "class='btn btn-link export'", true, true)?>
<?php if($config->systemMode == 'new'):?>
<?php common::printLink('product', 'manageLine', '', "<i class='icon-edit'></i> &nbsp;" . $lang->product->line, '', 'class="btn btn-link iframe"', '', true);?>
<?php endif;?>
<?php common::printLink('product', 'create', '', '<i class="icon icon-plus"></i>' . $lang->product->create, '', 'class="btn btn-primary create-product-btn"');?>
</div>
</div>
@@ -102,7 +104,7 @@
}
}
}
;?>
?>
<?php if(isset($program['programName']) and $config->systemMode == 'new'):?>
<tr class="row-program" <?php echo $trAttrs;?>>
<?php if($canBatchEdit):?>
@@ -136,7 +138,7 @@
<?php endif;?>
<?php foreach($program as $lineID => $line):?>
<?php if(isset($line['lineName']) and isset($line['products']) and is_array($line['products'])):?>
<?php if(isset($line['lineName']) and isset($line['products']) and is_array($line['products']) and $config->systemMode == 'new'):?>
<?php $lineNames[] = $line['lineName'];?>
<?php
if($this->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";
+1 -1
View File
@@ -29,7 +29,6 @@
<th class='w-140px'><?php echo $lang->program->common;?></th>
<td><?php echo html::select('program', $programs, $programID, "class='form-control chosen' onchange='setParentProgram(this.value)'");?></td><td></td>
</tr>
<?php endif;?>
<tr>
<th class='w-140px'><?php echo $lang->product->line;?></th>
<?php if(common::hasPriv('product', 'manageLine') and $programID):?>
@@ -52,6 +51,7 @@
<td><?php echo html::select('line', $lines, '', "class='form-control chosen'");?></td><td></td>
<?php endif;?>
</tr>
<?php endif;?>
<tr>
<th><?php echo $lang->product->name;?></th>
<td><?php echo html::input('name', '', "class='form-control input-product-title' required");?></td><td></td>
+1 -1
View File
@@ -43,11 +43,11 @@
<?php if($attr == 'disabled') echo html::hidden('program', $product->program);?>
<td><?php echo html::select('program', $programs, $product->program, "class='form-control chosen' $attr");?></td>
</tr>
<?php endif;?>
<tr>
<th class='w-140px'><?php echo $lang->product->line;?></th>
<td><?php echo html::select('line', $lines, $product->line, "class='form-control chosen'");?></td><td></td>
</tr>
<?php endif;?>
<tr>
<th class='w-140px'><?php echo $lang->product->name;?></th>
<td class='w-p40-f'><?php echo html::input('name', $product->name, "class='form-control' required");?></td><td></td>