Unverified Commit 7a584f01 authored by Xacobo Freire's avatar Xacobo Freire Committed by GitHub
Browse files

Fix sql total duration (#8551)

* Fix sql total duration

* Use SUM function

closes #8550
parent 8db3b86c
......@@ -6710,15 +6710,14 @@ abstract class CommonITILObject extends CommonDBTM {
$total_actiontime = 0;
$criteria = [
'SELECT' => 'actiontime',
'DISTINCT' => true,
'SELECT' => ['SUM' => 'actiontime AS actiontime'],
'FROM' => $task_table,
'WHERE' => [$foreignKey => $this->fields['id']]
];
$iterator = $DB->request($criteria);
foreach ($iterator as $req) {
$total_actiontime += $req['actiontime'];
$req = $DB->request($criteria);
if ($row = $req->next()) {
$total_actiontime = $row['actiontime'];
}
if ($total_actiontime > 0) {
echo "<h3>";
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment