Case Description showing HTML

Hey guys.

I have a big issue because when i create a case it shows HTML code…

How can i fix this? I prefer use PLAIN TEXT… How can i do this?

Thanks!

Hi,

If you go to /modules/Cases/metadata/ and open detailviewdefs.php

Go to line 121 which should be:

4 =>
array (
0 => ‘description’,
),

And replace it with this code:

4 =>
array (
0 =>
array(
‘name’ => ‘description’,
‘customCode’ => ‘{$fields.description.value|escape:‘htmlentitydecode’ |escape:‘html’|strip_tags|url2html|nl2br}’,
),
),

and do a Quick Repair and Rebuild, then clear your browser’s cache and CTRL+F5

Hey mate! Thanks for the other code, that fix the thing i mention before but now i have another issue…

When i click the ticket shows me the information and shows me HTML code…

How can i fix this?? Thanks!!!

Look the attached file! Thanks again!

I really need help for this… Thanks!!!

Hi,
There’s not really any good way to resolve this issue.
The code provided previously should have resolved the issues with HTML tags showing in your Case’s Descriptions
Did you ensure you Quick Repair & Rebuild, then cleared your cache?

Otherwise, you could try simply disabling the TinyMCE editor for case descriptions. Shown in this post: https://www.suitecrm.co.uk/forum/suitecrm-7-0-discussion/4276-how-to-disable-tinymce-editor-for-the-status-descrption-field-in-cases-module#17528

Or even disabling TinyMCE for cases altogether, in this Post: https://www.suitecrm.co.uk/forum/suitecrm-7-0-discussion/4274-html-tags-in-the-status-description-in-cases-module#16914

I know this is a very belated reply but I’ve just ran into the same issue and fixed it by creating a file at /custom/modules/Caes/views/view.detail with the following code:


<?php

require_once('include/MVC/View/views/view.detail.php');

class CasesViewDetail extends ViewDetail {
    function display(){
        $this->dv->focus->description = html_entity_decode($this->dv->focus->description);
        parent::display();

    }
}

After making the changes you’ll need to run a repair and rebuild. If you want to remove the html completely you could change the first line of the display method to:

$this->dv->focus->description = strip_tags(html_entity_decode($this->dv->focus->description));
3 Likes

Hi folks, and many thanks to ewanmcrobert

This fix worked for me, and I am comfortable with doing a change in this way, as it is an upgrade safe amendment in the custom/ directory.

Couple of things just for clarity :-

Specifically the file that you need to create is

/custom/modules/Cases/views/view.detail.php

1 Like

And thanks from me as well. :slight_smile:

It’s probably handy to restart Apache on your server if possible.

cheers

Ian

I have a custom module that uses an HTML field and I want to strip the HTML and copy the plain text to a textarea description field. I tried to copy the above ‘customCode’ into the module defs but I get a general php error. Is there a different conversion that might need to be used here? I want to actually strip the HTML code and copy the plain text using the workflow trigger (which currently works very well). I’m not just wanting to avoid displaying the HTML, it’s stripping the HTML out so I can use the workflow to copy the plain text field content into another field. Any ideas?