This commit is contained in:
Laurent Destailleur 2020-10-14 19:28:59 +02:00
parent a8eeb7099a
commit bc1ad96ad1
5 changed files with 10 additions and 9 deletions

View File

@ -79,7 +79,7 @@ class PropaleStats extends Stats
$this->field = 'total_ht'; $this->field = 'total_ht';
$this->field_line = 'total_ht'; $this->field_line = 'total_ht';
$this->where .= " p.fk_statut > 0"; //$this->where .= " p.fk_statut > 0";
} }
if ($mode == 'supplier') if ($mode == 'supplier')
{ {
@ -91,10 +91,10 @@ class PropaleStats extends Stats
$this->field = 'total_ht'; $this->field = 'total_ht';
$this->field_line = 'total_ht'; $this->field_line = 'total_ht';
$this->where .= " p.fk_statut > 0"; // Validated, accepted, refused and closed //$this->where .= " p.fk_statut > 0"; // Validated, accepted, refused and closed
} }
//$this->where.= " AND p.fk_soc = s.rowid AND p.entity = ".$conf->entity; //$this->where.= " AND p.fk_soc = s.rowid AND p.entity = ".$conf->entity;
$this->where .= " AND p.entity IN (".getEntity('propal').")"; $this->where .= ($this->where ? ' AND ' : '')."p.entity IN (".getEntity('propal').")";
if (!$user->rights->societe->client->voir && !$this->socid) $this->where .= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = ".$user->id; if (!$user->rights->societe->client->voir && !$this->socid) $this->where .= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = ".$user->id;
if ($this->socid) if ($this->socid)
{ {

View File

@ -86,7 +86,7 @@ if ($mode == 'customer')
if ($mode == 'supplier') if ($mode == 'supplier')
{ {
$picto = 'supplier_proposal'; $picto = 'supplier_proposal';
$title = $langs->trans("ProposalsStatisticsSuppliers").' ('.$langs->trans("SentToSuppliers").")"; $title = $langs->trans("ProposalsStatisticsSuppliers");
$dir = $conf->supplier_proposal->dir_temp; $dir = $conf->supplier_proposal->dir_temp;
$cat_type = Categorie::TYPE_SUPPLIER; $cat_type = Categorie::TYPE_SUPPLIER;
$cat_label = $langs->trans("Category").' '.lcfirst($langs->trans("Supplier")); $cat_label = $langs->trans("Category").' '.lcfirst($langs->trans("Supplier"));

View File

@ -77,7 +77,7 @@ class CommandeStats extends Stats
$this->from_line = MAIN_DB_PREFIX.$object->table_element_line." as tl"; $this->from_line = MAIN_DB_PREFIX.$object->table_element_line." as tl";
$this->field = 'total_ht'; $this->field = 'total_ht';
$this->field_line = 'total_ht'; $this->field_line = 'total_ht';
$this->where .= " c.fk_statut > 0"; // Not draft and not cancelled //$this->where .= " c.fk_statut > 0"; // Not draft and not cancelled
} elseif ($mode == 'supplier') } elseif ($mode == 'supplier')
{ {
$object = new CommandeFournisseur($this->db); $object = new CommandeFournisseur($this->db);
@ -85,10 +85,10 @@ class CommandeStats extends Stats
$this->from_line = MAIN_DB_PREFIX.$object->table_element_line." as tl"; $this->from_line = MAIN_DB_PREFIX.$object->table_element_line." as tl";
$this->field = 'total_ht'; $this->field = 'total_ht';
$this->field_line = 'total_ht'; $this->field_line = 'total_ht';
$this->where .= " c.fk_statut > 2"; // Only approved & ordered //$this->where .= " c.fk_statut > 2"; // Only approved & ordered
} }
//$this->where.= " AND c.fk_soc = s.rowid AND c.entity = ".$conf->entity; //$this->where.= " AND c.fk_soc = s.rowid AND c.entity = ".$conf->entity;
$this->where .= ' AND c.entity IN ('.getEntity('commande').')'; $this->where .= ($this->where ? ' AND ' : ''). 'c.entity IN ('.getEntity('commande').')';
if (!$user->rights->societe->client->voir && !$this->socid) $this->where .= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = ".$user->id; if (!$user->rights->societe->client->voir && !$this->socid) $this->where .= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = ".$user->id;
if ($this->socid) if ($this->socid)

View File

@ -81,7 +81,7 @@ $dir = $conf->commande->dir_temp;
if ($mode == 'supplier') if ($mode == 'supplier')
{ {
$picto = 'supplier_order'; $picto = 'supplier_order';
$title = $langs->trans("OrdersStatisticsSuppliers").' ('.$langs->trans("SentToSuppliers").")"; $title = $langs->trans("OrdersStatisticsSuppliers");
$dir = $conf->fournisseur->commande->dir_temp; $dir = $conf->fournisseur->commande->dir_temp;
} }

View File

@ -64,7 +64,6 @@ class FichinterStats extends Stats
$this->userid = $userid; $this->userid = $userid;
$this->cachefilesuffix = $mode; $this->cachefilesuffix = $mode;
$this->where .= " c.entity = ".$conf->entity;
if ($mode == 'customer') if ($mode == 'customer')
{ {
$object = new Fichinter($this->db); $object = new Fichinter($this->db);
@ -75,6 +74,8 @@ class FichinterStats extends Stats
//$this->where.= " AND c.fk_statut > 0"; // Not draft and not cancelled //$this->where.= " AND c.fk_statut > 0"; // Not draft and not cancelled
} }
if (!$user->rights->societe->client->voir && !$this->socid) $this->where .= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = ".$user->id; if (!$user->rights->societe->client->voir && !$this->socid) $this->where .= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = ".$user->id;
$this->where .= ($this->where ? ' AND ' : '')."c.entity IN (".getEntity('fichinter').')';
if ($this->socid) if ($this->socid)
{ {
$this->where .= " AND c.fk_soc = ".$this->socid; $this->where .= " AND c.fk_soc = ".$this->socid;