Qual: Uniformize code.

This commit is contained in:
Laurent Destailleur 2008-09-08 13:32:38 +00:00
parent e461753e43
commit b49d7f5390
2 changed files with 6 additions and 6 deletions

View File

@ -64,12 +64,12 @@ $data = $stats->getNbByMonthWithPrevYear($endyear,$startyear);
if (!$user->rights->societe->client->voir || $user->societe_id) 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'; $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstats&file=proposalsnbinyear-'.$user->id.'-'.$year.'.png';
} }
else 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'; $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) 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'; $fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstats&file=proposalsamountinyear-'.$user->id.'-'.$year.'.png';
} }
else 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'; $fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstats&file=proposalsamountinyear-'.$year.'.png';
} }

View File

@ -114,7 +114,7 @@ class PropaleStats extends Stats
{ {
global $user; 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"; 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"; $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"; 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; 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"; 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"; $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"; if (!$user->rights->societe->client->voir && !$this->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";