* Fix bug.

This commit is contained in:
leiyong
2020-11-27 13:46:33 +08:00
parent 79b2e6c830
commit 4b13262a15
4 changed files with 24 additions and 13 deletions
+1 -1
View File
@@ -865,7 +865,7 @@ $lang->menu->scrum->doc = '文档|doc|index|';
$lang->menu->scrum->qa = '测试|qa|index';
$lang->menu->scrum->projectrelease = array('link' => '发布|projectrelease|browse');
$lang->menu->scrum->stakeholder = '干系人|stakeholder|browse';
$lang->menu->scrum->list = array('link' => '更多|program|prjedit|project={PROJECT}', 'class' => 'dropdown dropdown-hover waterfall-list', 'subModule' => 'stakeholder,workestimation,durationestimation,budget,pssp,stakeholder');
$lang->menu->scrum->list = array('link' => '更多|program|prjedit|project={PROJECT}', 'class' => 'dropdown dropdown-hover waterfall-list');
$lang->scrum = new stdclass();
$lang->scrum->subMenu = new stdclass();
+3
View File
@@ -693,6 +693,9 @@ class commonModel extends model
$subMenu = "<ul class='dropdown-menu'>{$subMenu}</ul>";
}
/* Disable links to more buttons. */
if($menuItem->name == 'list') $link='javascript:void(0);';
$menuItemHtml = "<li class='$class $active' data-id='$menuItem->name'>" . html::a($link, $label, $target) . $subMenu . "</li>\n";
echo $menuItemHtml;
@@ -83,7 +83,13 @@
<?php $i ++; $memberCount ++;?>
<?php endfor;?>
</tbody>
<tfoot><tr><td colspan='6' class='text-center form-actions'><?php echo html::submitButton() . ' ' . html::a($this->createLink('program', 'PRJBrowse', '', '', '', $project->id), $lang->goback, '', 'class="btn btn-back btn-wide"');?></td></tr></tfoot>
<tfoot>
<tr>
<td colspan='6' class='text-center form-actions'>
<?php echo html::submitButton() . html::backButton();?>
</td>
</tr>
</tfoot>
</table>
<?php js::set('i', $i);?>
</form>
+13 -11
View File
@@ -311,20 +311,21 @@ class programplanModel extends model
/**
* Get total percent.
*
* @param object $plan
* @param object $stage
* @param object $parent
* @access public
* @return int
*/
public function getTotalPercent($plan, $parent = false)
public function getTotalPercent($stage, $parent = false)
{
/* When parent is equal to true, query the total workload of the subphase. */
$projectID = $parent ? $plan->id : $plan->project;
$plans = $this->getStage($projectID, $plan->product, 'parent');
$projectID = $parent ? $stage->id : $stage->project;
$plans = $this->getStage($projectID, $stage->product, 'parent');
$totalPercent = 0;
foreach($plans as $id => $stage)
{
if($id == $plan->id) continue;
if($id == $stage->id) continue;
$totalPercent += $stage->percent;
}
@@ -661,12 +662,12 @@ class programplanModel extends model
if($plan->parent > 0)
{
$parentPlan = $this->getByID($plan->parent);
$plan->attribute = $parentPlan->attribute;
$plan->acl = $parentPlan->acl;
$parentPercent = $parentPlan->percent;
$parentStage = $this->getByID($plan->parent);
$plan->attribute = $parentStage->attribute;
$plan->acl = $parentStage->acl;
$parentPercent = $parentStage->percent;
$childrenTotalPercent = $this->getTotalPercent($parentPlan, true);
$childrenTotalPercent = $this->getTotalPercent($parentStage, true);
$childrenTotalPercent = $plan->parent == $oldPlan->parent ? ($childrenTotalPercent - $oldPlan->percent + $plan->percent) : ($childrenTotalPercent + $plan->percent);
/* The sum of the workload of the child phases cannot be greater than that of the parent phase. */
@@ -677,12 +678,13 @@ class programplanModel extends model
}
/* If child plan has milestone, update parent plan set milestone eq 0 . */
if($plan->milestone and $parentPlan->milestone) $this->dao->update(TABLE_PROJECT)->set('milestone')->eq(0)->where('id')->eq($oldPlan->parent)->exec();
if($plan->milestone and $parentStage->milestone) $this->dao->update(TABLE_PROJECT)->set('milestone')->eq(0)->where('id')->eq($oldPlan->parent)->exec();
}
else
{
$childrenIDList = $this->dao->select('*')->from(TABLE_PROJECT)->where('parent')->eq($oldPlan->id)->fetch('id');
if(!empty($childrenIDList)) $this->dao->update(TABLE_PROJECT)->set('acl')->eq($plan->acl)->where('id')->in($childrenIDList)->exec();
/* The workload of the parent plan cannot exceed 100%. */
$oldPlan->parent = $plan->parent;
$totalPercent = $this->getTotalPercent($oldPlan);