* Fix product empty bug. bug #45365.

This commit is contained in:
wangyuting
2024-01-30 13:51:59 +08:00
parent 941104b3de
commit accf322feb
3 changed files with 348 additions and 346 deletions
+17 -15
View File
@@ -16,7 +16,6 @@ $app->loadLang('execution');
$active = isset($params['active']) ? $params['active'] : key($products); // 当前产品 ID。
$product = null; // 当前产品。 Current active product.
$items = array(); // 产品导航列表。 Product nav list.
foreach($products as $productItem)
{
$projectID = isset($params['projectID']) ? $params['projectID'] : 0;
@@ -33,23 +32,26 @@ foreach($products as $productItem)
$doneData = array();
$openedData = array();
foreach($product->monthFinish as $date => $count)
if($product)
{
if($date == date('Y-m'))
foreach($product->monthFinish as $date => $count)
{
$product->monthFinish[$lang->datepicker->dpText->TEXT_THIS_MONTH] = $count;
unset($product->monthFinish[$date]);
if($date == date('Y-m'))
{
$product->monthFinish[$lang->datepicker->dpText->TEXT_THIS_MONTH] = $count;
unset($product->monthFinish[$date]);
}
$doneData[] = $count;
}
$doneData[] = $count;
}
foreach($product->monthCreated as $date => $count)
{
if($date == date('Y-m'))
foreach($product->monthCreated as $date => $count)
{
$product->monthCreated[$lang->datepicker->dpText->TEXT_THIS_MONTH] = $count;
unset($product->monthCreated[$date]);
if($date == date('Y-m'))
{
$product->monthCreated[$lang->datepicker->dpText->TEXT_THIS_MONTH] = $count;
unset($product->monthCreated[$date]);
}
$openedData[] = $count;
}
$openedData[] = $count;
}
$monthFinish = !empty($product) ? $product->monthFinish : array();
@@ -61,7 +63,7 @@ statisticBlock
set::active($active),
set::moreLink(createLink('product', 'all', 'browseType=' . $block->params->type)),
set::items($items),
div
$product ? div
(
setClass($longBlock ? 'row' : 'col gap-3', 'h-full overflow-hidden items-stretch p-2'),
center
@@ -279,5 +281,5 @@ statisticBlock
)
) : null
) : null
)
) : null
);
+329 -329
View File
@@ -13,8 +13,7 @@ namespace zin;
$active = isset($params['active']) ? $params['active'] : key($projects);
$project = null;
$items = array();
$items = array();
foreach($projects as $projectItem)
{
$params = helper::safe64Encode("module={$block->module}&active={$projectItem->id}");
@@ -30,385 +29,386 @@ foreach($projects as $projectItem)
$remainingDays = !empty($project->remainingDays) ? $project->remainingDays : 0;
$projectOverview = array();
$projectOverview[] = cell
(
setClass('text-left'),
$project->status != 'closed' && $project->end != LONG_TIME ? span
if($project)
{
$projectOverview[] = cell
(
setClass('text-gray'),
$remainingDays >= 0 ? $lang->block->projectstatistic->leftDaysPre : $lang->block->projectstatistic->delayDaysPre,
span
setClass('text-left'),
$project->status != 'closed' && $project->end != LONG_TIME ? span
(
setClass('font-bold text-black px-1'),
abs($remainingDays)
),
$lang->block->projectstatistic->day
) : span
(
setClass('text-gray'),
$project->status == 'closed' ? $lang->block->projectstatistic->projectClosed : $lang->block->projectstatistic->longTimeProject
)
);
$projectOverview[] = $config->edition != 'open' ? cell
(
setClass('flex-1 text-left' . (!$longBlock ? ' w-full' : '')),
icon('bullhorn text-warning'),
span
(
setClass('text-gray mr-5'),
$lang->block->projectstatistic->existRisks,
span
(
setClass('font-bold text-warning'),
$project->risks
)
),
span
(
setClass('text-gray'),
$lang->block->projectstatistic->existIssues,
span
(
setClass('font-bold text-warning'),
$project->issues
)
)
) : '';
$width = $config->edition != 'open' ? '33%' : '50%';
$lastestExecution = !empty($project->executions) && $project->multiple ? cell
(
setClass('flex flex-1 overflow-hidden whitespace-nowrap clip w-full' . (!$longBlock ? ' text-left w-full' : '')),
span
(
setClass('text-gray'),
$lang->block->projectstatistic->lastestExecution,
hasPriv('execution', 'task') ? a
(
setClass('pl-2'),
set::href(helper::createLink('execution', 'task', "executionID={$project->executions[0]->id}")),
set('title', $project->executions[0]->name),
$project->executions[0]->name
setClass('text-gray'),
$remainingDays >= 0 ? $lang->block->projectstatistic->leftDaysPre : $lang->block->projectstatistic->delayDaysPre,
span
(
setClass('font-bold text-black px-1'),
abs($remainingDays)
),
$lang->block->projectstatistic->day
) : span
(
setClass('pl-2'),
$project->executions[0]->name
setClass('text-gray'),
$project->status == 'closed' ? $lang->block->projectstatistic->projectClosed : $lang->block->projectstatistic->longTimeProject
)
)
) : null;
$cells = array();
if(in_array($project->model, array('scrum', 'kanban', 'agileplus')))
{
foreach($config->block->projectstatistic->items as $module => $moduleItems)
{
$cellItems = array();
foreach($moduleItems as $item)
{
$field = $item['field'];
$unit = $item['unit'];
$cellItems[] = item
);
$projectOverview[] = $config->edition != 'open' ? cell
(
setClass('flex-1 text-left' . (!$longBlock ? ' w-full' : '')),
icon('bullhorn text-warning'),
span
(
setClass('text-gray mr-5'),
$lang->block->projectstatistic->existRisks,
span
(
set::name
setClass('font-bold text-warning'),
$project->risks
)
),
span
(
setClass('text-gray'),
$lang->block->projectstatistic->existIssues,
span
(
setClass('font-bold text-warning'),
$project->issues
)
)
) : '';
$lastestExecution = !empty($project->executions) && $project->multiple ? cell
(
setClass('flex flex-1 overflow-hidden whitespace-nowrap clip w-full' . (!$longBlock ? ' text-left w-full' : '')),
span
(
setClass('text-gray'),
$lang->block->projectstatistic->lastestExecution,
hasPriv('execution', 'task') ? a
(
setClass('pl-2'),
set::href(helper::createLink('execution', 'task', "executionID={$project->executions[0]->id}")),
set('title', $project->executions[0]->name),
$project->executions[0]->name
) : span
(
setClass('pl-2'),
$project->executions[0]->name
)
)
) : null;
$cells = array();
if(in_array($project->model, array('scrum', 'kanban', 'agileplus')))
{
foreach($config->block->projectstatistic->items as $module => $moduleItems)
{
$cellItems = array();
foreach($moduleItems as $item)
{
$field = $item['field'];
$unit = $item['unit'];
$cellItems[] = item
(
$lang->block->projectstatistic->{$field},
!isset($lang->block->tooltips[$field]) ? ':' : null
),
to::suffixName
(
isset($lang->block->tooltips[$field]) ? icon
set::name
(
setClass('text-light text-sm'),
toggle::tooltip
$lang->block->projectstatistic->{$field},
!isset($lang->block->tooltips[$field]) ? ':' : null
),
to::suffixName
(
isset($lang->block->tooltips[$field]) ? icon
(
array
setClass('text-light text-sm'),
toggle::tooltip
(
'title' => $lang->block->tooltips[$field],
'placement' => 'bottom',
'type' => 'white',
'className' => 'text-dark border border-light leading-5'
)
),
'help',
':'
) : null
),
span
array
(
'title' => $lang->block->tooltips[$field],
'placement' => 'bottom',
'type' => 'white',
'className' => 'text-dark border border-light leading-5'
)
),
'help',
':'
) : null
),
span
(
setClass('font-bold text-black mr-0.5'),
round(zget($project, $field, 0), 2)
),
span
(
setClass('text-gray'),
$field == 'storyPoints' ? $config->block->storyUnitList[$config->custom->hourPoint] : $lang->block->projectstatistic->{$unit}
)
);
}
$cells[] = cell
(
setClass('flex-1 overflow-hidden whitespace-nowrap project-statistic-table scrum' . (($module != 'cost' && $longBlock) || ($module != 'task' && $module != 'cost' && !$longBlock) ? ' border-l pl-4 ' : ' ml-4') . (!$longBlock && $module != 'cost' && $module != 'story'? ' border-t' : '')),
set::width($longBlock ? ($module == 'cost' ? 'calc(25% - 1rem)' : '25%') : 'calc(50% - 1rem)'),
div
(
setClass('font-bold text-black mr-0.5'),
round(zget($project, $field, 0), 2)
setClass('pt-1'),
span
(
setClass('font-bold'),
$lang->block->projectstatistic->{$module}
)
),
span
tableData
(
setClass('text-gray'),
$field == 'storyPoints' ? $config->block->storyUnitList[$config->custom->hourPoint] : $lang->block->projectstatistic->{$unit}
set::width('100%'),
$cellItems
)
);
}
}
else
{
$cells[] = cell
(
setClass('flex-1 overflow-hidden whitespace-nowrap project-statistic-table scrum' . (($module != 'cost' && $longBlock) || ($module != 'task' && $module != 'cost' && !$longBlock) ? ' border-l pl-4 ' : ' ml-4') . (!$longBlock && $module != 'cost' && $module != 'story'? ' border-t' : '')),
set::width($longBlock ? ($module == 'cost' ? 'calc(25% - 1rem)' : '25%') : 'calc(50% - 1rem)'),
setClass('flex flex-wrap items-center progress-circle pt-2 mb-2'),
set::width($longBlock ? '36%' : '100%'),
div
(
setClass('pt-1'),
setClass('flex justify-center w-full'),
progressCircle
(
set::percent($project->progress),
set::size(112),
set::text(false),
set::circleWidth(0.06),
div(span(setClass('text-2xl font-bold'), $project->progress), '%'),
div
(
setClass('row text-sm text-gray items-center gap-1'),
$lang->block->projectstatistic->totalProgress,
icon
(
setClass('pl-0.5 text-light text-sm'),
toggle::tooltip
(
array
(
'content' => array('html' => $lang->block->projectstatistic->totalProgressTip),
'placement' => 'bottom',
'type' => 'white',
'className' => 'text-dark border border-light leading-5'
)
),
'help'
)
)
)
)
);
$cells[] = cell
(
setClass('project-statistic-table waterfall pl-4' . ($longBlock ? ' border-l' : ' mt-4')),
set::width($longBlock ? '32%' : '50%'),
div
(
setClass('w-full'),
span
(
setClass('font-bold'),
$lang->block->projectstatistic->{$module}
$lang->project->progress
)
),
tableData
(
set::width('100%'),
$cellItems
)
);
}
}
else
{
$cells[] = cell
(
setClass('flex flex-wrap items-center progress-circle pt-2 mb-2'),
set::width($longBlock ? '36%' : '100%'),
div
(
setClass('flex justify-center w-full'),
progressCircle
(
set::percent($project->progress),
set::size(112),
set::text(false),
set::circleWidth(0.06),
div(span(setClass('text-2xl font-bold'), $project->progress), '%'),
div
item
(
setClass('row text-sm text-gray items-center gap-1'),
$lang->block->projectstatistic->totalProgress,
icon
set::name($lang->block->projectstatistic->sv),
to::suffixName
(
setClass('pl-0.5 text-light text-sm'),
toggle::tooltip
icon
(
array
setClass('text-light text-sm'),
toggle::tooltip
(
'content' => array('html' => $lang->block->projectstatistic->totalProgressTip),
'placement' => 'bottom',
'type' => 'white',
'className' => 'text-dark border border-light leading-5'
)
array
(
'title' => $lang->block->tooltips['sv'],
'placement' => 'bottom',
'type' => 'white',
'className' => 'text-dark border border-light leading-5'
)
),
'help'
),
'help'
':'
),
span
(
setClass('font-bold text-black mr-1'),
(!empty($project->sv) ? $project->sv : 0) . $lang->percent
)
),
item
(
set::name($lang->block->projectstatistic->pv),
to::suffixName
(
icon
(
setClass('text-light text-sm'),
toggle::tooltip
(
array
(
'title' => $lang->block->tooltips['pv'],
'placement' => 'bottom',
'type' => 'white',
'className' => 'text-dark border border-light leading-5'
)
),
'help'
),
':'
),
span
(
setClass('font-bold text-black mr-1'),
(!empty($project->pv) ? $project->pv : 0) . $lang->percent
)
),
item
(
set::name($lang->block->projectstatistic->ev),
to::suffixName
(
icon
(
setClass('text-light text-sm'),
toggle::tooltip
(
array
(
'content' => array('html' => $lang->block->tooltips['ev']),
'placement' => 'bottom',
'type' => 'white',
'className' => 'text-dark border border-light leading-5'
)
),
'help'
),
':'
),
span
(
setClass('font-bold text-black mr-1'),
(!empty($project->ev) ? $project->ev : 0) . $lang->percent
)
)
)
)
);
$cells[] = cell
(
setClass('project-statistic-table waterfall pl-4' . ($longBlock ? ' border-l' : ' mt-4')),
set::width($longBlock ? '32%' : '50%'),
div
);
$cells[] = cell
(
setClass('w-full'),
span
setClass('project-statistic-table waterfall pl-4 border-l' . (!$longBlock ? ' mt-3' : '')),
set::width($longBlock ? '32%' : '50%'),
div
(
setClass('font-bold'),
$lang->project->progress
)
),
tableData
(
item
(
set::name($lang->block->projectstatistic->sv),
to::suffixName
(
icon
(
setClass('text-light text-sm'),
toggle::tooltip
(
array
(
'title' => $lang->block->tooltips['sv'],
'placement' => 'bottom',
'type' => 'white',
'className' => 'text-dark border border-light leading-5'
)
),
'help'
),
':'
),
setClass('w-full'),
span
(
setClass('font-bold text-black mr-1'),
(!empty($project->sv) ? $project->sv : 0) . $lang->percent
setClass('font-bold'),
$lang->block->projectstatistic->currentCost
)
),
item
tableData
(
set::name($lang->block->projectstatistic->pv),
to::suffixName
item
(
icon
set::name($lang->block->projectstatistic->cv),
to::suffixName
(
setClass('text-light text-sm'),
toggle::tooltip
icon
(
array
setClass('text-light text-sm'),
toggle::tooltip
(
'title' => $lang->block->tooltips['pv'],
'placement' => 'bottom',
'type' => 'white',
'className' => 'text-dark border border-light leading-5'
)
array
(
'title' => $lang->block->tooltips['cv'],
'placement' => 'bottom',
'type' => 'white',
'className' => 'text-dark border border-light leading-5'
)
),
'help'
),
'help'
':'
),
':'
),
span
(
setClass('font-bold text-black mr-1'),
(!empty($project->pv) ? $project->pv : 0) . $lang->percent
)
),
item
(
set::name($lang->block->projectstatistic->ev),
to::suffixName
(
icon
span
(
setClass('text-light text-sm'),
toggle::tooltip
(
array
(
'content' => array('html' => $lang->block->tooltips['ev']),
'placement' => 'bottom',
'type' => 'white',
'className' => 'text-dark border border-light leading-5'
)
),
'help'
setClass('font-bold text-black mr-1'),
(!empty($project->cv) ? $project->cv : 0) . $lang->percent
),
':'
),
span
item
(
setClass('font-bold text-black mr-1'),
(!empty($project->ev) ? $project->ev : 0) . $lang->percent
set::name($lang->block->projectstatistic->ev),
to::suffixName
(
icon
(
setClass('text-light text-sm'),
toggle::tooltip
(
array
(
'content' => array('html' => $lang->block->tooltips['ev']),
'placement' => 'bottom',
'type' => 'white',
'className' => 'text-dark border border-light leading-5'
)
),
'help'
),
':'
),
span
(
setClass('font-bold text-black mr-1'),
(!empty($project->ev) ? $project->ev : 0) . $lang->percent
)
),
item
(
set::name($lang->block->projectstatistic->ac),
to::suffixName
(
icon
(
setClass('text-light text-sm'),
toggle::tooltip
(
array
(
'title' => $lang->block->tooltips['ac'],
'placement' => 'bottom',
'type' => 'white',
'className' => 'text-dark border border-light leading-5'
)
),
'help'
),
':'
),
span
(
setClass('font-bold text-black mr-1'),
(!empty($project->ac) ? $project->ac : 0) . $lang->percent
)
)
)
)
);
$cells[] = cell
(
setClass('project-statistic-table waterfall pl-4 border-l' . (!$longBlock ? ' mt-3' : '')),
set::width($longBlock ? '32%' : '50%'),
div
(
setClass('w-full'),
span
(
setClass('font-bold'),
$lang->block->projectstatistic->currentCost
)
),
tableData
(
item
(
set::name($lang->block->projectstatistic->cv),
to::suffixName
(
icon
(
setClass('text-light text-sm'),
toggle::tooltip
(
array
(
'title' => $lang->block->tooltips['cv'],
'placement' => 'bottom',
'type' => 'white',
'className' => 'text-dark border border-light leading-5'
)
),
'help'
),
':'
),
span
(
setClass('font-bold text-black mr-1'),
(!empty($project->cv) ? $project->cv : 0) . $lang->percent
),
),
item
(
set::name($lang->block->projectstatistic->ev),
to::suffixName
(
icon
(
setClass('text-light text-sm'),
toggle::tooltip
(
array
(
'content' => array('html' => $lang->block->tooltips['ev']),
'placement' => 'bottom',
'type' => 'white',
'className' => 'text-dark border border-light leading-5'
)
),
'help'
),
':'
),
span
(
setClass('font-bold text-black mr-1'),
(!empty($project->ev) ? $project->ev : 0) . $lang->percent
)
),
item
(
set::name($lang->block->projectstatistic->ac),
to::suffixName
(
icon
(
setClass('text-light text-sm'),
toggle::tooltip
(
array
(
'title' => $lang->block->tooltips['ac'],
'placement' => 'bottom',
'type' => 'white',
'className' => 'text-dark border border-light leading-5'
)
),
'help'
),
':'
),
span
(
setClass('font-bold text-black mr-1'),
(!empty($project->ac) ? $project->ac : 0) . $lang->percent
)
)
)
);
);
}
}
statisticBlock
@@ -418,7 +418,7 @@ statisticBlock
set::moreLink(createLink('project', 'browse', 'programID=0&browseType=' . zget($block->params, 'type', ''))),
set::items($items),
set::className('projectstatistic-block'),
div
$project ? div
(
div
(
@@ -431,5 +431,5 @@ statisticBlock
setClass('flex' . (!$longBlock ? ' flex-wrap' : '')),
$cells
)
)
) : null
);
+2 -2
View File
@@ -151,7 +151,7 @@ statisticBlock
set::block($block),
set::active($active),
set::items($items),
div
$product ? div
(
setClass($longBlock ? 'row' : 'col gap-3', 'h-full overflow-hidden items-stretch px-2 py-3'),
center
@@ -213,5 +213,5 @@ statisticBlock
),
$testTasksView
)
)
) : null
);