diff --git a/htdocs/core/tpl/objectline_edit.tpl.php b/htdocs/core/tpl/objectline_edit.tpl.php index 78290f896ca..4b079ef78d2 100644 --- a/htdocs/core/tpl/objectline_edit.tpl.php +++ b/htdocs/core/tpl/objectline_edit.tpl.php @@ -329,9 +329,9 @@ $(document).ready(function() { - margin->enabled)) { ?> - $.post('/fourn/ajax/getSupplierPrices.php', {'idprod': fk_product; ?>}, function(data) { - if (data.length > 0) { + margin->enabled)) { ?> + $.post('/fourn/ajax/getSupplierPrices.php', {'idprod': fk_product?$line->fk_product:0; ?>}, function(data) { + if (data && data.length > 0) { var options = ''; var trouve=false; $(data).each(function() { diff --git a/htdocs/core/tpl/predefinedproductline_create.tpl.php b/htdocs/core/tpl/predefinedproductline_create.tpl.php index 49d6ac2926b..e10dc184ccb 100644 --- a/htdocs/core/tpl/predefinedproductline_create.tpl.php +++ b/htdocs/core/tpl/predefinedproductline_create.tpl.php @@ -140,10 +140,12 @@ if (! empty($conf->margin->enabled)) { ?>