From 8f5c05f577907d7bfd413ac778ccc774e22bbdd9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 13 Oct 2022 12:22:16 +0200 Subject: [PATCH] Add price in local format in json response --- htdocs/core/class/html.form.class.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 107cf07c23d..02cfc44b284 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -3146,6 +3146,8 @@ class Form 'type'=>$outtype, 'price_ht'=>price2num($outprice_ht), 'price_ttc'=>price2num($outprice_ttc), + 'price_ht_locale'=>price(price2num($outprice_ht)), + 'price_ttc_locale'=>price(price2num($outprice_ttc)), 'pricebasetype'=>$outpricebasetype, 'tva_tx'=>$outtva_tx, 'default_vat_code'=>$outdefault_vat_code, @@ -3247,9 +3249,9 @@ class Form $sql .= " pfp.supplier_reputation"; // if we use supplier description of the products if (!empty($conf->global->PRODUIT_FOURN_TEXTS)) { - $sql .= " ,pfp.desc_fourn as description"; + $sql .= ", pfp.desc_fourn as description"; } else { - $sql .= " ,p.description"; + $sql .= ", p.description"; } // Units if (!empty($conf->global->PRODUCT_USE_UNITS)) { @@ -3532,7 +3534,7 @@ class Form $opt .= ' disabled'; } if (!empty($objp->idprodfournprice) && $objp->idprodfournprice > 0) { - $opt .= ' data-product-id="'.$objp->rowid.'" data-price-id="'.$objp->idprodfournprice.'" data-qty="'.$objp->quantity.'" data-up="'.$objp->unitprice.'" data-discount="'.$outdiscount.'" data-tvatx="'.$objp->tva_tx.'"'; + $opt .= ' data-product-id="'.dol_escape_htmltag($objp->rowid).'" data-price-id="'.dol_escape_htmltag($objp->idprodfournprice).'" data-qty="'.dol_escape_htmltag($objp->quantity).'" data-up="'.dol_escape_htmltag($objp->unitprice).'" data-discount="'.dol_escape_htmltag($outdiscount).'" data-tvatx="'.dol_escape_htmltag($objp->tva_tx).'"'; } $opt .= ' data-description="'.dol_escape_htmltag($objp->description, 0, 1).'"'; $opt .= ' data-html="'.dol_escape_htmltag($optlabel).'"'; @@ -3553,9 +3555,11 @@ class Form 'value'=>$outref, 'label'=>$outval, 'qty'=>$outqty, - 'price_qty_ht'=>price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty + 'price_qty_ht'=>price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty 'price_unit_ht'=>price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price 'price_ht'=>price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility) + 'price_qty_ht_locale'=>price($objp->fprice), + 'price_unit_ht_locale'=>price($objp->unitprice), 'tva_tx'=>$objp->tva_tx, 'default_vat_code'=>$objp->default_vat_code, 'discount'=>$outdiscount,