Fix 0 insert instead of null

This commit is contained in:
Laurent Destailleur 2021-08-28 18:52:43 +02:00
parent f7a9275c81
commit 97ee69e88f

View File

@ -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)."";