split projectControl::ajaxGetCopyProjects to projectModel::getCopyProjectPairs.

This commit is contained in:
liuhong
2023-05-10 09:11:44 +08:00
parent 1e5a3c30b3
commit fee94264f3
2 changed files with 31 additions and 16 deletions
+24
View File
@@ -832,6 +832,30 @@ class projectModel extends model
->fetchPairs('id', 'name');
}
/**
* 获取可复制项目的键值对。
* get the copy project pairs.
*
* @param string $name
* @param string $model
*
* @access public
* @return array
*/
public function getCopyProjectPairs(string $name, string $model = 'kanban'): array
{
$projectPairs = $this->dao->select('id, name')->from(TABLE_PROJECT)
->where('type')->eq('project')
->andWhere('deleted')->eq(0)
->andWhere('vision')->eq($this->config->vision)
->andWhere('model')->eq($model)
->beginIF(!$this->app->user->admin)->andWhere('id')->in($this->app->user->view->projects)->fi()
->beginIF(trim($name))->andWhere('name')->like("%$name%")->fi()
->fetchPairs();
return array_keys($projectPairs);
}
/**
* 根据项目ID获取关联产品及分支
* Get branches by project id.