From 97ee69e88f9be8f39467b2e340581e12a3b19249 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 28 Aug 2021 18:52:43 +0200 Subject: [PATCH] Fix 0 insert instead of null --- htdocs/fourn/class/fournisseur.facture.class.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index e58dd24f0a1..39b9d97dde2 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -438,19 +438,19 @@ class FactureFournisseur extends CommonInvoice $sql .= " VALUES ("; $sql .= "'(PROV)'"; $sql .= ", '".$this->db->escape($this->ref_supplier)."'"; - $sql .= ", ".$conf->entity; + $sql .= ", ".((int) $conf->entity); $sql .= ", '".$this->db->escape($this->type)."'"; $sql .= ", '".$this->db->escape(isset($this->label) ? $this->label : (isset($this->libelle) ? $this->libelle : ''))."'"; - $sql .= ", ".$this->socid; + $sql .= ", ".((int) $this->socid); $sql .= ", '".$this->db->idate($now)."'"; $sql .= ", '".$this->db->idate($this->date)."'"; - $sql .= ", ".($this->fk_project > 0 ? $this->fk_project : "null"); - $sql .= ", ".($this->cond_reglement_id > 0 ? $this->cond_reglement_id : "null"); - $sql .= ", ".($this->mode_reglement_id > 0 ? $this->mode_reglement_id : "null"); - $sql .= ", ".($this->fk_account > 0 ? $this->fk_account : 'NULL'); + $sql .= ", ".($this->fk_project > 0 ? ((int) $this->fk_project) : "null"); + $sql .= ", ".($this->cond_reglement_id > 0 ? ((int) $this->cond_reglement_id) : "null"); + $sql .= ", ".($this->mode_reglement_id > 0 ? ((int) $this->mode_reglement_id) : "null"); + $sql .= ", ".($this->fk_account > 0 ? ((int) $this->fk_account) : 'NULL'); $sql .= ", '".$this->db->escape($this->note_private)."'"; $sql .= ", '".$this->db->escape($this->note_public)."'"; - $sql .= ", ".$user->id.","; + $sql .= ", ".((int) $user->id).","; $sql .= $this->date_echeance != '' ? "'".$this->db->idate($this->date_echeance)."'" : "null"; $sql .= ", ".(int) $this->fk_incoterms; $sql .= ", '".$this->db->escape($this->location_incoterms)."'"; @@ -3426,7 +3426,7 @@ class SupplierInvoiceLine extends CommonObjectLine $sql .= ", fk_product = ".((int) $fk_product); $sql .= ", product_type = ".((int) $this->product_type); $sql .= ", info_bits = ".((int) $this->info_bits); - $sql .= ", fk_unit = ".((int) $fk_unit); + $sql .= ", fk_unit = ".($fk_unit > 0 ? (int) $fk_unit : 'null'); // Multicurrency $sql .= " , multicurrency_subprice=".price2num($this->multicurrency_subprice)."";