Ajout sécurités

This commit is contained in:
Rodolphe Quiedeville 2003-08-04 18:08:24 +00:00
parent b6bdc1b4f7
commit 9601acab85

View File

@ -137,7 +137,7 @@ class Facture
Function fetch($rowid) Function fetch($rowid)
{ {
$sql = "SELECT f.fk_soc,f.facnumber,f.amount,f.tva,f.total,f.remise,".$this->db->pdate("f.datef")."as df,f.fk_projet,".$this->db->pdate("f.date_lim_reglement")." as dlr, c.libelle, f.note, f.paye"; $sql = "SELECT f.fk_soc,f.facnumber,f.amount,f.tva,f.total,f.remise,".$this->db->pdate("f.datef")."as df,f.fk_projet,".$this->db->pdate("f.date_lim_reglement")." as dlr, c.libelle, f.note, f.paye, f.fk_statut";
$sql .= " FROM llx_facture as f, llx_cond_reglement as c"; $sql .= " FROM llx_facture as f, llx_cond_reglement as c";
$sql .= " WHERE f.rowid=$rowid AND c.rowid = f.fk_cond_reglement"; $sql .= " WHERE f.rowid=$rowid AND c.rowid = f.fk_cond_reglement";
@ -157,11 +157,18 @@ class Facture
$this->paye = $obj->paye; $this->paye = $obj->paye;
$this->remise = $obj->remise; $this->remise = $obj->remise;
$this->socidp = $obj->fk_soc; $this->socidp = $obj->fk_soc;
$this->statut = $obj->fk_statut;
$this->date_lim_reglement = $obj->dlr; $this->date_lim_reglement = $obj->dlr;
$this->cond_reglement = $obj->libelle; $this->cond_reglement = $obj->libelle;
$this->projetid = $obj->fk_projet; $this->projetid = $obj->fk_projet;
$this->note = stripslashes($obj->note); $this->note = stripslashes($obj->note);
$this->lignes = array(); $this->lignes = array();
if ($this->statut == 0)
{
$this->brouillon = 1;
}
$this->db->free(); $this->db->free();
/* /*
@ -297,6 +304,8 @@ class Facture
* *
*/ */
Function set_valid($rowid, $user) Function set_valid($rowid, $user)
{
if ($this->brouillon)
{ {
$action_notify = 2; // ne pas modifier cette valeur $action_notify = 2; // ne pas modifier cette valeur
@ -344,11 +353,14 @@ class Facture
return $result; return $result;
} }
}
/* /*
* *
* *
*/ */
Function addline($facid, $desc, $pu, $qty, $txtva, $fk_product='NULL') Function addline($facid, $desc, $pu, $qty, $txtva, $fk_product='NULL')
{
if ($this->brouillon)
{ {
$sql = "INSERT INTO llx_facturedet (fk_facture,description,price,qty,tva_taux, fk_product)"; $sql = "INSERT INTO llx_facturedet (fk_facture,description,price,qty,tva_taux, fk_product)";
$sql .= " VALUES ($facid, '$desc', $pu, $qty, $txtva, $fk_product) ;"; $sql .= " VALUES ($facid, '$desc', $pu, $qty, $txtva, $fk_product) ;";
@ -358,28 +370,35 @@ class Facture
$this->updateprice($facid); $this->updateprice($facid);
} }
} }
}
/* /*
* *
* *
*/ */
Function updateline($rowid, $desc, $pu, $qty) Function updateline($rowid, $desc, $pu, $qty)
{
if ($this->brouillon)
{ {
$sql = "UPDATE llx_facturedet set description='$desc',price=$pu,qty=$qty WHERE rowid = $rowid ;"; $sql = "UPDATE llx_facturedet set description='$desc',price=$pu,qty=$qty WHERE rowid = $rowid ;";
$result = $this->db->query( $sql); $result = $this->db->query( $sql);
$this->updateprice($this->id); $this->updateprice($this->id);
} }
}
/* /*
* *
* *
*/ */
Function deleteline($rowid) Function deleteline($rowid)
{
if ($this->brouillon)
{ {
$sql = "DELETE FROM llx_facturedet WHERE rowid = $rowid;"; $sql = "DELETE FROM llx_facturedet WHERE rowid = $rowid;";
$result = $this->db->query( $sql); $result = $this->db->query( $sql);
$this->updateprice($this->id); $this->updateprice($this->id);
} }
}
/* /*
* *
* *