Merge pull request #14022 from OPEN-DSI/fix_supplier_order_dispatching

FIX: Fix detect dispatched product and set to received completely when the supplier order have services
This commit is contained in:
Laurent Destailleur 2021-01-31 18:51:57 +01:00 committed by GitHub
commit 9ef5f26624
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3070,6 +3070,7 @@ class CommandeFournisseur extends CommonOrder
{
if (is_array($supplierorderdispatch->lines) && count($supplierorderdispatch->lines)>0)
{
require_once DOL_DOCUMENT_ROOT.'/htdocs/product/class/product.class.php';
$date_liv = dol_now();
// Build array with quantity deliverd by product
@ -3077,7 +3078,11 @@ class CommandeFournisseur extends CommonOrder
$qtydelivered[$line->fk_product]+=$line->qty;
}
foreach($this->lines as $line) {
$qtywished[$line->fk_product]+=$line->qty;
if ($line->product_type == Product::TYPE_PRODUCT ||
($line->product_type == Product::TYPE_SERVICE && !empty($conf->global->STOCK_SUPPORTS_SERVICES))
) {
$qtywished[$line->fk_product] += $line->qty;
}
}
//Compare array
$diff_array=array_diff_assoc($qtydelivered, $qtywished); // Warning: $diff_array is done only on common keys.