* Merge code.

This commit is contained in:
Yagami
2020-11-20 13:09:47 +08:00
parent f90a9dbe3d
commit 90df7cd4dc
3 changed files with 10 additions and 10 deletions
+2 -2
View File
@@ -144,7 +144,7 @@ class docModel extends model
{
$idList = array();
if($type == 'product') $idList = $this->loadModel('product')->getProductIDByProject($projectID, false);
if($type == 'project') $idList = $this->loadModel('project')->getExecutionsByProject($projectID);
if($type == 'project') $idList = $this->loadModel('project')->getExecutionPairs($projectID, 'all', 'noclosed');
$table = $type == 'product' ? TABLE_PRODUCT : TABLE_PROJECT;
$stmt = $this->dao->select('t1.*')->from(TABLE_DOCLIB)->alias('t1')
@@ -1484,7 +1484,7 @@ class docModel extends model
$projectLibs = array();
$productLibs = array();
if($projects) $projectLibs = $this->dao->select('id')->from(TABLE_DOCLIB)->where('project')->in($projects)->fetchPairs();
if($projects) $projectLibs = $this->dao->select('id')->from(TABLE_DOCLIB)->where('project')->in(array_keys($projects))->fetchPairs();
if($products) $productLibs = $this->dao->select('id')->from(TABLE_DOCLIB)->where('product')->in($products)->fetchPairs();
$customLibs = $this->dao->select('id')->from(TABLE_DOCLIB)->where('type')->eq('custom')->fetchPairs();
+2 -2
View File
@@ -445,7 +445,7 @@ class project extends control
$toProject = $project->id;
$branches = $this->project->getExecutionBranches($toProject);
$tasks = $this->project->getTasks2Imported($toProject, $branches);
$projects = $this->project->getProjectsToImport(array_keys($tasks));
$projects = $this->project->getExecutionsToImport(array_keys($tasks));
unset($projects[$toProject]);
unset($tasks[$toProject]);
@@ -2323,7 +2323,7 @@ class project extends control
$this->view->module = $module;
$this->view->method = $method;
$this->view->extra = $extra;
$this->view->projects = $this->project->getProjectsByProgram($project->project);
$this->view->projects = $this->project->getExecutionsByProject($project->project);
$this->display();
}
+6 -6
View File
@@ -1517,16 +1517,16 @@ class projectModel extends model
}
/**
* Get projects to import
* Get executions to import
*
* @param array $projectIds
* @param array $executionIds
* @access public
* @return array
*/
public function getProjectsToImport($projectIds)
public function getExecutionsToImport($executionIds)
{
$projects = $this->dao->select('*')->from(TABLE_PROJECT)
->where('id')->in($projectIds)
$executions = $this->dao->select('*')->from(TABLE_EXECUTION)
->where('id')->in($executionIds)
->beginIF(!$this->app->user->admin)->andWhere('id')->in($this->app->user->view->sprints)->fi()
->andWhere('deleted')->eq(0)
->orderBy('id desc')
@@ -1534,7 +1534,7 @@ class projectModel extends model
$pairs = array();
$now = date('Y-m-d');
foreach($projects as $id => $project) $pairs[$id] = ucfirst(substr($project->code, 0, 1)) . ':' . $project->name;
foreach($executions as $id => $execution) $pairs[$id] = ucfirst(substr($execution->code, 0, 1)) . ':' . $execution->name;
return $pairs;
}