* Finish task#54192,54196

This commit is contained in:
zenggang
2022-05-17 07:46:52 +00:00
parent 930f625c7e
commit 8a06d71cfd
4 changed files with 37 additions and 12 deletions
+7 -9
View File
@@ -2008,17 +2008,15 @@ class executionModel extends model
*/
public function getTasks2Imported($toExecution, $branches)
{
$products = $this->loadModel('product')->getProducts($toExecution);
if(empty($products)) return array();
$execution = $this->getById($toExecution);
$project = $this->loadModel('project')->getById($execution->project);
$brotherProjects = $this->project->getBrotherProjects($project);
$executions = $this->dao->select('id')->from(TABLE_EXECUTION)
->where('project')->in(array_keys($brotherProjects))
->andWhere('status')->ne('closed')
->fetchPairs('id');
$execution = $this->getById($toExecution);
$executions = $this->dao->select('t1.product, t1.project')->from(TABLE_PROJECTPRODUCT)->alias('t1')
->leftJoin(TABLE_EXECUTION)->alias('t2')->on('t1.project=t2.id')
->where('t1.product')->in(array_keys($products))
->andWhere('t2.project')->eq($execution->project)
->fetchGroup('project');
$branches = str_replace(',', "','", $branches);
$tasks = $this->dao->select('t1.*, t2.id AS storyID, t2.title AS storyTitle, t2.version AS latestStoryVersion, t2.status AS storyStatus, t3.realname AS assignedToRealName')->from(TABLE_TASK)->alias('t1')
->leftJoin(TABLE_STORY)->alias('t2')->on('t1.story = t2.id')
->leftJoin(TABLE_USER)->alias('t3')->on('t1.assignedTo = t3.account')
+5 -3
View File
@@ -79,7 +79,9 @@ $(function()
$('#changeUnitTip').modal('hide');
})
/* If end is longtime, set the default date to today */
var today = $.zui.formatDate(new Date(), 'yyyy-MM-dd');
if($('#end').val() == longTime) $('#end').val(today).datetimepicker('update').val(longTime);
/* If end is longtime, set the default date to today */
var today = $.zui.formatDate(new Date(), 'yyyy-MM-dd');
if($('#end').val() == longTime) $('#end').val(today).datetimepicker('update').val(longTime);
$('#realBegan').datetimepicker('setEndDate', today);
});
+1
View File
@@ -754,6 +754,7 @@ class programModel extends model
->setIF($this->post->begin == '0000-00-00', 'begin', '')
->setIF($this->post->end == '0000-00-00', 'end', '')
->setIF($this->post->delta == 999, 'end', LONG_TIME)
->setIF($this->post->realBegan != '' and $oldProgram->status == 'wait', 'status', 'doing')
->setIF($this->post->future, 'budget', 0)
->setIF($this->post->budget != 0, 'budget', round($this->post->budget, 2))
->setIF(!isset($_POST['budgetUnit']), 'budgetUnit', $oldProgram->budgetUnit)
+24
View File
@@ -700,6 +700,30 @@ class projectModel extends model
->fetchPairs();
}
/**
* Get all the projects under the program set to which an project belongs.
*
* @param object $project
* @access public
* @return void
*/
public function getBrotherProjects($project)
{
$projectIds = array_filter(explode(',', $project->path));
$parentProgram = $this->dao->select('*')->from(TABLE_PROGRAM)
->where('id')->in($projectIds)
->andWhere('`type`')->eq('program')
->orderBy('grade desc')
->fetch();
$projects = $this->dao->select('*')->from(TABLE_PROJECT)
->where('type')->eq('project')
->andWhere('deleted')->eq(0)
->andWhere('path')->like("{$parentProgram->path}%")
->fetchAll('id');
return $projects;
}
/**
* Get project by id list.
*