diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index ef3d96fed53..056d34018fc 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -398,7 +398,7 @@ class FactureRec extends CommonInvoice $sql .= ", '".$this->db->escape($facsrc->multicurrency_code)."'"; $sql .= ", ".((float) $facsrc->multicurrency_tx); $sql .= ", ".((int) $this->suspended); - $sql .= ", ".((int) $this->fk_societe_rib); + $sql .= ", ".(!empty($this->fk_societe_rib) ? ((int) $this->fk_societe_rib) : 'NULL'); $sql .= ")"; if ($this->db->query($sql)) { @@ -571,7 +571,7 @@ class FactureRec extends CommonInvoice $sql .= " localtax2 = ".((float) $this->total_localtax2).","; $sql .= " total_ht = ".((float) $this->total_ht).","; $sql .= " total_ttc = ".((float) $this->total_ttc).","; - $sql .= " fk_societe_rib = ".((int) $this->fk_societe_rib); + $sql .= " fk_societe_rib = ".(!empty($this->fk_societe_rib) ? ((int) $this->fk_societe_rib) : 'NULL');; // TODO Add missing fields $sql .= " WHERE rowid = ".((int) $this->id);