Merge branch 'sprint/181_liumengyi_addDynamic' into 'master'
* Add dynamic for parent plan status flow. See merge request easycorp/zentaopms!1191
This commit is contained in:
@@ -707,6 +707,10 @@ class actionModel extends model
|
||||
{
|
||||
$desc = $this->lang->$objectType->action->rejectreviewed;
|
||||
}
|
||||
elseif($action->objectType == 'productplan' and in_array($action->action, array('startedbychild','finishedbychild','closedbychild','activatedbychild')))
|
||||
{
|
||||
$desc = $this->lang->$objectType->action->changebychild;
|
||||
}
|
||||
elseif(isset($this->config->maxVersion) and strpos($this->config->action->assetType, $action->objectType) !== false and $action->action == 'approved')
|
||||
{
|
||||
$desc = empty($this->lang->action->approve->{$action->extra}) ? '' : $this->lang->action->approve->{$action->extra};
|
||||
|
||||
@@ -408,9 +408,6 @@ class productplan extends control
|
||||
$changes = $this->productplan->updateStatus($planID, 'doing');
|
||||
if(dao::isError()) die(js::error(dao::getError()));
|
||||
|
||||
$actionID = $this->loadModel('action')->create('productplan', $planID, 'started');
|
||||
$this->action->logHistory($actionID, $changes);
|
||||
|
||||
die(js::reload('parent'));
|
||||
}
|
||||
}
|
||||
@@ -421,9 +418,6 @@ class productplan extends control
|
||||
$changes = $this->productplan->updateStatus($planID, 'doing');
|
||||
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
|
||||
|
||||
$actionID = $this->loadModel('action')->create('productplan', $planID, 'started');
|
||||
$this->action->logHistory($actionID, $changes);
|
||||
|
||||
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess,'locate' => 'parent'));
|
||||
}
|
||||
$this->view->plan = $plan;
|
||||
@@ -450,9 +444,6 @@ class productplan extends control
|
||||
$changes = $this->productplan->updateStatus($planID, 'done');
|
||||
if(dao::isError()) die(js::error(dao::getError()));
|
||||
|
||||
$actionID = $this->loadModel('action')->create('productplan', $planID, 'finished');
|
||||
$this->action->logHistory($actionID, $changes);
|
||||
|
||||
die(js::reload('parent'));
|
||||
}
|
||||
}
|
||||
@@ -476,9 +467,6 @@ class productplan extends control
|
||||
$changes = $this->productplan->updateStatus($planID, 'closed');
|
||||
if(dao::isError()) die(js::error(dao::getError()));
|
||||
|
||||
$actionID = $this->loadModel('action')->create('productplan', $planID, 'closed');
|
||||
$this->action->logHistory($actionID, $changes);
|
||||
|
||||
die(js::reload('parent'));
|
||||
}
|
||||
}
|
||||
@@ -502,9 +490,6 @@ class productplan extends control
|
||||
$changes = $this->productplan->updateStatus($planID, 'doing');
|
||||
if(dao::isError()) die(js::error(dao::getError()));
|
||||
|
||||
$actionID = $this->loadModel('action')->create('productplan', $planID, 'activated');
|
||||
$this->action->logHistory($actionID, $changes);
|
||||
|
||||
die(js::reload('parent'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,6 +98,11 @@ $lang->productplan->statusList['doing'] = 'Doing';
|
||||
$lang->productplan->statusList['done'] = 'Done';
|
||||
$lang->productplan->statusList['closed'] = 'Closed';
|
||||
|
||||
$lang->productplan->parentActionList['startedbychild'] = '<strong>starting </strong>the productplan sets the plan status as <strong>Doing</strong>.';
|
||||
$lang->productplan->parentActionList['finishedbychild'] = '<strong>finishing </strong>all productplan sets the plan status as <strong>Done</strong>.';
|
||||
$lang->productplan->parentActionList['closedbychild'] = '<strong>closing </strong>all productplan sets the plan status as <strong>Closed</strong>.';
|
||||
$lang->productplan->parentActionList['activatedbychild'] = '<strong>activating </strong>the productplan sets the plan status as <strong>Doing</strong>.';
|
||||
|
||||
$lang->productplan->endList[7] = '1 Week';
|
||||
$lang->productplan->endList[14] = '2 Weeks';
|
||||
$lang->productplan->endList[31] = '1 Month';
|
||||
@@ -122,3 +127,6 @@ $lang->productplan->featureBar['browse']['wait'] = 'Waiting';
|
||||
$lang->productplan->featureBar['browse']['doing'] = 'Doing';
|
||||
$lang->productplan->featureBar['browse']['done'] = 'Done';
|
||||
$lang->productplan->featureBar['browse']['closed'] = 'Closed';
|
||||
|
||||
$lang->productplan->action = new stdclass();
|
||||
$lang->productplan->action->changebychild = array('main' => '$date, $extra', 'extra' => 'parentActionList');
|
||||
|
||||
@@ -97,6 +97,11 @@ $lang->productplan->statusList['doing'] = '进行中';
|
||||
$lang->productplan->statusList['done'] = '已完成';
|
||||
$lang->productplan->statusList['closed'] = '已关闭';
|
||||
|
||||
$lang->productplan->parentActionList['startedbychild'] = '系统判断由于子计划 <strong>开始</strong> ,将计划状态置为 <strong>进行中</strong> 。';
|
||||
$lang->productplan->parentActionList['finishedbychild'] = '系统判断由于子计划 <strong>全部完成</strong> ,将计划状态置为 <strong>已完成</strong> 。';
|
||||
$lang->productplan->parentActionList['closedbychild'] = '系统判断由于子计划 <strong>全部关闭</strong> ,将计划状态置为 <strong>已关闭</strong> 。';
|
||||
$lang->productplan->parentActionList['activatedbychild'] = '系统判断由于子计划 <strong>激活</strong> ,将计划状态置为 <strong>进行中</strong> 。';
|
||||
|
||||
$lang->productplan->endList[7] = '一星期';
|
||||
$lang->productplan->endList[14] = '两星期';
|
||||
$lang->productplan->endList[31] = '一个月';
|
||||
@@ -121,3 +126,6 @@ $lang->productplan->featureBar['browse']['wait'] = '未开始';
|
||||
$lang->productplan->featureBar['browse']['doing'] = '进行中';
|
||||
$lang->productplan->featureBar['browse']['done'] = '已完成';
|
||||
$lang->productplan->featureBar['browse']['closed'] = '已关闭';
|
||||
|
||||
$lang->productplan->action = new stdclass();
|
||||
$lang->productplan->action->changebychild = array('main' => '$date, $extra', 'extra' => 'parentActionList');
|
||||
|
||||
@@ -467,7 +467,7 @@ class productplanModel extends model
|
||||
|
||||
if($oldPlan->parent > 0) $parentPlan = $this->getByID($oldPlan->parent);
|
||||
if(!empty($parentPlan->begin))
|
||||
{
|
||||
{
|
||||
if($plan->begin < $parentPlan->begin) dao::$errors['begin'] = sprintf($this->lang->productplan->beginLetterParent, $parentPlan->begin);
|
||||
}
|
||||
if(!empty($parentPlan->end))
|
||||
@@ -513,7 +513,11 @@ class productplanModel extends model
|
||||
{
|
||||
$planID = (int)$planID;
|
||||
$oldPlan = $this->getByID($planID);
|
||||
if($oldPlan->parent > 0) $parentPlan = $this->getByID($oldPlan->parent);
|
||||
if($oldPlan->parent > 0)
|
||||
{
|
||||
$parentPlan = $this->getByID($oldPlan->parent);
|
||||
$parentChange = false;
|
||||
}
|
||||
|
||||
if($status == 'doing' and !empty($_POST))
|
||||
{
|
||||
@@ -530,6 +534,7 @@ class productplanModel extends model
|
||||
->where('id')->eq($planID)
|
||||
->beginIF(isset($parentPlan))->orWhere('id')->eq($oldPlan->parent)->fi()
|
||||
->exec();
|
||||
if($parentPlan->status != 'doing') $parentChange = true;
|
||||
}
|
||||
elseif($status == 'doing' and isset($parentPlan) and $parentPlan->status != 'doing')
|
||||
{
|
||||
@@ -538,6 +543,7 @@ class productplanModel extends model
|
||||
->where('id')->eq($planID)
|
||||
->orWhere('id')->eq($oldPlan->parent)
|
||||
->exec();
|
||||
if($parentPlan->status != 'doing') $parentChange = true;
|
||||
}
|
||||
elseif($status == 'done' and isset($parentPlan))
|
||||
{
|
||||
@@ -551,6 +557,7 @@ class productplanModel extends model
|
||||
break;
|
||||
}
|
||||
}
|
||||
if($parentDone) $parentChange = true;
|
||||
$this->dao->update(TABLE_PRODUCTPLAN)
|
||||
->set('`status`')->eq($status)
|
||||
->where('id')->eq($planID)
|
||||
@@ -569,6 +576,7 @@ class productplanModel extends model
|
||||
break;
|
||||
}
|
||||
}
|
||||
if($parentClosed) $parentChange = true;
|
||||
$this->dao->update(TABLE_PRODUCTPLAN)
|
||||
->set('`status`')->eq($status)
|
||||
->where('id')->eq($planID)
|
||||
@@ -586,7 +594,39 @@ class productplanModel extends model
|
||||
if(dao::isError()) return false;
|
||||
|
||||
if(!isset($plan)) $plan = $this->getByID($planID);
|
||||
if(!dao::isError())return common::createChanges($oldPlan, $plan);
|
||||
if(!dao::isError())
|
||||
{
|
||||
$method = $this->app->rawMethod;
|
||||
if($method == 'start')
|
||||
{
|
||||
$action = 'started';
|
||||
if($parentChange) $parentAction = 'startedbychild';
|
||||
}
|
||||
elseif($method == 'finish')
|
||||
{
|
||||
$action = 'finished';
|
||||
if($parentChange) $parentAction = 'finishedbychild';
|
||||
}
|
||||
elseif($method == 'close')
|
||||
{
|
||||
$action = 'closed';
|
||||
if($parentChange) $parentAction = 'closedbychild';
|
||||
}
|
||||
elseif($method == 'activate')
|
||||
{
|
||||
$action = 'activated';
|
||||
if($parentChange) $parentAction = 'activatedbychild';
|
||||
}
|
||||
|
||||
if(isset($action))
|
||||
{
|
||||
$changes = common::createChanges($oldPlan, $plan);
|
||||
$actionID = $this->loadModel('action')->create('productplan', $planID, $action);
|
||||
$this->action->loghistory($actionID, $changes);
|
||||
|
||||
if($parentChange) $actionID = $this->action->create('productplan', $oldPlan->parent, $parentAction, '', $parentAction);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -605,7 +645,7 @@ class productplanModel extends model
|
||||
$config = HTMLPurifier_Config::createDefault();
|
||||
$config->set('Cache.DefinitionImpl', null);
|
||||
$purifier = new HTMLPurifier($config);
|
||||
|
||||
|
||||
$plans = array();
|
||||
$extendFields = $this->getFlowExtendFields();
|
||||
foreach($data->id as $planID)
|
||||
@@ -617,7 +657,7 @@ class productplanModel extends model
|
||||
$plan->begin = $data->begin[$planID] == '' ? '2030-01-01' : $data->begin[$planID];
|
||||
$plan->end = $data->end[$planID] == '' ? '2030-01-01' : $data->end[$planID];
|
||||
$plan->status = $data->status[$planID];
|
||||
|
||||
|
||||
if($oldPlans[$planID]->parent > 0) $parentPlan = $this->getByID($oldPlans[$planID]->parent);
|
||||
if(!empty($parentPlan->begin))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user