Strange behaviour in printing to PDF - Possible bug?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • shalmaxb
    Senior Member
    • Mar 2015
    • 1665

    #1

    Strange behaviour in printing to PDF - Possible bug?

    Since Upgrading to 9.0.8 there is a strange error in my installations (wich are all the same).

    In a custom entity I have to print out some PDF. For convenience I created Bootstrap buttons based on the WYSIWYG editor field, where I coded the Link to the PDF template by concatenating the necessary values, as shown in the following example. The code is implemented to the Editos field by formula.

    [PHP]ausstellungslisteDrucken(this is the WYSIWYG field) = string\concatenate('<button type="button" class="btn-xs btn-primary" style="width: 100%;">', '<a rel="noopener noreferrer"',' ', 'href="/?entryPoint=pdf&entityType=Ausstellungen&entityId= ',id ,'&templateId=649aea4e09f81da53','"',' ', 'target="_blank">',
    '<span style="color: #fff; text-decoration: none;">','ohne Preis','</span></a></button>');(the rest is the code to concatenate the URL to the PDF, which is pulled by the templateId on base of the current record (entityId=',id ))
    Until the Upgrade this worked without problems. This one button does not even appear and also printing by the menu on top of the record, the PDF will not be created, only a blank page with error 500 appears.
    Nothing in log file or Server log.

    The most strange thing is, when I duplicate the same formula right after the already present first formula, it works.
    I tried also with any third party plugin deinstalled.
  • yuri
    Member
    • Mar 2014
    • 8945

    #2
    Unfortunately, I cannot currently look into. It's been too much workload for me, can't handle more.

    Could be related: https://github.com/espocrm/espocrm/s...qrwp-v8v3-hqp2
    If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

    Comment

    • shalmaxb
      Senior Member
      • Mar 2015
      • 1665

      #3
      The only thing I see is, that the editor strips the "&" and substitutes it by &amp;. See screenhot of the by formula generated code.

      Click image for larger version

Name:	switched_html_tags.jpg
Views:	0
Size:	24.3 KB
ID:	117770
      Is it possible to evitate the code formatting with these HTML-Tags? Escaping?

      Comment

      • yuri
        Member
        • Mar 2014
        • 8945

        #4
        &amp; in an HTML attribute is not the cause of your problem. It's correct. https://stackoverflow.com/questions/...ands-in-a-href
        If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

        Comment

        • lazovic
          Super Moderator
          • Jan 2022
          • 1013

          #5
          Hi shalmaxb,

          Please tell me if I understand correctly that after saving the formula script in the entity, you get extra characters in the field value? I would like to reproduce your error.

          For your information, in my case the buttons are successfully created and work; the following works best:
          Code:
          string\concatenate(
              '<a class="btn btn-xs btn-primary" rel="noopener noreferrer" href="/?entryPoint=pdf&entityType=CCustomEntity&entityId=', id,
              '&templateId=6826fa01462052e08" target="_blank" style="width: 100%; display: inline-block; text-align: center; color: #fff; text-decoration: none;">',
              'Button',
              '</a>'
          );

          Comment

          Working...