Fix: Bad calculation of total

Fix: Warning message not translated
This commit is contained in:
Laurent Destailleur 2014-09-18 10:05:37 +02:00
parent f0ebd7721d
commit 015b0d8036
5 changed files with 41 additions and 21 deletions

1
htdocs/.gitignore vendored
View File

@ -2,6 +2,7 @@
/custom* /custom*
/extensions* /extensions*
/nltechno* /nltechno*
/teclib*
/bootstrap* /bootstrap*
/google* /google*
/multicompany* /multicompany*

View File

@ -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>';
} }

View File

@ -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

View File

@ -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

View File

@ -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