Announcement

Collapse
No announcement yet.

No access to names of multiple attachments in print-to-pdf-feature

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • No access to names of multiple attachments in print-to-pdf-feature

    Hello,

    for the field type "Multiple Attachments" (e.g. in the entity cases) you have no acces to the names of the attachments in the print-to-pdf-feature. Ids are working.

    OK:
    {{#each attachmentsIds}}{{#if @first}}<br><b>IDs of Attachments:</b>{{/if}}<br>{{.}}{{/each}}

    Not OK (empty list):
    {{#each attachmentsNames}}{{#if @first}}<br><b>IDs of Attachments:</b>{{/if}}<br>{{.}}{{/each}}

    Both names (attachemtsIds and attachmentsNames) were offered in the Edit-Screen of the templates for the print-to-pdf-feature.

  • #2
    Hi,

    Try the snippet for link-multiple fields: https://github.com/espocrm/documenta...ultiple-fields

    Comment


    • #3
      Hi,
      I've tried the code based on your snippet:

      {{#each attachmentsIds}}
      <br>{{var this ../attachmentsNames}}
      {{/each}}


      It doesn't work. I just got an empty list. So I've digged in your attachment-multple.js. There I found the code (started at line 153):

      this.nameHashName = this.name + 'Names';
      this.typeHashName = this.name + 'Types';
      this.idsName = this.name + 'Ids';


      And I've tried to get access to attachmentsTypes in my print-to-pdf-template: it was successful. But I've no chance to get access to attachementsNames furthermore.


      Comment


      • #4
        Hello,

        Here's the fix: https://github.com/espocrm/espocrm/c...e00e6a92768867

        Comment


        • #5
          Hello,

          thanks for taking care of the problem. But something went wrong. I have integrated your fix. The #each - loop on attachmentsIds results in a list were are all attachmentsIds listes two times! (Before the fix, the list was ok.)
          I have tested a case in the entity cases with two attached files. The code

          {{#each attachmentsIds}}<br>{{@index}}: {{.}}{{/each}}

          generated the output

          0: 5b7d0c3fd7c1abbdd
          1: 5b7d0c3fd95f857e2
          2: 5b7d0c3fd7c1abbdd
          3: 5b7d0c3fd95f857e2


          But there are only 2 files attached. So I replaced the LightnCandy {{@index}} statement with the {{@key}} statement in my template code for analysis. The output was

          0: 5b7d0c3fd7c1abbdd
          1: 5b7d0c3fd95f857e2
          0_RAW: 5b7d0c3fd7c1abbdd
          1_RAW: 5b7d0c3fd95f857e2


          I hope it will be helpful

          And my underlying Problem exists furthermore: I have no access the attachmentsNames...

          Comment


          • #6
            Hi,

            Make sure that you applied the fix correctly.

            Comment


            • #7
              Hello,

              I'm really sure to implement the fix correctly:

              In file application/Espo/Core/Utils/Database/Orm/Relations/HasChildren.php I've changed the line 47 from
              'type' => 'varchar',
              to
              'type' => 'jsonObject',

              like showed in https://github.com/espocrm/espocrm/c...e00e6a92768867

              We are using the actual EspoCRM version: 5.3.6

              Comment


              • #8
                I can't reproduce.

                Comment


                • #9
                  It's mystic... After your last comment I've tried to reproduce the problem on a fresh installed Espo. There it works! But on the production system the error occurs furthermore. But it was only running after I rebuild the system AFTER changing the template. Rebuilding the system after changing the file HasChildren.php was NOT enough.
                  Whatever, thanks for your work - now it runs!

                  Comment


                  • #10
                    Maybe the php file was cached.

                    Comment

                    Working...
                    X