Merge branch 'master' of https://gitlab.zcorp.cc/easycorp/zentaopms
This commit is contained in:
+35
-15
@@ -505,6 +505,15 @@ class product extends control
|
||||
if($product->program) $lines = array('') + $this->product->getLinePairs($product->program);
|
||||
if($this->config->systemMode == 'classic') $lines = array('') + $this->product->getLinePairs();
|
||||
|
||||
/* Get programs. */
|
||||
$programs = $this->loadModel('program')->getTopPairs();
|
||||
if(!isset($programs[$product->program]) and $product->program)
|
||||
{
|
||||
$program = $this->program->getByID($product->program);
|
||||
$programs = array($product->program => $program->name);
|
||||
}
|
||||
|
||||
|
||||
$this->view->title = $this->lang->product->edit . $this->lang->colon . $product->name;
|
||||
$this->view->position[] = html::a($this->createLink($this->moduleName, 'browse'), $product->name);
|
||||
$this->view->position[] = $this->lang->product->edit;
|
||||
@@ -517,7 +526,7 @@ class product extends control
|
||||
$this->view->qdUsers = $qdUsers;
|
||||
$this->view->rdUsers = $rdUsers;
|
||||
$this->view->users = $this->user->getPairs('nodeleted|noclosed');
|
||||
$this->view->programs = array('') + $this->loadModel('program')->getTopPairs();
|
||||
$this->view->programs = array('') + $programs;
|
||||
$this->view->lines = $lines;
|
||||
$this->view->URSRPairs = $this->loadModel('custom')->getURSRPairs();
|
||||
$this->view->canChangeProgram = $canChangeProgram;
|
||||
@@ -586,13 +595,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;
|
||||
|
||||
$programs = array();
|
||||
$programs = array();
|
||||
$unauthorizedPrograms = array();
|
||||
if($this->config->systemMode == 'new')
|
||||
{
|
||||
/* Get product lines by programs.*/
|
||||
$programs = $this->program->getTopPairs();
|
||||
$lines = array(0 => '');
|
||||
foreach($programs as $id => $program)
|
||||
|
||||
/* Get unauthorized programs. */
|
||||
$programIDList = array();
|
||||
foreach($products as $product)
|
||||
{
|
||||
if($product->program and !isset($programs[$product->program]) and !in_array($product->program, $programIDList)) $programIDList[] = $product->program;
|
||||
}
|
||||
$unauthorizedPrograms = $this->program->getPairsByList($programIDList);
|
||||
|
||||
/* Get product lines by programs.*/
|
||||
$lines = array(0 => '');
|
||||
foreach($programs + $unauthorizedPrograms as $id => $program)
|
||||
{
|
||||
$lines[$id] = array('') + $this->product->getLinePairs($id);
|
||||
}
|
||||
@@ -602,16 +621,17 @@ class product extends control
|
||||
$lines = array('') + $this->product->getLinePairs();
|
||||
}
|
||||
|
||||
$this->view->title = $this->lang->product->batchEdit;
|
||||
$this->view->position[] = $this->lang->product->batchEdit;
|
||||
$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->programID = $programID;
|
||||
$this->view->programs = array('' => '') + $programs;
|
||||
$this->view->title = $this->lang->product->batchEdit;
|
||||
$this->view->position[] = $this->lang->product->batchEdit;
|
||||
$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->programID = $programID;
|
||||
$this->view->programs = array('' => '') + $programs;
|
||||
$this->view->unauthorizedPrograms = $unauthorizedPrograms;
|
||||
|
||||
unset($this->lang->product->typeList['']);
|
||||
$this->display();
|
||||
|
||||
@@ -44,7 +44,7 @@ $(function()
|
||||
{
|
||||
if(!$(this).prop('checked')) checkedProduct = false;
|
||||
})
|
||||
console.log(checkedProduct);
|
||||
|
||||
if(checkedProduct) $('.check-all').addClass('checked');
|
||||
if(!checkedProduct) $('.check-all').removeClass('checked');
|
||||
}, 100)
|
||||
|
||||
@@ -657,7 +657,7 @@ class productModel extends model
|
||||
|
||||
$productID = (int)$productID;
|
||||
$products[$productID] = new stdClass();
|
||||
if($this->config->systemMode == 'new') $products[$productID]->program = $data->programs[$productID];
|
||||
if($this->config->systemMode == 'new' and isset($data->programs[$productID])) $products[$productID]->program = $data->programs[$productID];
|
||||
$products[$productID]->name = $productName;
|
||||
$products[$productID]->line = (int)$data->lines[$productID];
|
||||
$products[$productID]->PO = $data->POs[$productID];
|
||||
|
||||
@@ -76,10 +76,15 @@
|
||||
<tr>
|
||||
<td><?php echo sprintf('%03d', $productID) . html::hidden("productIDList[$productID]", $productID);?></td>
|
||||
<?php if($this->config->systemMode == 'new'):?>
|
||||
<?php if(isset($unauthorizedPrograms[$products[$productID]->program])):?>
|
||||
<td class='text-left<?php echo zget($visibleFields, 'program', ' hidden')?>' style='overflow:visible'><?php echo html::select("programs[$productID]", $unauthorizedPrograms, $products[$productID]->program, "class='form-control' disabled");?></td>
|
||||
<?php else:?>
|
||||
<td class='text-left<?php echo zget($visibleFields, 'program', ' hidden')?>' style='overflow:visible'><?php echo html::select("programs[$productID]", $programs, $products[$productID]->program, "class='form-control picker-select' onchange='loadProductLines(this.value, $productID)'");?></td>
|
||||
<?php endif;?>
|
||||
<?php endif;?>
|
||||
<td title='<?php echo $products[$productID]->name?>'><?php echo html::input("names[$productID]", $products[$productID]->name, "class='form-control'");?></td>
|
||||
<td class='text-left<?php echo zget($visibleFields, 'line', ' hidden')?>' style='overflow:visible' id="line_<?php echo $productID;?>"><?php echo html::select("lines[$productID]", $this->config->systemMode == 'new' ? $lines[$products[$productID]->program] : $lines, $products[$productID]->line, "class='form-control picker-select'");?></td>
|
||||
<?php $productLines = isset($lines[$products[$productID]->program]) ? $lines[$products[$productID]->program] : '';?>
|
||||
<td class='text-left<?php echo zget($visibleFields, 'line', ' hidden')?>' style='overflow:visible' id="line_<?php echo $productID;?>"><?php echo html::select("lines[$productID]", $this->config->systemMode == 'new' ? $productLines : $lines, $products[$productID]->line, "class='form-control picker-select'");?></td>
|
||||
<td class='text-left<?php echo zget($visibleFields, 'PO', ' hidden')?>' style='overflow:visible'><?php echo html::select("POs[$productID]", $poUsers, $products[$productID]->PO, "class='form-control picker-select'");?></td>
|
||||
<td class='text-left<?php echo zget($visibleFields, 'QD', ' hidden')?>' style='overflow:visible'><?php echo html::select("QDs[$productID]", $qdUsers, $products[$productID]->QD, "class='form-control picker-select'");?></td>
|
||||
<td class='text-left<?php echo zget($visibleFields, 'RD', ' hidden')?>' style='overflow:visible'><?php echo html::select("RDs[$productID]", $rdUsers, $products[$productID]->RD, "class='form-control picker-select'");?></td>
|
||||
|
||||
@@ -35,7 +35,9 @@
|
||||
<?php if($this->config->systemMode == 'new'):?>
|
||||
<tr>
|
||||
<th class='w-140px'><?php echo $lang->product->program;?></th>
|
||||
<td><?php echo html::select('program', $programs, $product->program, "class='form-control chosen'");?></td>
|
||||
<?php $attr = strpos(",{$this->app->user->view->programs},", ",{$product->program},") === false ? 'disabled' : '';?>
|
||||
<?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>
|
||||
|
||||
@@ -101,6 +101,22 @@ class programModel extends model
|
||||
return $program;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get program pairs by id list.
|
||||
*
|
||||
* @param string|array $programIDList
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getPairsByList($programIDList = '')
|
||||
{
|
||||
return $this->dao->select('id, name')->from(TABLE_PROGRAM)
|
||||
->where('id')->in($programIDList)
|
||||
->andWhere('`type`')->eq('program')
|
||||
->andWhere('deleted')->eq(0)
|
||||
->fetchPairs();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get program list.
|
||||
*
|
||||
@@ -728,7 +744,7 @@ class programModel extends model
|
||||
|
||||
/**
|
||||
* Get parent PM by programIdList.
|
||||
*
|
||||
*
|
||||
* @param array $programIdList
|
||||
* @access public
|
||||
* @return void
|
||||
@@ -739,24 +755,24 @@ class programModel extends model
|
||||
|
||||
$parents = array();
|
||||
foreach($objects as $object)
|
||||
{
|
||||
{
|
||||
if($object->parent == 0) continue;
|
||||
foreach(explode(',', $object->path) as $objectID)
|
||||
{
|
||||
{
|
||||
if(empty($objectID) || $objectID == $object->id) continue;
|
||||
$parents[$objectID][] = $object->id;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Get all parent PM.*/
|
||||
$parentPM = $this->dao->select('id, PM')->from(TABLE_PROGRAM)->where('id')->in(array_keys($parents))->andWhere('deleted')->eq('0')->fetchAll();
|
||||
|
||||
$parentPMGroup = array();
|
||||
foreach($parentPM as $PM)
|
||||
{
|
||||
{
|
||||
$subPrograms = zget($parents, $PM->id, array());
|
||||
foreach($subPrograms as $subProgramID) $parentPMGroup[$subProgramID][$PM->PM] = $PM->PM;
|
||||
}
|
||||
}
|
||||
|
||||
return $parentPMGroup;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user