* kanban: refactor importPlan/importRelease.
This commit is contained in:
+13
-30
@@ -1038,8 +1038,7 @@ class kanban extends control
|
||||
$this->app->loadClass('pager', true);
|
||||
$pager = new pager($recTotal, $recPerPage, $pageID);
|
||||
|
||||
$productPairs = $this->loadModel('product')->getPairs('', 0, '', 0);
|
||||
$productPairs = array($this->lang->kanban->allProducts) + $productPairs;
|
||||
$productPairs = $this->kanban->getCanImportProducts('productplan');
|
||||
$selectedProductID = empty($selectedProductID) ? key($productPairs) : $selectedProductID;
|
||||
|
||||
$this->view->products = $productPairs;
|
||||
@@ -1056,20 +1055,21 @@ class kanban extends control
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入产品发布。
|
||||
* Import release.
|
||||
*
|
||||
* @param int $kanbanID
|
||||
* @param int $regionID
|
||||
* @param int $groupID
|
||||
* @param int $columnID
|
||||
* @param int $selectedProductID
|
||||
* @param int $recTotal
|
||||
* @param int $recPerPage
|
||||
* @param int $pageID
|
||||
* @param int $kanbanID
|
||||
* @param int $regionID
|
||||
* @param int $groupID
|
||||
* @param int $columnID
|
||||
* @param int $selectedProductID
|
||||
* @param int $recTotal
|
||||
* @param int $recPerPage
|
||||
* @param int $pageID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function importRelease($kanbanID = 0, $regionID = 0, $groupID = 0, $columnID = 0, $selectedProductID = 0, $recTotal = 0, $recPerPage = 20, $pageID = 1)
|
||||
public function importRelease(int $kanbanID = 0, int $regionID = 0, int $groupID = 0, int $columnID = 0, int $selectedProductID = 0, int $recTotal = 0, int $recPerPage = 20, int $pageID = 1)
|
||||
{
|
||||
if($_POST)
|
||||
{
|
||||
@@ -1085,31 +1085,14 @@ class kanban extends control
|
||||
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'closeModal' => true, 'callback' => $callback));
|
||||
}
|
||||
|
||||
$this->loadModel('product');
|
||||
$this->loadModel('release');
|
||||
|
||||
/* Load pager. */
|
||||
$this->app->loadClass('pager', true);
|
||||
$pager = new pager($recTotal, $recPerPage, $pageID);
|
||||
|
||||
/* Kanban products has no releases. */
|
||||
$productPairs = $this->product->getPairs('', 0, '', 'all');
|
||||
$kanbanProducts = $this->dao->select('t1.product')->from(TABLE_PROJECTPRODUCT)->alias('t1')
|
||||
->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project = t2.id')
|
||||
->where('t2.type')->eq('project')
|
||||
->andWhere('t2.model')->eq('kanban')
|
||||
->andWhere('t2.hasProduct')->eq('0')
|
||||
->fetchPairs();
|
||||
|
||||
foreach($productPairs as $id => $name)
|
||||
{
|
||||
if(isset($kanbanProducts[$id])) unset($productPairs[$id]);
|
||||
}
|
||||
|
||||
$this->view->products = array($this->lang->kanban->allProducts) + $productPairs;
|
||||
$this->view->products = $this->kanban->getCanImportProducts('release');
|
||||
$this->view->selectedProductID = $selectedProductID;
|
||||
$this->view->lanePairs = $this->kanban->getLanePairsByGroup($groupID);
|
||||
$this->view->releases2Imported = $this->release->getList($selectedProductID, 'all', 'all', 't1.date_desc', '', $pager);
|
||||
$this->view->releases2Imported = $this->loadModel('release')->getList($selectedProductID, 'all', 'all', 't1.date_desc', '', $pager);
|
||||
$this->view->pager = $pager;
|
||||
$this->view->kanbanID = $kanbanID;
|
||||
$this->view->regionID = $regionID;
|
||||
|
||||
Reference in New Issue
Block a user