diff --git a/htdocs/comm/propal/note.php b/htdocs/comm/propal/note.php index 77209fc164f..521b27f4e76 100644 --- a/htdocs/comm/propal/note.php +++ b/htdocs/comm/propal/note.php @@ -2,7 +2,7 @@ /* Copyright (C) 2004 Rodolphe Quiedeville * Copyright (C) 2004-2005 Laurent Destailleur * Copyright (C) 2004 Eric Seigne - * Copyright (C) 2005 Regis Houssin + * Copyright (C) 2005-2007 Regis Houssin * * 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 diff --git a/htdocs/fourn/commande/fiche.php b/htdocs/fourn/commande/fiche.php index 19c224d7625..a4b0852c7c6 100644 --- a/htdocs/fourn/commande/fiche.php +++ b/htdocs/fourn/commande/fiche.php @@ -610,8 +610,10 @@ else $sql = "SELECT l.ref, l.fk_product, l.description, l.price, l.qty"; $sql.= ", l.rowid, l.tva_tx, l.remise_percent, l.subprice"; $sql.= ", p.label"; + $sql.= ", pf.ref_fourn"; $sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as l"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON l.fk_product = p.rowid"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur as pf ON l.fk_product = pf.fk_product"; $sql.= " WHERE l.fk_commande = ".$commande->id; $sql.= " ORDER BY l.rowid"; @@ -639,7 +641,7 @@ else print ""; print ''; print ''.img_object($langs->trans("ShowProduct"),'product').' '.$objp->ref.''; - print ' - '.$objp->label; + print ' ('.$objp->ref_fourn.') - '.$objp->label; if ($objp->description) print '
'.nl2br($objp->description); print ""; print ''.$objp->tva_tx.'%'; diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php index 58cc37b48e7..837b055023d 100644 --- a/htdocs/fourn/facture/fiche.php +++ b/htdocs/fourn/facture/fiche.php @@ -735,8 +735,8 @@ else { $productstatic->id=$fac->lignes[$i]->fk_product; $productstatic->type=1; - $productstatic->ref=$fac->lignes[$i]->libelle; - print $productstatic->getNomUrl(1); + $productstatic->ref=$fac->lignes[$i]->ref; + print $productstatic->getNomUrl(1).' ('.$fac->lignes[$i]->ref_fourn.') - '.$fac->lignes[$i]->libelle; } else { diff --git a/htdocs/fourn/fournisseur.facture.class.php b/htdocs/fourn/fournisseur.facture.class.php index 404f638f8a6..1e1d765653e 100644 --- a/htdocs/fourn/fournisseur.facture.class.php +++ b/htdocs/fourn/fournisseur.facture.class.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2005 Laurent Destailleur * Copyright (C) 2004 Christophe Combelles * Copyright (C) 2005 Marc Barilley / Ocebo + * Copyright (C) 2005-2007 Regis Houssin * * 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 @@ -210,9 +211,11 @@ class FactureFournisseur extends Facture */ $sql = 'SELECT f.rowid, f.description, f.pu_ht, f.qty, f.tva_taux, f.tva,'; $sql.= ' f.total_ht, f.tva as total_tva, f.total_ttc, f.fk_product,'; - $sql.= ' p.label as label, p.description as product_desc'; + $sql.= ' p.ref, p.label as label, p.description as product_desc,'; + $sql.= ' pf.ref_fourn'; $sql.= ' FROM '.MAIN_DB_PREFIX.'facture_fourn_det as f'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON f.fk_product = p.rowid'; + $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_fournisseur as pf ON f.fk_product = pf.fk_product'; $sql.= ' WHERE fk_facture_fourn='.$this->id; dolibarr_syslog("FactureFourn::Fetch search lines sql=".$sql, LOG_DEBUG); @@ -226,18 +229,20 @@ class FactureFournisseur extends Facture while ($i < $num_rows) { $obj = $this->db->fetch_object($resql_rows); - $this->lignes[$i]->rowid = $obj->rowid; - $this->lignes[$i]->description = $obj->description; - $this->lignes[$i]->libelle = $obj->label; // Label produit - $this->lignes[$i]->product_desc = $obj->product_desc; // Description produit - $this->lignes[$i]->pu_ht = $obj->pu_ht; - $this->lignes[$i]->tva_taux = $obj->tva_taux; - $this->lignes[$i]->qty = $obj->qty; - $this->lignes[$i]->tva = $obj->tva; - $this->lignes[$i]->total_ht = $obj->total_ht; - $this->lignes[$i]->total_tva = $obj->total_tva; - $this->lignes[$i]->total_ttc = $obj->total_ttc; - $this->lignes[$i]->fk_product = $obj->fk_product; + $this->lignes[$i]->rowid = $obj->rowid; + $this->lignes[$i]->description = $obj->description; + $this->lignes[$i]->ref = $obj->ref; // Reference interne du produit + $this->lignes[$i]->ref_fourn = $obj->ref_fourn; // Reference fournisseur du produit + $this->lignes[$i]->libelle = $obj->label; // Label du produit + $this->lignes[$i]->product_desc = $obj->product_desc; // Description du produit + $this->lignes[$i]->pu_ht = $obj->pu_ht; + $this->lignes[$i]->tva_taux = $obj->tva_taux; + $this->lignes[$i]->qty = $obj->qty; + $this->lignes[$i]->tva = $obj->tva; + $this->lignes[$i]->total_ht = $obj->total_ht; + $this->lignes[$i]->total_tva = $obj->total_tva; + $this->lignes[$i]->total_ttc = $obj->total_ttc; + $this->lignes[$i]->fk_product = $obj->fk_product; $i++; } } diff --git a/htdocs/fourn/index.php b/htdocs/fourn/index.php index 528331e0fcd..58b9b250e6d 100644 --- a/htdocs/fourn/index.php +++ b/htdocs/fourn/index.php @@ -1,7 +1,7 @@ * Copyright (C) 2004-2007 Laurent Destailleur - * Copyright (C) 2005-2006 Regis Houssin + * Copyright (C) 2005-2007 Regis Houssin * * 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 diff --git a/htdocs/html.form.class.php b/htdocs/html.form.class.php index dcc5c13cddc..2e478f39db8 100644 --- a/htdocs/html.form.class.php +++ b/htdocs/html.form.class.php @@ -929,11 +929,14 @@ class Form { global $langs,$conf; - $sql = "SELECT p.rowid, p.label, p.ref, p.price, pf.price as fprice, pf.quantity, p.duration"; + $sql = "SELECT p.rowid, p.label, p.ref, p.price, p.duration,"; + $sql.= " pf.ref_fourn,"; + $sql.= " pfp.price as fprice, pfp.quantity"; $sql.= " FROM ".MAIN_DB_PREFIX."product as p"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pf ON p.rowid = pf.fk_product"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur as pf ON p.rowid = pf.fk_product"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product"; $sql.= " WHERE p.envente = 1"; - if ($socid) $sql.= " AND pf.fk_soc = ".$socid; + if ($socid) $sql.= " AND pfp.fk_soc = ".$socid; if ($filtretype && $filtretype != '') $sql.=" AND p.fk_product_type=".$filtretype; if ($filtre) $sql.="$filtre"; $sql.= " ORDER BY p.ref DESC"; @@ -955,7 +958,7 @@ class Form $opt = '