In select_produits_list() the product option data-html attribute is built by concatenating $labeltoshowhtml, $outvalUnits and $labeltoshowhtmlprice as raw strings. The variables that carry user text are $labeltoshowhtml (ref, customer ref, barcode and product label) and $outvalUnits (unit short label from the dictionary), so a double quote typed there, for example an inch mark 1/2", closes the data-html="..." attribute early and the rich dropdown (ajaxcombo) shows the name truncated at the quote. $labeltoshowhtmlprice only carries outputs of price() and transnoentities() and cannot contain a double quote. Sanitize the two user variables with dolPrintHTMLForAttribute(), as the stock part of the same attribute already does. The tag 'strong' is passed in the allowothertags parameter for the label so the search highlight added around the typed filter key is kept in the rich label. Base 21.0: the data-html attribute on the product option was introduced in 21.0; on 20.0 the option carried only a class and select2 used the plain option text where a quote is harmless. In develop the code was reworked by PR #39057 which now escapes the whole value with dol_escape_htmltag(), so this fix targets the maintained branches only. Signed-off-by: Gregory Aliot <greg.aliot@gmail.com>
This commit is contained in:
parent
e26839247b
commit
ea507289a9
1 changed files with 2 additions and 2 deletions
|
|
@ -3620,11 +3620,11 @@ class Form
|
|||
}
|
||||
|
||||
if ($stocktag == 1) {
|
||||
$opt .= ' class="product_line_stock_ok" data-html="'.$labeltoshowhtml.$outvalUnits.$labeltoshowhtmlprice.dolPrintHTMLForAttribute($labeltoshowhtmlstock).'"';
|
||||
$opt .= ' class="product_line_stock_ok" data-html="'.dolPrintHTMLForAttribute($labeltoshowhtml, 0, array('strong')).dolPrintHTMLForAttribute($outvalUnits).$labeltoshowhtmlprice.dolPrintHTMLForAttribute($labeltoshowhtmlstock).'"';
|
||||
//$opt .= ' class="product_line_stock_ok"';
|
||||
}
|
||||
if ($stocktag == -1) {
|
||||
$opt .= ' class="product_line_stock_too_low" data-html="'.$labeltoshowhtml.$outvalUnits.$labeltoshowhtmlprice.dolPrintHTMLForAttribute($labeltoshowhtmlstock).'"';
|
||||
$opt .= ' class="product_line_stock_too_low" data-html="'.dolPrintHTMLForAttribute($labeltoshowhtml, 0, array('strong')).dolPrintHTMLForAttribute($outvalUnits).$labeltoshowhtmlprice.dolPrintHTMLForAttribute($labeltoshowhtmlstock).'"';
|
||||
//$opt .= ' class="product_line_stock_too_low"';
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue