[ bug #70 ] Champ Stock toujours vide dans export produit
This commit is contained in:
parent
33540cb2e8
commit
a41186b4c5
@ -204,8 +204,15 @@ class Entrepot extends CommonObject
|
|||||||
$sql.= " WHERE rowid = " . $this->id;
|
$sql.= " WHERE rowid = " . $this->id;
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::delete sql=".$sql);
|
dol_syslog(get_class($this)."::delete sql=".$sql);
|
||||||
$resql=$this->db->query($sql);
|
$resql1=$this->db->query($sql);
|
||||||
if ($resql)
|
|
||||||
|
// Update denormalized fields because we change content of produt_stock
|
||||||
|
$sql = "UPDATE ".MAIN_DB_PREFIX."product p SET p.stock= (SELECT SUM(ps.reel) FROM ".MAIN_DB_PREFIX."product_stock ps WHERE ps.fk_product = p.rowid)";
|
||||||
|
|
||||||
|
dol_syslog(get_class($this)."::delete sql=".$sql);
|
||||||
|
$resql2=$this->db->query($sql);
|
||||||
|
|
||||||
|
if ($resql1 && $resql2)
|
||||||
{
|
{
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
@ -194,6 +194,8 @@ class MouvementStock
|
|||||||
{
|
{
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."product SET pmp = ".$newpmp.", stock = ".$this->db->ifsql("stock IS NULL", 0, "stock") . " + ".$qty;
|
$sql = "UPDATE ".MAIN_DB_PREFIX."product SET pmp = ".$newpmp.", stock = ".$this->db->ifsql("stock IS NULL", 0, "stock") . " + ".$qty;
|
||||||
$sql.= " WHERE rowid = ".$fk_product;
|
$sql.= " WHERE rowid = ".$fk_product;
|
||||||
|
// May be this request is better:
|
||||||
|
// UPDATE llx_product p SET p.stock= (SELECT SUM(ps.reel) FROM llx_product_stock ps WHERE ps.fk_product = p.rowid);
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::_create sql=".$sql);
|
dol_syslog(get_class($this)."::_create sql=".$sql);
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user