diff --git a/htdocs/societe/index.php b/htdocs/societe/index.php index c948127312d..98f5508a105 100644 --- a/htdocs/societe/index.php +++ b/htdocs/societe/index.php @@ -84,7 +84,8 @@ if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREF $sql.= ' WHERE s.entity IN ('.getEntity('societe', 1).')'; if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if ($socid) $sql.= " AND s.rowid = ".$socid; - +if (! $user->rights->fournisseur->lire) $sql.=" AND (s.fournisseur <> 1 OR s.client <> 0)"; // client=0, fournisseur=0 must be visible +//print $sql; $result = $db->query($sql); if ($result) { @@ -94,7 +95,7 @@ if ($result) if ($conf->societe->enabled && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS_STATS) && ($objp->client == 1 || $objp->client == 3)) { $found=1; $third['customer']++; } if ($conf->societe->enabled && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS) && ($objp->client == 2 || $objp->client == 3)) { $found=1; $third['prospect']++; } if ($conf->fournisseur->enabled && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_STATS) && $objp->fournisseur) { $found=1; $third['supplier']++; } - + if ($conf->societe->enabled && $objp->client == 0 && $objp->fournisseur == 0) { $found=1; $third['other']++; } if ($found) $total++; } } @@ -102,13 +103,14 @@ else dol_print_error($db); print '
| '.$langs->trans("Statistics").' | |
|---|---|
| '; $dataseries=array(); - if ($conf->societe->enabled && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS)) $dataseries[]=array('label'=>$langs->trans("Prospects"),'data'=>round($third['prospect'])); - if ($conf->societe->enabled && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS_STATS)) $dataseries[]=array('label'=>$langs->trans("Customers"),'data'=>round($third['customer'])); + if ($conf->societe->enabled && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS)) $dataseries[]=array('label'=>$langs->trans("Prospects"),'data'=>round($third['prospect'])); + if ($conf->societe->enabled && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS_STATS)) $dataseries[]=array('label'=>$langs->trans("Customers"),'data'=>round($third['customer'])); if ($conf->fournisseur->enabled && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_STATS)) $dataseries[]=array('label'=>$langs->trans("Suppliers"),'data'=>round($third['supplier'])); + if ($conf->societe->enabled) $dataseries[]=array('label'=>$langs->trans("Others"),'data'=>round($third['other'])); $data=array('series'=>$dataseries); dol_print_graph('stats',300,180,$data,1,'pie',0); print ' | |