From b6b736c402c2b0c131ead6b9147c28d11565dfab Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Mon, 8 Feb 2021 19:56:34 +0100 Subject: [PATCH 1/2] NEW:add hidden option to auto load input line extrafield into new lines --- htdocs/core/tpl/objectline_create.tpl.php | 8 ++++++++ htdocs/product/ajax/products.php | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index 954d17e450b..9d76b5a6d86 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -705,6 +705,14 @@ if (!empty($usemargins) && $user->rights->margins->creer) } ?> + global->PRODUCT_LOAD_EXTRAFIELD_INTO_OBJECTLINES)) { ?> + jQuery.each(data.array_options, function( key, value ) { + console.log('div[class$="det'+key.replace('options_','_extras_')+'"] > #'+key); + jQuery('div[class$="det'+key.replace('options_','_extras_')+'"] > #'+key).val(value); + }); + }, 'json' ); diff --git a/htdocs/product/ajax/products.php b/htdocs/product/ajax/products.php index 18ce5d12619..198d49defaf 100644 --- a/htdocs/product/ajax/products.php +++ b/htdocs/product/ajax/products.php @@ -192,7 +192,7 @@ if (!empty($action) && $action == 'fetch' && !empty($id)) 'tva_tx' => $outtva_tx, 'qty' => $outqty, 'discount' => $outdiscount, - 'array_option'=>$object->array_options); + 'array_options'=>$object->array_options); } echo json_encode($outjson); From 1e6144a99d39fd5f68360e72f0c71705b4c45d47 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Mon, 8 Feb 2021 19:59:18 +0100 Subject: [PATCH 2/2] fix indent --- htdocs/core/tpl/objectline_create.tpl.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index 9d76b5a6d86..a9c200aa99e 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -708,8 +708,7 @@ if (!empty($usemargins) && $user->rights->margins->creer) global->PRODUCT_LOAD_EXTRAFIELD_INTO_OBJECTLINES)) { ?> jQuery.each(data.array_options, function( key, value ) { - console.log('div[class$="det'+key.replace('options_','_extras_')+'"] > #'+key); - jQuery('div[class$="det'+key.replace('options_','_extras_')+'"] > #'+key).val(value); + jQuery('div[class$="det'+key.replace('options_','_extras_')+'"] > #'+key).val(value); });