From 46abd502e64d7e418d714974536c05b3422986ef Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 1 Feb 2011 20:07:48 +0000 Subject: [PATCH] Fix: Correct counting --- htdocs/societe/index.php | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/htdocs/societe/index.php b/htdocs/societe/index.php index 4b25431112c..0480dbf6e19 100644 --- a/htdocs/societe/index.php +++ b/htdocs/societe/index.php @@ -88,11 +88,12 @@ if ($result) { while ($objp = $db->fetch_object($result)) { - if ($objp->client == 1 || $objp->client == 3) $third['customer']++; - if ($objp->client == 2 || $objp->client == 3) $third['prospect']++; - if ($objp->fournisseur) $third['supplier']++; + $found=0; + if ($objp->client == 1 || $objp->client == 3) { $found=1; $third['customer']++; } + if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && ($objp->client == 2 || $objp->client == 3)) { $found=1; $third['prospect']++; } + if ($conf->fournisseur->enabled && $objp->fournisseur) { $found=1; $third['supplier']++; } - $total++; + if ($found) $total++; } } else dol_print_error($db); @@ -103,22 +104,22 @@ if ($conf->societe->enabled) { if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) { - $statProducts = ""; - $statProducts.= ''.$langs->trans("Prospects").''.round($third['prospect']).''; - $statProducts.= ""; + $statstring = ""; + $statstring.= ''.$langs->trans("Prospects").''.round($third['prospect']).''; + $statstring.= ""; } - $statProducts.= ""; - $statProducts.= ''.$langs->trans("Customers").''.round($third['customer']).''; - $statProducts.= ""; + $statstring.= ""; + $statstring.= ''.$langs->trans("Customers").''.round($third['customer']).''; + $statstring.= ""; } if ($conf->fournisseur->enabled) { - $statServices = ""; - $statServices.= ''.$langs->trans("Suppliers").''.round($third['supplier']).''; - $statServices.= ""; + $statstring2 = ""; + $statstring2.= ''.$langs->trans("Suppliers").''.round($third['supplier']).''; + $statstring2.= ""; } -print $statProducts; -print $statServices; +print $statstring; +print $statstring2; print ''.$langs->trans("UniqueThirdParties").''; print $total; print '';