Merge branch 'master' into 'sprint/294_liumengyi_fixbug'

# Conflicts:
#   module/project/js/execution.js
This commit is contained in:
孙广明
2023-02-28 07:16:39 +00:00
7 changed files with 48 additions and 20 deletions
+12 -6
View File
@@ -1995,7 +1995,8 @@ class execution extends control
$this->action->logHistory($actionID, $changes);
}
if($execution->type == 'stage') $this->loadModel('programplan')->computeProgress($executionID, 'edit');
$project = $this->loadModel('project')->getById($execution->project);
if($project->model == 'waterfall' or $project->model == 'waterfallplus') $this->loadModel('programplan')->computeProgress($executionID, 'edit');
/* Link the plan stories. */
$oldPlans = explode(',', implode(',' ,$oldPlans));
@@ -2291,7 +2292,8 @@ class execution extends control
$this->action->logHistory($actionID, $changes);
}
if($execution->type == 'stage') $this->loadModel('programplan')->computeProgress($executionID, 'start');
$project = $this->loadModel('project')->getById($execution->project);
if($project->model == 'waterfall' or $project->model == 'waterfallplus') $this->loadModel('programplan')->computeProgress($executionID, 'start');
$this->loadModel('common')->syncPPEStatus($executionID);
$this->executeHooks($executionID);
@@ -2383,7 +2385,8 @@ class execution extends control
$this->action->logHistory($actionID, $changes);
}
if($execution->type == 'stage') $this->loadModel('programplan')->computeProgress($executionID, 'suspend');
$project = $this->loadModel('project')->getById($execution->project);
if($project->model == 'waterfall' or $project->model == 'waterfallplus') $this->loadModel('programplan')->computeProgress($executionID, 'suspend');
$this->executeHooks($executionID);
if(isonlybody() and $from == 'kanban')
@@ -2423,7 +2426,8 @@ class execution extends control
$this->execution->activate($executionID);
if(dao::isError()) return print(js::error(dao::getError()));
if($execution->type == 'stage') $this->loadModel('programplan')->computeProgress($executionID, 'activate');
$project = $this->loadModel('project')->getById($execution->project);
if($project->model == 'waterfall' or $project->model == 'waterfallplus') $this->loadModel('programplan')->computeProgress($executionID, 'activate');
$this->executeHooks($executionID);
if(isonlybody() and $from == 'kanban')
@@ -2471,7 +2475,8 @@ class execution extends control
$this->execution->close($executionID);
if(dao::isError()) return print(js::error(dao::getError()));
if($execution->type == 'stage') $this->loadModel('programplan')->computeProgress($executionID, 'close');
$project = $this->loadModel('project')->getById($execution->project);
if($project->model == 'waterfall' or $project->model == 'waterfallplus') $this->loadModel('programplan')->computeProgress($executionID, 'close');
$this->executeHooks($executionID);
if(isonlybody() and $from == 'kanban')
@@ -3165,7 +3170,8 @@ class execution extends control
$this->execution->updateUserView($executionID);
$this->loadModel('common')->syncPPEStatus($executionID);
if($execution->type == 'stage') $this->loadModel('programplan')->computeProgress($executionID);
$project = $this->loadModel('project')->getById($execution->project);
if($project->model == 'waterfall' or $project->model == 'waterfallplus') $this->loadModel('programplan')->computeProgress($executionID);
$this->session->set('execution', '');
$message = $this->executeHooks($executionID);
+9 -5
View File
@@ -383,7 +383,7 @@ class executionModel extends model
$type = 'sprint';
if($project) $type = zget($this->config->execution->modelList, $project->model, 'sprint');
if($project->model == 'waterfall')
if($project->model == 'waterfall' or $project->model == 'waterfallplus')
{
$this->checkWorkload('create', $_POST['percent'], $project);
if(dao::isError()) return false;
@@ -658,6 +658,8 @@ class executionModel extends model
if(dao::isError()) return false;
if(isset($_POST['parent'])) $this->loadModel('programplan')->setTreePath($executionID);
/* Get team and language item. */
$this->loadModel('user');
$team = $this->user->getTeamMemberPairs($executionID, 'execution');
@@ -1567,7 +1569,7 @@ class executionModel extends model
}
}
if($type == 'update' and $oldExecution->grade == 2)
if($type == 'update' and $oldExecution->grade > 1)
{
$parentPlan = $this->loadModel('programPlan')->getByID($oldExecution->parent);
$childrenTotalPercent = $this->dao->select('SUM(percent) as total')->from(TABLE_EXECUTION)->where('parent')->eq($oldExecution->parent)->andWhere('deleted')->eq(0)->fetch('total');
@@ -1575,7 +1577,7 @@ class executionModel extends model
if($childrenTotalPercent > 100)
{
dao::$errors['parent'] = sprintf($this->lang->execution->workloadTotal, '%', $childrenTotalPercent . '%');
dao::$errors['percent'] = sprintf($this->lang->execution->workloadTotal, '%', $childrenTotalPercent . '%');
return false;
}
}
@@ -5274,11 +5276,13 @@ class executionModel extends model
$class = !empty($execution->children) ? 'disabled' : '';
common::printIcon('task', 'create', "executionID={$execution->id}", '', 'list', '', '', $class, false, "data-app='execution'");
if($execution->type == 'stage')
$project = $this->loadModel('project')->getByID($execution->project);
if($execution->type == 'stage' or ($this->app->tab == 'project' and !empty($project->model) and $project->model == 'waterfallplus'))
{
$isCreateTask = $this->loadModel('programplan')->isCreateTask($execution->id);
$disabled = ($isCreateTask and $execution->type == 'stage') ? '' : ' disabled';
$title = !$isCreateTask ? $this->lang->programplan->error->createdTask : $this->lang->programplan->createSubPlan;
$title = (!empty($disabled) and $execution->type != 'stage') ? $this->lang->programplan->error->notStage : $title;
common::printIcon('programplan', 'create', "program={$execution->project}&productID=$productID&planID=$execution->id", $execution, 'list', 'split', '', $disabled, '', '', $title);
}
@@ -5710,7 +5714,7 @@ class executionModel extends model
{
$label = $execution->type == 'stage' ? 'label-warning' : 'label-info';
$link = $execution->type == 'kanban' ? helper::createLink('execution', 'kanban', "id=$execution->id") : helper::createLink('execution', 'task', "id=$execution->id");
$execution->name = "<span class='project-type-label label label-outline $label'>{$this->lang->execution->typeList[$execution->type]}</span> " . html::a($link, $execution->name);
$execution->name = "<span class='project-type-label label label-outline $label'>{$this->lang->execution->typeList[$execution->type]}</span> " . (empty($execution->children) ? html::a($link, $execution->name) : $execution->name);
$execution->project = $execution->projectName;
$execution->parent = ($execution->parent and $execution->grade > 1) ? $execution->parent : '';
$execution->asParent = !empty($execution->children);
+4 -2
View File
@@ -166,7 +166,8 @@
<div class='input-group required'>
<span class='input-group-addon fix-border'><?php echo $lang->project->branch;?></span>
<?php $branchIdList = isset($product->branches) ? join(',', $product->branches) : '';?>
<?php echo html::select("branch[$i][]", isset($branchGroups[$product->id]) ? $branchGroups[$product->id] : array(), $branchIdList, "class='form-control chosen' multiple onchange=\"loadPlans('#products{$i}', this)\"");?>
<?php if(!isset($linkedBranches)) echo html::select("branch[$i][]", isset($branchGroups[$product->id]) ? $branchGroups[$product->id] : array(), $branchIdList, "class='form-control chosen' multiple onchange=\"loadPlans('#products{$i}', this)\"");?>
<?php if(isset($linkedBranches)) echo html::select("branch[$i][]", isset($branchGroups[$product->id]) ? $branchGroups[$product->id] : array(), !empty($linkedBranches[$product->id]) ? $linkedBranches[$product->id] : array(), "class='form-control chosen' multiple onchange=\"loadPlans('#products{$i}', this)\"");?>
</div>
</div>
</div>
@@ -174,7 +175,8 @@
<div class="col-sm-6 planBox">
<div class='input-group' <?php echo "id='plan$i'";?>>
<span class='input-group-addon'><?php echo $lang->product->plan;?></span>
<?php echo html::select("plans[$product->id][]", isset($productPlans[$product->id]) ? $productPlans[$product->id] : array(), isset($product->plans) ? $product->plans : '', "class='form-control chosen' multiple");?>
<?php if(empty($productID) or (!empty($productID) and $productID != $product->id)) echo html::select("plans[$product->id][]", isset($productPlans[$product->id]) ? $productPlans[$product->id] : array(), isset($product->plans) ? $product->plans : '', "class='form-control chosen' multiple");?>
<?php if(!empty($productID) and $productID == $product->id) echo html::select("plans[$product->id][]", !empty($productPlan) ? $productPlan : array(), isset($productPlan[$plan->id]) ? $plan->id : '', "class='form-control chosen' multiple");?>
<?php if(!($isStage and !$project->division)):?>
<div class='input-group-btn'>
<a href='javascript:;' onclick='addNewLine(this)' class='btn btn-link addLine'><i class='icon-plus'></i></a>
+1 -1
View File
@@ -45,7 +45,7 @@
</tr>
<?php elseif($app->tab == 'project' and $project->model == 'waterfallplus'):?>
<tr>
<th><?php echo $lang->programplan->parent;?></th>
<th class='c-name'><?php echo $lang->programplan->parent;?></th>
<td><?php echo html::select('parent', $parentStageList, $execution->parent, "class='form-control chosen '");?></td><td></td>
</tr>
<?php endif;?>
-1
View File
@@ -472,7 +472,6 @@ function renderExecutionItem(item, $item)
].join('')).appendTo($item);
var $titleBox = $header.children('.executionName');
debugger
if(!$titleBox.length) $titleBox = $(
[
'<div class="executionName">',
+14 -4
View File
@@ -1027,17 +1027,26 @@ class programplanModel extends model
$stage = $this->dao->select('id,type,parent,path,grade')->from(TABLE_PROJECT)->where('id')->eq($planID)->fetch();
$parent = $this->dao->select('id,type,parent,path,grade')->from(TABLE_PROJECT)->where('id')->eq($stage->parent)->fetch();
$this->loadModel('execution');
if($parent->type == 'project')
{
$path['path'] = ",{$parent->id},{$stage->id},";
$path['grade'] = 1;
}
elseif($parent->type == 'stage')
elseif(isset($this->lang->execution->typeList[$parent->type]))
{
$path['path'] = $parent->path . "{$stage->id},";
$path['grade'] = $parent->grade + 1;
$children = $this->execution->getChildExecutions($planID);
}
$this->dao->update(TABLE_PROJECT)->set('path')->eq($path['path'])->set('grade')->eq($path['grade'])->where('id')->eq($stage->id)->exec();
if(count($children) > 0)
{
foreach($children as $id => $child) $this->setTreePath($id);
}
}
/**
@@ -1478,8 +1487,9 @@ class programplanModel extends model
*/
public function computeProgress($stageID, $action = '', $isParent = false)
{
$stage = $this->loadModel('execution')->getByID($stageID);
if(empty($stage) or empty($stage->path) or $stage->type != 'stage') return false;
$stage = $this->loadModel('execution')->getByID($stageID);
$project = $this->loadModel('project')->getByID($stage->project);
if(empty($stage) or empty($stage->path) or ($project->model != 'waterfall' and $project->model != 'waterfallplus')) return false;
$this->loadModel('execution');
$this->loadModel('action');
@@ -1489,7 +1499,7 @@ class programplanModel extends model
foreach($parentIdList as $id)
{
$parent = $this->execution->getByID($id);
if($parent->type != 'stage' or (!$isParent and $id == $stageID)) continue;
if(empty($this->lang->execution->typeList[$parent->type]) or (!$isParent and $id == $stageID)) continue;
$statusCount = array();
$children = $this->execution->getChildExecutions($parent->id);
+8 -1
View File
@@ -2709,6 +2709,13 @@ class projectModel extends model
->andWhere('deleted')->eq(0)
->fetchGroup('execution', 'id');
$projects = $this->dao->select('t1.id,t2.model')
->from(TABLE_PROJECT)->alias('t1')
->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project=t2.id')
->where('t1.deleted')->eq('0')
->andWhere('t1.id')->in(array_keys($executions))
->fetchPairs();
/* Compute totalEstimate, totalConsumed, totalLeft. */
foreach($tasks as $executionID => $executionTasks)
{
@@ -2721,7 +2728,7 @@ class projectModel extends model
}
$hours[$executionID] = $hour;
if(isset($executions[$executionID]) and $executions[$executionID]->type == 'stage' and $executions[$executionID]->grade > 1)
if(isset($executions[$executionID]) and $executions[$executionID]->grade > 1 and isset($projects[$executionID]) and ($projects[$executionID] == 'waterfall' or $projects[$executionID] == 'waterfallplus'))
{
$stageParents = $this->dao->select('id')->from(TABLE_EXECUTION)->where('id')->in(trim($executions[$executionID]->path, ','))->andWhere('type')->eq('stage')->andWhere('id')->ne($executions[$executionID]->id)->orderBy('grade')->fetchPairs();
foreach($stageParents as $stageParent)