From b49d7f5390ca070311123ce27b67bedaa949b88d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 8 Sep 2008 13:32:38 +0000 Subject: [PATCH] Qual: Uniformize code. --- htdocs/comm/propal/stats/index.php | 8 ++++---- htdocs/comm/propal/stats/propalestats.class.php | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/comm/propal/stats/index.php b/htdocs/comm/propal/stats/index.php index 239ecdc1125..9bec6d086a8 100644 --- a/htdocs/comm/propal/stats/index.php +++ b/htdocs/comm/propal/stats/index.php @@ -64,12 +64,12 @@ $data = $stats->getNbByMonthWithPrevYear($endyear,$startyear); if (!$user->rights->societe->client->voir || $user->societe_id) { - $filenamenb = $conf->propal->dir_temp.'/proposalsnbinyear-'.$user->id.'-'.$year.'.png'; + $filenamenb = $dir.'/proposalsnbinyear-'.$user->id.'-'.$year.'.png'; $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstats&file=proposalsnbinyear-'.$user->id.'-'.$year.'.png'; } else { - $filenamenb = $conf->propal->dir_temp.'/proposalsnbinyear-'.$year.'.png'; + $filenamenb = $dir.'/proposalsnbinyear-'.$year.'.png'; $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstats&file=proposalsnbinyear-'.$year.'.png'; } @@ -107,12 +107,12 @@ $data = $stats->getAmountByMonthWithPrevYear($endyear,$startyear); if (!$user->rights->societe->client->voir || $user->societe_id) { - $filenameamount = $conf->propal->dir_temp.'/proposalsamountinyear-'.$user->id.'-'.$year.'.png'; + $filenameamount = $dir.'/proposalsamountinyear-'.$user->id.'-'.$year.'.png'; $fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstats&file=proposalsamountinyear-'.$user->id.'-'.$year.'.png'; } else { - $filenameamount = $conf->propal->dir_temp.'/proposalsamountinyear-'.$year.'.png'; + $filenameamount = $dir.'/proposalsamountinyear-'.$year.'.png'; $fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstats&file=proposalsamountinyear-'.$year.'.png'; } diff --git a/htdocs/comm/propal/stats/propalestats.class.php b/htdocs/comm/propal/stats/propalestats.class.php index 0ab2f60ce31..885e570640a 100644 --- a/htdocs/comm/propal/stats/propalestats.class.php +++ b/htdocs/comm/propal/stats/propalestats.class.php @@ -114,7 +114,7 @@ class PropaleStats extends Stats { global $user; - $sql = "SELECT date_format(p.datep,'%m') as dm, sum(p.total_ht)"; + $sql = "SELECT date_format(p.datep,'%m') as dm, sum(p.".$this->field.")"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", sc.fk_soc, sc.fk_user"; $sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element." as p"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -132,7 +132,7 @@ class PropaleStats extends Stats { global $user; - $sql = "SELECT date_format(p.datep,'%m') as dm, avg(p.total_ht)"; + $sql = "SELECT date_format(p.datep,'%m') as dm, avg(p.".$this->field.")"; if (!$user->rights->societe->client->voir && !$this->socid) $sql .= ", sc.fk_soc, sc.fk_user"; $sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element." as p"; if (!$user->rights->societe->client->voir && !$this->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";