Fix: Bad calculation of total
Fix: Warning message not translated
This commit is contained in:
parent
f0ebd7721d
commit
015b0d8036
1
htdocs/.gitignore
vendored
1
htdocs/.gitignore
vendored
@ -2,6 +2,7 @@
|
|||||||
/custom*
|
/custom*
|
||||||
/extensions*
|
/extensions*
|
||||||
/nltechno*
|
/nltechno*
|
||||||
|
/teclib*
|
||||||
/bootstrap*
|
/bootstrap*
|
||||||
/google*
|
/google*
|
||||||
/multicompany*
|
/multicompany*
|
||||||
|
|||||||
@ -228,7 +228,14 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
|
|||||||
|
|
||||||
$numlines=count($lines);
|
$numlines=count($lines);
|
||||||
|
|
||||||
$total=0;
|
// We declare counter as global because we want to edit them into recursive call
|
||||||
|
global $total_projectlinesa_spent,$total_projectlinesa_planned,$total_projectlinesa_spent_if_planned;
|
||||||
|
if ($level == 0)
|
||||||
|
{
|
||||||
|
$total_projectlinesa_spent=0;
|
||||||
|
$total_projectlinesa_planned=0;
|
||||||
|
$total_projectlinesa_spent_if_planned=0;
|
||||||
|
}
|
||||||
|
|
||||||
for ($i = 0 ; $i < $numlines ; $i++)
|
for ($i = 0 ; $i < $numlines ; $i++)
|
||||||
{
|
{
|
||||||
@ -293,8 +300,8 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
|
|||||||
|
|
||||||
if ($showproject)
|
if ($showproject)
|
||||||
{
|
{
|
||||||
|
// Project ref
|
||||||
print "<td>";
|
print "<td>";
|
||||||
//var_dump($taskrole);
|
|
||||||
if ($showlineingray) print '<i>';
|
if ($showlineingray) print '<i>';
|
||||||
$projectstatic->id=$lines[$i]->fk_project;
|
$projectstatic->id=$lines[$i]->fk_project;
|
||||||
$projectstatic->ref=$lines[$i]->projectref;
|
$projectstatic->ref=$lines[$i]->projectref;
|
||||||
@ -390,7 +397,9 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
|
|||||||
$level++;
|
$level++;
|
||||||
if ($lines[$i]->id) projectLinesa($inc, $lines[$i]->id, $lines, $level, $var, $showproject, $taskrole, $projectsListId, $addordertick);
|
if ($lines[$i]->id) projectLinesa($inc, $lines[$i]->id, $lines, $level, $var, $showproject, $taskrole, $projectsListId, $addordertick);
|
||||||
$level--;
|
$level--;
|
||||||
$total += $lines[$i]->duration;
|
$total_projectlinesa_spent += $lines[$i]->duration;
|
||||||
|
$total_projectlinesa_planned += $lines[$i]->planned_workload;
|
||||||
|
if ($lines[$i]->planned_workload) $total_projectlinesa_spent_if_planned += $lines[$i]->duration;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -399,7 +408,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($total>0 && $level==0)
|
if (($total_projectlinesa_planned > 0 || $total_projectlinesa_spent > 0) && $level==0)
|
||||||
{
|
{
|
||||||
print '<tr class="liste_total">';
|
print '<tr class="liste_total">';
|
||||||
print '<td class="liste_total">'.$langs->trans("Total").'</td>';
|
print '<td class="liste_total">'.$langs->trans("Total").'</td>';
|
||||||
@ -407,10 +416,16 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
|
|||||||
print '<td></td>';
|
print '<td></td>';
|
||||||
print '<td></td>';
|
print '<td></td>';
|
||||||
print '<td></td>';
|
print '<td></td>';
|
||||||
|
print '<td align="center" class="nowrap liste_total">';
|
||||||
|
print convertSecondToTime($total_projectlinesa_planned, 'allhourmin');
|
||||||
|
print '</td>';
|
||||||
print '<td></td>';
|
print '<td></td>';
|
||||||
print '<td></td>';
|
print '<td align="right" class="nowrap liste_total">';
|
||||||
print '<td align="right" class="nowrap liste_total">'.convertSecondToTime($total, 'allhourmin').'</td>';
|
print convertSecondToTime($total_projectlinesa_spent, 'allhourmin');
|
||||||
print '<td></td>';
|
print '</td>';
|
||||||
|
print '<td align="right" class="nowrap liste_total">';
|
||||||
|
if ($total_projectlinesa_planned) print round(100 * $total_projectlinesa_spent_if_planned / $total_projectlinesa_planned,2).' %';
|
||||||
|
print '</td>';
|
||||||
if ($addordertick) print '<td class="hideonsmartphone"></td>';
|
if ($addordertick) print '<td class="hideonsmartphone"></td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
@ -459,7 +474,7 @@ function projectLinesb(&$inc, $parent, $lines, &$level, &$projectsrole, &$tasksr
|
|||||||
if (empty($mine) || ! empty($tasksrole[$lines[$i]->id]))
|
if (empty($mine) || ! empty($tasksrole[$lines[$i]->id]))
|
||||||
{
|
{
|
||||||
print "<tr ".$bc[$var].">\n";
|
print "<tr ".$bc[$var].">\n";
|
||||||
|
|
||||||
// Project
|
// Project
|
||||||
print "<td>";
|
print "<td>";
|
||||||
$projectstatic->id=$lines[$i]->fk_project;
|
$projectstatic->id=$lines[$i]->fk_project;
|
||||||
@ -468,14 +483,14 @@ function projectLinesb(&$inc, $parent, $lines, &$level, &$projectsrole, &$tasksr
|
|||||||
$projectstatic->label=$langs->transnoentitiesnoconv("YourRole").': '.$projectsrole[$lines[$i]->fk_project];
|
$projectstatic->label=$langs->transnoentitiesnoconv("YourRole").': '.$projectsrole[$lines[$i]->fk_project];
|
||||||
print $projectstatic->getNomUrl(1);
|
print $projectstatic->getNomUrl(1);
|
||||||
print "</td>";
|
print "</td>";
|
||||||
|
|
||||||
// Ref
|
// Ref
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$taskstatic->id=$lines[$i]->id;
|
$taskstatic->id=$lines[$i]->id;
|
||||||
$taskstatic->ref=$lines[$i]->id;
|
$taskstatic->ref=$lines[$i]->id;
|
||||||
print $taskstatic->getNomUrl(1);
|
print $taskstatic->getNomUrl(1);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Label task
|
// Label task
|
||||||
print "<td>";
|
print "<td>";
|
||||||
for ($k = 0 ; $k < $level ; $k++)
|
for ($k = 0 ; $k < $level ; $k++)
|
||||||
@ -486,28 +501,28 @@ function projectLinesb(&$inc, $parent, $lines, &$level, &$projectsrole, &$tasksr
|
|||||||
$taskstatic->ref=$lines[$i]->label;
|
$taskstatic->ref=$lines[$i]->label;
|
||||||
print $taskstatic->getNomUrl(0);
|
print $taskstatic->getNomUrl(0);
|
||||||
print "</td>\n";
|
print "</td>\n";
|
||||||
|
|
||||||
// Date start
|
// Date start
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
print dol_print_date($lines[$i]->date_start,'dayhour');
|
print dol_print_date($lines[$i]->date_start,'dayhour');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Date end
|
// Date end
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
print dol_print_date($lines[$i]->date_end,'dayhour');
|
print dol_print_date($lines[$i]->date_end,'dayhour');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Planned Workload
|
// Planned Workload
|
||||||
print '<td align="right">';
|
print '<td align="right">';
|
||||||
if ($lines[$i]->planned_workload) print convertSecondToTime($lines[$i]->planned_workload,'allhourmin');
|
if ($lines[$i]->planned_workload) print convertSecondToTime($lines[$i]->planned_workload,'allhourmin');
|
||||||
else print '--:--';
|
else print '--:--';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Progress declared %
|
// Progress declared %
|
||||||
print '<td align="right">';
|
print '<td align="right">';
|
||||||
print $lines[$i]->progress.' %';
|
print $lines[$i]->progress.' %';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Time spent
|
// Time spent
|
||||||
print '<td align="right">';
|
print '<td align="right">';
|
||||||
if ($lines[$i]->duration)
|
if ($lines[$i]->duration)
|
||||||
@ -518,7 +533,7 @@ function projectLinesb(&$inc, $parent, $lines, &$level, &$projectsrole, &$tasksr
|
|||||||
}
|
}
|
||||||
else print '--:--';
|
else print '--:--';
|
||||||
print "</td>\n";
|
print "</td>\n";
|
||||||
|
|
||||||
$disabledproject=1;$disabledtask=1;
|
$disabledproject=1;$disabledtask=1;
|
||||||
//print "x".$lines[$i]->fk_project;
|
//print "x".$lines[$i]->fk_project;
|
||||||
//var_dump($lines[$i]);
|
//var_dump($lines[$i]);
|
||||||
@ -534,7 +549,7 @@ function projectLinesb(&$inc, $parent, $lines, &$level, &$projectsrole, &$tasksr
|
|||||||
{
|
{
|
||||||
$disabledtask=1;
|
$disabledtask=1;
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<td class="nowrap">';
|
print '<td class="nowrap">';
|
||||||
$s =$form->select_date('',$lines[$i]->id,'','','',"addtime",1,0,1,$disabledtask);
|
$s =$form->select_date('',$lines[$i]->id,'','','',"addtime",1,0,1,$disabledtask);
|
||||||
$s.=' ';
|
$s.=' ';
|
||||||
@ -546,7 +561,7 @@ function projectLinesb(&$inc, $parent, $lines, &$level, &$projectsrole, &$tasksr
|
|||||||
if ((! $lines[$i]->public) && $disabledproject) print $form->textwithpicto('',$langs->trans("YouAreNotContactOfProject"));
|
if ((! $lines[$i]->public) && $disabledproject) print $form->textwithpicto('',$langs->trans("YouAreNotContactOfProject"));
|
||||||
else if ($disabledtask) print $form->textwithpicto('',$langs->trans("TaskIsNotAffectedToYou"));
|
else if ($disabledtask) print $form->textwithpicto('',$langs->trans("TaskIsNotAffectedToYou"));
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -146,3 +146,5 @@ WarningCloseAlways=Warning, closing is done even if amount differs between sourc
|
|||||||
WarningUsingThisBoxSlowDown=Warning, using this box slow down seriously all pages showing the box.
|
WarningUsingThisBoxSlowDown=Warning, using this box slow down seriously all pages showing the box.
|
||||||
WarningClickToDialUserSetupNotComplete=Setup of ClickToDial information for your user are not complete (see tab ClickToDial onto your user card).
|
WarningClickToDialUserSetupNotComplete=Setup of ClickToDial information for your user are not complete (see tab ClickToDial onto your user card).
|
||||||
WarningNotRelevant=Irrelevant operation for this dataset
|
WarningNotRelevant=Irrelevant operation for this dataset
|
||||||
|
WarningTooManyDataPleaseUseMoreFilters=Too many data. Please use more filters
|
||||||
|
|
||||||
|
|||||||
@ -164,9 +164,10 @@ if ( $resql )
|
|||||||
|
|
||||||
if ($num > (empty($conf->global->PROJECT_LIMIT_TASK_PROJECT_AREA)?1000:$conf->global->PROJECT_LIMIT_TASK_PROJECT_AREA))
|
if ($num > (empty($conf->global->PROJECT_LIMIT_TASK_PROJECT_AREA)?1000:$conf->global->PROJECT_LIMIT_TASK_PROJECT_AREA))
|
||||||
{
|
{
|
||||||
/* print '<tr '.$bc[0].'>';
|
/* $langs->load("errors");
|
||||||
|
print '<tr '.$bc[0].'>';
|
||||||
print '<td colspan="9">';
|
print '<td colspan="9">';
|
||||||
print $langs->trans("TooManyDataPleaseUseMoreFilters");
|
print $langs->trans("WarningTooManyDataPleaseUseMoreFilters");
|
||||||
print '</td></tr>';*/
|
print '</td></tr>';*/
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@ -121,9 +121,10 @@ print "</tr>\n";
|
|||||||
|
|
||||||
if (count($tasksarray) > (empty($conf->global->PROJECT_LIMIT_TASK_PROJECT_AREA)?1000:$conf->global->PROJECT_LIMIT_TASK_PROJECT_AREA))
|
if (count($tasksarray) > (empty($conf->global->PROJECT_LIMIT_TASK_PROJECT_AREA)?1000:$conf->global->PROJECT_LIMIT_TASK_PROJECT_AREA))
|
||||||
{
|
{
|
||||||
|
$langs->load("errors");
|
||||||
print '<tr '.$bc[0].'>';
|
print '<tr '.$bc[0].'>';
|
||||||
print '<td colspan="9">';
|
print '<td colspan="9">';
|
||||||
print $langs->trans("TooManyDataPleaseUseMoreFilters");
|
print $langs->trans("WarningTooManyDataPleaseUseMoreFilters");
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user