From ac41b61ad8b91f71c98ce1d7dd338eb4dbad3321 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sun, 11 Dec 2016 10:48:49 +0100 Subject: [PATCH] Empty inputs when editing line --- htdocs/core/tpl/objectline_create.tpl.php | 2 ++ htdocs/core/tpl/objectline_edit.tpl.php | 21 +++++++++++++++++---- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index beeecf9f511..c87a243a1c3 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -698,6 +698,7 @@ function setforfree() { jQuery("#prod_entry_mode_free").prop('checked',true); jQuery("#prod_entry_mode_predef").prop('checked',false); jQuery("#price_ht").show(); + jQuery("#multicurrency_price_ht").show(); jQuery("#price_ttc").show(); // May no exists jQuery("#tva_tx").show(); jQuery("#buying_price").val('').show(); @@ -717,6 +718,7 @@ function setforpredef() { jQuery("#prod_entry_mode_free").prop('checked',false); jQuery("#prod_entry_mode_predef").prop('checked',true); jQuery("#price_ht").hide(); + jQuery("#multicurrency_price_ht").hide(); jQuery("#price_ttc").hide(); // May no exists jQuery("#tva_tx").hide(); jQuery("#buying_price").show(); diff --git a/htdocs/core/tpl/objectline_edit.tpl.php b/htdocs/core/tpl/objectline_edit.tpl.php index ce019d58dea..74c6bdd4211 100644 --- a/htdocs/core/tpl/objectline_edit.tpl.php +++ b/htdocs/core/tpl/objectline_edit.tpl.php @@ -260,12 +260,25 @@ jQuery(document).ready(function() { jQuery("#price_ht").keyup(function(event) { // console.log(event.which); // discard event tag and arrows - if (event.which != 9 && (event.which < 37 ||event.which > 40) && jQuery("#price_ht").val() != '') jQuery("#price_ttc").val(''); - }); + if (event.which != 9 && (event.which < 37 ||event.which > 40) && jQuery("#price_ht").val() != '') { + jQuery("#price_ttc").val(''); + jQuery("#multicurrency_subprice").val(''); + } + }); jQuery("#price_ttc").keyup(function(event) { // console.log(event.which); // discard event tag and arrows - if (event.which != 9 && (event.which < 37 || event.which > 40) && jQuery("#price_ttc").val() != '') jQuery("#price_ht").val(''); - }); + if (event.which != 9 && (event.which < 37 || event.which > 40) && jQuery("#price_ttc").val() != '') { + jQuery("#price_ht").val(''); + jQuery("#multicurrency_subprice").val(''); + } + }); + jQuery("#multicurrency_subprice").keyup(function(event) { + // console.log(event.which); // discard event tag and arrows + if (event.which != 9 && (event.which < 37 || event.which > 40) && jQuery("#price_ttc").val() != '') { + jQuery("#price_ht").val(''); + jQuery("#price_ttc").val(''); + } + }); margin->enabled))