Fix: Change status of order to cancel
This commit is contained in:
parent
5ff9286a1f
commit
c8526a2a18
@ -476,7 +476,7 @@ class Commande extends CommonObject
|
|||||||
if ($this->db->query($sql) )
|
if ($this->db->query($sql) )
|
||||||
{
|
{
|
||||||
// If stock is decremented on validate order, we must reincrement it
|
// If stock is decremented on validate order, we must reincrement it
|
||||||
if($conf->stock->enabled && $conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER == 1)
|
if ($conf->stock->enabled && $conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER == 1)
|
||||||
{
|
{
|
||||||
require_once(DOL_DOCUMENT_ROOT."/product/stock/mouvementstock.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/product/stock/mouvementstock.class.php");
|
||||||
|
|
||||||
@ -488,24 +488,21 @@ class Commande extends CommonObject
|
|||||||
$result=$mouvP->reception($user, $this->lignes[$i]->fk_product, $entrepot_id, $this->lignes[$i]->qty, $this->lignes[$i]->subprice);
|
$result=$mouvP->reception($user, $this->lignes[$i]->fk_product, $entrepot_id, $this->lignes[$i]->qty, $this->lignes[$i]->subprice);
|
||||||
if ($result < 0) { $error++; }
|
if ($result < 0) { $error++; }
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
$this->statut=-1;
|
$this->statut=-1;
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
return $result;
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error=$mouvP->error;
|
$this->error=$mouvP->error;
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return $result;
|
return -2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->db->commit();
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error=$this->db->error();
|
$this->error=$this->db->error();
|
||||||
|
|||||||
@ -77,7 +77,7 @@ class MouvementStock
|
|||||||
dol_syslog("MouvementStock::_create sql=".$sql, LOG_DEBUG);
|
dol_syslog("MouvementStock::_create sql=".$sql, LOG_DEBUG);
|
||||||
if ($resql = $this->db->query($sql))
|
if ($resql = $this->db->query($sql))
|
||||||
{
|
{
|
||||||
$mvid = $this->db->last_insert_id($resql);
|
$mvid = $this->db->last_insert_id(MAIN_DB_PREFIX."stock_mouvement");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user