2
0
forked from Wavyzz/dolibarr

Add update_total function (like on other element)

the goal is to have and use the same function in all the native standard element (proposal, order, bill / customer and fournish)
This commit is contained in:
BENKE Charlie
2016-09-21 12:05:18 +02:00
committed by GitHub
parent 39c4feaef7
commit cb736f5b93

View File

@@ -2481,6 +2481,38 @@ class SupplierInvoiceLine extends CommonObjectLine
$this->db->rollback();
return -2;
}
}
}
/**
* Mise a jour de l'objet ligne de commande en base
*
* @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."facture_fourn_det SET";
$sql.= " total_ht='".price2num($this->total_ht)."'";
$sql.= ", tva='".price2num($this->total_tva)."'";
$sql.= ", total_localtax1='".price2num($this->total_localtax1)."'";
$sql.= ", total_localtax2='".price2num($this->total_localtax2)."'";
$sql.= ", total_ttc='".price2num($this->total_ttc)."'";
$sql.= " WHERE rowid = ".$this->rowid;
dol_syslog("CommandeFournisseurLigne.class.php::update_total", LOG_DEBUG);
$resql=$this->db->query($sql);
if ($resql)
{
$this->db->commit();
return 1;
}
else
{
$this->error=$this->db->error();
$this->db->rollback();
return -2;
}
}
}