Merge branch 'master' into zentaopms_239

This commit is contained in:
wangyidong
2022-10-27 11:39:47 +08:00
370 changed files with 9090 additions and 2016 deletions
+48 -20
View File
@@ -109,6 +109,16 @@ class executionModel extends model
unset($this->lang->execution->menu->build);
}
$stageFilter = array('request', 'design', 'review');
if(isset($execution->attribute))
{
if($this->config->edition == 'open' and in_array($execution->attribute, $stageFilter))
{
unset($this->lang->execution->menu->qa);
unset($this->lang->execution->menu->build);
}
}
if($executions and (!isset($executions[$executionID]) or !$this->checkPriv($executionID))) $this->accessDenied();
$moduleName = $this->app->getModuleName();
@@ -360,7 +370,7 @@ class executionModel extends model
}
/* Check the workload format and total. */
if(!empty($sprint->percent)) $this->checkWorkload('create', $sprint->percent);
if(!empty($sprint->percent)) $this->checkWorkload('create', $sprint->percent, $sprint->project);
/* Set planDuration and realDuration. */
if($this->config->edition == 'max')
@@ -1137,7 +1147,7 @@ class executionModel extends model
->batchCheck($this->config->kanban->edit->requiredFields, 'notempty')
->checkIF(!$execution->fluidBoard, 'colWidth', 'gt', 0)
->batchCheckIF($execution->fluidBoard, 'minColWidth,maxColWidth', 'gt', 0)
->checkIF($execution->minColWidth and $execution->maxColWidth and $execution->fluidBoard, 'maxColWidth', 'ge', $kanban->minColWidth)
->checkIF($execution->minColWidth and $execution->maxColWidth and $execution->fluidBoard, 'maxColWidth', 'gt', $execution->minColWidth)
->where('id')->eq((int)$executionID)
->exec();
}
@@ -1145,9 +1155,9 @@ class executionModel extends model
/**
* Check the workload format and total.
*
* @param string $type create|update
* @param int $percent
* @param object $oldExecution
* @param string $type create|update
* @param int $percent
* @param object|int $oldExecution
* @access public
* @return bool
*/
@@ -1168,7 +1178,7 @@ class executionModel extends model
->andWhere('t2.type')->eq('stage')
->andWhere('t2.grade')->eq(1)
->andWhere('t2.deleted')->eq(0)
->andWhere('t2.parent')->eq($oldExecution->parent)
->andWhere('t2.parent')->eq($oldExecution)
->fetch('total');
if($type == 'create') $percentTotal = $percent + $oldPercentTotal;
@@ -1551,6 +1561,15 @@ class executionModel extends model
$hours = $this->loadModel('project')->computerProgress($executions);
$burns = $this->getBurnData($executions);
/* Get the number of execution teams. */
$teams = $this->dao->select('t1.root,count(t1.id) as teams')->from(TABLE_TEAM)->alias('t1')
->leftJoin(TABLE_USER)->alias('t2')->on('t1.account=t2.account')
->where('t1.root')->in(array_keys($executions))
->andWhere('t1.type')->ne('project')
->andWhere('t2.deleted')->eq(0)
->groupBy('t1.root')
->fetchAll('root');
if($withTasks) $executionTasks = $this->getTaskGroupByExecution(array_keys($executions));
/* Process executions. */
@@ -1577,6 +1596,7 @@ class executionModel extends model
/* Process the hours. */
$execution->hours = isset($hours[$execution->id]) ? $hours[$execution->id] : (object)$emptyHour;
$execution->teamCount = isset($teams[$execution->id]) ? $teams[$execution->id]->teams : 0;
if(isset($executionTasks) and isset($executionTasks[$execution->id]))
{
@@ -4273,7 +4293,7 @@ class executionModel extends model
$days = count($dateList) - 1;
$rate = $days ? $firstTime / $days : '';
$baselineJSON = '[';
foreach($dateList as $i => $date) $baselineJSON .= round(($days - $i) * (float)$rate, 1) . ',';
foreach($dateList as $i => $date) $baselineJSON .= round(($days - $i) * (float)$rate, 3) . ',';
$baselineJSON = rtrim($baselineJSON, ',') . ']';
$chartData['labels'] = $this->report->convertFormat($dateList, DT_DATE5);
@@ -4616,25 +4636,24 @@ class executionModel extends model
if(!$isChild)
{
$trClass = 'is-top-level table-nest-child-hide';
$trAttrs = "data-id='$execution->id' data-order='$execution->order' data-nested='true'";
$trAttrs = "data-id='$execution->id' data-order='$execution->order' data-nested='true' data-status={$execution->status}";
}
else
{
$trClass = 'table-nest-hide';
$trAttrs = "data-id={$execution->id} data-parent={$execution->parent}";
$trAttrs = "data-id={$execution->id} data-parent={$execution->parent} data-status={$execution->status}";
$trAttrs .= " data-nest-parent='$execution->parent' data-order='$execution->order' data-nest-path=',$execution->parent,$execution->id,'";
}
$burns = join(',', $execution->burns);
echo "<tr $trAttrs class='$trClass'>";
echo "<td><span id=$execution->id class='table-nest-icon icon table-nest-toggle'></span>";
echo "<td class='c-name text-left flex sort-handler'>";
if(common::hasPriv('execution', 'batchEdit')) echo "<span id=$execution->id class='table-nest-icon icon table-nest-toggle'></span>";
$spanClass = $execution->type == 'stage' ? 'label-warning' : 'label-info';
echo "<span class='project-type-label label label-outline $spanClass'>{$this->lang->execution->typeList[$execution->type]}</span> ";
if(empty($execution->children))
{
echo html::a(helper::createLink('execution', 'view', "executionID=$execution->id"), $execution->name);
echo html::a(helper::createLink('execution', 'view', "executionID=$execution->id"), $execution->name, '', 'class="text-ellipsis"');
if(!helper::isZeroDate($execution->end))
{
if($execution->status != 'closed')
@@ -4645,7 +4664,7 @@ class executionModel extends model
}
else
{
echo $execution->name;
echo "<span class='text-ellipsis'>" . $execution->name . '</span>';
if(!helper::isZeroDate($execution->end))
{
if($execution->status != 'closed')
@@ -4654,14 +4673,14 @@ class executionModel extends model
}
}
}
echo '<td>' . zget($users, $execution->PM) . '</td>';
echo "<td class='status-{$execution->status} text-center'>" . zget($this->lang->project->statusList, $execution->status) . '</td>';
echo '<td>' . html::ring($execution->hours->progress) . '</td>';
echo '<td>' . zget($users, $execution->PM) . '</td>';
echo helper::isZeroDate($execution->begin) ? '<td class="c-date"></td>' : '<td class="c-date">' . $execution->begin . '</td>';
echo helper::isZeroDate($execution->end) ? '<td class="c-date"></td>' : '<td class="c-date">' . $execution->end . '</td>';
echo "<td class='hours' title='{$execution->hours->totalEstimate}{$this->lang->execution->workHour}'>" . $execution->hours->totalEstimate . $this->lang->execution->workHourUnit . '</td>';
echo "<td class='hours' title='{$execution->hours->totalConsumed}{$this->lang->execution->workHour}'>" . $execution->hours->totalConsumed . $this->lang->execution->workHourUnit . '</td>';
echo "<td class='hours' title='{$execution->hours->totalLeft}{$this->lang->execution->workHour}'>" . $execution->hours->totalLeft . $this->lang->execution->workHourUnit . '</td>';
echo "<td class='hours text-right' title='{$execution->hours->totalEstimate}{$this->lang->execution->workHour}'>" . $execution->hours->totalEstimate . $this->lang->execution->workHourUnit . '</td>';
echo "<td class='hours text-right' title='{$execution->hours->totalConsumed}{$this->lang->execution->workHour}'>" . $execution->hours->totalConsumed . $this->lang->execution->workHourUnit . '</td>';
echo "<td class='hours text-right' title='{$execution->hours->totalLeft}{$this->lang->execution->workHour}'>" . $execution->hours->totalLeft . $this->lang->execution->workHourUnit . '</td>';
echo '<td>' . html::ring($execution->hours->progress) . '</td>';
echo "<td id='spark-{$execution->id}' class='sparkline text-left no-padding' values='$burns'></td>";
echo '<td class="c-actions">';
common::printIcon('execution', 'start', "executionID={$execution->id}", $execution, 'list', '', '', 'iframe', true);
@@ -4874,6 +4893,12 @@ class executionModel extends model
if(!empty($execution->children)) $class .= ' has-child';
}
if($id == 'teamCount')
{
$title = " title='{$execution->teamCount}'";
$class .= ' text-right';
}
if($id == 'project') $title = " title='{$execution->projectName}'";
if($id == 'code') $title = " title='{$execution->code}'";
@@ -4915,7 +4940,7 @@ class executionModel extends model
if(isset($execution->delay)) echo "<span class='label label-danger label-badge'>{$this->lang->execution->delayed}</span> ";
if(!empty($execution->children))
{
echo "<a class='plan-toggle' data-id='$execution->id'><i class='icon icon-angle-double-right'></i></a>";
echo "<a class='plan-toggle' data-id='$execution->id'><i class='icon icon-angle-right'></i></a>";
}
break;
case 'code':
@@ -4942,6 +4967,9 @@ class executionModel extends model
case 'begin':
echo helper::isZeroDate($execution->begin) ? '' : $execution->begin;
break;
case 'teamCount':
echo $execution->teamCount;
break;
case 'end':
echo helper::isZeroDate($execution->end) ? '' : $execution->end;
break;