This commit is contained in:
Laurent Destailleur 2016-11-22 20:17:20 +01:00
parent f4fb07b570
commit 97034a7dff

View File

@ -2821,7 +2821,8 @@ class Facture extends CommonInvoice
*/ */
function deleteline($rowid) function deleteline($rowid)
{ {
global $user;
dol_syslog(get_class($this)."::deleteline rowid=".$rowid, LOG_DEBUG); dol_syslog(get_class($this)."::deleteline rowid=".$rowid, LOG_DEBUG);
if (! $this->brouillon) if (! $this->brouillon)
@ -2847,13 +2848,14 @@ class Facture extends CommonInvoice
} }
$line=new FactureLigne($this->db); $line=new FactureLigne($this->db);
$line->context = $this->context; $line->context = $this->context;
// For triggers // For triggers
$line->fetch($rowid); $result = $line->fetch($rowid);
if (! ($result > 0)) dol_print_error($db, $line->error, $line->errors);
if ($line->delete() > 0)
if ($line->delete($user) > 0)
{ {
$result=$this->update_price(1); $result=$this->update_price(1);
@ -4208,13 +4210,13 @@ class FactureLigne extends CommonInvoiceLine
$sql.= ' fd.date_start as date_start, fd.date_end as date_end, fd.fk_product_fournisseur_price as fk_fournprice, fd.buy_price_ht as pa_ht,'; $sql.= ' fd.date_start as date_start, fd.date_end as date_end, fd.fk_product_fournisseur_price as fk_fournprice, fd.buy_price_ht as pa_ht,';
$sql.= ' fd.info_bits, fd.special_code, fd.total_ht, fd.total_tva, fd.total_ttc, fd.total_localtax1, fd.total_localtax2, fd.rang,'; $sql.= ' fd.info_bits, fd.special_code, fd.total_ht, fd.total_tva, fd.total_ttc, fd.total_localtax1, fd.total_localtax2, fd.rang,';
$sql.= ' fd.fk_code_ventilation,'; $sql.= ' fd.fk_code_ventilation,';
$sql.= ' fd.fk_unit, fk_user_author, fk_user_modif,'; $sql.= ' fd.fk_unit, fd.fk_user_author, fd.fk_user_modif,';
$sql.= ' fd.situation_percent, fd.fk_prev_id,'; $sql.= ' fd.situation_percent, fd.fk_prev_id,';
$sql.= ' fd.multicurrency_subprice,';
$sql.= ' fd.multicurrency_total_ht,';
$sql.= ' fd.multicurrency_total_tva,';
$sql.= ' fd.multicurrency_total_ttc,';
$sql.= ' p.ref as product_ref, p.label as product_libelle, p.description as product_desc'; $sql.= ' p.ref as product_ref, p.label as product_libelle, p.description as product_desc';
$sql.= ' , fd.multicurrency_subprice';
$sql.= ' , fd.multicurrency_total_ht';
$sql.= ' , fd.multicurrency_total_tva';
$sql.= ' , fd.multicurrency_total_ttc';
$sql.= ' FROM '.MAIN_DB_PREFIX.'facturedet as fd'; $sql.= ' FROM '.MAIN_DB_PREFIX.'facturedet as fd';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON fd.fk_product = p.rowid'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON fd.fk_product = p.rowid';
$sql.= ' WHERE fd.rowid = '.$rowid; $sql.= ' WHERE fd.rowid = '.$rowid;
@ -4278,6 +4280,7 @@ class FactureLigne extends CommonInvoiceLine
} }
else else
{ {
$this->error = $this->db->lasterror();
return -1; return -1;
} }
} }
@ -4633,8 +4636,9 @@ class FactureLigne extends CommonInvoiceLine
/** /**
* Delete line in database * Delete line in database
* * TODO Add param User $user and notrigger (see skeleton)
* @return int <0 if KO, >0 if OK *
* @return int <0 if KO, >0 if OK
*/ */
function delete() function delete()
{ {