Le descriptif de ligne de propal est propagé à la facture créée.

This commit is contained in:
Laurent Destailleur 2005-08-13 23:14:42 +00:00
parent e7861691b8
commit 4962c51fae

View File

@ -486,47 +486,50 @@ class Propal
$this->ref_url = '<a href="'.DOL_URL_ROOT.'/comm/propal.php?propalid='.$this->id.'">'.$this->ref.'</a>'; $this->ref_url = '<a href="'.DOL_URL_ROOT.'/comm/propal.php?propalid='.$this->id.'">'.$this->ref.'</a>';
/* /*
* Lignes produits * Lignes propales liées à un produit
*/ */
$sql = "SELECT d.description, p.rowid, p.label, p.description as product_desc, p.ref, d.price, d.tva_tx, d.qty, d.remise_percent, d.subprice";
$sql = "SELECT p.rowid, p.label, p.description, p.ref, d.price, d.tva_tx, d.qty, d.remise_percent, d.subprice"; $sql .= " FROM ".MAIN_DB_PREFIX."propaldet as d, ".MAIN_DB_PREFIX."product as p";
$sql .= " FROM ".MAIN_DB_PREFIX."propaldet as d, ".MAIN_DB_PREFIX."product as p"; $sql .= " WHERE d.fk_propal = ".$this->id ." AND d.fk_product = p.rowid";
$sql .= " WHERE d.fk_propal = ".$this->id ." AND d.fk_product = p.rowid ORDER by d.rowid ASC"; $sql .= " ORDER by d.rowid ASC";
$result = $this->db->query($sql); $result = $this->db->query($sql);
if ($result) if ($result)
{ {
$num = $this->db->num_rows($result); $num = $this->db->num_rows($result);
$i = 0; $i = 0;
while ($i < $num) while ($i < $num)
{ {
$objp = $this->db->fetch_object($result); $objp = $this->db->fetch_object($result);
$ligne = new PropaleLigne(); $ligne = new PropaleLigne();
$ligne->libelle = stripslashes($objp->label); $ligne->desc = stripslashes($objp->description); // Description ligne
$ligne->desc = stripslashes($objp->description); $ligne->libelle = stripslashes($objp->label); // Label produit
$ligne->qty = $objp->qty; $ligne->product_desc = stripslashes($objp->product_desc); // Description produit
$ligne->ref = $objp->ref; $ligne->qty = $objp->qty;
$ligne->tva_tx = $objp->tva_tx; $ligne->ref = $objp->ref;
$ligne->subprice = $objp->subprice; $ligne->tva_tx = $objp->tva_tx;
$ligne->remise_percent = $objp->remise_percent; $ligne->subprice = $objp->subprice;
$ligne->price = $objp->price; $ligne->remise_percent = $objp->remise_percent;
$ligne->product_id = $objp->rowid; $ligne->price = $objp->price;
$ligne->product_id = $objp->rowid;
$this->lignes[$i] = $ligne;
$i++; $this->lignes[$i] = $ligne;
} //dolibarr_syslog("1 ".$ligne->desc);
$this->db->free($result); //dolibarr_syslog("2 ".$ligne->product_desc);
} $i++;
else }
{ $this->db->free($result);
dolibarr_syslog("Propal::Fetch Erreur lecture des produits"); }
return -1; else
} {
dolibarr_syslog("Propal::Fetch Erreur lecture des produits");
return -1;
}
/* /*
* Lignes propales * Lignes propales liées à aucun produit
*/ */
$sql = "SELECT d.qty, d.description, d.price, d.subprice, d.tva_tx, d.rowid, d.remise_percent"; $sql = "SELECT d.qty, d.description, d.price, d.subprice, d.tva_tx, d.rowid, d.remise_percent";
$sql .= " FROM ".MAIN_DB_PREFIX."propaldet as d"; $sql .= " FROM ".MAIN_DB_PREFIX."propaldet as d";