Empty lines in emails (view summary of history tab)

Hi,

in the History section of a lead/contact/account, my archived emails have lots of empty lines when I click on the view summary button. This makes it hard to read.

How to correct ? Using version 7.5.3

See attachments. Thanks!

I looked in the database (emails_text table) and there is a lot of

stored in the “description_html” field.

For example :

any cues ?

When I view source html code of the “view summary” page, I can’t find the

's but there is a lot of
. See attachment.

Ok so far I’ve found the modules/Activities/Popup_picker.php is responsible to build the “view summary”.

The line : $this->formatDescription(strip_tags(br2nl(from_html($email->description_html))));

Strip all html tags and keep \n only. And then \n are converted back to
.

However, after playing around I can’t find a way to remove all the duplicated
.
I tried a couple of regex but it.'s not working. And it seems there is a invisible char between all
tags…

Any cues ?

There is a pull request on gitHub that solves the issue:

https://github.com/salesagility/SuiteCRM/pull/3052

Will this fix be rolled into the next SuiteCRM update?

Hi, thanks for the answer.

I tried but it doesn’t correct my problem. I don’t think it’s the same problem.

I have a lot of
in my emails descriptions (coming from the emails_text table, field description_html).

It’s caused by this line : The line : $this->formatDescription(strip_tags(br2nl(from_html($email->description_html))));
In the popup_picker.php. And more, there is an invisible character in front of the
and it’s not a \n, I can’t find it.

I want to get rid of all those duplicated
plus that invisible char.

For example :


<br />
 <br />
 <br />
 <br />
 <br />
If you or your engineer have any questions, please do not hesitate to contact us.<br />
 <br />
 <br />
 <br />
 <br />
 <br />
 <br />
 <br />
 <br />
 <br />
 <br />
 <br />
 <br />
 <br />
 <br />
 <br />
 <br />
 <br />
Best regards,<br />
 <br />
 <br />
 <br />
 <br />
 <br />

Sorry, I made mistake. I meant to post in a different forum discussion. I got confuesed because you referenced the History section.

With respect to your issue it may be due to the cleaning that takes place on emails before they are saved.

Another thing to look at could be your default email template: that could also be the source of the empty lines.

I think that the class “MsoNormal” is someting that comes from MS Outlook.

You should really try to understand how those empty lines got there in the first place; the display is correct (for what you have in the database).

If you must just correct the output, this might help you get the regex:
http://stackoverflow.com/questions/7738439/how-to-regex-replace-multiple-br-tags-with-one-br-tag

and when I have to do a regex, I always go here to build it up, this is a really helpful site that lets you test and explains every bit of the regex:

https://regex101.com/

(see Substitution at the bottom of the screen)

Ok thanks,

The
and

are coming from Outlook. I figured how to remove them for now in the “view summary”. So this is a working solution.

modules/Activites/popup_picker.php



		$htmlClean = $this->formatDescription(strip_tags(br2nl(from_html($email->description_html))));
			
		$search = array(chr(0xC2) . chr(0xA0), // c2a0; Alt+255; Alt+0160; Alt+511; Alt+99999999;
		chr(0xC2) . chr(0x90), // c290; Alt+0144
		chr(0xC2) . chr(0x9D), // cd9d; Alt+0157
		chr(0xC2) . chr(0x81), // c281; Alt+0129
		chr(0xC2) . chr(0x8D), // c28d; Alt+0141
		chr(0xC2) . chr(0x8F), // c28f; Alt+0143
		chr(0xC2) . chr(0xAD), // cdad; Alt+0173
		chr(0xAD)); // Soft-Hyphen; AD
		$htmlClean = str_replace($search, '', $htmlClean);
		$htmlClean = preg_replace('#<br\s*/?>(?:\s*<br\s*/?>)+#i', '<br /><br />', $htmlClean);
		
		$details .= empty($email->description_html)
			? $this->formatDescription($email->description)
			: $htmlClean;	

It would be nice to remove them each time an email is stored in email_text. But I’m not there yet.

Jonathan

1 Like

Hey Jonathan,

Just wondering whether you made any further progress with this at all?

Ben

Hi Ben,

No, my solution (posted before) to fix the “view summary” was an “ok” solution for now. So I stopped investigating. But those

are still stored in database and still there when we reply to emails.

Any progress on your side ? Do you have the same problem ?

Jonathan

Yes, I have exactly the same problem. I have raised a GitHub suggestion, now I’m waiting to see if the SuiteCRM team can come up with a fix.

Ok thanks. Can you post the link to the GitHub suggestion ?

Jonathan

This is it

https://github.com/salesagility/SuiteCRM/issues/4153

my feeling, from what I know about SuiteCRM GitHub Issues, is that it won’t go anywhere unless somebody who actually has this problem can make a more elaborate technical analysis, and pinpoint exactly where the line breaks are being added, or describe exactly how SuiteCRM should determine when to remove them (because it can’t just discard valid content, some double-newlines might be intentional).

Most people (all?) in SalesAgility don’t even have Outlook to test. It seems the Outlook plugin is developed externally…

So if anyone on this thread can work on it, great.