Dolibarr: Bug 11.x, 12.0.0 - saving text in the wrong format (lost format - new lines)

Created on 29 Jun 2020  Â·  5Comments  Â·  Source: Dolibarr/dolibarr

Bug

After saving texts wroted in input in WYSIWYG editor have wrong format for view.
Sometimes also bad formating stayed after reopening for modification.
The same problem occurs even when the WYSIWYG editor is turned off and the text is entered in the description field.

Environment

  • Version: 11.x, 12.0.0 - Version from Sourceforge
  • OS: Windows
  • Web server: Apache
  • PHP: 7.4.7
  • Database: MySQL

Steps to reproduce the behavior

  1. Open any input big text field defined as "Description" in Dolibarr (for example Project)
    1b. Create new Project and to imput "Description" add text with new lines.
    In the label field I write text that has separate lines with blank lines or at the end of a line I need to go to a new line for which I use the ENTER key.
  2. Now I click the save button.
  3. When I reopen the project and want to read the description, the new lines do not appear, but the text that was originally on the new line appears immediately after the text of the previous line.
    When I want to modify it, the formatting doesn't work anyway and the formatting is lost.
    Formatting is lost even if I switch text input to "Source" mode. The only time new lines are saved is to use SHIFT + ENTER instead of ENTER at the end of the lines.

I want show as same formating if used ENTER only. and same formating texts pasted from other plain text editors (CTRL+C
form notepad.exe, etc. with new/empty lines) to Dolibarr WYSIWYG editor inputs (CTRL+V).

Attached files (Screenshots, screencasts, dolibarr.log, debugging informations…)

1. Typed texts and endline is ENTER key:

1

Showing as (buged):
2

or randomly showing as (buged):
3

2. Typed texts and endline is SHIFT+ENTER key:

1

Showing as (show is ok):
4

Bug

Most helpful comment

I fixed that, the function GETPOST in the file /htdocs/core/lib/functions.lib.php at the line 302 (in the version 12.0.1) have some default parameters. The "check" parameter had by default the value "alphanohtml", this value make html dont persistent when a form with some HTML content is submit (not in all case).

To fix that : change the default value of the var check to "none" (like in the previous version 11.0.4)

All 5 comments

Hi,

Did you fix that ? I have the same bug...

Simon.

I fixed that, the function GETPOST in the file /htdocs/core/lib/functions.lib.php at the line 302 (in the version 12.0.1) have some default parameters. The "check" parameter had by default the value "alphanohtml", this value make html dont persistent when a form with some HTML content is submit (not in all case).

To fix that : change the default value of the var check to "none" (like in the previous version 11.0.4)

Could you submit a pull request with the fix?

Could you submit a pull request with the fix?

i dont know how. And solution from @PlatiScript is good ... this is problem fixed.

Thank you @PlatiScript very much.

Was this page helpful?
0 / 5 - 0 ratings