* get all branch for workflowdatasource.

This commit is contained in:
wangyidong
2019-11-07 11:29:29 +08:00
parent edac0a4dd7
commit 630c2a87e7
+31
View File
@@ -51,6 +51,37 @@ class branchModel extends model
return $branches;
}
/**
* Get all pairs.
*
* @param string $params
* @access public
* @return array
*/
public function getAllPairs($params = '')
{
$branchGroups = $this->dao->select('*')->from(TABLE_BRANCH)->where('deleted')->eq(0)->orderBy('product,`order`')->fetchGroup('product', 'id');
$products = $this->loadModel('product')->getByIdList(array_keys($branchGroups));
$branchPairs = array();
foreach($branchGroups as $productID => $branches)
{
if(empty($products[$productID])) continue;
$product = $products[$productID];
foreach($branches as $branch)
{
$branchPairs[$branch->id] = $product->name . '/' . $branch->name;
}
}
if(strpos($params, 'noempty') === false)
{
$branchPairs = array('0' => $this->lang->branch->all . $this->lang->product->branchName['branch']) + $branchPairs;
}
return $branchPairs;
}
/**
* Manage branch
*