Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-9807

Create PDF Letter Not Working With Joomla 2.5.x

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Minor
    • Resolution: Cannot Reproduce
    • Affects Version/s: 4.1.0
    • Fix Version/s: 4.1.2
    • Component/s: Core CiviCRM
    • Labels:
      None

      Description

      When trying to create a PDF letter using CiviCRM 4.1 on Joomla 2.5, Joomla returns a 500 error with the following message: Passed array does not specify a callable static method

      This is apparently due to some changes in the Joomla autoloader. When googling the error, I found that the only matching results were error reports for a Joomla plugin called HTMLPurifier which was returning the same unique error. I eventually found a patched version of HTMLPurifier by Alessandro Pasotti here: http://www.itopen.it/2012/02/07/htmlpurifier-plugin-for-joomla-2-5/

      I was able to incorporate his patch into joomla/administrator/components/com_civicrm/civicrm/CRM/Utils/PDF/Utils.php

      This section:

      require_once 'packages/dompdf/dompdf_config.inc.php';
      spl_autoload_register('DOMPDF_autoload');

      Was replaced with this:

      //Below added in from HTML Purifier Patch
      // ABP: Disable spl functions
      if ($funcs = spl_autoload_functions()){
      foreach($funcs as $func)

      { spl_autoload_unregister($func); }

      }

      require_once 'packages/dompdf/dompdf_config.inc.php';
      spl_autoload_register('DOMPDF_autoload');

      //This added in as well
      // ABP: Re-enable spl functions
      if ($funcs){
      foreach($funcs as $func){
      if(is_callable($func))

      { spl_autoload_register($func); }

      }
      // Re-register
      // Import the library loader if necessary.
      if (!class_exists('JLoader'))

      { require_once JPATH_PLATFORM . '/loader.php'; }

      class_exists('JLoader') or die;
      // Setup the autoloaders.
      JLoader::setup();
      // Import the cms loader if necessary.
      if (!class_exists('JCmsLoader'))

      { require_once JPATH_PLATFORM.'/cms/cmsloader.php'; }

      // Setup the autoloader.
      JCmsLoader::setup();

      }

      I take no credit for the code. That should all go to Alessandro Pasotti.

      I hope this helps.

        Attachments

          Activity

            People

            • Assignee:
              lobo Donald A. Lobo
              Reporter:
              hajimaichiro David Rivera
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: