Skip to content

Commit

Permalink
#36 [TimeSpent] add: improve show total line
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-eoxia committed Nov 3, 2022
1 parent b316477 commit 971f518
Showing 1 changed file with 24 additions and 3 deletions.
27 changes: 24 additions & 3 deletions view/timespent_list.php
Original file line number Diff line number Diff line change
Expand Up @@ -571,8 +571,11 @@
if ($key == 'thm') {
$totalarray['val'][$key] += $value;
} else {
$totalarray['val'][$key] += $obj->{$key};
}
$totalarray['val'][$key] += $obj->{$key};
}
if (!$i) {
$totalarray['total'.$key] = $totalarray['nbfield'];
}
}
}
}
Expand Down Expand Up @@ -601,7 +604,25 @@
}

// Show total line
include DOL_DOCUMENT_ROOT . '/core/tpl/list_print_total.tpl.php';
print '<tr class="liste_total">';
$i = 0;
while ($i < $totalarray['nbfield']) {
$i++;
if ($i == 1) {
if ($num < $limit && empty($offset)) {
print '<td class="left">'.$langs->trans("Total").'</td>';
} else {
print '<td class="left">'.$langs->trans("Totalforthispage").'</td>';
}
} elseif ($totalarray['totaltask_duration'] == $i) {
print '<td class="left">'.convertSecondToTime($totalarray['val']['task_duration'], 'allhourmin').'</td>';
} elseif ($totalarray['totalthm'] == $i) {
print '<td class="right">'.price($totalarray['val']['thm']).'</td>';
} else {
print '<td></td>';
}
}
print '</tr>';

// If no record found
if ($num == 0) {
Expand Down

0 comments on commit 971f518

Please sign in to comment.