diff --git a/module/block/ui/projectblock.html.php b/module/block/ui/projectblock.html.php
index 8f549fc7dc..3242c39b17 100644
--- a/module/block/ui/projectblock.html.php
+++ b/module/block/ui/projectblock.html.php
@@ -15,7 +15,11 @@ jsVar('delayInfo', $lang->project->delayInfo);
jsVar('LONG_TIME', LONG_TIME);
jsVar('longTimeText', $lang->project->longTime);
-foreach($projects as $project) $project->consumed .= $lang->execution->workHourUnit;
+foreach($projects as $project)
+{
+ $project->consumed .= $lang->execution->workHourUnit;
+ $project->consumed = helper::formatHours($project->consumed);
+}
if(!$longBlock)
{
unset($config->block->project->dtable->fieldList['PM']);
diff --git a/module/block/ui/scrumlistblock.html.php b/module/block/ui/scrumlistblock.html.php
index f017fc2bd3..7eaba92fd5 100644
--- a/module/block/ui/scrumlistblock.html.php
+++ b/module/block/ui/scrumlistblock.html.php
@@ -19,6 +19,10 @@ foreach($executionStats as $scrum)
$scrum->totalConsumed = zget($scrum, 'consumed', 0) . $lang->execution->workHourUnit;
$scrum->totalLeft = zget($scrum, 'left', 0) . $lang->execution->workHourUnit;
$scrum->progress = zget($scrum, 'progress', 0);
+
+ $scrum->totalEstimate = helper::formatHours($scrum->totalEstimate);
+ $scrum->totalConsumed = helper::formatHours($scrum->totalConsumed);
+ $scrum->totalLeft = helper::formatHours($scrum->totalLeft);
}
if(!$longBlock)
diff --git a/module/execution/control.php b/module/execution/control.php
index dd804e5e92..ab732d6da3 100644
--- a/module/execution/control.php
+++ b/module/execution/control.php
@@ -1003,8 +1003,8 @@ class execution extends control
foreach($this->view->teamMembers as $member)
{
$member->days = $member->days . $this->lang->execution->day;
- $member->hours = $member->hours . $this->lang->execution->workHour;
- $member->total = $member->totalHours . $this->lang->execution->workHour;
+ $member->hours = helper::formatHours($member->hours) . $this->lang->execution->workHour;
+ $member->total = helper::formatHours($member->totalHours) . $this->lang->execution->workHour;
$member->actions = array();
if(common::hasPriv('execution', 'unlinkMember', $member) && common::canModify('execution', $execution)) $member->actions = array('unlink');
diff --git a/module/execution/ui/grouptask.html.php b/module/execution/ui/grouptask.html.php
index 8f9639230a..cd1d997942 100644
--- a/module/execution/ui/grouptask.html.php
+++ b/module/execution/ui/grouptask.html.php
@@ -351,17 +351,17 @@ $tbody = function() use($tasks, $lang, $groupBy, $users, $groupByList, $executio
h::td
(
setClass('text-right'),
- $task->estimate . $lang->execution->workHourUnit
+ helper::formatHours($task->estimate) . $lang->execution->workHourUnit
),
h::td
(
setClass('text-right'),
- $task->consumed . $lang->execution->workHourUnit
+ helper::formatHours($task->consumed) . $lang->execution->workHourUnit
),
h::td
(
setClass('text-right'),
- $task->left . $lang->execution->workHourUnit
+ helper::formatHours($task->left) . $lang->execution->workHourUnit
),
h::td
(
diff --git a/module/execution/ui/treestory.html.php b/module/execution/ui/treestory.html.php
index 3d9fb16762..3e58b36d43 100644
--- a/module/execution/ui/treestory.html.php
+++ b/module/execution/ui/treestory.html.php
@@ -129,7 +129,7 @@ div
span
(
setClass('ml-2 font-bold'),
- $story->estimate
+ helper::formatHours($story->estimate)
)
)
),
diff --git a/module/execution/ui/treetask.html.php b/module/execution/ui/treetask.html.php
index 8217abc9d8..d7389ce52a 100644
--- a/module/execution/ui/treetask.html.php
+++ b/module/execution/ui/treetask.html.php
@@ -57,7 +57,7 @@ div
span
(
setClass('ml-2 font-bold'),
- $task->estimate . ' ' . $lang->execution->workHourUnit
+ helper::formatHours($task->estimate) . ' ' . $lang->execution->workHourUnit
)
),
div
@@ -67,7 +67,7 @@ div
span
(
setClass('ml-2 font-bold'),
- round($task->consumed, 2) . ' ' . $lang->execution->workHourUnit
+ helper::formatHours($task->consumed) . ' ' . $lang->execution->workHourUnit
)
),
div
@@ -77,7 +77,7 @@ div
span
(
setClass('ml-2 font-bold'),
- $task->left . ' ' . $lang->execution->workHourUnit
+ helper::formatHours($task->left) . ' ' . $lang->execution->workHourUnit
)
),
div
diff --git a/module/execution/ui/view.html.php b/module/execution/ui/view.html.php
index 11520c24cf..22d9e7e95d 100644
--- a/module/execution/ui/view.html.php
+++ b/module/execution/ui/view.html.php
@@ -596,19 +596,19 @@ div
(
setClass('w-1/3'),
span(setClass('text-gray'), $lang->execution->estimateHours),
- span(setClass('ml-2'), $execution->totalEstimate . $lang->execution->workHourUnit)
+ span(setClass('ml-2'), helper::formatHours($execution->totalEstimate) . $lang->execution->workHourUnit)
),
div
(
setClass('w-1/3'),
span(setClass('text-gray'), $lang->execution->consumedHours),
- span(setClass('ml-2'), $execution->totalConsumed . $lang->execution->workHourUnit)
+ span(setClass('ml-2'), helper::formatHours($execution->totalConsumed) . $lang->execution->workHourUnit)
),
div
(
setClass('w-1/3'),
span(setClass('text-gray'), $lang->execution->leftHours),
- span(setClass('ml-2'), $execution->totalLeft . $lang->execution->workHourUnit)
+ span(setClass('ml-2'), helper::formatHours($execution->totalLeft) . $lang->execution->workHourUnit)
),
div
(
diff --git a/module/my/ui/project.html.php b/module/my/ui/project.html.php
index ac74207bef..3e2bda625e 100644
--- a/module/my/ui/project.html.php
+++ b/module/my/ui/project.html.php
@@ -60,7 +60,9 @@ foreach($projects as $project)
$project->budget = $lang->project->future;
}
- $project->end = $project->end == LONG_TIME ? $lang->project->longTime : $project->end;
+ $project->end = $project->end == LONG_TIME ? $lang->project->longTime : $project->end;
+ $project->estimate = helper::formatHours($project->estimate);
+ $project->consume = helper::formatHours($project->consume);
}
$projects = array_values($projects);
diff --git a/module/my/ui/story.html.php b/module/my/ui/story.html.php
index 181ea7b10f..7acf76b61d 100644
--- a/module/my/ui/story.html.php
+++ b/module/my/ui/story.html.php
@@ -109,6 +109,7 @@ foreach($stories as $id => $story)
if($action['name'] == 'create' && $story->isParent == '1') $stories[$id]->actions[$key]['disabled'] = 1;
}
}
+ $story->estimate = helper::formatHours($story->estimate);
}
if($viewType == 'tiled') $config->my->story->dtable->fieldList['title']['nestedToggle'] = false;
diff --git a/module/my/ui/task.html.php b/module/my/ui/task.html.php
index 67311a60c6..8457249984 100644
--- a/module/my/ui/task.html.php
+++ b/module/my/ui/task.html.php
@@ -100,6 +100,10 @@ if($config->edition == 'ipd')
}
}
}
+
+ $data->estimate = helper::formatHours($data->estimate);
+ $data->consumed = helper::formatHours($data->consumed);
+ $data->left = helper::formatHours($data->left);
}
}
diff --git a/module/project/ui/team.html.php b/module/project/ui/team.html.php
index 40940ef33f..a2d640be6c 100644
--- a/module/project/ui/team.html.php
+++ b/module/project/ui/team.html.php
@@ -13,8 +13,8 @@ namespace zin;
foreach($teamMembers as $member)
{
$member->days = $member->days . $this->lang->execution->day;
- $member->hours = $member->hours . $this->lang->execution->workHour;
- $member->total = $member->totalHours . $this->lang->execution->workHour;
+ $member->hours = helper::formatHours($member->hours) . $this->lang->execution->workHour;
+ $member->total = helper::formatHours($member->totalHours) . $this->lang->execution->workHour;
$member->actions = array();
if(common::hasPriv('project', 'unlinkMember', $member) && $canBeChanged) $member->actions = array('unlink');
}
diff --git a/module/project/ui/view.html.php b/module/project/ui/view.html.php
index 3bb3b58240..ee38c06624 100644
--- a/module/project/ui/view.html.php
+++ b/module/project/ui/view.html.php
@@ -465,19 +465,19 @@ row
(
setClass('w-1/3'),
span(setClass('text-gray'), $lang->execution->estimateHours),
- span(setClass('ml-2'), (float)$project->estimate . 'h')
+ span(setClass('ml-2'), helper::formatHours($project->estimate) . 'h')
),
div
(
setClass('w-1/3'),
span(setClass('text-gray'), $lang->execution->consumedHours),
- span(setClass('ml-2'), (float)$project->consumed . 'h')
+ span(setClass('ml-2'), helper::formatHours($project->consumed) . 'h')
),
div
(
setClass('w-1/3'),
span(setClass('text-gray'), $lang->execution->leftHours),
- span(setClass('ml-2'), (float)$project->left . 'h')
+ span(setClass('ml-2'), helper::formatHours($project->left) . 'h')
),
div
(
@@ -489,7 +489,7 @@ row
(
setClass('w-1/3 mt-4'),
span(setClass('text-gray'), $lang->execution->totalHours),
- span(setClass('ml-2'), (float)$project->left . 'h')
+ span(setClass('ml-2'), helper::formatHours($project->left) . 'h')
),
div
(
diff --git a/module/project/zen.php b/module/project/zen.php
index 87f36ac8ee..3173291d16 100755
--- a/module/project/zen.php
+++ b/module/project/zen.php
@@ -1385,6 +1385,10 @@ class projectZen extends project
$project->from = 'project';
$project->actions = $this->project->buildActionList($project);
+
+ $project->estimate = helper::formatHours($project->estimate);
+ $project->consume = helper::formatHours($project->consume);
+ $project->left = helper::formatHours($project->left);
}
return array_values($projectList);
diff --git a/module/story/model.php b/module/story/model.php
index e74600c87d..ed0b2f2d72 100644
--- a/module/story/model.php
+++ b/module/story/model.php
@@ -5091,7 +5091,7 @@ class storyModel extends model
public function formatStoryForList(object $story, array $options = array(), string $storyType = 'story', array $maxGradeGroup = array()): object
{
$story->actions = $this->buildActionButtonList($story, 'browse', zget($options, 'execution', null), $storyType, $maxGradeGroup);
- $story->estimate = $story->estimate . $this->config->hourUnit;
+ $story->estimate = helper::formatHours($story->estimate) . $this->config->hourUnit;
$story->taskCount = zget(zget($options, 'storyTasks', array()), $story->id, 0);
$story->bugCount = zget(zget($options, 'storyBugs', array()), $story->id, 0);
diff --git a/module/story/ui/view.html.php b/module/story/ui/view.html.php
index 4539ed1b61..9fe2e87af9 100644
--- a/module/story/ui/view.html.php
+++ b/module/story/ui/view.html.php
@@ -21,6 +21,8 @@ $isRequirement = $story->type == 'requirement';
$isStoryType = $story->type == 'story';
if(empty($executionID)) $executionID = 0;
+$story->estimate = helper::formatHours($story->estimate);
+
/* 版本列表。Version list. */
$versions = array();
for($i = $story->version; $i >= 1; $i--)
diff --git a/module/task/model.php b/module/task/model.php
index 18c0d5aab1..b55e1693a6 100755
--- a/module/task/model.php
+++ b/module/task/model.php
@@ -2613,7 +2613,7 @@ class taskModel extends model
$dataList = array();
foreach($tasks as $task)
{
- $key = (string)$task->$field;
+ $key = strpos(',estimate,consumed,left,', ",{$field},") !== false ? helper::formatHours($task->$field) : (string)$task->$field;
if(!isset($fields[$key])) $fields[$key] = 0;
$fields[$key] ++;
}
diff --git a/module/task/ui/linearefforts.html.php b/module/task/ui/linearefforts.html.php
index 3f1ec450bd..501f2c94ef 100644
--- a/module/task/ui/linearefforts.html.php
+++ b/module/task/ui/linearefforts.html.php
@@ -26,6 +26,9 @@ $myEfforts = array();
$myLastOrder = 0;
foreach($efforts as $key => $effort)
{
+ $effort->consumed = helper::formatHours($effort->consumed);
+ $effort->left = helper::formatHours($effort->left);
+
$prevEffort = $key > 0 ? $efforts[$key - 1] : null;
$order = (!$prevEffort or $prevEffort->order == $effort->order) ? $index : ++$index;
$account = $effort->account;
diff --git a/module/task/ui/recordworkhour.html.php b/module/task/ui/recordworkhour.html.php
index 3102ba8253..0d8a567dc0 100644
--- a/module/task/ui/recordworkhour.html.php
+++ b/module/task/ui/recordworkhour.html.php
@@ -29,7 +29,7 @@ modalHeader
span
(
setClass('label secondary-pale'),
- $task->estimate . $lang->task->suffixHour
+ helper::formatHours($task->estimate) . $lang->task->suffixHour
)
),
span
@@ -42,7 +42,7 @@ modalHeader
span
(
setID('totalConsumed'),
- $task->consumed
+ helper::formatHours($task->consumed)
),
$lang->task->suffixHour
)
@@ -63,6 +63,9 @@ if($efforts)
$i = 1;
foreach($efforts as $effort)
{
+ $effort->consumed = helper::formatHours($effort->consumed);
+ $effort->left = helper::formatHours($effort->left);
+
$canOperateEffort = $this->task->canOperateEffort($task, $effort);
$operateTips = $canOperateEffort ? '' : $lang->task->effortOperateTips;
$hidden = ($taskEffortFold and $i > 3) ? 'hidden' : '';
diff --git a/module/task/ui/view.html.php b/module/task/ui/view.html.php
index be1e878531..cf1edfc9f5 100644
--- a/module/task/ui/view.html.php
+++ b/module/task/ui/view.html.php
@@ -45,6 +45,9 @@ if($this->config->edition == 'ipd')
}
$task->executionInfo = $execution;
+$task->estimate = helper::formatHours($task->estimate);
+$task->consumed = helper::formatHours($task->consumed);
+$task->left = helper::formatHours($task->left);
$actions = !$task->deleted && common::canModify('execution', $execution) ? $this->loadModel('common')->buildOperateMenu($task) : array();
$hasDivider = !empty($actions['mainActions']) && !empty($actions['suffixActions']);
if(!empty($actions)) $actions = array_merge($actions['mainActions'], $hasDivider ? array(array('type' => 'divider')) : array(), $actions['suffixActions']);