modif dans fetch ->
This commit is contained in:
parent
c5eccdc2bc
commit
f441fc0a06
@ -92,6 +92,17 @@ class Propal
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
Function fetch_client()
|
||||||
|
{
|
||||||
|
$client = new Societe($this->db);
|
||||||
|
$client->fetch($this->socidp);
|
||||||
|
$this->client = $client;
|
||||||
|
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
Function delete_product($idligne)
|
Function delete_product($idligne)
|
||||||
{
|
{
|
||||||
if ($this->statut == 0)
|
if ($this->statut == 0)
|
||||||
@ -216,7 +227,8 @@ class Propal
|
|||||||
Function fetch($rowid)
|
Function fetch($rowid)
|
||||||
{
|
{
|
||||||
|
|
||||||
$sql = "SELECT ref,price,remise,".$this->db->pdate(datep)."as dp FROM llx_propal WHERE rowid=$rowid;";
|
$sql = "SELECT ref,total,price,remise,fk_soc,".$this->db->pdate(datep)."as dp ";
|
||||||
|
$sql .= " FROM llx_propal WHERE rowid=$rowid;";
|
||||||
|
|
||||||
if ($this->db->query($sql) )
|
if ($this->db->query($sql) )
|
||||||
{
|
{
|
||||||
@ -230,9 +242,46 @@ class Propal
|
|||||||
$this->ref = $obj->ref;
|
$this->ref = $obj->ref;
|
||||||
$this->price = $obj->price;
|
$this->price = $obj->price;
|
||||||
$this->remise = $obj->remise;
|
$this->remise = $obj->remise;
|
||||||
|
$this->total = $obj->total;
|
||||||
|
$this->total_ht = $obj->total;
|
||||||
|
$this->total_ttc = $obj->total;
|
||||||
|
$this->socidp = $obj->fk_soc;
|
||||||
|
$this->lignes = array();
|
||||||
|
$this->db->free();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Lignes
|
||||||
|
*/
|
||||||
|
|
||||||
|
$sql = "SELECT d.qty, p.description, p.ref, p.price";
|
||||||
|
$sql .= " FROM llx_propaldet as d, llx_product as p";
|
||||||
|
$sql .= " WHERE d.fk_propal = ".$this->id ." AND d.fk_product = p.rowid";
|
||||||
|
|
||||||
|
$result = $this->db->query($sql);
|
||||||
|
if ($result)
|
||||||
|
{
|
||||||
|
$num = $this->db->num_rows();
|
||||||
|
$i = 0;
|
||||||
|
|
||||||
|
while ($i < $num)
|
||||||
|
{
|
||||||
|
$objp = $this->db->fetch_object($i);
|
||||||
|
$ligne = new PropaleLigne();
|
||||||
|
$ligne->desc = stripslashes($objp->description);
|
||||||
|
$ligne->qty = $objp->qty;
|
||||||
|
$ligne->ref = $objp->ref;
|
||||||
|
$ligne->price = $objp->price;
|
||||||
|
$this->lignes[$i] = $ligne;
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
|
||||||
$this->db->free();
|
$this->db->free();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print $this->db->error();
|
||||||
|
}
|
||||||
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -261,17 +310,47 @@ class Propal
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
Function cloture($userid, $statut, $note) {
|
Function cloture($userid, $statut, $note)
|
||||||
|
{
|
||||||
$sql = "UPDATE llx_propal SET fk_statut = $statut, note = '$note', date_cloture=now(), fk_user_cloture=$userid";
|
$sql = "UPDATE llx_propal SET fk_statut = $statut, note = '$note', date_cloture=now(), fk_user_cloture=$userid";
|
||||||
|
|
||||||
$sql .= " WHERE rowid = $this->id;";
|
$sql .= " WHERE rowid = $this->id;";
|
||||||
|
|
||||||
if ($this->db->query($sql) ) {
|
if ($this->db->query($sql) )
|
||||||
|
{
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
print $this->db->error() . ' in ' . $sql;
|
print $this->db->error() . ' in ' . $sql;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
Function reopen($userid)
|
||||||
|
{
|
||||||
|
$sql = "UPDATE llx_propal SET fk_statut = 0";
|
||||||
|
|
||||||
|
$sql .= " WHERE rowid = $this->id;";
|
||||||
|
|
||||||
|
if ($this->db->query($sql) )
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print $this->db->error() . ' in ' . $sql;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class PropaleLigne
|
||||||
|
{
|
||||||
|
Function PropaleLigne()
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user