This commit is contained in:
Rodolphe Quiedeville 2006-12-11 22:43:40 +00:00
parent 661f69daca
commit 01c9915b7a

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2006 Regis Houssin <regis.houssin@cap-networks.com> * Copyright (C) 2005-2006 Regis Houssin <regis.houssin@cap-networks.com>
* *
@ -36,7 +36,6 @@ if (!$user->rights->produit->lire)
$staticproduct=new Product($db); $staticproduct=new Product($db);
/* /*
* Affichage page accueil * Affichage page accueil
* *
@ -73,29 +72,6 @@ print "</table></form><br>";
$prodser = array(); $prodser = array();
$prodser[0][0]=$prodser[0][1]=$prodser[1][0]=$prodser[1][1]=0; $prodser[0][0]=$prodser[0][1]=$prodser[1][0]=$prodser[1][1]=0;
$sql = "SELECT count(*), p.fk_product_type, p.envente";
$sql .= " FROM ".MAIN_DB_PREFIX."product as p";
if ($conf->categorie->enabled && !$user->rights->categorie->voir)
{
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON cp.fk_product = p.rowid";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie as c ON cp.fk_categorie = c.rowid";
$sql.= " WHERE IFNULL(c.visible,1)=1";
}
$sql .= " GROUP BY p.fk_product_type, p.envente";
$result=$db->query($sql);
if ($result)
{
$num = $db->num_rows($result);
$i = 0;
while ($i < $num)
{
$row = $db->fetch_row($result);
$prodser[$row[1]][$row[2]] = $row[0];
$i++;
}
$db->free();
}
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Statistics").'</td></tr>'; print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Statistics").'</td></tr>';
if ($conf->produit->enabled) if ($conf->produit->enabled)
@ -120,7 +96,6 @@ print '</table>';
print '</td><td valign="top" width="70%" class="notopnoleftnoright">'; print '</td><td valign="top" width="70%" class="notopnoleftnoright">';
/* /*
* Derniers produits/services en vente * Derniers produits/services en vente
*/ */
@ -133,6 +108,8 @@ if ($conf->categorie->enabled && !$user->rights->categorie->voir)
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie as c ON cp.fk_categorie = c.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie as c ON cp.fk_categorie = c.rowid";
$sql.= " WHERE IFNULL(c.visible,1)=1 "; $sql.= " WHERE IFNULL(c.visible,1)=1 ";
} }
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_subproduct as sp ON p.rowid = sp.fk_product_subproduct";
$sql.= " WHERE sp.fk_product_subproduct IS NULL";
$sql.= " ORDER BY p.datec DESC "; $sql.= " ORDER BY p.datec DESC ";
$sql.= $db->plimit($max,0); $sql.= $db->plimit($max,0);
$result = $db->query($sql) ; $result = $db->query($sql) ;