From 9f890c28ddbb052551bb78e14bd56ffcec23e57b Mon Sep 17 00:00:00 2001 From: atm-greg Date: Mon, 29 Oct 2018 15:37:17 +0100 Subject: [PATCH 1/5] add ability to edit price ht before adding a line --- htdocs/core/tpl/objectline_create.tpl.php | 18 ++++++++++++++++-- htdocs/langs/en_US/admin.lang | 1 + htdocs/product/admin/product.php | 11 +++++++++++ 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index 23640216cd9..5430eb0ad46 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -646,8 +646,19 @@ jQuery(document).ready(function() { setforpredef(); // TODO Keep vat combo visible and set it to first entry into list that match result of get_default_tva jQuery('#trlinefordates').show(); - + global->EDIT_PREDEF_PRICEHT)) + { + ?> + // get the HT price for the product and display it + $.post('/product/ajax/products.php?action=fetch', { 'id': $(this).val(), 'socid' : socid; ?> }, function(data) { + jQuery("#price_ht").val(data.price_ht); + }, + 'json'); + rights->margins->creer) { $langs->load('stocks'); @@ -831,7 +842,10 @@ function setforpredef() { jQuery("#prod_entry_mode_free").prop('checked',false).change(); jQuery("#prod_entry_mode_predef").prop('checked',true).change(); - jQuery("#price_ht").val('').hide(); + global->EDIT_PREDEF_PRICEHT)) + {?> + jQuery("#price_ht").val('').hide(); + jQuery("#multicurrency_price_ht").hide(); jQuery("#price_ttc").hide(); // May no exists jQuery("#fourn_ref").hide(); diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 190b7cded97..ba6989d6288 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1447,6 +1447,7 @@ ServiceSetup=Services module setup ProductServiceSetup=Products and Services modules setup NumberOfProductShowInSelect=Max number of products in combos select lists (0=no limit) ViewProductDescInFormAbility=Display product descriptions in forms (otherwise as popup tooltip) +EditPredifinedPriceHTAbility=Add the ability to edit price ht before adding a line on documents MergePropalProductCard=Activate in product/service Attached Files tab an option to merge product PDF document to proposal PDF azur if product/service is in the proposal ViewProductDescInThirdpartyLanguageAbility=Display products descriptions in the language of the third party UseSearchToSelectProductTooltip=Also if you have a large number of products (> 100 000), you can increase speed by setting constant PRODUCT_DONOTSEARCH_ANYWHERE to 1 in Setup->Other. Search will then be limited to start of string. diff --git a/htdocs/product/admin/product.php b/htdocs/product/admin/product.php index 45f938431c3..a8116314dda 100644 --- a/htdocs/product/admin/product.php +++ b/htdocs/product/admin/product.php @@ -155,6 +155,9 @@ if ($action == 'other') $resql_new = $db->query($sql_new); } } + + $value = GETPOST('activate_EditPredifinedPriceHT','alpha'); + $res = dolibarr_set_const($db, "EDIT_PREDEF_PRICEHT", $value,'chaine',0,'',$conf->entity); } if ($action == 'specimen') // For products @@ -675,6 +678,14 @@ if (! empty($conf->fournisseur->enabled)) print ''; } +// Activate price ht edition for predefined product on line add +print ''; +print ''.$langs->trans("EditPredifinedPriceHTAbility").''; +print ''; +print $form->selectyesno("activate_EditPredifinedPriceHT",$conf->global->EDIT_PREDEF_PRICEHT,1); +print ''; +print ''; + if (! empty($conf->global->PRODUCT_CANVAS_ABILITY)) { // Add canvas feature From 3bd1563052243ccd7552fe4ff6876366913abf1e Mon Sep 17 00:00:00 2001 From: atm-greg Date: Mon, 29 Oct 2018 16:46:06 +0100 Subject: [PATCH 2/5] fix travis white_space error --- htdocs/core/tpl/objectline_create.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index 5430eb0ad46..458872cf99b 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -646,7 +646,7 @@ jQuery(document).ready(function() { setforpredef(); // TODO Keep vat combo visible and set it to first entry into list that match result of get_default_tva jQuery('#trlinefordates').show(); - global->EDIT_PREDEF_PRICEHT)) { ?> From eb7f9642681b353790915e4c983b1151fff6ae56 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 7 Sep 2019 11:25:11 +0200 Subject: [PATCH 3/5] Update objectline_create.tpl.php --- htdocs/core/tpl/objectline_create.tpl.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index 458872cf99b..480e0975f00 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -647,7 +647,7 @@ jQuery(document).ready(function() { jQuery('#trlinefordates').show(); global->EDIT_PREDEF_PRICEHT)) + if (!empty($conf->global->MAIN_EDIT_PREDEF_PRICEHT)) { ?> // get the HT price for the product and display it @@ -842,10 +842,9 @@ function setforpredef() { jQuery("#prod_entry_mode_free").prop('checked',false).change(); jQuery("#prod_entry_mode_predef").prop('checked',true).change(); - global->EDIT_PREDEF_PRICEHT)) - {?> + global->MAIN_EDIT_PREDEF_PRICEHT)) { ?> jQuery("#price_ht").val('').hide(); - + jQuery("#multicurrency_price_ht").hide(); jQuery("#price_ttc").hide(); // May no exists jQuery("#fourn_ref").hide(); From c7a90ad52803ddae84a9a517acdaf1ddff9edb8d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 7 Sep 2019 11:25:58 +0200 Subject: [PATCH 4/5] Update product.php --- htdocs/product/admin/product.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/htdocs/product/admin/product.php b/htdocs/product/admin/product.php index a8116314dda..392ae8eb081 100644 --- a/htdocs/product/admin/product.php +++ b/htdocs/product/admin/product.php @@ -155,9 +155,6 @@ if ($action == 'other') $resql_new = $db->query($sql_new); } } - - $value = GETPOST('activate_EditPredifinedPriceHT','alpha'); - $res = dolibarr_set_const($db, "EDIT_PREDEF_PRICEHT", $value,'chaine',0,'',$conf->entity); } if ($action == 'specimen') // For products From a5d04e8fd5d7725abcb3c4c463b061db14290b40 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 7 Sep 2019 11:26:21 +0200 Subject: [PATCH 5/5] Update product.php --- htdocs/product/admin/product.php | 8 -------- 1 file changed, 8 deletions(-) diff --git a/htdocs/product/admin/product.php b/htdocs/product/admin/product.php index 392ae8eb081..45f938431c3 100644 --- a/htdocs/product/admin/product.php +++ b/htdocs/product/admin/product.php @@ -675,14 +675,6 @@ if (! empty($conf->fournisseur->enabled)) print ''; } -// Activate price ht edition for predefined product on line add -print ''; -print ''.$langs->trans("EditPredifinedPriceHTAbility").''; -print ''; -print $form->selectyesno("activate_EditPredifinedPriceHT",$conf->global->EDIT_PREDEF_PRICEHT,1); -print ''; -print ''; - if (! empty($conf->global->PRODUCT_CANVAS_ABILITY)) { // Add canvas feature