Fix: modification du fonctionnement des produits fournisseurs !!!
This commit is contained in:
parent
1211ab9093
commit
417e918367
@ -626,13 +626,11 @@ else
|
||||
*/
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
$sql = "SELECT l.ref as ref_fourn, l.fk_prod_fourn_price, l.description, l.price, l.qty";
|
||||
$sql = "SELECT l.ref as ref_fourn, l.fk_product, l.description, l.price, l.qty";
|
||||
$sql.= ", l.rowid, l.tva_tx, l.remise_percent, l.subprice";
|
||||
$sql.= ", p.rowid as product_id, p.label, p.ref";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as l";
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_fournisseur_price as pfp ON l.fk_prod_fourn_price = pfp.rowid';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_fournisseur as pf ON pfp.fk_product_fournisseur = pf.rowid';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON pf.fk_product = p.rowid';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product = p.rowid';
|
||||
$sql.= " WHERE l.fk_commande = ".$commande->id;
|
||||
$sql.= " ORDER BY l.rowid";
|
||||
|
||||
|
||||
@ -112,12 +112,10 @@ class CommandeFournisseur extends Commande
|
||||
// export pdf -----------
|
||||
|
||||
$this->lignes = array();
|
||||
$sql = 'SELECT l.fk_prod_fourn_price, l.description, l.price, l.qty, l.rowid, l.tva_tx, l.remise_percent, l.subprice,';
|
||||
$sql = 'SELECT l.fk_product, l.description, l.price, l.qty, l.rowid, l.tva_tx, l.remise_percent, l.subprice,';
|
||||
$sql.= ' p.label, p.description as product_desc, p.ref, p.rowid as prodid';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'commande_fournisseurdet as l';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_fournisseur_price as pfp ON l.fk_prod_fourn_price = pfp.rowid';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_fournisseur as pf ON pfp.fk_product_fournisseur = pf.rowid';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON pf.fk_product = p.rowid';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product = p.rowid';
|
||||
$sql.= ' WHERE l.fk_commande = '.$this->id;
|
||||
$sql.= ' ORDER BY l.rowid';
|
||||
$result = $this->db->query($sql);
|
||||
@ -138,7 +136,6 @@ class CommandeFournisseur extends Commande
|
||||
$ligne->subprice = $objp->subprice;
|
||||
$ligne->remise_percent = $objp->remise_percent;
|
||||
$ligne->price = $objp->price;
|
||||
$ligne->fk_prod_fourn_price = $objp->fk_prod_fourn_price;
|
||||
|
||||
$ligne->libelle = $objp->label; // Label produit
|
||||
$ligne->product_desc = $objp->product_desc; // Description produit
|
||||
@ -719,8 +716,8 @@ class CommandeFournisseur extends Commande
|
||||
$price = $pu - $remise;
|
||||
}
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."commande_fournisseurdet (fk_commande,label,description,fk_prod_fourn_price, price, qty, tva_tx, remise_percent, subprice, remise, ref)";
|
||||
$sql .= " VALUES (".$this->id.", '" . addslashes($label) . "','" . addslashes($desc) . "',".$fk_prod_fourn_price.",".price2num($price,'MU').", '$qty', $txtva, $remise_percent,'".price2num($subprice,'MU')."','".price2num($remise)."','".$ref."') ;";
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."commande_fournisseurdet (fk_commande,label,description,fk_product, price, qty, tva_tx, remise_percent, subprice, remise, ref)";
|
||||
$sql .= " VALUES (".$this->id.", '" . addslashes($label) . "','" . addslashes($desc) . "',".$fk_product.",".price2num($price,'MU').", '$qty', $txtva, $remise_percent,'".price2num($subprice,'MU')."','".price2num($remise)."','".$ref."') ;";
|
||||
dolibarr_syslog('Fournisseur.commande.class::addline sql='.$sql);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
|
||||
@ -870,5 +870,4 @@ ALTER TABLE llx_product_fournisseur_price ADD INDEX idx_product_fournisseur_pric
|
||||
ALTER TABLE llx_product_fournisseur_price_log DROP COLUMN fk_soc;
|
||||
ALTER TABLE llx_product_fournisseur_price_log CHANGE fk_product fk_product_fournisseur integer NOT NULL;
|
||||
|
||||
ALTER TABLE llx_commande_fournisseurdet MODIFY fk_commande integer NOT NULL;
|
||||
ALTER TABLE llx_commande_fournisseurdet CHANGE fk_product fk_prod_fourn_price integer NOT NULL;
|
||||
ALTER TABLE llx_commande_fournisseurdet MODIFY fk_commande integer NOT NULL;
|
||||
@ -24,7 +24,7 @@ create table llx_commande_fournisseurdet
|
||||
(
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
fk_commande integer NOT NULL,
|
||||
fk_prod_fourn_price integer NOT NULL,
|
||||
fk_product integer NOT NULL,
|
||||
ref varchar(50),
|
||||
label varchar(255),
|
||||
description text,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user