mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-06 01:28:19 +01:00
Fix: Missing thirdparties that were nor prospect, nor customer, nor
suppliers into nb.
This commit is contained in:
@@ -84,7 +84,8 @@ if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREF
|
|||||||
$sql.= ' WHERE s.entity IN ('.getEntity('societe', 1).')';
|
$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 (! $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 ($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);
|
$result = $db->query($sql);
|
||||||
if ($result)
|
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_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->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->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++;
|
if ($found) $total++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -102,13 +103,14 @@ else dol_print_error($db);
|
|||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("Statistics").'</th></tr>';
|
print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("Statistics").'</th></tr>';
|
||||||
if ($conf->use_javascript_ajax && ((round($third['prospect'])?1:0)+(round($third['customer'])?1:0)+(round($third['supplier'])?1:0) >= 2))
|
if ($conf->use_javascript_ajax && ((round($third['prospect'])?1:0)+(round($third['customer'])?1:0)+(round($third['supplier'])?1:0)+(round($third['other'])?1:0) >= 2))
|
||||||
{
|
{
|
||||||
print '<tr><td align="center">';
|
print '<tr><td align="center">';
|
||||||
$dataseries=array();
|
$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_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_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->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);
|
$data=array('series'=>$dataseries);
|
||||||
dol_print_graph('stats',300,180,$data,1,'pie',0);
|
dol_print_graph('stats',300,180,$data,1,'pie',0);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
@@ -153,10 +155,7 @@ if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREF
|
|||||||
$sql.= ' WHERE s.entity IN ('.getEntity('societe', 1).')';
|
$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 (! $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 ($socid) $sql.= " AND s.rowid = ".$socid;
|
||||||
$sql.= " AND (";
|
if (! $user->rights->fournisseur->lire) $sql.=" AND (s.fournisseur != 1 OR s.client != 0)";
|
||||||
if (! empty($conf->societe->enabled)) $sql.=" s.client IN (1,2,3)";
|
|
||||||
if (! empty($conf->fournisseur->enabled)) $sql.=" OR s.fournisseur IN (1)";
|
|
||||||
$sql.= ")";
|
|
||||||
$sql.= $db->order("s.tms","DESC");
|
$sql.= $db->order("s.tms","DESC");
|
||||||
$sql.= $db->plimit($max,0);
|
$sql.= $db->plimit($max,0);
|
||||||
|
|
||||||
|
|||||||
@@ -184,10 +184,7 @@ if (dol_strlen($stcomm))
|
|||||||
{
|
{
|
||||||
$sql.= " AND s.fk_stcomm=".$stcomm;
|
$sql.= " AND s.fk_stcomm=".$stcomm;
|
||||||
}
|
}
|
||||||
if (! $user->rights->societe->lire || ! $user->rights->fournisseur->lire)
|
if (! $user->rights->fournisseur->lire) $sql.=" AND (s.fournisseur <> 1 OR s.client <> 0)"; // client=0, fournisseur=0 must be visible
|
||||||
{
|
|
||||||
if (! $user->rights->fournisseur->lire) $sql.=" AND s.fournisseur != 1";
|
|
||||||
}
|
|
||||||
// Insert sale filter
|
// Insert sale filter
|
||||||
if ($search_sale)
|
if ($search_sale)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user