Fix error return when creating order with not enough stock
This commit is contained in:
parent
b4a309a251
commit
f4ae869678
@ -936,6 +936,7 @@ class Commande extends CommonOrder
|
|||||||
if ($result != self::STOCK_NOT_ENOUGH_FOR_ORDER)
|
if ($result != self::STOCK_NOT_ENOUGH_FOR_ORDER)
|
||||||
{
|
{
|
||||||
$this->error=$this->db->lasterror();
|
$this->error=$this->db->lasterror();
|
||||||
|
$this->errors[] = $this->error;
|
||||||
dol_print_error($this->db);
|
dol_print_error($this->db);
|
||||||
}
|
}
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
@ -1412,7 +1413,8 @@ class Commande extends CommonOrder
|
|||||||
if (! empty($conf->global->STOCK_MUST_BE_ENOUGH_FOR_ORDER) && $product_type == 0 && $product->stock_reel < $qty)
|
if (! empty($conf->global->STOCK_MUST_BE_ENOUGH_FOR_ORDER) && $product_type == 0 && $product->stock_reel < $qty)
|
||||||
{
|
{
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
$this->error=$langs->trans('ErrorStockIsNotEnoughToAddProductOnOrder', $product->ref);
|
$this->error = $langs->trans('ErrorStockIsNotEnoughToAddProductOnOrder', $product->ref);
|
||||||
|
$this->errors[] = $this->error;
|
||||||
dol_syslog(get_class($this)."::addline error=Product ".$product->ref.": ".$this->error, LOG_ERR);
|
dol_syslog(get_class($this)."::addline error=Product ".$product->ref.": ".$this->error, LOG_ERR);
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return self::STOCK_NOT_ENOUGH_FOR_ORDER;
|
return self::STOCK_NOT_ENOUGH_FOR_ORDER;
|
||||||
@ -3053,7 +3055,8 @@ class Commande extends CommonOrder
|
|||||||
if (! empty($conf->global->STOCK_MUST_BE_ENOUGH_FOR_ORDER) && $product_type == 0 && $product->stock_reel < $qty)
|
if (! empty($conf->global->STOCK_MUST_BE_ENOUGH_FOR_ORDER) && $product_type == 0 && $product->stock_reel < $qty)
|
||||||
{
|
{
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
$this->error=$langs->trans('ErrorStockIsNotEnoughToAddProductOnOrder', $product->ref);
|
$this->error = $langs->trans('ErrorStockIsNotEnoughToAddProductOnOrder', $product->ref);
|
||||||
|
$this->errors[] = $this->error;
|
||||||
dol_syslog(get_class($this)."::addline error=Product ".$product->ref.": ".$this->error, LOG_ERR);
|
dol_syslog(get_class($this)."::addline error=Product ".$product->ref.": ".$this->error, LOG_ERR);
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return self::STOCK_NOT_ENOUGH_FOR_ORDER;
|
return self::STOCK_NOT_ENOUGH_FOR_ORDER;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user