Fix sql syntax error

This commit is contained in:
Laurent Destailleur 2022-02-10 16:35:50 +01:00
parent 16e4e736fd
commit 2c6b6ce4d1

View File

@ -1121,8 +1121,8 @@ class FactureFournisseurRec extends CommonInvoice
} }
$sql = 'UPDATE ' . MAIN_DB_PREFIX . 'facture_fourn_det_rec SET'; $sql = 'UPDATE ' . MAIN_DB_PREFIX . 'facture_fourn_det_rec SET';
$sql .= 'fk_facture_fourn= ' . $facid;; $sql .= ' fk_facture_fourn = ' . ((int) $facid);
$sql .= ', fk_product=' . (! empty($fk_product) ? "'" . $this->db->escape($fk_product) . "'" : 'null'); $sql .= ', fk_product = ' . ($fk_product > 0 ? ((int) $fk_product) : 'null');
$sql .= ", ref = '" . $this->db->escape($ref) . "'"; $sql .= ", ref = '" . $this->db->escape($ref) . "'";
$sql .= ", label = '" . $this->db->escape($label) . "'"; $sql .= ", label = '" . $this->db->escape($label) . "'";
$sql .= ", description = '" . $this->db->escape($desc) . "'"; $sql .= ", description = '" . $this->db->escape($desc) . "'";
@ -2123,8 +2123,8 @@ class FactureFournisseurLigneRec extends CommonObjectLine
$sql .= ' fk_facture_fourn = ' . (int) $this->fk_facture_fourn; $sql .= ' fk_facture_fourn = ' . (int) $this->fk_facture_fourn;
$sql .= ', fk_parent_line = ' . (int) $this->fk_parent; $sql .= ', fk_parent_line = ' . (int) $this->fk_parent;
$sql .= ', fk_product = ' . (int) $this->fk_product; $sql .= ', fk_product = ' . (int) $this->fk_product;
$sql .= ', ref = ' . (! empty($this->ref) ? "'" . $this->db->escape($this->ref) . "'" : 'null') . "'"; $sql .= ', ref = ' . (! empty($this->ref) ? "'" . $this->db->escape($this->ref) . "'" : 'null');
$sql .= ", label ='" . (! empty($this->label) ? "'" . $this->db->escape($this->label) . "'" : 'null') . "'"; $sql .= ", label = " . (! empty($this->label) ? "'" . $this->db->escape($this->label) . "'" : 'null');
$sql .= ", description = '" . $this->db->escape($this->description) . "'"; $sql .= ", description = '" . $this->db->escape($this->description) . "'";
$sql .= ', pu_ht = ' . price2num($this->pu_ht); $sql .= ', pu_ht = ' . price2num($this->pu_ht);
$sql .= ', pu_ttc = ' . price2num($this->pu_ttc); $sql .= ', pu_ttc = ' . price2num($this->pu_ttc);