mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-16 14:31:29 +01:00
FIX #21543
This commit is contained in:
@@ -143,15 +143,20 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption = '', $minLen
|
|||||||
textarea[key] = item[value];
|
textarea[key] = item[value];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
console.log("Return value from GET to the rest of code");
|
||||||
return { label: label, value: item.value, id: item.key, disabled: item.disabled,
|
return { label: label, value: item.value, id: item.key, disabled: item.disabled,
|
||||||
update: update, textarea: textarea,
|
update: update,
|
||||||
|
textarea: textarea,
|
||||||
pbq: item.pbq,
|
pbq: item.pbq,
|
||||||
type: item.type, qty: item.qty, discount: item.discount,
|
type: item.type,
|
||||||
|
qty: item.qty,
|
||||||
|
discount: item.discount,
|
||||||
pricebasetype: item.pricebasetype,
|
pricebasetype: item.pricebasetype,
|
||||||
price_ht: item.price_ht,
|
price_ht: item.price_ht,
|
||||||
price_ttc: item.price_ttc,
|
price_ttc: item.price_ttc,
|
||||||
description : item.description,
|
description : item.description,
|
||||||
ref_customer: item.ref_customer }
|
ref_customer: item.ref_customer,
|
||||||
|
tva_tx: item.tva_tx }
|
||||||
}));
|
}));
|
||||||
} else {
|
} else {
|
||||||
console.error("Error: Ajax url '.$url.($urloption ? '?'.$urloption : '').' has returned an empty page. Should be an empty json array.");
|
console.error("Error: Ajax url '.$url.($urloption ? '?'.$urloption : '').' has returned an empty page. Should be an empty json array.");
|
||||||
@@ -173,6 +178,7 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption = '', $minLen
|
|||||||
$("#'.$htmlnamejquery.'").attr("data-discount", ui.item.discount);
|
$("#'.$htmlnamejquery.'").attr("data-discount", ui.item.discount);
|
||||||
$("#'.$htmlnamejquery.'").attr("data-description", ui.item.description);
|
$("#'.$htmlnamejquery.'").attr("data-description", ui.item.description);
|
||||||
$("#'.$htmlnamejquery.'").attr("data-ref-customer", ui.item.ref_customer);
|
$("#'.$htmlnamejquery.'").attr("data-ref-customer", ui.item.ref_customer);
|
||||||
|
$("#'.$htmlnamejquery.'").attr("data-tvatx", ui.item.tva_tx);
|
||||||
';
|
';
|
||||||
if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY)) {
|
if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY)) {
|
||||||
$script .= '
|
$script .= '
|
||||||
|
|||||||
@@ -952,14 +952,15 @@ if (!empty($usemargins) && $user->rights->margins->creer) {
|
|||||||
var discount = parseFloat($('option:selected', this).attr('data-discount'));
|
var discount = parseFloat($('option:selected', this).attr('data-discount'));
|
||||||
if (isNaN(discount)) { discount = parseFloat(jQuery('#idprodfournprice').attr('data-discount'));}
|
if (isNaN(discount)) { discount = parseFloat(jQuery('#idprodfournprice').attr('data-discount'));}
|
||||||
|
|
||||||
var tva_tx = $('option:selected', this).data('tvatx'); /* FIX21543 */
|
var tva_tx = parseFloat($('option:selected', this).attr('data-tvatx')); // When select is done from HTML select
|
||||||
|
if (isNaN(tva_tx)) { tva_tx = parseFloat(jQuery('#idprodfournprice').attr('data-tvatx'));} // When select is done from HTML input with autocomplete
|
||||||
|
|
||||||
console.log("We find supplier price :"+up+" qty: "+qty+" tva_tx="+tva_tx+" discount: "+discount+" for product "+jQuery('#idprodfournprice').val());
|
console.log("We find supplier price :"+up+" qty: "+qty+" tva_tx="+tva_tx+" discount: "+discount+" for product "+jQuery('#idprodfournprice').val());
|
||||||
|
|
||||||
jQuery("#price_ht").val(up);
|
jQuery("#price_ht").val(up);
|
||||||
/* $('#tva_tx option').removeAttr('selected').filter('[value='+tva_tx+']').prop('selected', true); */
|
|
||||||
|
|
||||||
$('#tva_tx option').val(tva_tx); /* FIX21543 */
|
/* $('#tva_tx option').removeAttr('selected').filter('[value='+tva_tx+']').prop('selected', true); */
|
||||||
|
$('#tva_tx option').val(tva_tx);
|
||||||
|
|
||||||
if (jQuery("#qty").val() < qty) {
|
if (jQuery("#qty").val() < qty) {
|
||||||
jQuery("#qty").val(qty);
|
jQuery("#qty").val(qty);
|
||||||
|
|||||||
Reference in New Issue
Block a user