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 { ...@@ -6710,15 +6710,14 @@ abstract class CommonITILObject extends CommonDBTM {
$total_actiontime = 0; $total_actiontime = 0;
$criteria = [ $criteria = [
'SELECT' => 'actiontime', 'SELECT' => ['SUM' => 'actiontime AS actiontime'],
'DISTINCT' => true,
'FROM' => $task_table, 'FROM' => $task_table,
'WHERE' => [$foreignKey => $this->fields['id']] 'WHERE' => [$foreignKey => $this->fields['id']]
]; ];
$iterator = $DB->request($criteria); $req = $DB->request($criteria);
foreach ($iterator as $req) { if ($row = $req->next()) {
$total_actiontime += $req['actiontime']; $total_actiontime = $row['actiontime'];
} }
if ($total_actiontime > 0) { if ($total_actiontime > 0) {
echo "<h3>"; 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