Fix: Move table in wrong repository

This commit is contained in:
Laurent Destailleur 2010-07-10 23:13:28 +00:00
parent a1ceca54c5
commit 359038d2e5
3 changed files with 15 additions and 36 deletions

View File

@ -1,28 +0,0 @@
-- ============================================================================
-- Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
--
-- 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;

View File

@ -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)
{

View File

@ -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);