diff --git a/htdocs/product/class/html.formproduct.class.php b/htdocs/product/class/html.formproduct.class.php index da10faa4f34..3c080f159f8 100644 --- a/htdocs/product/class/html.formproduct.class.php +++ b/htdocs/product/class/html.formproduct.class.php @@ -655,11 +655,13 @@ class FormProduct } foreach ($productIdArray as $productId) { - foreach ($this->cache_lot[$productId] as $id => $arraytypes) { - if (empty($fk_entrepot) || $fk_entrepot == $arraytypes['entrepot_id']) { - $label = $arraytypes['entrepot_label'].' - '; - $label .= $arraytypes['batch']; - $out .= ''; + if (array_key_exists($productId, $this->cache_lot)) { + foreach ($this->cache_lot[$productId] as $id => $arraytypes) { + if (empty($fk_entrepot) || $fk_entrepot == $arraytypes['entrepot_id']) { + $label = $arraytypes['entrepot_label'] . ' - '; + $label .= $arraytypes['batch']; + $out .= ''; + } } } }