diff --git a/htdocs/fichinter/index.php b/htdocs/fichinter/index.php index 0f0fc0acc99..5e62cc5b0e4 100644 --- a/htdocs/fichinter/index.php +++ b/htdocs/fichinter/index.php @@ -89,7 +89,6 @@ $sql .= " GROUP BY f.fk_statut"; $resql = $db->query($sql); if ($resql) { $num = $db->num_rows($resql); - $i = 0; $total = 0; $totalinprocess = 0; @@ -97,38 +96,28 @@ if ($resql) { $vals = array(); $bool = false; // -1=Canceled, 0=Draft, 1=Validated, 2=Accepted/On process, 3=Closed (Sent/Received, billed or not) - while ($i < $num) { - $row = $db->fetch_row($resql); - if ($row) { - //if ($row[1]!=-1 && ($row[1]!=3 || $row[2]!=1)) - { - $bool = (!empty($row[2]) ?true:false); - if (!isset($vals[$row[1].$bool])) { - $vals[$row[1].$bool] = 0; - } - $vals[$row[1].$bool] += $row[0]; - $totalinprocess += $row[0]; + if ($num>0) { + while ($row = $db->fetch_row($resql)) { + if (!isset($vals[$row[1]])) { + $vals[$row[1]] = 0; } + $vals[$row[1]] += $row[0]; + $totalinprocess += $row[0]; + $total += $row[0]; } - $i++; } $db->free($resql); - include DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php'; print '
| '.$langs->trans("Statistics").' - '.$langs->trans("Interventions").' | ||
|---|---|---|
| '; @@ -159,21 +146,15 @@ if ($resql) { print ' | ||
| '.$fichinterstatic->LibStatut($status, $bool, 0).' | '; - print ''.(isset($vals[$status.$bool]) ? $vals[$status.$bool] : 0).' '; - print $fichinterstatic->LibStatut($status, $bool, 3); + print ' | '.(isset($vals[$status]) ? $vals[$status] : 0).' '; + print $fichinterstatic->LibStatut($status, 3); print ''; print ' | '; print "