* Finish task #83942.

This commit is contained in:
liumengyi
2023-02-08 14:14:08 +08:00
parent a5a0316602
commit 84970085ec
8 changed files with 25 additions and 27 deletions

View File

@@ -156,30 +156,9 @@ class commonModel extends model
$this->loadModel('action')->create('execution', $parentExecutionID, 'syncexecutionbychild');
}
if($parentExecution->type == 'stage')
if($execution->type == 'stage')
{
$childExecutions = $this->dao->select('*')->from(TABLE_EXECUTION)->where('parent')->eq($parentExecutionID)->andWhere('deleted')->eq('0')->fetchAll('id');
if($execution->deleted == '1' and count($childExecutions) > 0)
{
$childWait = true;
$childClosed = true;
foreach($childExecutions as $childExecution)
{
if($childExecution->status != 'wait') $childWait = false;
if($childExecution->status != 'closed') $childClosed = false;
}
if($childWait and $parentExecution->status != 'wait')
{
$this->dao->update(TABLE_EXECUTION)->set('status')->eq('wait')->where('id')->eq($parentExecutionID)->exec();
$this->loadModel('action')->create('execution', $parentExecutionID, 'waitbychilddelete');
}
if($childClosed and $parentExecution->status != 'closed')
{
$this->dao->update(TABLE_EXECUTION)->set('status')->eq('closed')->where('id')->eq($parentExecutionID)->exec();
$this->loadModel('action')->create('execution', $parentExecutionID, 'closebychilddelete');
}
}
$this->loadModel('programplan')->computeProgress($execution->id);
}
return $parentExecution;

View File

@@ -1986,6 +1986,8 @@ class execution extends control
$this->action->logHistory($actionID, $changes);
}
if($execution->type == 'stage') $this->loadModel('programplan')->computeProgress($executionID, 'edit');
/* Link the plan stories. */
$oldPlans = explode(',', implode(',' ,$oldPlans));
$newPlans = array();

View File

@@ -555,6 +555,7 @@ $lang->execution->action->startbychildactivate = '$date, the stage status is <st
$lang->execution->action->startbychildsuspend = '$date, the stage status is <strong>Doing</strong> as the system judges that its sub-stages are <strong>Suspended</strong>.';
$lang->execution->action->startbychildclose = '$date, the stage status is <strong>Doing</strong> as the system judges that its sub-stages are <strong>Closed</strong>.';
$lang->execution->action->startbychildcreate = '$date, the stage status is <strong>Doing</strong> as the system judges that its sub-stages are <strong>Created</strong>. ';
$lang->execution->action->startbychildedit = '$date, the stage status is <strong>Doing</strong> as the system judges that its sub-stages are <strong>Edited</strong>';
$lang->execution->action->startbychild = '$date, the stage status is <strong>Doing</strong> as the system judges that its sub-stages are <strong>Activated</strong>.';
$lang->execution->startbychildactivate = 'activated';
@@ -569,6 +570,7 @@ $lang->execution->startbychildactivate = 'activated';
$lang->execution->startbychildsuspend = 'activated';
$lang->execution->startbychildclose = 'activated';
$lang->execution->startbychildcreate = 'activated';
$lang->execution->startbychildedit = 'activated';
$lang->execution->startbychild = 'activated';
$lang->execution->statusColorList = array();

View File

@@ -555,6 +555,7 @@ $lang->execution->action->startbychildactivate = '$date, the stage status is <st
$lang->execution->action->startbychildsuspend = '$date, the stage status is <strong>Doing</strong> as the system judges that its sub-stages are <strong>Suspended</strong>.';
$lang->execution->action->startbychildclose = '$date, the stage status is <strong>Doing</strong> as the system judges that its sub-stages are <strong>Closed</strong>.';
$lang->execution->action->startbychildcreate = '$date, the stage status is <strong>Doing</strong> as the system judges that its sub-stages are <strong>Created</strong>. ';
$lang->execution->action->startbychildedit = '$date, the stage status is <strong>Doing</strong> as the system judges that its sub-stages are <strong>Edited</strong>';
$lang->execution->action->startbychild = '$date, the stage status is <strong>Doing</strong> as the system judges that its sub-stages are <strong>Activated</strong>.';
$lang->execution->startbychildactivate = 'activated';
@@ -569,6 +570,7 @@ $lang->execution->startbychildactivate = 'activated';
$lang->execution->startbychildsuspend = 'activated';
$lang->execution->startbychildclose = 'activated';
$lang->execution->startbychildcreate = 'activated';
$lang->execution->startbychildedit = 'activated';
$lang->execution->startbychild = 'activated';
$lang->execution->statusColorList = array();

