diff --git a/htdocs/telephonie/script/graph-statistiques-ca.php b/htdocs/telephonie/script/graph-statistiques-ca.php index 083887aa00d..0037cc3a2dc 100644 --- a/htdocs/telephonie/script/graph-statistiques-ca.php +++ b/htdocs/telephonie/script/graph-statistiques-ca.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2004-2006 Rodolphe Quiedeville * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -24,6 +24,11 @@ require ("../../master.inc.php"); $verbose = 0; + +$datetime = time(); +$date = strftime("%d%h%Y%Hh%Mm%S",$datetime); +$year = strftime("%Y", $datetime); + for ($i = 1 ; $i < sizeof($argv) ; $i++) { if ($argv[$i] == "-v") @@ -38,6 +43,10 @@ for ($i = 1 ; $i < sizeof($argv) ; $i++) { $verbose = 3; } + if ($argv[$i] == "-y") + { + $year = $argv[$i+1]; + } } require_once (DOL_DOCUMENT_ROOT."/telephonie/lignetel.class.php"); @@ -59,10 +68,6 @@ require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/comm.nbmensuel.class.ph $error = 0; -$datetime = time(); -$date = strftime("%d%h%Y%Hh%Mm%S",$datetime); -$year = strftime("%Y", $datetime); - $img_root = DOL_DATA_ROOT."/graph/telephonie"; $month = array(); @@ -88,7 +93,7 @@ $month[12] = 'D'; $sql = "DELETE FROM ".MAIN_DB_PREFIX."telephonie_stats"; $sql .= " WHERE graph IN ('factures.facture_moyenne','factures.ca_mensuel','factures.nb_mensuel')"; -$sql .= " AND legend like '".$this->year."%';"; +$sql .= " AND legend like '".$year."%';"; $resql = $db->query($sql); $sql = "SELECT date_format(tf.date,'%Y%m'), sum(tf.cout_vente)";