Merge branch '3.8' of git@github.com:Dolibarr/dolibarr.git into 3.8

This commit is contained in:
Laurent Destailleur 2016-02-05 19:21:59 +01:00
commit 96bf59f065
2 changed files with 17 additions and 3 deletions

View File

@ -8,6 +8,7 @@
* Copyright (C) 2013 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2014 Cedric GROSS <c.gross@kreiz-it.fr>
* Copyright (C) 2014 Francis Appels <francis.appels@yahoo.com>
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -237,7 +238,7 @@ if (empty($reshook))
$ret=$object->addline_batch($batch_line[$i]);
if ($ret < 0)
{
$mesg='<div class="error">'.$object->error.'</div>';
$mesg='<div class="error">'.$object->errorsToString().'</div>';
$error++;
}
}
@ -881,7 +882,7 @@ if ($action == 'create')
if ($defaultqty<=0) {
$defaultqty=0;
} else {
$defaultqty -= min($defaultqty,$substock);
$defaultqty -= ($substock > 0 ? min($defaultqty,$substock) : 0);
}
$subj++;
}

View File

@ -8,6 +8,7 @@
* Copyright (C) 2014 Cedric GROSS <c.gross@kreiz-it.fr>
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2014-2015 Francis Appels <francis.appels@yahoo.com>
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -857,6 +858,7 @@ class Expedition extends CommonObject
*/
function addline_batch($dbatch)
{
global $conf,$langs;
$num = count($this->lines);
if ($dbatch['qty']>0)
{
@ -882,7 +884,17 @@ class Expedition extends CommonObject
if ($conf->global->STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT)
{
// TODO
require_once DOL_DOCUMENT_ROOT.'/product/class/productbatch.class.php';
$prod_batch = new Productbatch($this->db);
$prod_batch->fetch($value['id_batch']);
if ($prod_batch->qty < $linebatch->dluo_qty)
{
$this->errors[] = $langs->trans('ErrorStockIsNotEnough');
dol_syslog(get_class($this)."::addline_batch error=Product ".$prod_batch->batch.": ".$this->errorsToString(), LOG_ERR);
$this->db->rollback();
return -1;
}
}
//var_dump($linebatch);
@ -895,6 +907,7 @@ class Expedition extends CommonObject
//var_dump($line);
$this->lines[$num] = $line;
return 1;
}
}