Fix: Change status of order to cancel

This commit is contained in:
Laurent Destailleur 2010-05-17 12:48:59 +00:00
parent 5ff9286a1f
commit c8526a2a18
2 changed files with 14 additions and 17 deletions

View File

@ -476,7 +476,7 @@ class Commande extends CommonObject
if ($this->db->query($sql) )
{
// 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");
@ -488,23 +488,20 @@ class Commande extends CommonObject
$result=$mouvP->reception($user, $this->lignes[$i]->fk_product, $entrepot_id, $this->lignes[$i]->qty, $this->lignes[$i]->subprice);
if ($result < 0) { $error++; }
}
if (! $error)
{
$this->statut=-1;
$this->db->commit();
return $result;
}
else
{
$this->error=$mouvP->error;
$this->db->rollback();
return $result;
}
}
$this->db->commit();
return 1;
if (! $error)
{
$this->statut=-1;
$this->db->commit();
return 1;
}
else
{
$this->error=$mouvP->error;
$this->db->rollback();
return -2;
}
}
else
{

View File

@ -77,7 +77,7 @@ class MouvementStock
dol_syslog("MouvementStock::_create sql=".$sql, LOG_DEBUG);
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
{