diff --git a/htdocs/install/mysql/tables/llx_product_subproduct.sql b/htdocs/install/mysql/tables/llx_product_subproduct.sql deleted file mode 100644 index 92a0a6b88f8..00000000000 --- a/htdocs/install/mysql/tables/llx_product_subproduct.sql +++ /dev/null @@ -1,28 +0,0 @@ --- ============================================================================ --- Copyright (C) 2006 Rodolphe Quiedeville --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 2 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --- --- $Id$ --- ============================================================================ - -create table llx_product_subproduct -( - rowid integer AUTO_INCREMENT PRIMARY KEY, - fk_product integer NOT NULL, -- id du produit maitre - fk_product_subproduct integer NOT NULL, -- id du sous-produit - UNIQUE(fk_product, fk_product_subproduct) -)type=innodb; - diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 4ab25c391da..6734d18c72b 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -1657,9 +1657,11 @@ class Product extends CommonObject } } + /** - * \brief Remplit le tableau des sous-produits - * \return int < 0 si erreur, > 0 si ok + * \brief Remplit le tableau des sous-produits + * \return int < 0 si erreur, > 0 si ok + * \remark Not used. Used by module droitpret only. */ function load_subproduct() { @@ -1688,9 +1690,10 @@ class Product extends CommonObject /** - * \brief Lie un sous produit au produit/service - * \param id_sub Id du produit a lier - * \return int < 0 si erreur, > 0 si ok + * \brief Lie un sous produit au produit/service + * \param id_sub Id du produit a lier + * \return int < 0 si erreur, > 0 si ok + * \remark Not used. Used by module droitpret only. */ function add_subproduct($id_sub) { diff --git a/htdocs/product/index.php b/htdocs/product/index.php index 3c4c487404a..c5c869b41fe 100644 --- a/htdocs/product/index.php +++ b/htdocs/product/index.php @@ -167,11 +167,15 @@ $max=15; $sql = "SELECT p.rowid, p.label, p.price, p.ref, p.fk_product_type, p.envente,"; $sql.= " p.tms as datem"; $sql.= " FROM ".MAIN_DB_PREFIX."product as p"; -$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_subproduct as sp ON p.rowid = sp.fk_product_subproduct"; +$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_subproduct as sp ON p.rowid = sp.fk_product_subproduct"; // Exclude record that are subproduct for module ??? $sql.= " WHERE sp.fk_product_subproduct IS NULL"; $sql.= " AND p.entity = ".$conf->entity; -if (!$user->rights->produit->hidden) $sql.=' AND (p.hidden=0 OR p.fk_product_type != 0)'; -if (!$user->rights->service->hidden) $sql.=' AND (p.hidden=0 OR p.fk_product_type != 1)'; +if (empty($user->rights->produit->hidden) && empty($user->rights->service->hidden)) $sql.=' AND p.hidden=0'; +else +{ + if (!$user->rights->produit->hidden) $sql.=' AND (p.hidden=0 OR p.fk_product_type != 0)'; + if (!$user->rights->service->hidden) $sql.=' AND (p.hidden=0 OR p.fk_product_type != 1)'; +} if ($type != '') $sql.= " AND p.fk_product_type = ".$type; $sql.= $db->order("p.tms","DESC"); $sql.= $db->plimit($max,0);