* Fix bug#23185.

This commit is contained in:
xieqiyu
2022-06-01 21:29:30 +08:00
parent c470517b65
commit 1a24cdbc80
2 changed files with 17 additions and 6 deletions
+14 -3
View File
@@ -131,12 +131,12 @@ class programModel extends model
* @param string $orderBy
* @param object $pager
* @param string $type top|child
* @param array $topIdList
* @access public
* @return array
*/
public function getList($status = 'all', $orderBy = 'id_asc', $pager = NULL, $type = '')
public function getList($status = 'all', $orderBy = 'id_asc', $pager = NULL, $type = '', $topIdList = '')
{
$objectIdList = array();
if(!$this->app->user->admin)
{
$objectIdList = trim($this->app->user->view->programs, ',') . ',' . trim($this->app->user->view->projects, ',');
@@ -145,9 +145,20 @@ class programModel extends model
if($this->app->rawMethod == 'browse')
{
$pathList = $this->dao->select('id,path')->from(TABLE_PROJECT)->where('id')->in($objectIdList)->andWhere('deleted')->eq(0)->fetchPairs('id');
$pathList = $this->dao->select('id,path')->from(TABLE_PROJECT)
->where('id')->in($objectIdList)
->andWhere('deleted')->eq(0)
->fetchPairs('id');
$objectIdList = array();
foreach($pathList as $path)
{
if($type == 'child' and !empty($topIdList))
{
$topID = $this->getTopByPath($path);
if(!in_array($topID, $topIdList)) continue;
}
foreach(explode(',', trim($path, ',')) as $pathID) $objectIdList[$pathID] = $pathID;
}
}