Error: Class 'Fabrik\Helpers\Pdf' not found: Class 'Fabrik\Helpers\Pdf' not found

Discussion in 'Community' started by pietrocir, Jan 11, 2018.

  1. pietrocir

    pietrocir New Member

    Level: Community
    When I click PDF button from a list I get a white page with this error:
    Error: Class 'Fabrik\Helpers\Pdf' not found: Class 'Fabrik\Helpers\Pdf' not found

    I installed Joomla! 3.8.3 by a fresh install, then Fabrik 3.8 and Fabrik libraries, then full update from GitHub today, I use default PDF template in parent window and Protostar for Joomla! template.
     
  2. pietrocir

    pietrocir New Member

    Level: Community
    I note that in file components / com_fabrik / pdf / pdf. php
    there is at line 19:
    require_once JPATH_SITE . '/components/com_fabrik/helpers/pdf.php';
    but such a file is absent from GitHub, elsewhere this line is commented, like at line 13 in
    libraries / src / Document / PdfDocument. php

    PDF Set up helper in GitHub is in:
    libraries / fabrik / fabrik / Helpers / Pdf. php
     
  3. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Professional
    The components/com_fabrik/pdf/pdf.php isn't used in 3.8, that's the one we copy to the ./libraries location in 3.7.

    Can you check ./libraries/fabrik/include.php and make sure it has the 'helper' autoload at line 27.

    -- hugh
     
  4. pietrocir

    pietrocir New Member

    Level: Community
    It is there, line 27:
    spl_autoload_register(array($this, 'helper'));
     
  5. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Professional
    OK, so it should work - the ./libraries/fabrik/fabrik/Helpers/Pdf.php should get autoloaded when referenced. And I can't replicate this problem, PDF works fine for me (and lots of other sites).

    The only thing I can think of is that there is some other system plugin causing the PDF doc to load before our system plugin has run (which is where that include.php gets run). I've seen that happen a couple of times, although I can't remember off the top of my head which plugins cause the issue.

    One thing you might try is run phpMyAdmin (or whatever your database client of choice is), find the plg_fabrik_system plugin row in #__extensions, and set the 'ordering' to -1, to make sure it runs first.

    -- hugh
     
    pietrocir likes this.
  6. pietrocir

    pietrocir New Member

    Level: Community
    In #__extensions table in my Joomla! db I have 30 components, all with 'ordering' set to '0', but there is not something for fabrik.
    Then in Joomla! administration I checked Plug-ins (Extensions Plugin Manager Edit), and for 'System - fabrik' its ordering was below another plug-in (System - EU e-Privacy Directive): when I disable this last one, PDF button works. If I try to change ordering and save, it keeps old ordering anyway, it refuses to change, so I have to disable privacy plug-in.
    Are System - fabrik and System - EU e-Privacy Directive plug-ins incompatible each other?
    Is there a way to use Fabrik PDF and EU e-Privacy Directive together?
     
  7. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Professional
    Look again. There will be a row with the 'name' = plg_fabrik_system, 'type' = plugin, 'folder' = system.

    Make sure the ordering on that is set less than the EU one. You can't change the ordering in the Joomla UI, you have to do it directly in the database table.

    -- hugh
     
  8. pietrocir

    pietrocir New Member

    Level: Community
    OK,
    I found in #__extensions table a row with the 'name' = plg_fabrik_system, 'type' = plugin, 'folder' = system, and I set 'ordering' to '-1'.
    There is a row with the 'name' = PLG_SYS_EPRIVACY, 'type' = plugin, 'folder' = system, with 'ordering' = 0.
    Now in Joomla! UI the ordering is changed, but problem still persists: PDF output works only if PLG_SYS_EPRIVACY is disabled.
    I also tried with PLG_SYS_EPRIVACY set to '1' for 'ordering'.
     
  9. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Professional
    Oh well. I have no clue what that plugin is doing then, but it's causing the document to be instantiated before we have had a chance to register the autoloaders for our helper classes.

    -- hugh
     
  10. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Professional
    I loaded that extension and had a look. Although it doesn't blow up on my system, is does prevent PDF's from being generated, because the plugin is doing this:

    Code (Text):

    $this->_doc = JFactory::getDocument();
     
    ... in its __constructor() method, which is causing J!'s default doc to be created as html instead of pdf, because none of the rest of J!'s init has happened, including setting the 'format' input. Plugins should *not* create the document until all routing and initialization has completed.

    I'll see if I can get hold of the dev and get him to tweak how he sets his plugin up.

    -- hugh
     
  11. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Professional
    I created an account on their forum and posted a followup to your post.

    -- hugh
     
  12. Sophist

    Sophist Moderator Staff Member

    Level: Community
    In my experience Michael is normally extremely responsive to support requests.

    And thank you Hugh for diagnosing the problem - well beyond my level of experience to identify.
     

Share This Page