diff --git a/htdocs/compta/facture/stats/index.php b/htdocs/compta/facture/stats/index.php index 8d87f388855..f7e3d08bcfc 100644 --- a/htdocs/compta/facture/stats/index.php +++ b/htdocs/compta/facture/stats/index.php @@ -37,7 +37,7 @@ llxHeader(); print_fiche_titre('Statistiques factures', $mesg); -$stats = new FactureStats($db); +$stats = new FactureStats($db, $socidp); $year = strftime("%Y", time()); $data = $stats->getNbByMonthWithPrevYear($year); $filev = "/document/images/nbfacture2year-$year.png"; @@ -50,12 +50,12 @@ $px->SetHeight(280); $px->draw(DOL_DOCUMENT_ROOT.$filev, $data, $year); -$sql = "SELECT count(*), date_format(datef,'%Y') as dm, sum(total) FROM llx_facture WHERE fk_statut > 0 GROUP BY dm DESC "; +$sql = "SELECT count(*), date_format(datef,'%Y') as dm, sum(total) FROM llx_facture WHERE fk_statut > 0 "; if ($socidp) { $sql .= " AND fk_soc = $socidp"; } - +$sql .= " GROUP BY dm DESC "; if ($db->query($sql)) { $num = $db->num_rows(); diff --git a/htdocs/compta/facture/stats/month.php b/htdocs/compta/facture/stats/month.php index 077b276ba38..0c2eb0d6141 100644 --- a/htdocs/compta/facture/stats/month.php +++ b/htdocs/compta/facture/stats/month.php @@ -21,6 +21,14 @@ */ require("./pre.inc.php"); +/* + * Sécurité accés client + */ +if ($user->societe_id > 0) +{ + $action = ''; + $socidp = $user->societe_id; +} llxHeader(); $year = $_GET["year"]; @@ -35,7 +43,7 @@ print ''.($year + 1).''; * * */ -$stats = new FactureStats($db); +$stats = new FactureStats($db, $socidp); $dir = DOL_DOCUMENT_ROOT;