Fix CRM_Utils_PDF_Utils::_html2pdf_dompdf() when invoked more than once
authorOlaf Buddenhagen <antrik@digitalcourage.de>
Sat, 20 Jun 2015 22:49:12 +0000 (00:49 +0200)
committerOlaf Buddenhagen <antrik@digitalcourage.de>
Sat, 20 Jun 2015 23:28:58 +0000 (01:28 +0200)
Constants are like functions: they are always global; and they cannot
be redefined. Thus, move the defines to a context that doesn't get
re-evaluated on each invocation.

CRM/Utils/PDF/Utils.php

index 036e059f483ab2cef8fc5559ecd9531b6045615d..f2c9bd85588899f41ae18255cca136052f400bbd 100644 (file)
  +--------------------------------------------------------------------+
  */
 
+// CRM-12165 - Remote file support required for image handling.
+define("DOMPDF_ENABLE_REMOTE", TRUE);
+define('DOMPDF_ENABLE_AUTOLOAD', FALSE);
+
 /**
  *
  * @package CRM
@@ -190,9 +194,6 @@ class CRM_Utils_PDF_Utils {
    * @return string
    */
   public static function _html2pdf_dompdf($paper_size, $orientation, $html, $output, $fileName) {
-    // CRM-12165 - Remote file support required for image handling.
-    define('DOMPDF_ENABLE_REMOTE', TRUE);
-    define('DOMPDF_ENABLE_AUTOLOAD', FALSE);
     require_once 'vendor/dompdf/dompdf/dompdf_config.inc.php';
 
     $dompdf = new DOMPDF();