Generate Letter and TinyMCE fields - HTML encoding

Hi,

I converted “Description” field in Opportunities module to have TinyMCE editor.
Also implemented a “Generate Letter” option with the associated PDF Template.
However, when using this field through the proper template, HTML tags are printed and not decoded:

Opportunities description field


Title1 Title2
record 1 record 2


Any idea on how to get around this?

Regards,

VítorM

I see the crux of your problem, the html is stored as text in database field. You will probably have to alter the generate letter pdf code to check for this field and specifically decode it somehow.

Hi Andy,

Thank you for your reply.
I manage to solve this issue by changing “templateParser.php”, “parse_template_bean” function, right before the return statement.
Probably it’s not the most elegant way and for sure not an upgrade safe one, but here it is how I made it, based in formLetter.php code:

                if($focus->module_dir === "Opportunities" && $name === "opportunities_description"){

                        $search = array ('@&(quot|#34);@i',                      // Replace HTML entities
                                                '@&(amp|#38);@i',
                                                '@&(lt|#60);@i',
                                                '@&(gt|#62);@i',
                                                '@&(nbsp|#160);@i',
                                                '@&(iexcl|#161);@i',
                                                '@([\r\n])[\s]+@'
                                );

                        $replace = array ('"',
                                                 '&',
                                                 '<',
                                                 '>',
                                                 ' ',
                                                 chr(161),
                                                '\1'                            //^M
                        );

                        $string = preg_replace($search, $replace, $string);
                }

Regards,

VitorM

I’ve been seeing the same error… no one knows I think, cause no one has responded to my topic neither!

Hi,

You said:

“I converted “Description” field in Opportunities module to have TinyMCE editor.”

How did you do it?

I have the TinyMCE editor appearing instead of textarea for status description in the cases module. I need to disable it.

How to disable it?

Thanks,