Synchro
This commit is contained in:
parent
661f69daca
commit
01c9915b7a
@ -1,5 +1,5 @@
|
||||
<?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) 2005-2006 Regis Houssin <regis.houssin@cap-networks.com>
|
||||
*
|
||||
@ -22,10 +22,10 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/product/index.php
|
||||
\ingroup product
|
||||
\brief Page accueil des produits et services
|
||||
\version $Revision$
|
||||
\file htdocs/product/index.php
|
||||
\ingroup product
|
||||
\brief Page accueil des produits et services
|
||||
\version $Revision$
|
||||
*/
|
||||
|
||||
require("./pre.inc.php");
|
||||
@ -36,7 +36,6 @@ if (!$user->rights->produit->lire)
|
||||
|
||||
$staticproduct=new Product($db);
|
||||
|
||||
|
||||
/*
|
||||
* Affichage page accueil
|
||||
*
|
||||
@ -73,54 +72,30 @@ print "</table></form><br>";
|
||||
$prodser = array();
|
||||
$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 '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Statistics").'</td></tr>';
|
||||
if ($conf->produit->enabled)
|
||||
{
|
||||
print "<tr $bc[0]>";
|
||||
print '<td><a href="liste.php?type=0&envente=0">'.$langs->trans("ProductsNotOnSell").'</a></td><td align="right">'.round($prodser[0][0]).'</td>';
|
||||
print "</tr>";
|
||||
print "<tr $bc[1]>";
|
||||
print '<td><a href="liste.php?type=0&envente=1">'.$langs->trans("ProductsOnSell").'</a></td><td align="right">'.round($prodser[0][1]).'</td>';
|
||||
print "</tr>";
|
||||
print "<tr $bc[0]>";
|
||||
print '<td><a href="liste.php?type=0&envente=0">'.$langs->trans("ProductsNotOnSell").'</a></td><td align="right">'.round($prodser[0][0]).'</td>';
|
||||
print "</tr>";
|
||||
print "<tr $bc[1]>";
|
||||
print '<td><a href="liste.php?type=0&envente=1">'.$langs->trans("ProductsOnSell").'</a></td><td align="right">'.round($prodser[0][1]).'</td>';
|
||||
print "</tr>";
|
||||
}
|
||||
if ($conf->service->enabled)
|
||||
{
|
||||
print "<tr $bc[0]>";
|
||||
print '<td><a href="liste.php?type=1&envente=0">'.$langs->trans("ServicesNotOnSell").'</a></td><td align="right">'.round($prodser[1][0]).'</td>';
|
||||
print "</tr>";
|
||||
print "<tr $bc[1]>";
|
||||
print '<td><a href="liste.php?type=1&envente=1">'.$langs->trans("ServicesOnSell").'</a></td><td align="right">'.round($prodser[1][1]).'</td>';
|
||||
print "</tr>";
|
||||
print "<tr $bc[0]>";
|
||||
print '<td><a href="liste.php?type=1&envente=0">'.$langs->trans("ServicesNotOnSell").'</a></td><td align="right">'.round($prodser[1][0]).'</td>';
|
||||
print "</tr>";
|
||||
print "<tr $bc[1]>";
|
||||
print '<td><a href="liste.php?type=1&envente=1">'.$langs->trans("ServicesOnSell").'</a></td><td align="right">'.round($prodser[1][1]).'</td>';
|
||||
print "</tr>";
|
||||
}
|
||||
print '</table>';
|
||||
|
||||
print '</td><td valign="top" width="70%" class="notopnoleftnoright">';
|
||||
|
||||
|
||||
/*
|
||||
* Derniers produits/services en vente
|
||||
*/
|
||||
@ -130,9 +105,11 @@ $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.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie as c ON cp.fk_categorie = c.rowid";
|
||||
$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.= $db->plimit($max,0);
|
||||
$result = $db->query($sql) ;
|
||||
@ -140,9 +117,9 @@ $result = $db->query($sql) ;
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
|
||||
|
||||
$i = 0;
|
||||
|
||||
|
||||
if ($num > 0)
|
||||
{
|
||||
print '<table class="noborder" width="100%">';
|
||||
@ -151,40 +128,40 @@ if ($result)
|
||||
|
||||
$var=True;
|
||||
|
||||
while ($i < $num)
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
//Multilangs
|
||||
if ($conf->global->MAIN_MULTILANGS)
|
||||
{
|
||||
$sql = "SELECT label FROM ".MAIN_DB_PREFIX."product_det";
|
||||
$sql.= " WHERE fk_product=".$objp->rowid." AND lang='". $langs->getDefaultLang() ."'";
|
||||
$resultd = $db->query($sql);
|
||||
if ($resultd)
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
//Multilangs
|
||||
if ($conf->global->MAIN_MULTILANGS)
|
||||
{
|
||||
$sql = "SELECT label FROM ".MAIN_DB_PREFIX."product_det";
|
||||
$sql.= " WHERE fk_product=".$objp->rowid." AND lang='". $langs->getDefaultLang() ."'";
|
||||
$resultd = $db->query($sql);
|
||||
if ($resultd)
|
||||
{
|
||||
$objtp = $db->fetch_object($resultd);
|
||||
if ($objtp->label != '') $objp->label = $objtp->label;
|
||||
}
|
||||
}
|
||||
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td nowrap="nowrap"><a href="fiche.php?id='.$objp->rowid.'">';
|
||||
if ($objp->fk_product_type) print img_object($langs->trans("ShowService"),"service");
|
||||
else print img_object($langs->trans("ShowProduct"),"product");
|
||||
print "</a> <a href=\"fiche.php?id=$objp->rowid\">$objp->ref</a></td>\n";
|
||||
print '<td>'.dolibarr_trunc($objp->label,40).'</td>';
|
||||
print '<td>'.$staticproduct->typeprodser[$objp->fk_product_type]."</td>";
|
||||
print '<td align="right" nowrap="nowrap">';
|
||||
print $staticproduct->LibStatut($objp->envente,5);
|
||||
print "</td>";
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
$objtp = $db->fetch_object($resultd);
|
||||
if ($objtp->label != '') $objp->label = $objtp->label;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td nowrap="nowrap"><a href="fiche.php?id='.$objp->rowid.'">';
|
||||
if ($objp->fk_product_type) print img_object($langs->trans("ShowService"),"service");
|
||||
else print img_object($langs->trans("ShowProduct"),"product");
|
||||
print "</a> <a href=\"fiche.php?id=$objp->rowid\">$objp->ref</a></td>\n";
|
||||
print '<td>'.dolibarr_trunc($objp->label,40).'</td>';
|
||||
print '<td>'.$staticproduct->typeprodser[$objp->fk_product_type]."</td>";
|
||||
print '<td align="right" nowrap="nowrap">';
|
||||
print $staticproduct->LibStatut($objp->envente,5);
|
||||
print "</td>";
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
|
||||
$db->free();
|
||||
|
||||
|
||||
print "</table>";
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user