Fix: Plantage mise a jour si quot dans description ou libellé du produit

This commit is contained in:
Laurent Destailleur 2005-04-11 23:36:15 +00:00
parent 2f4f6a617d
commit 84972e20ec

View File

@ -162,26 +162,22 @@ class Product
$langs->load("main"); $langs->load("main");
$langs->load("products"); $langs->load("products");
if (! $this->libelle) $this->libelle = 'LIBELLE MANQUANT';
$this->ref = ereg_replace("\"","",stripslashes($this->ref)); $this->ref = ereg_replace("\"","",stripslashes($this->ref));
$this->ref = ereg_replace("'","",stripslashes($this->ref)); $this->ref = ereg_replace("'","",stripslashes($this->ref));
if (strlen(trim($this->libelle)) == 0) $this->ref = trim($this->ref);
{ $this->libelle = trim($this->libelle);
$this->libelle = 'LIBELLE MANQUANT'; $this->description = trim($this->description);
}
$sql = "UPDATE ".MAIN_DB_PREFIX."product "; $sql = "UPDATE ".MAIN_DB_PREFIX."product ";
$sql .= " SET label = '" . trim($this->libelle) ."'"; $sql .= " SET label = '" . addslashes($this->libelle) ."'";
if (strlen(trim($this->ref))) if ($this->ref) $sql .= ",ref = '" . $this->ref ."'";
{
$sql .= ",ref = '" . trim($this->ref) ."'";
}
$sql .= ",tva_tx = " . $this->tva_tx ; $sql .= ",tva_tx = " . $this->tva_tx ;
$sql .= ",envente = " . $this->envente ; $sql .= ",envente = " . $this->envente ;
$sql .= ",seuil_stock_alerte = " . $this->seuil_stock_alerte ; $sql .= ",seuil_stock_alerte = " . $this->seuil_stock_alerte ;
$sql .= ",description = '" . trim($this->description) ."'"; $sql .= ",description = '" . addslashes($this->description) ."'";
$sql .= ",duration = '" . $this->duration_value . $this->duration_unit ."'"; $sql .= ",duration = '" . $this->duration_value . $this->duration_unit ."'";
$sql .= " WHERE rowid = " . $id; $sql .= " WHERE rowid = " . $id;
if ( $this->db->query($sql) ) if ( $this->db->query($sql) )