* Finish task #110593.

This commit is contained in:
chaideqing
2024-01-10 13:47:38 +08:00
parent 06a05e4482
commit e037349cec
5 changed files with 8 additions and 20 deletions
+4 -4
View File
@@ -454,7 +454,7 @@ class product extends control
if(!empty($this->config->user->moreLink)) $this->config->moreLinks["RD"] = $this->config->user->moreLink;
$lines = array();
if($programID and in_array($this->config->systemMode, array('ALM', 'PLM'))) $lines = array('') + $this->product->getLinePairs($programID);
if(in_array($this->config->systemMode, array('ALM', 'PLM'))) $lines = array('') + $this->product->getLinePairs($programID, true);
if($this->app->tab == 'doc') unset($this->lang->doc->menu->product['subMenu']);
@@ -541,7 +541,7 @@ class product extends control
if(!empty($this->config->user->moreLink)) $this->config->moreLinks["RD"] = $this->config->user->moreLink;
$lines = array();
if($product->program and in_array($this->config->systemMode, array('ALM', 'PLM'))) $lines = array('') + $this->product->getLinePairs($product->program);
if(in_array($this->config->systemMode, array('ALM', 'PLM'))) $lines = array('') + $this->product->getLinePairs($product->program, true);
/* Get programs. */
$programs = $this->loadModel('program')->getTopPairs('', 'noclosed');
@@ -1123,7 +1123,7 @@ class product extends control
public function ajaxGetLine($programID, $productID = 0)
{
$lines = array();
if(empty($productID) or $programID) $lines = $this->product->getLinePairs($programID);
if(empty($productID) or $programID) $lines = $this->product->getLinePairs($programID, true);
if($productID) return print(html::select("lines[$productID]", array('' => '') + $lines, '', "class='form-control picker-select'"));
if(!$productID) return print(html::select('line', array('' => '') + $lines, '', "class='form-control picker-select'"));
@@ -1430,7 +1430,7 @@ class product extends control
$this->view->title = $this->lang->product->line;
$this->view->position[] = $this->lang->product->line;
$this->view->programs = array('null' => $this->lang->null) + $this->loadModel('program')->getTopPairs('', 'withDeleted', true);
$this->view->programs = array(0 => $this->lang->null) + $this->loadModel('program')->getTopPairs('', 'withDeleted', true);
$this->view->lines = $this->product->getLines();
$this->display();
}
-2
View File
@@ -2,8 +2,6 @@ $(function()
{
$('#lineName').css('border-left-color', '');
$('[name=newLine]').change();
if(programID == 0) $("#line").closest('tr').addClass('hidden');
})
/**
* Load product Lines.
-6
View File
@@ -1,12 +1,6 @@
$(function()
{
if(programID == 0) $("#line").closest('tr').addClass('hidden');
});
$('#program').change(function()
{
var programID = $(this).val();
programID > 0 ? $("#line").closest('tr').removeClass('hidden') : $("#line").closest('tr').addClass('hidden');
$.get(createLink('product', 'ajaxGetLine', 'programID=' + programID), function(data)
{
+3 -7
View File
@@ -1035,11 +1035,6 @@ class productModel extends model
foreach($data->modules as $id => $name)
{
if(empty($name)) continue;
if(in_array($this->config->systemMode, array('ALM', 'PLM')) and empty($data->programs[$id]))
{
dao::$errors[] = $this->lang->product->programEmpty;
return false;
}
$programID = $data->programs[$id];
if(!isset($lines[$programID])) $lines[$programID] = array();
@@ -2091,14 +2086,15 @@ class productModel extends model
* Get product line pairs.
*
* @param int $programID
* @param bool $withZero
* @access public
* @return array
*/
public function getLinePairs($programID = 0)
public function getLinePairs($programID = 0, $withZero = false)
{
return $this->dao->select('id,name')->from(TABLE_MODULE)
->where('type')->eq('line')
->beginIF($programID)->andWhere('root')->eq($programID)->fi()
->beginIF($withZero || $programID)->andWhere('root')->eq($programID)->fi()
->andWhere('deleted')->eq(0)
->fetchPairs();
}
+1 -1
View File
@@ -31,7 +31,7 @@
</tr>
<tr>
<th class='w-140px'><?php echo $lang->product->line;?></th>
<?php if(common::hasPriv('product', 'manageLine') and $programID):?>
<?php if(common::hasPriv('product', 'manageLine')):?>
<td>
<div class='input-group'>
<?php $checkedNewLine = count($lines) > 1 ? '' : 'checked';?>