Merge pull request #21482 from thomas-Ngr/14.0_fix_check_batch_on_reception

check batch on receptions->addline when module is enabled
This commit is contained in:
Laurent Destailleur 2022-07-10 18:40:22 +02:00 committed by GitHub
commit 1a6c690a4a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -846,6 +846,21 @@ class Reception extends CommonObject
}
}
// Check batch is set
$product = new Product($this->db);
$product->fetch($fk_product);
if (!empty($conf->productbatch->enabled)) {
$langs->load("errors");
if (!empty($product->status_batch) && empty($batch)) {
$this->error = $langs->trans('ErrorProductNeedBatchNumber', $product->ref);
return -1;
} elseif (empty($product->status_batch) && !empty($batch)) {
$this->error = $langs->trans('ErrorProductDoesNotNeedBatchNumber', $product->ref);
return -1;
}
}
unset($product);
// extrafields
$line->array_options = $supplierorderline->array_options;
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($array_options) && count($array_options) > 0) {