Fix: On affiche aussi les produits qui ne sont pas dans des catgories caches.
This commit is contained in:
parent
5c65415a8f
commit
7a6672433e
@ -613,20 +613,20 @@ class Form
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."product as p ";
|
||||
if ($conf->categorie->enabled && !$user->rights->categorie->voir)
|
||||
{
|
||||
$sql .= ", ".MAIN_DB_PREFIX."categorie_product as cp";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."categorie as c";
|
||||
$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 p.envente = 1";
|
||||
if ($conf->categorie->enabled && !$user->rights->categorie->voir)
|
||||
{
|
||||
$sql .= " AND cp.fk_product = p.rowid";
|
||||
$sql .= " AND cp.fk_categorie = c.rowid AND c.visible = 1";
|
||||
$sql.= ' AND IFNULL(c.visible,1)=1';
|
||||
}
|
||||
if ($filtretype && $filtretype != '') $sql.=" AND p.fk_product_type=".$filtretype;
|
||||
$sql.= " ORDER BY p.nbvente DESC";
|
||||
if ($limit) $sql.= " LIMIT $limit";
|
||||
|
||||
|
||||
$result=$this->db->query($sql);
|
||||
if (! $result) dolibarr_print_error($this->db);
|
||||
|
||||
// Multilang : on construit une liste des traductions des produits listés
|
||||
$sqld = "SELECT d.fk_product, d.label";
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2006 Regis Houssin <regis.houssin@cap-networks.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -19,7 +19,6 @@
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -69,17 +68,16 @@ class box_services_vendus extends ModeleBoxes {
|
||||
if (!$user->rights->commercial->client->voir && !$user->societe_id) $sql .= ", sc.fk_soc, sc.fk_user";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as c, ".MAIN_DB_PREFIX."contratdet as cd, ".MAIN_DB_PREFIX."product as p";
|
||||
if (!$user->rights->commercial->client->voir && !$user->societe_id) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
if ($conf->categorie->enabled && !$user->rights->categorie->voir)
|
||||
{
|
||||
$sql .= ", ".MAIN_DB_PREFIX."categorie_product as cp";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."categorie as ca";
|
||||
}
|
||||
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 ca ON cp.fk_categorie = ca.rowid";
|
||||
}
|
||||
$sql .= " WHERE s.idp = c.fk_soc AND c.rowid = cd.fk_contrat AND cd.fk_product = p.rowid";
|
||||
if (!$user->rights->commercial->client->voir && !$user->societe_id) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
if ($conf->categorie->enabled && !$user->rights->categorie->voir)
|
||||
{
|
||||
$sql .= " AND cp.fk_product = p.rowid";
|
||||
$sql .= " AND cp.fk_categorie = ca.rowid AND ca.visible = 1";
|
||||
$sql.= ' AND IFNULL(ca.visible,1)=1';
|
||||
}
|
||||
if($user->societe_id)
|
||||
{
|
||||
|
||||
@ -79,15 +79,10 @@ $title=$langs->trans("ProductsAndServices");
|
||||
$sql = 'SELECT p.rowid, p.ref, p.label, p.price, p.fk_product_type, '.$db->pdate('p.tms').' as datem,';
|
||||
$sql.= ' p.duration, p.envente as statut';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'product as p'; // '.MAIN_DB_PREFIX.'product_det as d'; //en attendant le debugage
|
||||
|
||||
if ($catid || ($conf->categorie->enabled && !$user->rights->categorie->voir))
|
||||
{
|
||||
$sql .= ", ".MAIN_DB_PREFIX."categorie_product as cp";
|
||||
}
|
||||
|
||||
if ($conf->categorie->enabled && !$user->rights->categorie->voir)
|
||||
{
|
||||
$sql .= ", ".MAIN_DB_PREFIX."categorie as c";
|
||||
$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";
|
||||
}
|
||||
|
||||
if ($_GET["fourn_id"] > 0)
|
||||
@ -116,17 +111,13 @@ if (isset($_GET["envente"]) && strlen($_GET["envente"]) > 0)
|
||||
{
|
||||
$sql .= " AND p.envente = ".$_GET["envente"];
|
||||
}
|
||||
if($catid || ($conf->categorie->enabled && !$user->rights->categorie->voir))
|
||||
{
|
||||
$sql .= " AND cp.fk_product = p.rowid";
|
||||
}
|
||||
if($catid)
|
||||
{
|
||||
$sql .= " AND cp.fk_categorie = ".$catid;
|
||||
}
|
||||
if ($conf->categorie->enabled && !$user->rights->categorie->voir)
|
||||
{
|
||||
$sql .= " AND cp.fk_categorie = c.rowid AND c.visible = 1";
|
||||
$sql.= ' AND IFNULL(c.visible,1)=1';
|
||||
}
|
||||
if ($fourn_id > 0)
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user