* Code for task#56393,#56390,#56389.
This commit is contained in:
@@ -1496,7 +1496,7 @@ class execution extends control
|
||||
$this->view->name = $name;
|
||||
$this->view->code = $code;
|
||||
$this->view->team = $team;
|
||||
$this->view->teams = array(0 => '', $projectID => (isset($project->name) ? $project->name : '')) + $this->execution->getCanCopyObjects((int)$projectID);
|
||||
$this->view->teams = array(0 => '') + $this->execution->getCanCopyObjects((int)$projectID);
|
||||
$this->view->allProjects = array(0 => '') + $this->project->getPairsByModel('all', 0, 'noclosed');
|
||||
$this->view->executionID = $executionID;
|
||||
$this->view->productID = $productID;
|
||||
@@ -2730,7 +2730,7 @@ class execution extends control
|
||||
|
||||
$currentMembers = $this->execution->getTeamMembers($executionID);
|
||||
$members2Import = $this->execution->getMembers2Import($team2Import, array_keys($currentMembers));
|
||||
$teams2Import = $this->loadModel('personnel')->getCopiedObjects($executionID, 'sprint');
|
||||
$teams2Import = $this->loadModel('personnel')->getCopiedObjects($executionID, 'sprint', true);
|
||||
$teams2Import = array('' => '') + $teams2Import;
|
||||
|
||||
/* Append users for get users. */
|
||||
|
||||
@@ -396,6 +396,7 @@ $lang->execution->projectNotEmpty = 'Project cannot be empty.';
|
||||
$lang->execution->confirmStoryToTask = $lang->SRCommon . '%s are converted to tasks in the current. Do you want to convert them anyways?';
|
||||
$lang->execution->ge = "『%s』should be >= actual begin『%s』.";
|
||||
$lang->execution->storyDragError = "The {$lang->SRCommon} is still a draft or has been changed, please drag it after the review";
|
||||
$lang->execution->countTip = ' (%s member)';
|
||||
|
||||
/* Statistics. */
|
||||
$lang->execution->charts = new stdclass();
|
||||
|
||||
@@ -396,6 +396,7 @@ $lang->execution->projectNotEmpty = '所属项目不能为空。';
|
||||
$lang->execution->confirmStoryToTask = '%s' . $lang->SRCommon . '已经在当前' . $lang->execution->common . '中转了任务,请确认是否重复转任务。';
|
||||
$lang->execution->ge = "『%s』应当不小于实际开始时间『%s』。";
|
||||
$lang->execution->storyDragError = "该{$lang->SRCommon}还是草稿或已变更状态,请评审通过后再拖动";
|
||||
$lang->execution->countTip = '(%s人)';
|
||||
|
||||
/* 统计。*/
|
||||
$lang->execution->charts = new stdclass();
|
||||
|
||||
@@ -2743,14 +2743,31 @@ class executionModel extends model
|
||||
|
||||
$objectPairs = $this->dao->select('id,name')->from(TABLE_PROJECT)
|
||||
->where('deleted')->eq(0)
|
||||
->andWhere('project', true)->eq($projectID)
|
||||
->andWhere('type')->ne('project')
|
||||
->andWhere('(project')->eq($projectID)
|
||||
->orWhere('id')->eq($projectID)
|
||||
->markRight(1)
|
||||
->orWhere('id')->eq($projectID)
|
||||
->orderBy('type_asc,openedDate_desc')
|
||||
->limit('9')
|
||||
->fetchPairs();
|
||||
|
||||
$countPairs = $this->dao->select('root, COUNT(*) as count')->from(TABLE_TEAM)
|
||||
->where('( type')->eq('project')
|
||||
->andWhere('root')->eq($projectID)
|
||||
->markRight(1)
|
||||
->orWhere('( type')->eq('execution')
|
||||
->andWhere('root')->in(array_keys($objectPairs))
|
||||
->markRight(1)
|
||||
->groupBy('root')
|
||||
->fetchPairs('root');
|
||||
|
||||
foreach($objectPairs as $objectID => $objectName)
|
||||
{
|
||||
$memberCount = zget($countPairs, $objectID, 0);
|
||||
$countTip = $memberCount > 1 ? str_replace('member', 'members', $this->lang->execution->countTip) : $this->lang->execution->countTip;
|
||||
$objectPairs[$objectID] = $objectName . sprintf($countTip, $memberCount);
|
||||
}
|
||||
|
||||
return $objectPairs;
|
||||
}
|
||||
|
||||
|
||||
@@ -38,3 +38,4 @@ $lang->personnel->copy = 'Copy Whitelist';
|
||||
|
||||
$lang->personnel->openedPGMTip = 'The program is public and can be accessed by users with Program privileges.';
|
||||
$lang->personnel->selectObjectTips = 'Select %s to copy its whitelist';
|
||||
$lang->personnel->countTip = ' (%s member)';
|
||||
|
||||
@@ -38,3 +38,4 @@ $lang->personnel->copy = 'Copy Whitelist';
|
||||
|
||||
$lang->personnel->openedPGMTip = 'The program is public and can be accessed by users with Program privileges.';
|
||||
$lang->personnel->selectObjectTips = 'Select %s to copy its whitelist';
|
||||
$lang->personnel->countTip = ' (%s member)';
|
||||
|
||||
@@ -38,3 +38,4 @@ $lang->personnel->copy = 'Copy Whitelist';
|
||||
|
||||
$lang->personnel->openedPGMTip = 'The program is public and can be accessed by users with Program privileges.';
|
||||
$lang->personnel->selectObjectTips = 'Select %s to copy its whitelist';
|
||||
$lang->personnel->countTip = ' (%s member)';
|
||||
|
||||
@@ -38,3 +38,4 @@ $lang->personnel->copy = 'Copy Whitelist';
|
||||
|
||||
$lang->personnel->openedPGMTip = 'The program is public and can be accessed by users with Program privileges.';
|
||||
$lang->personnel->selectObjectTips = 'Select %s to copy its whitelist';
|
||||
$lang->personnel->countTip = ' (%s member)';
|
||||
|
||||
@@ -38,3 +38,4 @@ $lang->personnel->copy = '复制白名单';
|
||||
|
||||
$lang->personnel->openedPGMTip = '该项目集是公开状态,有项目集视图权限的人员即可访问。';
|
||||
$lang->personnel->selectObjectTips = '请选择一个%s白名单来复制';
|
||||
$lang->personnel->countTip = '(%s人)';
|
||||
|
||||
@@ -38,3 +38,4 @@ $lang->personnel->copy = '複製白名單';
|
||||
|
||||
$lang->personnel->openedPGMTip = '該項目集是公開狀態,有項目集視圖權限的人員即可訪問。';
|
||||
$lang->personnel->selectObjectTips = '請選擇一個%s白名單來複制';
|
||||
$lang->personnel->countTip = '(%s人)';
|
||||
|
||||
@@ -466,10 +466,11 @@ class personnelModel extends model
|
||||
*
|
||||
* @param int $objectID
|
||||
* @param int $objectType
|
||||
* @param bool $addCount
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getCopiedObjects($objectID, $objectType)
|
||||
public function getCopiedObjects($objectID, $objectType, $addCount = false)
|
||||
{
|
||||
$objects = array();
|
||||
|
||||
@@ -512,6 +513,28 @@ class personnelModel extends model
|
||||
}
|
||||
|
||||
unset($objects[$objectID]);
|
||||
|
||||
if($addCount)
|
||||
{
|
||||
$objectType = $objectType == 'sprint' ? 'execution' : $objectType;
|
||||
$countPairs = $this->dao->select('root, COUNT(*) as count')->from(TABLE_TEAM)
|
||||
->where('type')->eq($objectType)
|
||||
->andWhere('root')->in(array_keys($objects))
|
||||
->beginIF($objectType == 'execution')
|
||||
->orWhere('( type')->eq('project')
|
||||
->andWhere('root')->eq($parentID)->markRight(1)
|
||||
->fi()
|
||||
->groupBy('root')
|
||||
->fetchPairs('root');
|
||||
|
||||
foreach($objects as $objectID => $objectName)
|
||||
{
|
||||
$memberCount = zget($countPairs, $objectID, 0);
|
||||
$countTip = $memberCount > 1 ? str_replace('member', 'members', $this->lang->personnel->countTip) : $this->lang->personnel->countTip;
|
||||
$objects[$objectID] = $objectName . sprintf($countTip, $memberCount);
|
||||
}
|
||||
}
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
|
||||
@@ -1455,7 +1455,7 @@ class project extends control
|
||||
$this->view->depts = array('' => '') + $this->dept->getOptionMenu();
|
||||
$this->view->currentMembers = $currentMembers;
|
||||
$this->view->members2Import = $members2Import;
|
||||
$this->view->teams2Import = array('' => '') + $this->loadModel('personnel')->getCopiedObjects($projectID, 'project');
|
||||
$this->view->teams2Import = array('' => '') + $this->loadModel('personnel')->getCopiedObjects($projectID, 'project', true);
|
||||
$this->view->copyProjectID = $copyProjectID;
|
||||
$this->display();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user