Fix: [ bug #233 ] Delete invoice problem with a discount
This commit is contained in:
parent
a4570c578e
commit
e08e07c493
@ -1205,8 +1205,8 @@ class Facture extends CommonObject
|
||||
if (sizeof($list_rowid_det))
|
||||
{
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'societe_remise_except';
|
||||
$sql.= ' SET fk_facture = NULL';
|
||||
$sql.= ' WHERE fk_facture IN ('.join(',',$list_rowid_det).')';
|
||||
$sql.= ' SET fk_facture = NULL, fk_facture_line = NULL';
|
||||
$sql.= ' WHERE fk_facture_line IN ('.join(',',$list_rowid_det).')';
|
||||
|
||||
dol_syslog("Facture.class::delete sql=".$sql);
|
||||
if (! $this->db->query($sql))
|
||||
@ -1644,7 +1644,7 @@ class Facture extends CommonObject
|
||||
if (! $error)
|
||||
{
|
||||
$this->oldref = '';
|
||||
|
||||
|
||||
// Rename directory if dir was a temporary ref
|
||||
if (preg_match('/^[\(]?PROV/i', $this->ref))
|
||||
{
|
||||
@ -1661,7 +1661,7 @@ class Facture extends CommonObject
|
||||
if (@rename($dirsource, $dirdest))
|
||||
{
|
||||
$this->oldref = $facref;
|
||||
|
||||
|
||||
dol_syslog("Rename ok");
|
||||
// Suppression ancien fichier PDF dans nouveau rep
|
||||
dol_delete_file($conf->facture->dir_output.'/'.$snumfa.'/'.$facref.'.*');
|
||||
@ -1899,7 +1899,7 @@ class Facture extends CommonObject
|
||||
$this->line->total_tva= (($this->type==2||$qty<0)?-abs($total_tva):$total_tva);
|
||||
$this->line->total_localtax1=(($this->type==2||$qty<0)?-abs($total_localtax1):$total_localtax1);
|
||||
$this->line->total_localtax2=(($this->type==2||$qty<0)?-abs($total_localtax2):$total_localtax2);
|
||||
$this->line->total_ttc= (($this->type==2||$qty<0)?-abs($total_ttc):$total_ttc);
|
||||
$this->line->total_ttc= (($this->type==2||$qty<0)?-abs($total_ttc):$total_ttc);
|
||||
$this->line->special_code=$special_code;
|
||||
$this->line->fk_parent_line=$fk_parent_line;
|
||||
$this->line->origin=$origin;
|
||||
@ -2003,12 +2003,12 @@ class Facture extends CommonObject
|
||||
|
||||
// Update line into database
|
||||
$this->line=new FactureLigne($this->db);
|
||||
|
||||
|
||||
// Stock previous line records
|
||||
$staticline=new FactureLigne($this->db);
|
||||
$staticline->fetch($rowid);
|
||||
$this->line->oldline = $staticline;
|
||||
|
||||
|
||||
$this->line->rowid = $rowid;
|
||||
$this->line->desc = $desc;
|
||||
$this->line->qty= ($this->type==2?abs($qty):$qty); // For credit note, quantity is always positive and unit price negative
|
||||
@ -2023,7 +2023,7 @@ class Facture extends CommonObject
|
||||
$this->line->total_tva= (($this->type==2||$qty<0)?-abs($total_tva):$total_tva);
|
||||
$this->line->total_localtax1=(($this->type==2||$qty<0)?-abs($total_localtax1):$total_localtax1);
|
||||
$this->line->total_localtax2=(($this->type==2||$qty<0)?-abs($total_localtax2):$total_localtax2);
|
||||
$this->line->total_ttc= (($this->type==2||$qty<0)?-abs($total_ttc):$total_ttc);
|
||||
$this->line->total_ttc= (($this->type==2||$qty<0)?-abs($total_ttc):$total_ttc);
|
||||
$this->line->info_bits = $info_bits;
|
||||
$this->line->product_type = $type;
|
||||
$this->line->fk_parent_line = $fk_parent_line;
|
||||
@ -3255,7 +3255,7 @@ class FactureLigne
|
||||
{
|
||||
var $db;
|
||||
var $error;
|
||||
|
||||
|
||||
var $oldline;
|
||||
|
||||
//! From llx_facturedet
|
||||
|
||||
Loading…
Reference in New Issue
Block a user