Skip to content
Snippets Groups Projects
Commit 02439bed authored by Juanjo Menent's avatar Juanjo Menent Committed by GitHub
Browse files

Merge pull request #5458 from hregis/3.8_bug

Fix: wrong multicompany filter
parents 148f2e4c 4503659c
No related branches found
No related tags found
No related merge requests found
...@@ -372,14 +372,13 @@ function activitytrim($product_type) ...@@ -372,14 +372,13 @@ function activitytrim($product_type)
// breakdown by quarter // breakdown by quarter
$sql = "SELECT DATE_FORMAT(p.datep,'%Y') as annee, DATE_FORMAT(p.datep,'%m') as mois, SUM(fd.total_ht) as Mnttot"; $sql = "SELECT DATE_FORMAT(p.datep,'%Y') as annee, DATE_FORMAT(p.datep,'%m') as mois, SUM(fd.total_ht) as Mnttot";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."facturedet as fd"; $sql.= " FROM ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."facturedet as fd";
$sql.= " , ".MAIN_DB_PREFIX."paiement as p,".MAIN_DB_PREFIX."paiement_facture as pf"; $sql.= " , ".MAIN_DB_PREFIX."paiement as p,".MAIN_DB_PREFIX."paiement_facture as pf";
$sql.= " WHERE f.fk_soc = s.rowid"; $sql.= " WHERE f.entity = " . $conf->entity;
$sql.= " AND f.rowid = fd.fk_facture"; $sql.= " AND f.rowid = fd.fk_facture";
$sql.= " AND pf.fk_facture = f.rowid"; $sql.= " AND pf.fk_facture = f.rowid";
$sql.= " AND pf.fk_paiement= p.rowid"; $sql.= " AND pf.fk_paiement= p.rowid";
$sql.= " AND fd.product_type=".$product_type; $sql.= " AND fd.product_type=".$product_type;
$sql.= " AND s.entity IN (".getEntity('societe', 1).")";
$sql.= " AND p.datep >= '".$db->idate(dol_get_first_day($yearofbegindate),1)."'"; $sql.= " AND p.datep >= '".$db->idate(dol_get_first_day($yearofbegindate),1)."'";
$sql.= " GROUP BY annee, mois "; $sql.= " GROUP BY annee, mois ";
$sql.= " ORDER BY annee, mois "; $sql.= " ORDER BY annee, mois ";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment