From 489be5ef26a064f50613b6daee64d8f56bce4ae6 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 26 May 2006 15:40:39 +0000 Subject: [PATCH] =?UTF-8?q?Ajout=20de=20restriction=20pour=20les=20commerc?= =?UTF-8?q?iaux=20et=20les=20acc=E8s=20soci=E9t=E9s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/commande/stats/index.php | 13 +++++++++--- htdocs/commande/stats/month.php | 36 +++++++++++++++++++++++++++------ 2 files changed, 40 insertions(+), 9 deletions(-) diff --git a/htdocs/commande/stats/index.php b/htdocs/commande/stats/index.php index e433ef02156..800e53902b4 100644 --- a/htdocs/commande/stats/index.php +++ b/htdocs/commande/stats/index.php @@ -64,9 +64,16 @@ if (! file_exists($dir)) } } - -$filename = $conf->commande->dir_images."/nbcommande2year-".$year.".png"; -$fileurl = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=nbcommande2year-'.$year.'.png'; +if (!$user->rights->commercial->client->voir || $user->societe_id) +{ + $filename = $conf->commande->dir_images.'/nbcommande2year-'.$user->id.'-'.$year.'.png'; + $fileurl = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=nbcommande2year-'.$user->id.'-'.$year.'.png'; +} +else +{ + $filename = $conf->commande->dir_images.'/nbcommande2year-'.$year.'.png'; + $fileurl = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=nbcommande2year-'.$year.'.png'; +} $px = new BarGraph(); $mesg = $px->isGraphKo(); diff --git a/htdocs/commande/stats/month.php b/htdocs/commande/stats/month.php index 254fce1dc2d..ecb9e3b9f45 100644 --- a/htdocs/commande/stats/month.php +++ b/htdocs/commande/stats/month.php @@ -64,8 +64,16 @@ $data = $stats->getNbByMonth($year); if (! is_dir($conf->commande->dir_images)) { mkdir($conf->commande->dir_images); } -$filename = $conf->commande->dir_images."/commande".$year.".png"; -$fileurl = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=commande'.$year.'.png'; +if (!$user->rights->commercial->client->voir || $user->societe_id) +{ + $filename = $conf->commande->dir_images.'/commande-'.$user->id.'-'.$year.'.png'; + $fileurl = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=commande-'.$user->id.'-'.$year.'.png'; +} +else +{ + $filename = $conf->commande->dir_images.'/commande'.$year.'.png'; + $fileurl = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=commande'.$year.'.png'; +} $px = new BarGraph(); $mesg = $px->isGraphKo(); @@ -87,8 +95,16 @@ for ($i = 1 ; $i < 13 ; $i++) $data[$i-1] = array(ucfirst(substr(strftime("%b",mktime(12,12,12,$i,1,$year)),0,3)), $res[$i]); } -$filename_amount = $conf->commande->dir_images."/commandeamount".$year.".png"; -$fileurl_amount = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=commandeamount'.$year.'.png'; +if (!$user->rights->commercial->client->voir || $user->societe_id) +{ + $filename_amount = $conf->commande->dir_images.'/commandeamount-'.$user->id.'-'.$year.'.png'; + $fileurl_amount = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=commandeamount-'.$user->id.'-'.$year.'.png'; +} +else +{ + $filename_amount = $conf->commande->dir_images.'/commandeamount'.$year.'.png'; + $fileurl_amount = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=commandeamount'.$year.'.png'; +} $px = new BarGraph(); $mesg = $px->isGraphKo(); @@ -109,8 +125,16 @@ for ($i = 1 ; $i < 13 ; $i++) $data[$i-1] = array(ucfirst(substr(strftime("%b",mktime(12,12,12,$i,1,$year)),0,3)), $res[$i]); } -$filename_avg = $conf->commande->dir_images."/commandeaverage".$year.".png"; -$fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=commandeaverage'.$year.'.png'; +if (!$user->rights->commercial->client->voir || $user->societe_id) +{ + $filename_avg = $conf->commande->dir_images.'/commandeaverage-'.$user->id.'-'.$year.'.png'; + $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=commandeaverage-'.$user->id.'-'.$year.'.png'; +} +else +{ + $filename_avg = $conf->commande->dir_images.'/commandeaverage'.$year.'.png'; + $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=commandeaverage'.$year.'.png'; +} $px = new BarGraph(); $mesg = $px->isGraphKo();