Fix: Affiche le libell du type de produit dans page produit
This commit is contained in:
parent
c9b125601a
commit
ab094f4a4f
@ -28,10 +28,13 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
require("./pre.inc.php");
|
require("./pre.inc.php");
|
||||||
|
require_once(DOL_DOCUMENT_ROOT.'/product.class.php');
|
||||||
|
|
||||||
if (!$user->rights->produit->lire)
|
if (!$user->rights->produit->lire)
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
|
|
||||||
|
$staticproduct=new Product($db);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Affichage page accueil
|
* Affichage page accueil
|
||||||
@ -70,17 +73,18 @@ $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(*), fk_product_type, envente FROM ".MAIN_DB_PREFIX."product as p GROUP BY fk_product_type, envente";
|
$sql = "SELECT count(*), fk_product_type, envente FROM ".MAIN_DB_PREFIX."product as p GROUP BY fk_product_type, envente";
|
||||||
if ($db->query($sql))
|
$result=$db->query($sql);
|
||||||
|
if ($result)
|
||||||
{
|
{
|
||||||
$num = $db->num_rows();
|
$num = $db->num_rows($result);
|
||||||
$i = 0;
|
$i = 0;
|
||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
$row = $db->fetch_row($i);
|
$row = $db->fetch_row($result);
|
||||||
$prodser[$row[1]][$row[2]] = $row[0];
|
$prodser[$row[1]][$row[2]] = $row[0];
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
$db->free();
|
$db->free();
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
@ -120,13 +124,10 @@ $result = $db->query($sql) ;
|
|||||||
|
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
$num = $db->num_rows();
|
$num = $db->num_rows($result);
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
|
||||||
$typeprodser[0]=$langs->trans("Product");
|
|
||||||
$typeprodser[1]=$langs->trans("Service");
|
|
||||||
|
|
||||||
if ($num > 0)
|
if ($num > 0)
|
||||||
{
|
{
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
@ -136,7 +137,7 @@ if ($result)
|
|||||||
$var=True;
|
$var=True;
|
||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
$objp = $db->fetch_object( $i);
|
$objp = $db->fetch_object($result);
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
print "<tr $bc[$var]>";
|
print "<tr $bc[$var]>";
|
||||||
print '<td nowrap="nowrap"><a href="fiche.php?id='.$objp->rowid.'">';
|
print '<td nowrap="nowrap"><a href="fiche.php?id='.$objp->rowid.'">';
|
||||||
@ -144,7 +145,7 @@ if ($result)
|
|||||||
else print img_object($langs->trans("ShowProduct"),"product");
|
else print img_object($langs->trans("ShowProduct"),"product");
|
||||||
print "</a> <a href=\"fiche.php?id=$objp->rowid\">$objp->ref</a></td>\n";
|
print "</a> <a href=\"fiche.php?id=$objp->rowid\">$objp->ref</a></td>\n";
|
||||||
print "<td>$objp->label</td>";
|
print "<td>$objp->label</td>";
|
||||||
print "<td>".$typeprodser[$objp->fk_product_type]."</td>";
|
print "<td>".$staticproduct->typeprodser[$objp->fk_product_type]."</td>";
|
||||||
print '<td align="center" nowrap="nowrap">'.($objp->envente?$langs->trans("OnSell"):$langs->trans("NotOnSell"))."</td>";
|
print '<td align="center" nowrap="nowrap">'.($objp->envente?$langs->trans("OnSell"):$langs->trans("NotOnSell"))."</td>";
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
$i++;
|
$i++;
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -19,7 +19,6 @@
|
|||||||
*
|
*
|
||||||
* $Id$
|
* $Id$
|
||||||
* $Source$
|
* $Source$
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** \file htdocs/product/popuprop.php
|
/** \file htdocs/product/popuprop.php
|
||||||
@ -29,46 +28,41 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
require("./pre.inc.php");
|
require("./pre.inc.php");
|
||||||
|
require_once(DOL_DOCUMENT_ROOT.'/product.class.php');
|
||||||
|
|
||||||
$sortfield = isset($_GET["sortfield"])?$_GET["sortfield"]:$_POST["sortfield"];
|
$sortfield = isset($_GET["sortfield"])?$_GET["sortfield"]:$_POST["sortfield"];
|
||||||
$sortorder = isset($_GET["sortorder"])?$_GET["sortorder"]:$_POST["sortorder"];
|
$sortorder = isset($_GET["sortorder"])?$_GET["sortorder"]:$_POST["sortorder"];
|
||||||
$page = $_GET["page"];
|
$page = $_GET["page"];
|
||||||
if ($page < 0) {
|
if ($page < 0) $page = 0;
|
||||||
$page = 0 ; }
|
if (! $sortfield) $sortfield="c";
|
||||||
|
if (! $sortorder) $sortorder="DESC";
|
||||||
if ($sortfield == "")
|
|
||||||
{
|
|
||||||
$sortfield="c";
|
|
||||||
}
|
|
||||||
if ($sortorder == "")
|
|
||||||
{
|
|
||||||
$sortorder="DESC";
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($page == -1) { $page = 0 ; }
|
if ($page == -1) { $page = 0 ; }
|
||||||
$limit = $conf->liste_limit;
|
$limit = $conf->liste_limit;
|
||||||
$offset = $limit * $page ;
|
$offset = $limit * $page ;
|
||||||
|
|
||||||
|
|
||||||
|
$staticproduct=new Product($db);
|
||||||
|
|
||||||
|
|
||||||
llxHeader();
|
llxHeader();
|
||||||
|
|
||||||
//On n'affiche le lien page suivante que s'il y a une page suivante ...
|
//On n'affiche le lien page suivante que s'il y a une page suivante ...
|
||||||
$sql = "select count(*) as c from ".MAIN_DB_PREFIX."product";
|
$sql = "select count(*) as c from ".MAIN_DB_PREFIX."product";
|
||||||
if ( $db->query($sql) )
|
$result=$db->query($sql);
|
||||||
|
if ($result)
|
||||||
{
|
{
|
||||||
$d = $db->fetch_object(0);
|
$obj = $db->fetch_object($result);
|
||||||
$num = $d->c;
|
$num = $obj->c;
|
||||||
if($num < ($offset+$offset))
|
|
||||||
$afficher_pagesuivante = 0;
|
|
||||||
else
|
|
||||||
$afficher_pagesuivante = -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
print_barre_liste("Liste des produits et services par popularité", $page, "popuprop.php","","","","",$afficher_pagesuivante);
|
print_barre_liste("Liste des produits et services par popularité", $page, "popuprop.php","","","","",$num);
|
||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
|
|
||||||
print "<tr class=\"liste_titre\">";
|
print "<tr class=\"liste_titre\">";
|
||||||
print_liste_field_titre($langs->trans("Ref"),"popuprop.php", "p.ref","","","",$sortfield);
|
print_liste_field_titre($langs->trans("Ref"),"popuprop.php", "p.ref","","","",$sortfield);
|
||||||
|
print_liste_field_titre($langs->trans("Type"),"popuprop.php", "p.type","","","",$sortfield);
|
||||||
print_liste_field_titre($langs->trans("Label"),"popuprop.php", "p.label","","","",$sortfield);
|
print_liste_field_titre($langs->trans("Label"),"popuprop.php", "p.label","","","",$sortfield);
|
||||||
print_liste_field_titre("Nb. de proposition","popuprop.php", "c","","",'align="right"',$sortfield);
|
print_liste_field_titre("Nb. de proposition","popuprop.php", "c","","",'align="right"',$sortfield);
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
@ -79,24 +73,25 @@ $sql .= " WHERE p.rowid = pd.fk_product group by (p.rowid)";
|
|||||||
$sql .= " ORDER BY $sortfield $sortorder ";
|
$sql .= " ORDER BY $sortfield $sortorder ";
|
||||||
$sql .= $db->plimit( $limit ,$offset);
|
$sql .= $db->plimit( $limit ,$offset);
|
||||||
|
|
||||||
|
$result=$db->query($sql) ;
|
||||||
if ( $db->query($sql) )
|
if ($result)
|
||||||
{
|
{
|
||||||
$num = $db->num_rows();
|
$num = $db->num_rows($result);
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
|
||||||
$var=True;
|
$var=True;
|
||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
$objp = $db->fetch_object( $i);
|
$objp = $db->fetch_object($result);
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
print "<tr $bc[$var]>";
|
print "<tr $bc[$var]>";
|
||||||
print "<td><a href=\"fiche.php?id=$objp->rowid\">";
|
print '<td><a href="'.DOL_URL_ROOT.'/product/stats/fiche.php?id='.$objp->rowid.'">';
|
||||||
if ($objp->fk_product_type) print img_object($langs->trans("ShowService"),"service");
|
if ($objp->fk_product_type) print img_object($langs->trans("ShowService"),"service");
|
||||||
else print img_object($langs->trans("ShowProduct"),"product");
|
else print img_object($langs->trans("ShowProduct"),"product");
|
||||||
print " ";
|
print " ";
|
||||||
print "$objp->ref</a></td>\n";
|
print $objp->ref.'</a></td>';
|
||||||
print "<td>$objp->label</td>\n";
|
print '<td>'.$staticproduct->typeprodser[$objp->fk_product_type].'</td>';
|
||||||
|
print '<td>'.$objp->label.'</td>';
|
||||||
print '<td align="right">'.$objp->c.'</td>';
|
print '<td align="right">'.$objp->c.'</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
$i++;
|
$i++;
|
||||||
@ -107,5 +102,5 @@ print "</table>";
|
|||||||
|
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|
||||||
llxFooter("<em>Dernière modification $Date$ révision $Revision$</em>");
|
llxFooter('$Date$ - $Revision$');
|
||||||
?>
|
?>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user