Skip to content

Commit

Permalink
Merge branch '3.7' of git@github.com:Dolibarr/dolibarr.git into 3.7
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Mar 14, 2015
2 parents 605a7de + 851cae8 commit 5146936
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
1 change: 1 addition & 0 deletions ChangeLog
Expand Up @@ -202,6 +202,7 @@ Dolibarr better:
- Fix: [ bug #1790 ] Email form behaves in an unexpected way when pressing Enter key
- Fix: Bad SEPA xml file creation
- Fix: [ bug #1892 ] PHP Fatal error when using USER_UPDATE_SESSION trigger and adding a supplier invoice payment
- Fix: Showing system error if not enough stock of product into orders creation with lines

***** ChangeLog for 3.6.2 compared to 3.6.1 *****
- Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice.
Expand Down
20 changes: 15 additions & 5 deletions htdocs/commande/class/commande.class.php
Expand Up @@ -3,7 +3,7 @@
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2014 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2010-2015 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011 Jean Heimburger <jean@tiaris.info>
* Copyright (C) 2012-2014 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
Expand Down Expand Up @@ -109,6 +109,11 @@ class Commande extends CommonOrder
// Pour board
var $nbtodo;
var $nbtodolate;

/**
* ERR Not engouch stock
*/
const STOCK_NOT_ENOUGH_FOR_ORDER = -3;


/**
Expand Down Expand Up @@ -745,8 +750,11 @@ function create($user, $notrigger=0)
);
if ($result < 0)
{
$this->error=$this->db->lasterror();
dol_print_error($this->db);
if ($result != self::STOCK_NOT_ENOUGH_FOR_ORDER)
{
$this->error=$this->db->lasterror();
dol_print_error($this->db);
}
$this->db->rollback();
return -1;
}
Expand Down Expand Up @@ -1185,10 +1193,12 @@ function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $f
$result=$product->fetch($fk_product);
$product_type=$product->type;

if($conf->global->STOCK_MUST_BE_ENOUGH_FOR_ORDER && $product_type == 0 && $product->stock_reel < $qty) {
if($conf->global->STOCK_MUST_BE_ENOUGH_FOR_ORDER && $product_type == 0 && $product->stock_reel < $qty)
{
$this->error=$langs->trans('ErrorStockIsNotEnough');
dol_syslog(get_class($this)."::addline error=Product ".$product->ref.": ".$this->error, LOG_ERR);
$this->db->rollback();
return -3;
return self::STOCK_NOT_ENOUGH_FOR_ORDER;
}
}

Expand Down
2 changes: 1 addition & 1 deletion htdocs/compta/prelevement/class/rejetprelevement.class.php
Expand Up @@ -156,7 +156,7 @@ function create($user, $id, $motif, $date_rejet, $bonid, $facturation=0)
}
else
{
$result=$pai->addPaymentToBank($user,'payment','(InvoiceRefused)',$bankaccount);
$result=$pai->addPaymentToBank($user,'payment','(InvoiceRefused)',$bankaccount,'','');
if ($result < 0)
{
dol_syslog("RejetPrelevement::Create AddPaymentToBan Error");
Expand Down

0 comments on commit 5146936

Please sign in to comment.