Bugfix sur les remises exceptionnelles

This commit is contained in:
Rodolphe Quiedeville 2005-04-04 08:14:40 +00:00
parent 5e2684bac0
commit b9b44660bb

View File

@ -125,7 +125,6 @@ class Facture
$datelim=mktime(0,0,0,$mois,$fins[$mois-1],$annee); $datelim=mktime(0,0,0,$mois,$fins[$mois-1],$annee);
} }
/* /*
* Lecture de la remise exceptionnelle * Lecture de la remise exceptionnelle
* *
@ -135,16 +134,18 @@ class Facture
$sql .= " WHERE rc.fk_soc =". $this->socidp; $sql .= " WHERE rc.fk_soc =". $this->socidp;
$sql .= " AND fk_facture IS NULL"; $sql .= " AND fk_facture IS NULL";
if ( $this->db->query($sql) ) $resql = $this->db->query($sql) ;
if ( $resql)
{ {
$nurmx = $this->db->num_rows(); $nurmx = $this->db->num_rows($resql);
if ($nurmx > 0) if ($nurmx > 0)
{ {
$row = $this->db->fetch_row(); $row = $this->db->fetch_row($resql);
$this->remise_exceptionnelle = $row[0]; $this->remise_exceptionnelle = $row[0];
} }
$this->db->free(); $this->db->free($resql);
} }
/* /*
* Insertion dans la base * Insertion dans la base
@ -249,7 +250,7 @@ class Facture
if ( $result_insert < 0) if ( $result_insert < 0)
{ {
dolibarr_print_error($this->db); dolibarr_print_error($this->db);
} }
} }
} }
@ -268,7 +269,9 @@ class Facture
'19.6'); '19.6');
$sql = "UPDATE ".MAIN_DB_PREFIX."societe_remise_except"; $sql = "UPDATE ".MAIN_DB_PREFIX."societe_remise_except";
$sql .= " SET fk_facture = $this->id WHERE fk_facture IS NULL"; $sql .= " SET fk_facture = ".$this->id;
$sql .= " WHERE fk_facture IS NULL";
$sql .= " AND fk_soc =". $this->socidp;
$this->db->query( $sql) ; $this->db->query( $sql) ;
} }