forked from Wavyzz/dolibarr
Fix: Affiche le libell du type de produit dans page produit
This commit is contained in:
@@ -28,10 +28,13 @@
|
||||
*/
|
||||
|
||||
require("./pre.inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT.'/product.class.php');
|
||||
|
||||
if (!$user->rights->produit->lire)
|
||||
accessforbidden();
|
||||
|
||||
$staticproduct=new Product($db);
|
||||
|
||||
|
||||
/*
|
||||
* Affichage page accueil
|
||||
@@ -70,17 +73,18 @@ $prodser = array();
|
||||
$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";
|
||||
if ($db->query($sql))
|
||||
$result=$db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows();
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$row = $db->fetch_row($i);
|
||||
$prodser[$row[1]][$row[2]] = $row[0];
|
||||
$i++;
|
||||
$row = $db->fetch_row($result);
|
||||
$prodser[$row[1]][$row[2]] = $row[0];
|
||||
$i++;
|
||||
}
|
||||
$db->free();
|
||||
$db->free();
|
||||
}
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
@@ -120,13 +124,10 @@ $result = $db->query($sql) ;
|
||||
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows();
|
||||
$num = $db->num_rows($result);
|
||||
|
||||
$i = 0;
|
||||
|
||||
$typeprodser[0]=$langs->trans("Product");
|
||||
$typeprodser[1]=$langs->trans("Service");
|
||||
|
||||
if ($num > 0)
|
||||
{
|
||||
print '<table class="noborder" width="100%">';
|
||||
@@ -136,7 +137,7 @@ if ($result)
|
||||
$var=True;
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object( $i);
|
||||
$objp = $db->fetch_object($result);
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]>";
|
||||
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");
|
||||
print "</a> <a href=\"fiche.php?id=$objp->rowid\">$objp->ref</a></td>\n";
|
||||
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 "</tr>\n";
|
||||
$i++;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* 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>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -19,7 +19,6 @@
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*
|
||||
*/
|
||||
|
||||
/** \file htdocs/product/popuprop.php
|
||||
@@ -29,46 +28,41 @@
|
||||
*/
|
||||
|
||||
require("./pre.inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT.'/product.class.php');
|
||||
|
||||
$sortfield = isset($_GET["sortfield"])?$_GET["sortfield"]:$_POST["sortfield"];
|
||||
$sortorder = isset($_GET["sortorder"])?$_GET["sortorder"]:$_POST["sortorder"];
|
||||
$page = $_GET["page"];
|
||||
if ($page < 0) {
|
||||
$page = 0 ; }
|
||||
|
||||
if ($sortfield == "")
|
||||
{
|
||||
$sortfield="c";
|
||||
}
|
||||
if ($sortorder == "")
|
||||
{
|
||||
$sortorder="DESC";
|
||||
}
|
||||
if ($page < 0) $page = 0;
|
||||
if (! $sortfield) $sortfield="c";
|
||||
if (! $sortorder) $sortorder="DESC";
|
||||
|
||||
if ($page == -1) { $page = 0 ; }
|
||||
$limit = $conf->liste_limit;
|
||||
$offset = $limit * $page ;
|
||||
|
||||
|
||||
$staticproduct=new Product($db);
|
||||
|
||||
|
||||
llxHeader();
|
||||
|
||||
//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";
|
||||
if ( $db->query($sql) )
|
||||
$result=$db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$d = $db->fetch_object(0);
|
||||
$num = $d->c;
|
||||
if($num < ($offset+$offset))
|
||||
$afficher_pagesuivante = 0;
|
||||
else
|
||||
$afficher_pagesuivante = -1;
|
||||
$obj = $db->fetch_object($result);
|
||||
$num = $obj->c;
|
||||
}
|
||||
|
||||
print_barre_liste("Liste des produits et services par popularit<69>", $page, "popuprop.php","","","","",$afficher_pagesuivante);
|
||||
print_barre_liste("Liste des produits et services par popularit<69>", $page, "popuprop.php","","","","",$num);
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
print "<tr class=\"liste_titre\">";
|
||||
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("Nb. de proposition","popuprop.php", "c","","",'align="right"',$sortfield);
|
||||
print "</tr>\n";
|
||||
@@ -79,24 +73,25 @@ $sql .= " WHERE p.rowid = pd.fk_product group by (p.rowid)";
|
||||
$sql .= " ORDER BY $sortfield $sortorder ";
|
||||
$sql .= $db->plimit( $limit ,$offset);
|
||||
|
||||
|
||||
if ( $db->query($sql) )
|
||||
$result=$db->query($sql) ;
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows();
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
|
||||
$var=True;
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object( $i);
|
||||
$objp = $db->fetch_object($result);
|
||||
$var=!$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");
|
||||
else print img_object($langs->trans("ShowProduct"),"product");
|
||||
print " ";
|
||||
print "$objp->ref</a></td>\n";
|
||||
print "<td>$objp->label</td>\n";
|
||||
print $objp->ref.'</a></td>';
|
||||
print '<td>'.$staticproduct->typeprodser[$objp->fk_product_type].'</td>';
|
||||
print '<td>'.$objp->label.'</td>';
|
||||
print '<td align="right">'.$objp->c.'</td>';
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
@@ -107,5 +102,5 @@ print "</table>";
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter("<em>Dernière modification $Date$ révision $Revision$</em>");
|
||||
llxFooter('$Date$ - $Revision$');
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user