Fix: Possibilité de mettre de ' dans les notes de propal

This commit is contained in:
Laurent Destailleur 2005-12-06 23:45:35 +00:00
parent 3eb18b53c9
commit 643576a44a

View File

@ -347,7 +347,7 @@ class Propal
$this->fin_validite = $this->datep + ($this->duree_validite * 24 * 3600); $this->fin_validite = $this->datep + ($this->duree_validite * 24 * 3600);
$sql = "INSERT INTO ".MAIN_DB_PREFIX."propal (fk_soc, fk_soc_contact, price, remise, tva, total, datep, datec, ref, fk_user_author, note, model_pdf, fin_validite) "; $sql = "INSERT INTO ".MAIN_DB_PREFIX."propal (fk_soc, fk_soc_contact, price, remise, tva, total, datep, datec, ref, fk_user_author, note, model_pdf, fin_validite) ";
$sql .= " VALUES ($this->socidp, $this->contactid, 0, $this->remise, 0,0,".$this->db->idate($this->datep).", now(), '$this->ref', $this->author, '$this->note','$this->modelpdf',".$this->db->idate($this->fin_validite).")"; $sql .= " VALUES ($this->socidp, $this->contactid, 0, $this->remise, 0,0,".$this->db->idate($this->datep).", now(), '$this->ref', $this->author, '".addslashes($this->note)."','$this->modelpdf',".$this->db->idate($this->fin_validite).")";
$sqlok = 0; $sqlok = 0;
if ( $this->db->query($sql) ) if ( $this->db->query($sql) )
@ -536,9 +536,9 @@ class Propal
$objp = $this->db->fetch_object($result); $objp = $this->db->fetch_object($result);
$ligne = new PropaleLigne(); $ligne = new PropaleLigne();
$ligne->desc = stripslashes($objp->description); // Description ligne $ligne->desc = $objp->description; // Description ligne
$ligne->libelle = stripslashes($objp->label); // Label produit $ligne->libelle = $objp->label; // Label produit
$ligne->product_desc = stripslashes($objp->product_desc); // Description produit $ligne->product_desc = $objp->product_desc; // Description produit
$ligne->qty = $objp->qty; $ligne->qty = $objp->qty;
$ligne->ref = $objp->ref; $ligne->ref = $objp->ref;
$ligne->tva_tx = $objp->tva_tx; $ligne->tva_tx = $objp->tva_tx;
@ -577,8 +577,8 @@ class Propal
{ {
$objp = $this->db->fetch_object($result); $objp = $this->db->fetch_object($result);
$ligne = new PropaleLigne(); $ligne = new PropaleLigne();
$ligne->libelle = stripslashes($objp->description); $ligne->libelle = $objp->description;
$ligne->desc = stripslashes($objp->description); $ligne->desc = $objp->description;
$ligne->qty = $objp->qty; $ligne->qty = $objp->qty;
$ligne->ref = $objp->ref; $ligne->ref = $objp->ref;
$ligne->tva_tx = $objp->tva_tx; $ligne->tva_tx = $objp->tva_tx;
@ -1045,26 +1045,27 @@ class Propal
} }
} }
/** /**
* \brief Mets à jour la note * \brief Mets à jour la note
* * \param note Note à mettre à jour
*/ * \return int <0 si ko, >0 si ok
*/
function update_note($note) function update_note($note)
{ {
$sql = "UPDATE ".MAIN_DB_PREFIX."propal SET note = '$note'"; $sql = "UPDATE ".MAIN_DB_PREFIX."propal";
$sql .= " WHERE rowid = $this->id;"; $sql.= " SET note = '".addslashes($note)."'";
$sql.= " WHERE rowid = ".$this->id;
if ($this->db->query($sql) ) if ($this->db->query($sql))
{ {
return 1; return 1;
} }
else else
{ {
$this->error=$this->db->error(); $this->error=$this->db->error();
return -1; return -1;
} }
} }
/** /**