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


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

      Comment


      • #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


            • #7
              Hello item,

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

              Christoph

              Comment

              Working...
              X