I have upgraded my Dolibarr installation to v22.0.4.
If I write description text with several lines in my invoice/facture, everything works as expected and is displayed (and printed in PDF) correctly.
However, as soon as I use the & character (meaning “and” like in “new & fresh”) my linefeeds disappear. The description looks as though I had never pressed ENTER after a line of text. I can get it to work again by editing the text and replacing the & character with something else.
Is there something special about this & character?
As far as I know, I have not activated the WYSIWYG-Editor module, and I only see that the & character will be replaced with &
Have I overlooked any settings?
Hello,
I can confirm this behavior. I have tested with V18.03 : no problem, and after a migration to V22.03 : same problem as you mentioned.
No solution for the moment…
I have found the source of the problem and a workaround.
In recent Dolibarr, MAIN_RESTRICTHTML_ONLY_VALID_HTML is set to 1 by default. Dolibarr HTML is sanitized more than before (this is a good improvement).
However, in textarea, “&” character is replaced by “&” by dol_htmlwithnojs inside sanitizeVal function.
If you do the reverse operation in val, then record will be ok.
In /core/lib/functions.lib.php, function sanitizeVal,
case ‘restricthtmlallowunvalid’:
$out = dol_htmlwithnojs($out, 1, $check);
//add & replacement
$out = str_replace(‘&’, ‘&’, $out); //workaround
break;
I have tested it with Dolibarr 22.0.3 and with WYSIWYG module disabled.
1 Like