Synchro
This commit is contained in:
parent
661f69daca
commit
01c9915b7a
@ -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>
|
||||||
*
|
*
|
||||||
@ -22,10 +22,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\file htdocs/product/index.php
|
\file htdocs/product/index.php
|
||||||
\ingroup product
|
\ingroup product
|
||||||
\brief Page accueil des produits et services
|
\brief Page accueil des produits et services
|
||||||
\version $Revision$
|
\version $Revision$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require("./pre.inc.php");
|
require("./pre.inc.php");
|
||||||
@ -36,7 +36,6 @@ if (!$user->rights->produit->lire)
|
|||||||
|
|
||||||
$staticproduct=new Product($db);
|
$staticproduct=new Product($db);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Affichage page accueil
|
* Affichage page accueil
|
||||||
*
|
*
|
||||||
@ -73,54 +72,30 @@ 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)
|
||||||
{
|
{
|
||||||
print "<tr $bc[0]>";
|
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 '<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>";
|
||||||
print "<tr $bc[1]>";
|
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 '<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>";
|
||||||
}
|
}
|
||||||
if ($conf->service->enabled)
|
if ($conf->service->enabled)
|
||||||
{
|
{
|
||||||
print "<tr $bc[0]>";
|
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 '<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>";
|
||||||
print "<tr $bc[1]>";
|
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 '<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>";
|
||||||
}
|
}
|
||||||
print '</table>';
|
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
|
||||||
*/
|
*/
|
||||||
@ -130,9 +105,11 @@ $sql.= " FROM ".MAIN_DB_PREFIX."product as p";
|
|||||||
if ($conf->categorie->enabled && !$user->rights->categorie->voir)
|
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_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.= " 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) ;
|
||||||
@ -151,37 +128,37 @@ if ($result)
|
|||||||
|
|
||||||
$var=True;
|
$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);
|
$objtp = $db->fetch_object($resultd);
|
||||||
|
if ($objtp->label != '') $objp->label = $objtp->label;
|
||||||
//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++;
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$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();
|
$db->free();
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user