Ask questions about installing and configuring ProcessMaker 3

Moderator: amosbatto

By linnsystems
#788184
Processmaker 3.1.3 on Apache 2.4.7 on PHP 5.6.29.

When displaying case notes in dynaforms (using grid as documented in wiki), apostrophes and some other characters do not display correctly (apostrophe becomes &#39! ). This same behavior is also present when viewing case notes in the mobile app. Case notes display correctly when viewing them in the case notes pop-up icon on the web version of the case list. Also viewing the raw case notes in the database, they have correct characters.

MariaDB has correct settings and query reflects same:
Code: Select all
[client]
loose-default-character-set = utf8

[mysql]
loose-default-character-set = utf8

[mysqld]
collation-server = utf8_unicode_ci
loose-default-character-set = utf8
character-set-server = utf8
init-connect = 'SET NAMES utf8'
Apache is set to utf8 in char.conf and in pmos.conf and php.ini is also set to utf8 verified in the admin menu -> php information.

Please help me from pulling anymore of my hair out, am I missing (or misunderstanding) something?

Thanks.
Josh
User avatar
By amosbatto
#788257
You can convert HTML entities (like &#39!) to their characters like this in a trigger:
Code: Select all
@@myString = html_entity_decode(@@myString);
linnsystems wrote: When displaying case notes in dynaforms (using grid as documented in wiki), apostrophes and some other characters do not display correctly (apostrophe becomes &#39! ).
Where do you see code example in the wiki? I want to change it.
By richvle
#817379
Hi, following the instructions per https://wiki.processmaker.com/3.2/Proce ... otes.28.29
It looks like the display is showing special characters such as apostrophes as " ' ". Anybody have any idea how to resolve this?

I've tried using html_entity_decode during the insertion in a trigger, but that didn't seem to do it.
Code: Select all
@@NewCaseNote = "what's up";
@@ReturnValue_CaseNote = PMFAddCaseNote(@@APPLICATION, @@PROCESS, @@TASK, @@USER_LOGGED, html_entity_decode(@@NewCaseNote), 0);
By richvle
#817712
Also, I think linnsystems (Josh) is referring to this trigger code:
@@gridPMFunction = PMFGetCaseNotes(@@APPLICATION, 'array', '');

per the documentation. I also have this problem. Josh, did you ever get it to work?
By richvle
#817816
Ah OK, so if you followed up the instructions on the WIKI, you can either do

@@textAreaPMFunction = PMFGetCaseNotes(@@APPLICATION, 'string', '');
or
@@gridPMFunction = PMFGetCaseNotes(@@APPLICATION, 'array', '');

The HTML character problem can be fixed by doing add this line next...
@@textAreaPMFunction = PMFGetCaseNotes(@@APPLICATION, 'string', '');
@@textAreaPMFunction = htmlspecialchars_decode(@@textAreaPMFunction,ENT_QUOTES);

However, this only works when you are using it with the string parameter. For the one the uses an array, htmlspecialchars_decode won't work because it returns a string and we're dealing with an array. I'm going to see if I can get it to work by putting the array through a loop and working on it from there.
User avatar
By amosbatto
#817820
Did you figure it out?
User avatar
By amosbatto
#817821
The code would be something like this:
Code: Select all
@=notes = PMFGetCaseNotes(@@APPLICATION, 'array', '');

for ($i = 0; $i < count(@=notes); $i++) {
     @=notes[$i]['NOTE_CONTENT'] = htmlspecialchars_decode(@=notes[$i]['NOTE_CONTENT'], ENT_QUOTES);
} 
By richvle
#817823
Thanks for replying Amos.
I couldn't get it work using other approaches. I tried using yours, (changed out your @=notes variable with @gridPMFunction to match the WIKI), but it still wasn't working.
Code: Select all
@=gridPMFunction = PMFGetCaseNotes(@@APPLICATION, 'array', '');

for ($i = 0; $i < count(@=gridPMFunction); $i++) {
     @=gridPMFunction[$i]['NOTE_CONTENT'] = htmlspecialchars_decode(@=gridPMFunction[$i]['NOTE_CONTENT'], ENT_QUOTES);
} 
Capture2.JPG
Capture2.JPG (30.2 KiB) Viewed 1567 times
amosbatto wrote: Fri Nov 16, 2018 5:10 pm The code would be something like this:
Code: Select all
@=notes = PMFGetCaseNotes(@@APPLICATION, 'array', '');

for ($i = 0; $i < count(@=notes); $i++) {
     @=notes[$i]['NOTE_CONTENT'] = htmlspecialchars_decode(@=notes[$i]['NOTE_CONTENT'], ENT_QUOTES);
} 
User avatar
By amosbatto
#817939
I just tried it in PM 3.2.3. You can use this code to convert from the html entities to normal text:
Code: Select all
@=notes = PMFGetCaseNotes(@@APPLICATION, 'array', '');

for ($i = 1; $i <= count(@=notes); $i++) {
   @=notes[$i]['NOTE_CONTENT'] = html_entity_decode(@=notes[$i]['NOTE_CONTENT'], ENT_QUOTES, 'UTF-8');
} 
By richvle
#817944
That did it! Thanks so much Amos.

incase anybody is doing it following the WIKI, here's the Amos's code with the modification using the WIKI Variable
Code: Select all
@@gridPMFunction = PMFGetCaseNotes(@@APPLICATION, 'array', '');

for ($i = 1; $i <= count(@=gridPMFunction); $i++) {
   @=gridPMFunction[$i]['NOTE_CONTENT'] = html_entity_decode(@=gridPMFunction[$i]['NOTE_CONTENT'], ENT_QUOTES, 'UTF-8');
} 
Deleting the processes.

Are you sure that you are using version 1.245 f[…]

Changing the login page

In your pmos.conf, try changing from: Redir[…]

Clearing a datetime field

Is there a way to clear a date area inside of a […]

add dropdown to search process

I have to add dropdown list to search process. How[…]