View File

@@ -555,6 +555,7 @@ $lang->execution->action->startbychildactivate = '$date, the stage status is <st
$lang->execution->action->startbychildsuspend = '$date, the stage status is <strong>Doing</strong> as the system judges that its sub-stages are <strong>Suspended</strong>.';
$lang->execution->action->startbychildclose = '$date, the stage status is <strong>Doing</strong> as the system judges that its sub-stages are <strong>Closed</strong>.';
$lang->execution->action->startbychildcreate = '$date, the stage status is <strong>Doing</strong> as the system judges that its sub-stages are <strong>Created</strong>. ';
$lang->execution->action->startbychildedit = '$date, the stage status is <strong>Doing</strong> as the system judges that its sub-stages are <strong>Edited</strong>';
$lang->execution->action->startbychild = '$date, the stage status is <strong>Doing</strong> as the system judges that its sub-stages are <strong>Activated</strong>.';
$lang->execution->startbychildactivate = 'activated';
@@ -569,6 +570,7 @@ $lang->execution->startbychildactivate = 'activated';
$lang->execution->startbychildsuspend = 'activated';
$lang->execution->startbychildclose = 'activated';
$lang->execution->startbychildcreate = 'activated';
$lang->execution->startbychildedit = 'activated';
$lang->execution->startbychild = 'activated';
$lang->execution->statusColorList = array();

View File

@@ -555,6 +555,7 @@ $lang->execution->action->startbychildactivate = '$date, 系统判断由于子
$lang->execution->action->startbychildsuspend = '$date, 系统判断由于子阶段 <strong>挂起</strong> ,将阶段状态置为 <strong>进行中</strong> 。';
$lang->execution->action->startbychildclose = '$date, 系统判断由于子阶段 <strong>关闭</strong> ,将阶段状态置为 <strong>进行中</strong> 。';
$lang->execution->action->startbychildcreate = '$date, 系统判断由于 <strong>创建</strong> 子阶段 ,将阶段状态置为 <strong>进行中</strong> 。';
$lang->execution->action->startbychildedit = '$date, 系统判断由于子阶段 <strong>状态修改</strong> ,将阶段状态置为 <strong>进行中</strong> 。';
$lang->execution->action->startbychild = '$date, 系统判断由于子阶段 <strong>激活</strong> ,将阶段状态置为 <strong>进行中</strong> 。';
@@ -570,6 +571,7 @@ $lang->execution->startbychildactivate = '激活了';
$lang->execution->startbychildsuspend = '激活了';
$lang->execution->startbychildclose = '激活了';
$lang->execution->startbychildcreate = '激活了';
$lang->execution->startbychildedit = '激活了';
$lang->execution->startbychild = '激活了';
$lang->execution->statusColorList = array();

View File

@@ -231,6 +231,14 @@ class programplan extends control
{
$actionID = $this->loadModel('action')->create('execution', $planID, 'edited');
$this->action->logHistory($actionID, $changes);
$newPlan = $this->programplan->getByID($planID);
if($plan->parent != $newPlan->parent)
{
$this->programplan->computeProgress($planID, 'edit');
$this->programplan->computeProgress($plan->parent, 'edit', true);
}
}
$locate = isonlybody() ? 'parent' : inlink('browse', "program=$plan->program&type=lists");
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $locate));

View File

@@ -1418,11 +1418,12 @@ class programplanModel extends model
* Compute stage status.
*
* @param int $stage
* @param strihg $action
* @param string $action
* @param bool $isParent
* @access public
* @return void
*/
public function computeProgress($stageID, $action = '')
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;
@@ -1435,7 +1436,7 @@ class programplanModel extends model
foreach($parentIdList as $id)
{
$parent = $this->execution->getByID($id);
if($parent->type != 'stage' or $id == $stageID) continue;
if($parent->type != 'stage' or (!$isParent and $id == $stageID)) continue;
$statusCount = array();
$children = $this->execution->getChildExecutions($parent->id);
@@ -1470,7 +1471,7 @@ class programplanModel extends model
if($parent->status != 'doing')
{
$parentStatus = 'doing';
$parentAction = 'startbychild' . $action;
$parentAction = $parent->status == 'wait' ?'startbychildstart' : 'startbychild' . $action;
}
}