Skip to content

Commit

Permalink
Merge pull request #2846 from fappels/3.6
Browse files Browse the repository at this point in the history
Fix: SQL error in facturestats on no view rights
  • Loading branch information
eldy committed May 20, 2015
2 parents a4df49f + 40ef573 commit 439b416
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion htdocs/compta/facture/class/facturestats.class.php
Expand Up @@ -206,7 +206,7 @@ function getAllByProduct($year)

$sql = "SELECT product.ref, COUNT(product.ref) as nb, SUM(tl.".$this->field_line.") as total, AVG(tl.".$this->field_line.") as avg";
$sql.= " FROM ".$this->from.", ".$this->from_line.", ".MAIN_DB_PREFIX."product as product";
//if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
if (!$user->rights->societe->client->voir && !$this->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE ".$this->where;
$sql.= " AND f.rowid = tl.fk_facture AND tl.fk_product = product.rowid";
$sql.= " AND f.datef BETWEEN '".$this->db->idate(dol_get_first_day($year,1,false))."' AND '".$this->db->idate(dol_get_last_day($year,12,false))."'";
Expand Down

0 comments on commit 439b416

Please sign in to comment.