Fix: optimizing

This commit is contained in:
Regis Houssin 2012-09-19 17:24:40 +02:00
parent 40f5427520
commit 98b38628c5

View File

@ -142,8 +142,7 @@ if (! empty($conf->margin->enabled)) {
$("#idprod").change(function() { $("#idprod").change(function() {
$("#fournprice options").remove(); $("#fournprice options").remove();
$("#fournprice").hide(); $("#fournprice").hide();
$("#buying_price").val(""); $("#buying_price").val("").show();
$("#buying_price").show();
$.post('<?php echo DOL_URL_ROOT; ?>/fourn/ajax/getSupplierPrices.php', {'idprod': $(this).val()}, function(data) { $.post('<?php echo DOL_URL_ROOT; ?>/fourn/ajax/getSupplierPrices.php', {'idprod': $(this).val()}, function(data) {
if (data && data.length > 0) { if (data && data.length > 0) {
var options = ''; var options = '';
@ -158,9 +157,8 @@ $("#idprod").change(function() {
options += '>'+this.label+'</option>'; options += '>'+this.label+'</option>';
}); });
options += '<option value=null><?php echo $langs->trans("InputPrice"); ?></option>'; options += '<option value=null><?php echo $langs->trans("InputPrice"); ?></option>';
$("#fournprice").html(options);
$("#buying_price").hide(); $("#buying_price").hide();
$("#fournprice").show(); $("#fournprice").html(options).show();
$("#fournprice").change(function() { $("#fournprice").change(function() {
var selval = $(this).find('option:selected').attr("price"); var selval = $(this).find('option:selected').attr("price");
if (selval) if (selval)