From 7fc5fe050533f14220ff5bb1d7b6207e6eac770d Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Mon, 18 Dec 2006 13:37:29 +0000 Subject: [PATCH] Bugfix sur le calcul --- scripts/cron/stock-graph.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/scripts/cron/stock-graph.php b/scripts/cron/stock-graph.php index 050a9b6b49c..e70e2735476 100644 --- a/scripts/cron/stock-graph.php +++ b/scripts/cron/stock-graph.php @@ -78,6 +78,7 @@ else */ $now = time(); $year = strftime('%Y',$now); +$day = strftime('%j', $now); for ($i = 0 ; $i < strftime('%j',$now) ; $i++) { foreach ($entrepots as $key => $ent) @@ -103,9 +104,9 @@ if ($resql) $i = 0; while ($row = $db->fetch_row($resql)) { + $max_day = $row[0]; $values[$row[2]][$row[0]] = $row[1]; $values[0][$row[0]] += $row[1]; - $i++; } $db->free($resql); @@ -115,6 +116,17 @@ else print $sql; } +for ($i = $max_day + 1 ; $i < ($day + 1) ; $i++) +{ + foreach ($entrepots as $key => $ent) + { + $values[$key][$i] = $values[$key][$max_day]; + } + $values[0][$i] = $values[0][$max_day]; +} + + + require_once DOL_DOCUMENT_ROOT."/../external-libs/Artichow/LinePlot.class.php"; foreach ($entrepots as $key => $ent)