Qual: Uniformisation du code. On utilise fk_product partout pour stocker l'id du produit dans les entites
This commit is contained in:
parent
49468fadfa
commit
bee23ad216
@ -117,7 +117,7 @@ class Commande extends CommonObject
|
||||
$CommLigne->tva_tx = $propal->lignes[$i]->tva_tx;
|
||||
$CommLigne->qty = $propal->lignes[$i]->qty;
|
||||
$CommLigne->remise_percent = $propal->lignes[$i]->remise_percent;
|
||||
$CommLigne->fk_product = $propal->lignes[$i]->product_id;
|
||||
$CommLigne->fk_product = $propal->lignes[$i]->fk_product;
|
||||
$this->lines[$i] = $CommLigne;
|
||||
}
|
||||
|
||||
@ -1984,30 +1984,18 @@ class CommandeLigne
|
||||
* \brief Mise a jour de l'objet ligne de commande en base
|
||||
* \return int <0 si ko, >0 si ok
|
||||
*/
|
||||
function update()
|
||||
function update_total()
|
||||
{
|
||||
$this->db->begin();
|
||||
|
||||
// Mise a jour ligne en base
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."commandedet SET";
|
||||
$sql.= " description='".addslashes($this->desc)."'";
|
||||
$sql.= ",price='".price2num($this->price)."'";
|
||||
$sql.= ",subprice='".price2num($this->subprice)."'";
|
||||
$sql.= ",remise='".price2num($this->remise)."'";
|
||||
$sql.= ",remise_percent='".price2num($this->remise_percent)."'";
|
||||
if ($fk_remise_except) $sql.= ",fk_remise_except=".$this->fk_remise_except;
|
||||
else $sql.= ",fk_remise_except=null";
|
||||
$sql.= ",tva_tx='".price2num($this->tva_tx)."'";
|
||||
$sql.= ",qty='".price2num($this->qty)."'";
|
||||
$sql.= ",rang='".$this->rang."'";
|
||||
$sql.= ",coef='".$this->coef."'";
|
||||
$sql.= ",info_bits='".$this->info_bits."'";
|
||||
$sql.= ",total_ht='".price2num($this->total_ht)."'";
|
||||
$sql.= " total_ht='".price2num($this->total_ht)."'";
|
||||
$sql.= ",total_tva='".price2num($this->total_tva)."'";
|
||||
$sql.= ",total_ttc='".price2num($this->total_ttc)."'";
|
||||
$sql.= " WHERE rowid = ".$this->rowid;
|
||||
|
||||
dolibarr_syslog("CommandeLigne.class.php::update sql=$sql");
|
||||
dolibarr_syslog("CommandeLigne.class.php::update_total sql=$sql");
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
@ -2018,7 +2006,7 @@ class CommandeLigne
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dolibarr_syslog("CommandeLigne.class.php::update Error ".$this->error);
|
||||
dolibarr_syslog("CommandeLigne.class.php::update_total Error ".$this->error);
|
||||
$this->db->rollback();
|
||||
return -2;
|
||||
}
|
||||
|
||||
@ -256,7 +256,7 @@ if ($_POST['action'] == 'add')
|
||||
$prop->lignes[$i]->subprice,
|
||||
$prop->lignes[$i]->qty,
|
||||
$prop->lignes[$i]->tva_tx,
|
||||
$prop->lignes[$i]->product_id,
|
||||
$prop->lignes[$i]->fk_product,
|
||||
$prop->lignes[$i]->remise_percent);
|
||||
}
|
||||
}
|
||||
@ -339,7 +339,7 @@ if ($_POST['action'] == 'add')
|
||||
$lines[$i]->subprice,
|
||||
$lines[$i]->qty,
|
||||
$lines[$i]->tva_tx,
|
||||
$lines[$i]->product_id,
|
||||
$lines[$i]->fk_product,
|
||||
$lines[$i]->remise_percent,
|
||||
$date_start,
|
||||
$date_end);
|
||||
|
||||
@ -364,7 +364,7 @@ class Contrat extends CommonObject
|
||||
$ligne->statut = $objp->statut;
|
||||
$ligne->remise_percent = $objp->remise_percent;
|
||||
$ligne->price = $objp->price;
|
||||
$ligne->product_id = $objp->rowid;
|
||||
$ligne->fk_product = $objp->rowid;
|
||||
|
||||
$ligne->date_debut_prevue = $objp->date_ouverture_prevue;
|
||||
$ligne->date_debut_reel = $objp->date_ouverture;
|
||||
@ -412,7 +412,7 @@ class Contrat extends CommonObject
|
||||
$ligne->subprice = $objp->subprice;
|
||||
$ligne->remise_percent = $objp->remise_percent;
|
||||
$ligne->price = $objp->price;
|
||||
$ligne->product_id = 0;
|
||||
$ligne->fk_product = 0;
|
||||
|
||||
$ligne->date_debut_prevue = $objp->date_ouverture_prevue;
|
||||
$ligne->date_debut_reel = $objp->date_ouverture;
|
||||
@ -1096,7 +1096,7 @@ class ContratLigne
|
||||
var $subprice;
|
||||
var $remise_percent;
|
||||
var $price;
|
||||
var $product_id;
|
||||
var $fk_product;
|
||||
|
||||
var $statut;
|
||||
var $date_debut_prevue;
|
||||
|
||||
@ -471,7 +471,7 @@ if ($_GET["id"] > 0)
|
||||
{
|
||||
if ($value > 0)
|
||||
{
|
||||
$sql = "SELECT e.rowid as entrepot_id, e.label as entrepot, ps.reel, p.label, p.ref, p.rowid as product_id";
|
||||
$sql = "SELECT e.rowid as entrepot_id, e.label as entrepot, ps.reel, p.label, p.ref, p.rowid as fk_product";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."entrepot as e, ".MAIN_DB_PREFIX."product_stock as ps, ".MAIN_DB_PREFIX."product as p";
|
||||
$sql .= " WHERE e.rowid = ps.fk_entrepot AND ps.fk_product = p.rowid AND ps.fk_product = $key";
|
||||
$sql .= " AND e.statut = 1 AND reel < $value";
|
||||
@ -488,7 +488,7 @@ if ($_GET["id"] > 0)
|
||||
$obja = $db->fetch_object($resql);
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td width="30%">';
|
||||
print '<a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$objp->product_id.'">'.img_object($langs->trans("ShowProduct"),"product").' '.$obja->ref.'</a> - '.$obja->label;
|
||||
print '<a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$objp->fk_product.'">'.img_object($langs->trans("ShowProduct"),"product").' '.$obja->ref.'</a> - '.$obja->label;
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/product/stock/fiche.php?id='.$obja->entrepot_id.'">'.$obja->entrepot.'</td>';
|
||||
print '<td><b>Stock : '.$obja->reel.'</b>' .img_warning($langs->trans("Alert")).'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
@ -165,7 +165,7 @@ class Expedition extends CommonObject
|
||||
{
|
||||
if ($this->commande->lignes[$j]->id == $commande_ligne_id)
|
||||
{
|
||||
$idprod = $this->commande->lignes[$j]->product_id;
|
||||
$idprod = $this->commande->lignes[$j]->fk_product;
|
||||
}
|
||||
$j++;
|
||||
}
|
||||
@ -250,7 +250,7 @@ class Expedition extends CommonObject
|
||||
$ligne->commande_ligne_id = $objp->fk_commande_ligne;
|
||||
$ligne->product_desc = $objp->description; // Description ligne
|
||||
$ligne->qty_commande = $objp->qtycom;
|
||||
$ligne->product_id = $objp->fk_product;
|
||||
$ligne->fk_product = $objp->fk_product;
|
||||
|
||||
$ligne->libelle = $objp->label; // Label produit
|
||||
$ligne->ref = $objp->ref;
|
||||
@ -571,7 +571,7 @@ class Expedition extends CommonObject
|
||||
$ligne = new ExpeditionLigne();
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$ligne->product_id = $obj->fk_product;
|
||||
$ligne->fk_product = $obj->fk_product;
|
||||
$ligne->qty_commande = $obj->qtycom;
|
||||
$ligne->qty_expedition = $obj->qtyexp;
|
||||
$ligne->description = stripslashes($obj->description);
|
||||
@ -588,20 +588,22 @@ class Expedition extends CommonObject
|
||||
|
||||
class ExpeditionLigne
|
||||
{
|
||||
// From llx_expeditiondet
|
||||
var $qty;
|
||||
var $qty_expedition;
|
||||
var $product_id;
|
||||
var $db;
|
||||
|
||||
// From llx_commandedet
|
||||
var $qty_commande;
|
||||
var $libelle; // Label produit
|
||||
var $product_desc; // Description produit
|
||||
var $ref;
|
||||
// From llx_expeditiondet
|
||||
var $qty;
|
||||
var $qty_expedition;
|
||||
var $fk_product;
|
||||
|
||||
// From llx_commandedet
|
||||
var $qty_commande;
|
||||
var $libelle; // Label produit
|
||||
var $product_desc; // Description produit
|
||||
var $ref;
|
||||
|
||||
function ExpeditionLigne()
|
||||
function ExpeditionLigne($DB)
|
||||
{
|
||||
|
||||
$this->db=$DB;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -250,13 +250,13 @@ if ($_GET["action"] == 'create')
|
||||
$ligne = $commande->lignes[$i];
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]>\n";
|
||||
if ($ligne->product_id > 0)
|
||||
if ($ligne->fk_product > 0)
|
||||
{
|
||||
$product = new Product($db);
|
||||
$product->fetch($ligne->product_id);
|
||||
$product->fetch($ligne->fk_product);
|
||||
|
||||
print '<td>';
|
||||
print '<a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$ligne->product_id.'">'.img_object($langs->trans("ShowProduct"),"product").' '.$product->ref.'</a> - '.$product->libelle;
|
||||
print '<a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$ligne->fk_product.'">'.img_object($langs->trans("ShowProduct"),"product").' '.$product->ref.'</a> - '.$product->libelle;
|
||||
if ($ligne->description) print nl2br($ligne->description);
|
||||
print '</td>';
|
||||
}
|
||||
@ -270,7 +270,7 @@ if ($_GET["action"] == 'create')
|
||||
*
|
||||
*/
|
||||
print '<td align="center">';
|
||||
$quantite_livree = $commande->expeditions[$ligne->product_id];
|
||||
$quantite_livree = $commande->expeditions[$ligne->fk_product];
|
||||
print $quantite_livree;;
|
||||
print '</td>';
|
||||
|
||||
|
||||
@ -115,7 +115,7 @@ Class pdf_expedition_dorade extends ModelePdfExpedition
|
||||
{
|
||||
$a = $this->pdf->tableau_top + 14 + ($i * 16);
|
||||
|
||||
$this->pdf->i25(8, ($a - 2), "000000".$this->expe->lignes[$i]->product_id, 1, 8);
|
||||
$this->pdf->i25(8, ($a - 2), "000000".$this->expe->lignes[$i]->fk_product, 1, 8);
|
||||
|
||||
$this->pdf->Text(40, $a, $this->expe->lignes[$i]->description);
|
||||
|
||||
|
||||
@ -132,7 +132,7 @@ Class pdf_expedition_merou extends ModelePdfExpedition
|
||||
for ($i = 0 ; $i < $nblignes ; $i++){
|
||||
//Generation du produit
|
||||
$Prod = new Product($this->db);
|
||||
$Prod->fetch($Produits[$i]->product_id);
|
||||
$Prod->fetch($Produits[$i]->fk_product);
|
||||
//Creation des cases à cocher
|
||||
$pdf->rect(10+3, $curY+1, 3, 3);
|
||||
$pdf->rect(20+3, $curY+1, 3, 3);
|
||||
|
||||
@ -2104,9 +2104,8 @@ class FactureLigne
|
||||
|
||||
// From llx_facturedet
|
||||
var $rowid;
|
||||
var $fk_facture;
|
||||
var $desc; // Description ligne
|
||||
var $product_id; // Id produit prédéfini
|
||||
var $fk_facture; // Id produit prédéfini
|
||||
|
||||
var $qty; // Quantité (exemple 2)
|
||||
var $subprice; // P.U. HT (exemple 100)
|
||||
@ -2300,6 +2299,38 @@ class FactureLigne
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Mise a jour en base des champs total_xxx de ligne de facture
|
||||
* \return int <0 si ko, >0 si ok
|
||||
*/
|
||||
function update_total()
|
||||
{
|
||||
$this->db->begin();
|
||||
|
||||
// Mise a jour ligne en base
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."facturedet SET";
|
||||
$sql.= " total_ht='".price2num($this->total_ht)."'";
|
||||
$sql.= ",total_tva='".price2num($this->total_tva)."'";
|
||||
$sql.= ",total_ttc='".price2num($this->total_ttc)."'";
|
||||
$sql.= " WHERE rowid = ".$this->rowid;
|
||||
|
||||
dolibarr_syslog("FactureLigne::update_total sql=$sql");
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dolibarr_syslog("FactureLigne::update_total Error ".$this->error);
|
||||
$this->db->rollback();
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@ -207,11 +207,11 @@ class pdf_muscadet extends ModelePDFCommandesSuppliers
|
||||
$libelleproduitservice.=$com->lignes[$i]->desc;
|
||||
}
|
||||
// Si ligne associée à un code produit
|
||||
if ($com->lignes[$i]->product_id)
|
||||
if ($com->lignes[$i]->fk_product)
|
||||
{
|
||||
$prodser = new Product($this->db);
|
||||
|
||||
$prodser->fetch($com->lignes[$i]->product_id);
|
||||
$prodser->fetch($com->lignes[$i]->fk_product);
|
||||
if ($prodser->ref)
|
||||
{
|
||||
$libelleproduitservice=$langs->trans("Product")." ".$prodser->ref." - ".$libelleproduitservice;
|
||||
|
||||
@ -131,7 +131,7 @@ class Fournisseur extends Societe
|
||||
}
|
||||
|
||||
|
||||
function ProductCommande($user, $product_id)
|
||||
function ProductCommande($user, $fk_product)
|
||||
{
|
||||
include_once(DOL_DOCUMENT_ROOT."/fourn/fournisseur.commande.class.php");
|
||||
include_once(DOL_DOCUMENT_ROOT."/product.class.php");
|
||||
@ -158,7 +158,7 @@ class Fournisseur extends Societe
|
||||
if ($idc > 0)
|
||||
{
|
||||
$prod = new Product($this->db);
|
||||
$prod->fetch($product_id);
|
||||
$prod->fetch($fk_product);
|
||||
$prod->fetch_fourn_data($this->id);
|
||||
|
||||
$commf->fetch($idc);
|
||||
|
||||
@ -133,7 +133,7 @@ class CommandeFournisseur extends Commande
|
||||
$ligne->subprice = $objp->subprice;
|
||||
$ligne->remise_percent = $objp->remise_percent;
|
||||
$ligne->price = $objp->price;
|
||||
$ligne->product_id = $objp->fk_product;
|
||||
$ligne->fk_product = $objp->fk_product;
|
||||
|
||||
$ligne->libelle = $objp->label; // Label produit
|
||||
$ligne->product_desc = $objp->product_desc; // Description produit
|
||||
@ -1014,7 +1014,7 @@ class CommandeFournisseurLigne extends CommandeLigne
|
||||
var $subprice;
|
||||
var $remise_percent;
|
||||
var $price;
|
||||
var $product_id;
|
||||
var $fk_product;
|
||||
var $desc; // Description ligne
|
||||
|
||||
// From llx_product
|
||||
|
||||
@ -232,11 +232,11 @@ class pdf_propale_azur extends ModelePDFPropales
|
||||
$libelleproduitservice.=$propale->lignes[$i]->desc;
|
||||
}
|
||||
// Si ligne associée à un code produit
|
||||
if ($propale->lignes[$i]->product_id)
|
||||
if ($propale->lignes[$i]->fk_product)
|
||||
{
|
||||
$prodser = new Product($this->db);
|
||||
|
||||
$prodser->fetch($propale->lignes[$i]->product_id);
|
||||
$prodser->fetch($propale->lignes[$i]->fk_product);
|
||||
if ($prodser->ref)
|
||||
{
|
||||
$prefix_prodserv = "";
|
||||
|
||||
@ -268,13 +268,13 @@ if ($_GET["action"] == 'create')
|
||||
$ligne = $commande->lignes[$i];
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]>\n";
|
||||
if ($ligne->product_id > 0)
|
||||
if ($ligne->fk_product > 0)
|
||||
{
|
||||
$product = new Product($db);
|
||||
$product->fetch($ligne->product_id);
|
||||
$product->fetch($ligne->fk_product);
|
||||
|
||||
print '<td>';
|
||||
print '<a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$ligne->product_id.'">'.img_object($langs->trans("ShowProduct"),"product").' '.$product->ref.'</a> - '.$product->libelle;
|
||||
print '<a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$ligne->fk_product.'">'.img_object($langs->trans("ShowProduct"),"product").' '.$product->ref.'</a> - '.$product->libelle;
|
||||
if ($ligne->description) print nl2br($ligne->description);
|
||||
print '</td>';
|
||||
}
|
||||
@ -288,7 +288,7 @@ if ($_GET["action"] == 'create')
|
||||
*
|
||||
*/
|
||||
print '<td align="center">';
|
||||
$quantite_livree = $commande->livraisons[$ligne->product_id];
|
||||
$quantite_livree = $commande->livraisons[$ligne->fk_product];
|
||||
print $quantite_livree;;
|
||||
print '</td>';
|
||||
|
||||
|
||||
@ -173,7 +173,7 @@ class Livraison extends CommonObject
|
||||
{
|
||||
if ($this->commande->lignes[$j]->id == $commande_ligne_id)
|
||||
{
|
||||
$idprod = $this->commande->lignes[$j]->product_id;
|
||||
$idprod = $this->commande->lignes[$j]->fk_product;
|
||||
}
|
||||
$j++;
|
||||
}
|
||||
@ -427,7 +427,7 @@ class Livraison extends CommonObject
|
||||
$LivraisonLigne->libelle = $expedition->lignes[$i]->libelle;
|
||||
$LivraisonLigne->description = $expedition->lignes[$i]->product_desc;
|
||||
$LivraisonLigne->qty = $expedition->lignes[$i]->qty_commande;
|
||||
$LivraisonLigne->product_id = $expedition->lignes[$i]->product_id;
|
||||
$LivraisonLigne->fk_product = $expedition->lignes[$i]->fk_product;
|
||||
$LivraisonLigne->ref = $expedition->lignes[$i]->ref;
|
||||
$this->lignes[$i] = $LivraisonLigne;
|
||||
}
|
||||
@ -585,7 +585,7 @@ class Livraison extends CommonObject
|
||||
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$ligne->product_id = $obj->fk_product;
|
||||
$ligne->fk_product = $obj->fk_product;
|
||||
$ligne->qty_commande = $obj->qtycom;
|
||||
$ligne->qty_livre = $obj->qtyliv;
|
||||
$ligne->ref = $obj->ref;
|
||||
|
||||
@ -208,11 +208,11 @@ class pdf_typhon extends ModelePDFDeliveryOrder
|
||||
$libelleproduitservice.=$lignesdelivery[$i]->description;
|
||||
}
|
||||
// Si ligne associée à un code produit
|
||||
if ($lignesdelivery[$i]->product_id)
|
||||
if ($lignesdelivery[$i]->fk_product)
|
||||
{
|
||||
$prodser = new Product($this->db);
|
||||
|
||||
$prodser->fetch($lignesdelivery[$i]->product_id);
|
||||
$prodser->fetch($lignesdelivery[$i]->fk_product);
|
||||
if ($prodser->ref)
|
||||
{
|
||||
$libelleproduitservice=$langs->trans("Product")." ".$prodser->ref." - ".$libelleproduitservice;
|
||||
|
||||
@ -44,20 +44,20 @@ class MouvementStock
|
||||
* \brief Crée un mouvement en base
|
||||
* \return int <0 si ko, >0 si ok
|
||||
*/
|
||||
function _create($user, $product_id, $entrepot_id, $qty, $type)
|
||||
function _create($user, $fk_product, $entrepot_id, $qty, $type)
|
||||
{
|
||||
dolibarr_syslog("mouvementstock.class.php::create $user, $product_id, $entrepot_id, $qty, $type");
|
||||
dolibarr_syslog("mouvementstock.class.php::create $user, $fk_product, $entrepot_id, $qty, $type");
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."stock_mouvement (datem, fk_product, fk_entrepot, value, type_mouvement, fk_user_author)";
|
||||
$sql .= " VALUES (now(), $product_id, $entrepot_id, $qty, $type, $user->id)";
|
||||
$sql .= " VALUES (now(), $fk_product, $entrepot_id, $qty, $type, $user->id)";
|
||||
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."product_stock SET reel = reel + $qty";
|
||||
$sql.= " WHERE fk_entrepot = $entrepot_id AND fk_product = $product_id";
|
||||
$sql.= " WHERE fk_entrepot = $entrepot_id AND fk_product = $fk_product";
|
||||
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
@ -87,10 +87,10 @@ class MouvementStock
|
||||
*
|
||||
*
|
||||
*/
|
||||
function livraison($user, $product_id, $entrepot_id, $qty)
|
||||
function livraison($user, $fk_product, $entrepot_id, $qty)
|
||||
{
|
||||
|
||||
return $this->_create($user, $product_id, $entrepot_id, (0 - $qty), 2);
|
||||
return $this->_create($user, $fk_product, $entrepot_id, (0 - $qty), 2);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -862,15 +862,15 @@ class Propal extends CommonObject
|
||||
$ligne->coef = $objp->coef;
|
||||
$ligne->rang = $objp->rang;
|
||||
|
||||
$ligne->product_id = $objp->fk_product;
|
||||
$ligne->fk_product = $objp->fk_product;
|
||||
|
||||
$ligne->libelle = $objp->label; // Label produit
|
||||
$ligne->product_desc = $objp->product_desc; // Description produit
|
||||
$ligne->ref = $objp->ref;
|
||||
|
||||
$this->lignes[$i] = $ligne;
|
||||
//dolibarr_syslog("1 ".$ligne->product_id);
|
||||
//print "xx $i ".$this->lignes[$i]->product_id;
|
||||
//dolibarr_syslog("1 ".$ligne->fk_product);
|
||||
//print "xx $i ".$this->lignes[$i]->fk_product;
|
||||
$i++;
|
||||
}
|
||||
$this->db->free($result);
|
||||
@ -1922,7 +1922,7 @@ class Propal extends CommonObject
|
||||
$price,
|
||||
$ligne->qty,
|
||||
$tva_tx,
|
||||
$ligne->product_id,
|
||||
$ligne->fk_product,
|
||||
$ligne->remise_percent
|
||||
);
|
||||
|
||||
@ -2065,7 +2065,7 @@ class PropaleLigne
|
||||
var $rowid;
|
||||
var $fk_propal;
|
||||
var $desc; // Description ligne
|
||||
var $product_id; // Id produit prédéfini
|
||||
var $fk_product; // Id produit prédéfini
|
||||
|
||||
var $qty;
|
||||
var $tva_tx;
|
||||
@ -2239,7 +2239,39 @@ class PropaleLigne
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Mise a jour an base des champs total_xxx de ligne de propale
|
||||
* \return int <0 si ko, >0 si ok
|
||||
*/
|
||||
function update_total()
|
||||
{
|
||||
$this->db->begin();
|
||||
|
||||
// Mise a jour ligne en base
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."propaldet SET";
|
||||
$sql.= " total_ht='".price2num($this->total_ht)."'";
|
||||
$sql.= ",total_tva='".price2num($this->total_tva)."'";
|
||||
$sql.= ",total_ttc='".price2num($this->total_ttc)."'";
|
||||
$sql.= " WHERE rowid = ".$this->rowid;
|
||||
|
||||
dolibarr_syslog("PropaleLigne::update_total sql=$sql");
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dolibarr_syslog("PropaleLigne::update_total Error ".$this->error);
|
||||
$this->db->rollback();
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user