Announcement

Collapse
No announcement yet.

placeholder in PDF-templates for user who prints the report

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

  • placeholder in PDF-templates for user who prints the report

    what is the placeholder? I've tested everything (?) but still empty print
    I use dompdf.

    Christoph

  • #2
    here is the link to the documentation that covers that subject https://docs.espocrm.com/user-guide/...rinting-to-pdf

    PHP Code:
    {{reportTable border=1 borderColor="#333" cellpadding=2 fontSize=9}} 

    Comment


    • conceptmedical
      conceptmedical commented
      Editing a comment
      rabii, Is there any possibilities to print row number in reportTable and any extra column, column size. I'm also getting two empty rows in reportTable one in starting at 0 index and one at the last index. How we can solve this issue.

  • #3
    Placeholder for current user is: {{assignedUserName}}

    Comment


    • conceptmedical
      conceptmedical commented
      Editing a comment
      yuri can you please answer to this?, I'm also getting the report assign user by {{assignedUserName}}. There is no such option for current user.

  • #4
    There's no such placeholder as far as I remember. You can implement it though, it's pretty trivial. https://docs.espocrm.com/development...custom-helper/

    Comment


    • #5
      Thanks yuri for your hint.
      I tried it ... but for me it's not trivial to get it run:
      At which place I have to add the dependecy to which field that shows me the name of the loged-in-user?
      <?php
      namespace Espo\Custom\TemplateHelpers;

      use Espo\Core\Htmlizer\Helper;
      use Espo\Core\Htmlizer\Helper\Data;
      use Espo\Core\Htmlizer\Helper\Result;

      class UserPrint implements Helper
      {
      public function __construct(
      // Pass needed dependencies.
      ) {

      }
      ok at THIS place, but WHAT?

      and if I add {{userPrint 'good morning' color='#bd318e'}} in my PDF-template, it shows good morning​ - that's not what I want ...
      WHAT is - in my example - to add instead of 'good morning'?

      Sometimes it is easy to learn with an example
      I think this implementation is useful for all users and all variants of espoCRM.

      Christoph
      Last edited by ctheuring; 12-02-2023, 11:41 AM.

      Comment


      • #6
        PHP Code:
        <?php

        namespace Espo\Custom\TemplateHelpers;

        use 
        Espo\Core\Htmlizer\Helper;
        use 
        Espo\Core\Htmlizer\Helper\Data;
        use 
        Espo\Core\Htmlizer\Helper\Result;
        use 
        Espo\Entities\User;

        class 
        PrintedBy implements Helper
        {
            public function 
        __construct(
                private 
        User $user,
            ){}

            public function 
        render(Data $data): Result
            
        {  
                return 
        Result::createSafeString$this->user->get('name') );
            }
        }
        PHP Code:
        "printedBy""Espo\\Custom\\TemplateHelpers\\PrintedBy" 

        and print-in-pdf
        {{printedBy}}
        Last edited by item; 12-02-2023, 11:37 PM.

        Comment


        • conceptmedical
          conceptmedical commented
          Editing a comment
          item, Can you show the path as well, where this files to be created to get the name as printedBy. and if possible, also suggest for row number.

        • item
          item commented
          Editing a comment
          Hi,
          first read doc .. the very well documented : https://docs.espocrm.com/development...plate-helpers/

          path : Espo\Custom\TemplateHelpers\PrintedBy.php <--- look namespace of the class.

          and : custom/Espo/Custom/Resources/metadata/app/templateHelpers.json

      • #7
        Hello item,

        that's what I want ... and it shows my inadequateness of php.
        Now it runs

        Christoph

        Comment

        Working...
        X