* Modify the logic of the acquisition plan.

This commit is contained in:
tianshujie
2021-11-05 17:19:41 +08:00
parent 1424fbe869
commit 0328182a47
6 changed files with 47 additions and 13 deletions
+22 -1
View File
@@ -332,10 +332,31 @@ class productplanModel extends model
->leftJoin(TABLE_PLANSTORY)->alias('t2')->on('t1.id=t2.story')
->leftJoin(TABLE_PRODUCTPLAN)->alias('t3')->on('t2.plan=t3.id')
->where('t1.id')->in($storyIdList)
->andWhere('t3.deleted')->eq(0)
->fetchGroup('storyID', 'id');
}
/**
* Get branch plan pairs.
*
* @param int $productID
* @access public
* @return array
*/
public function getBranchPlanPairs($productID)
{
$plans = $this->dao->select('branch,id,title,begin,end')->from(TABLE_PRODUCTPLAN)
->where('deleted')->eq(0)
->andWhere('product')->eq($productID)
->fetchAll('id');
$planPairs = array();
foreach($plans as $planID => $plan)
{
$planPairs[$plan->branch][$planID] = $plan->title . ' [' . $plan->begin . '~' . $plan->end . ']';
}
return $planPairs;
}
/**
* Create a plan.
*
+6 -7
View File
@@ -706,15 +706,12 @@ class story extends control
$product = $this->product->getByID($productID);
$branchProduct = $product->type == 'normal' ? false : true;
/* Set modules and productPlans. */
$modules = $this->tree->getOptionMenu($productID, $viewType = 'story', 0, $branch);
$modules = array('ditto' => $this->lang->story->ditto) + $modules;
$productPlans = $this->productplan->getPairs($productID, $branch, '', true);
$productPlans = array('' => '', 'ditto' => $this->lang->story->ditto) + $productPlans;
/* Set modules. */
$modules = array('ditto' => $this->lang->story->ditto) + $this->tree->getOptionMenu($productID, $viewType = 'story', 0, $branch);
$this->view->modules = $modules;
$this->view->branches = $product->type == 'normal' ? array() : $this->loadModel('branch')->getPairs($product->id);
$this->view->productPlans = $productPlans;
$this->view->plans = $this->productplan->getBranchPlanPairs($productID);
$this->view->position[] = html::a($this->createLink('product', 'browse', "product=$product->id&branch=$branch"), $product->name);
$this->view->title = $product->name . $this->lang->colon . $this->lang->story->batchEdit;
}
@@ -1393,6 +1390,7 @@ class story extends control
$normalStotyIdList = '';
$conflictStoryIdList = '';
$conflictStoryArray = array();
/* Determine whether there is a conflict between the branch of the story and the linked plan. */
foreach($storyIdList as $storyID)
{
@@ -1400,10 +1398,11 @@ class story extends control
{
foreach($plans[$storyID] as $plan)
{
if($plan->branch != BRANCH_MAIN and $plan->branch != $branchID and strpos($conflictStoryIdList, '[' . $storyID . ']') === false)
if($plan->branch != BRANCH_MAIN and $plan->branch != $branchID)
{
$conflictStoryIdList .= '[' . $storyID . ']';
$conflictStoryArray[] = $storyID;
break;
}
}
}
+1 -1
View File
@@ -277,7 +277,7 @@ $lang->story->moveChildrenTips = "Its Child {$lang->SRCommon} will be moved
$lang->story->changeTips = 'The story associated with the requirements to change, click "Cancel" ignore this change, click "Confirm" to change the story.';
$lang->story->estimateMustBeNumber = 'Estimate value must be number.';
$lang->story->estimateMustBePlus = 'Estimated value cannot be negative';
$lang->story->confirmChangeBranch = $lang->SRCommon . '%s is linked to the plan of its linked branch. If the branch is edited, ' . $lang->SRCommon . ' will be removed from the plan of its linked branch. Do you want to continue edit ' . $lang->SRCommon . '?';
$lang->story->confirmChangeBranch = $lang->SRCommon . ' %s is linked to the plan of its linked branch. If the branch is edited, ' . $lang->SRCommon . ' will be removed from the plan of its linked branch. Do you want to continue edit ' . $lang->SRCommon . '?';
$lang->story->form = new stdclass();
$lang->story->form->area = 'Scope';
+1 -1
View File
@@ -277,7 +277,7 @@ $lang->story->moveChildrenTips = "修改父{$lang->SRCommon}的所属产品
$lang->story->changeTips = '该软件需求关联的用户需求有变更,点击“不变更”忽略此条变更,点击“变更”来进行该软件需求的变更。';
$lang->story->estimateMustBeNumber = '估算值必须是数字';
$lang->story->estimateMustBePlus = '估算值不能是负数';
$lang->story->confirmChangeBranch = $lang->SRCommon . '%s已关联在之前所属分支的计划中,调整分支后,' . $lang->SRCommon . '将从之前所属分支的计划中移除,请确认是否继续修改上述' . $lang->SRCommon . ' 的分支。';
$lang->story->confirmChangeBranch = $lang->SRCommon . '%s已关联在之前所属分支的计划中,调整分支后,' . $lang->SRCommon . '将从之前所属分支的计划中移除,请确认是否继续修改上述' . $lang->SRCommon . '的分支。';
$lang->story->form = new stdclass();
$lang->story->form->area = "该{$lang->SRCommon}所属范围";
+2 -2
View File
@@ -1678,7 +1678,7 @@ class storyModel extends model
* @param string $confirm
* @param array $plans
* @access public
* @return void
* @return array
*/
public function batchChangeBranch($storyIdList, $branchID, $confirm = '', $plans = array())
{
@@ -1716,7 +1716,7 @@ class storyModel extends model
}
}
/* If there is a conflict in the linked plan when the branch story to be modified, the linked with the conflicting plan will be removed. */
/* If there is a conflict in the linked plan when the branch story to be modified, the linked with the conflicting plan will be removed. */
if($conflictPlanIdList)
{
$story->plan = $planIdList;
+15 -1
View File
@@ -100,7 +100,21 @@ foreach(explode(',', $showFields) as $field)
<?php echo html::select("modules[$storyID]", $modules, $story->module, "class='form-control chosen'");?>
</td>
<td class='text-left<?php echo zget($visibleFields, 'plan', ' hidden')?>'>
<?php if($this->session->currentProductType != 'normal') $productPlans = $this->productplan->getPairs($productID, $story->branch, '', true);?>
<?php
$productPlans = array();
if($story->branch != BRANCH_MAIN)
{
$productPlans = zget($plans, $story->branch) + zget($plans, 0);
}
else
{
foreach($plans as $branchPlan)
{
$productPlans += $branchPlan;
}
}
?>
<?php if($this->session->currentProductType == 'normal') $productPlans = array('' => '', 'ditto' => $this->lang->story->ditto) + $productPlans;?>
<?php echo html::select("plans[$storyID]", $productPlans, $story->plan, "class='form-control chosen'");?>
</td>
<td title='<?php echo $story->title?>'>