1. Kayako Download customers: we will continue to develop and support Kayako Download beyond July 2017, alongside the new Kayako for existing customers.

    Find out more.

  2. The forum you are viewing relates to Kayako Classic. If you signed up or upgraded to the new Kayako (after the 4th July 2016), the information in this thread may not apply to you. You can visit the forums for the new Kayako here.

Major fix for HTML emails + breaklines!

Discussion in 'Developing, APIs and extending' started by Marvin Herbold, Feb 11, 2012.

  1. Eddie Loh

    Eddie Loh New Member

    Is 959 version compatible to kayako v4.40.986?
     
  2. Drew Keller

    Drew Keller Just one person in a world of millions.

    I have not taken the latest update yet so I am unsure, you could compare the files and merge the chnges like I did to make the 959 version
     
  3. Gary McGrath

    Gary McGrath Staff Member

    It should be, the only files changed were relating to unified search and the security flaws which needed patching, tickposts was unchanged.

    Gary
     
  4. tallen-bt

    tallen-bt Established Member

    I am assuming this works with 1079? We are getting the following every once in a while:
    Code:
    [Notice]: Trying to get property of non-object (Ticket/class.SWIFT_TicketPost.php:865)
    [Warning]: Invalid argument supplied for foreach() (Ticket/class.SWIFT_TicketPost.php:865)
    The line refers to a function Marvin created called FindTag().

    EDIT: Since I don't know why it failed I had to revert to the original Ticket.Post. So many extra spaces and broken break lines now. :(
     
  5. Drew Keller

    Drew Keller Just one person in a world of millions.

    Its a real shame that Marvin is not keeping up with releases as this was a very handy mod, but it does not work with 4.40.1148 and my PHP skills are not enough to debug the issues (everything seems to just hang when i merge the files and then try to open the ticket list let anlone an individual ticket.
     
  6. Gary McGrath

    Gary McGrath Staff Member

    Drew,

    I would suggest you run a file compare between two "clean" kayako files, between the last version and the lastest. Look for the lines that changed, then take those changes and put them into the files Marvin created. that should get it working for you

    Gary
     
  7. Drew Keller

    Drew Keller Just one person in a world of millions.

    Gary,

    Unfortunately I did not have a clean copy of the old version (little mishap with the delete key which is why my upgrade took me a while to arrange)

    I tried to insert all Marvin's changes but there was at least one line that Marvin changed and Kayako changed.

    I will have more of a look over the weekend to see of I can debug it further.
     
  8. Gary McGrath

    Gary McGrath Staff Member

    Give this version a try, I have not checked marvins code, but I imported the kayako changes into his file

    Gary
     

    Attached Files:

    Drew Keller likes this.
  9. Drew Keller

    Drew Keller Just one person in a world of millions.

    Gary,

    Thanks,

    I was so close. Looks like when I did it I stuffed up line 1613 (in your copy), I think I tried to merge the code together rather than just using Marvins code. My Bad.

    Anyway, so far so good seems to be working once again. but real test will come next week as real emails are sent in, but at least I can access the screens with this version installed.
     
  10. brat42

    brat42 Established Member

    Can anyone tell me please how I can fix the attached please? So that the Parsar interprets everything as a Ctrl + Enter line break?

    Thank you
     

    Attached Files:

  11. Drew Keller

    Drew Keller Just one person in a world of millions.

    If this modification does not fix it directly you need to have a look at the source of one of the emails to see how the mail client is formatting the standard Enter. I suspect that it will be a <p></p> as in paragraph which is why it would be showing larger breaks than a </br>.

    This would mean that you would have to adjust this code to handle this type of entry differently and replace it with </br>, however you also need to consider how actual paragraphs should be handled. But this is all an asumption as I am not sure how your mail client is actually formatting the emails.
     
  12. brat42

    brat42 Established Member

    Code:
    <span style='font-size:11.0pt;font-family:"Calibri","sans-serif"'>Test 23:40<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif"'>Test 23:40<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif"'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif"'>Test 23:40<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif"'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif"'>Test 23:40<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif"'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif"'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif"'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif"'>Test 23:40<o:p></o:p></span></p><p class=MsoNormal>
    The above is the code for the incorrect ticket parse from the attached image (bottom). Yes, it seems like it is the <p> and </p> but how would I get it to parse as <br> instead?

    Thank you
     
  13. Drew Keller

    Drew Keller Just one person in a world of millions.

    I would think you need to find something that is unique in this situation and then do a replace.

    Looking at your code I would think you could parse
    Code:
    <o:p></o:p></span></p>
    and replace with </br> however this would be somethign specific for this mail client and could cause other issues if you did not do it properly.

    My PHP skills are not strong enough to be able to develop this update and I have to say I have not actually noticed an issue since using this Mod that Marvin wrote, although as its only a small gap when you only have a single Enter I may not have noticed it.
     
  14. tallen-bt

    tallen-bt Established Member

    You aren't using the TinyMCE patch by chance are you?
     
  15. brat42

    brat42 Established Member

    I am using the patch :(

    Any help appreciated. Thank you.
     
  16. tallen-bt

    tallen-bt Established Member

    You have to modify Core.js in the LoadTinyMCE function (not sure if that is the right name or not) and switch it from using P tags to using BR instead. Here is what I posted in the dev area:
    Code:
    We are using the following settings to match what we see in TinyMCE vs previous Ticket Responses after submitted
    force_br_newlines : true,
    force_p_newlines : false,
    forced_root_block : false,
     
  17. indesigns

    indesigns Established Member

    Does anyone have the latest file for this to work with 4.40.1148? I had it working with 4.40.959 or 4.40.986. Looks like it is not being updated in kayako forge.
     
  18. tallen-bt

    tallen-bt Established Member

    Gary posted the changed file further up ^. That is the one that currently works.
     
  19. u.ha

    u.ha Member

    We had the same notice and warning in our error log although we used Gary's file which should work with 4.40.1148.
    Seems to be a problem with $_parentTag->_data from line:
    Code:
    foreach ($_parentTag->_data as $_key => $_data)
    For now we had to restore the original TicketPost.php. Maybe someone can fix the problem?
     
  20. Drew Keller

    Drew Keller Just one person in a world of millions.

    I have been using Gary's version on 4.40.1148 since he posted it in May and have not had a single error in the log with regards to this.

    Do you have any other mod's installed?
     

Share This Page