From 33694bd85c565cbf35e26e753d7887b95d1032e2 Mon Sep 17 00:00:00 2001 From: Lisa Marie Maginnis Date: Mon, 6 Oct 2014 11:03:49 -0400 Subject: [PATCH] Forward porting our changes Conflicts: packages/snappy/src/Knp/Snappy/Pdf.php --- CRM/Contact/Form/Task/PDFLatexCommon.php | 9 +- CRM/Member/Import/Form/DataSource.php | 1 + CRM/Utils/PDF/Utils.php | 12 +- packages/snappy/src/Knp/Snappy/Pdf.php | 144 +++++++++++++++++++++++ 4 files changed, 156 insertions(+), 10 deletions(-) create mode 100644 packages/snappy/src/Knp/Snappy/Pdf.php diff --git a/CRM/Contact/Form/Task/PDFLatexCommon.php b/CRM/Contact/Form/Task/PDFLatexCommon.php index a0ca45339c..4dbdb1806b 100644 --- a/CRM/Contact/Form/Task/PDFLatexCommon.php +++ b/CRM/Contact/Form/Task/PDFLatexCommon.php @@ -48,7 +48,7 @@ class CRM_Contact_Form_Task_PDFLatexCommon { static function preProcess(&$form) { $messageText = array(); $messageSubject = array(); - $dao = new CRM_Core_BAO_MessageTemplates(); + $dao = new CRM_Core_BAO_MessageTemplate(); $dao->is_active = 1; $dao->find(); while ($dao->fetch()) { @@ -254,14 +254,14 @@ class CRM_Contact_Form_Task_PDFLatexCommon { } if (CRM_Utils_Array::value('saveTemplate', $formValues) && $formValues['saveTemplate']) { $messageTemplate['msg_title'] = $formValues['saveTemplateName']; - CRM_Core_BAO_MessageTemplates::add($messageTemplate); + CRM_Core_BAO_MessageTemplate::add($messageTemplate); } if (CRM_Utils_Array::value('updateTemplate', $formValues) && $formValues['template'] && $formValues['updateTemplate']) { $messageTemplate['id'] = $formValues['template']; unset($messageTemplate['msg_title']); - CRM_Core_BAO_MessageTemplates::add($messageTemplate); + CRM_Core_BAO_MessageTemplate::add($messageTemplate); } } elseif (CRM_Utils_Array::value('template', $formValues) > 0) { @@ -384,10 +384,11 @@ class CRM_Contact_Form_Task_PDFLatexCommon { foreach ($form->_contactIds as $contactId) { $activityTargetParams = array( + 'contact_id' => $contactId, 'activity_id' => empty($activity->id) ? $activityIds[$contactId] : $activity->id, 'target_contact_id' => $contactId, ); - CRM_Activity_BAO_Activity::createActivityTarget($activityTargetParams); + CRM_Activity_BAO_ActivityTarget::create($activityTargetParams); } } diff --git a/CRM/Member/Import/Form/DataSource.php b/CRM/Member/Import/Form/DataSource.php index f9ccde2a9a..107f536d4f 100644 --- a/CRM/Member/Import/Form/DataSource.php +++ b/CRM/Member/Import/Form/DataSource.php @@ -56,6 +56,7 @@ class CRM_Member_Import_Form_DataSource extends CRM_Core_Form { * @access public */ public function buildQuickForm() { + //Setting Upload File Size $config = CRM_Core_Config::singleton(); if ($config->maxImportFileSize >= 8388608) { diff --git a/CRM/Utils/PDF/Utils.php b/CRM/Utils/PDF/Utils.php index 492dae75f4..8b51f8341f 100644 --- a/CRM/Utils/PDF/Utils.php +++ b/CRM/Utils/PDF/Utils.php @@ -71,16 +71,16 @@ class CRM_Utils_PDF_Utils { %% This line might be necessary, but it was not able to find utf8.def on my %% machine. -\usepackage[utf8x]{inputenc} +%% \usepackage[utf8x]{inputenc} \pagestyle{empty} \tolerance=8000 \address{\vspace{0.05in}} \signature{John Sullivan \\\\ Executive Director} \usepackage[ -top = 0.4in, -bottom = 0.9in, -left = 0.8in, -right = 0.8in]{geometry} +top = 1.5in, +bottom = 1.0in, +left = 1.0in, +right = 1.0in]{geometry} \begin{document} '; $footer=' @@ -120,7 +120,7 @@ right = 0.8in]{geometry} header('Content-Disposition: attachment; filename="' . $fileName . '"'); echo $pdf; } - } + } static function html2pdf(&$text, $fileName = 'civicrm.pdf', $output = FALSE, $pdfFormat = NULL) { if (is_array($text)) { diff --git a/packages/snappy/src/Knp/Snappy/Pdf.php b/packages/snappy/src/Knp/Snappy/Pdf.php new file mode 100644 index 0000000000..6ea79ea45e --- /dev/null +++ b/packages/snappy/src/Knp/Snappy/Pdf.php @@ -0,0 +1,144 @@ + + * @author Antoine Hérault + */ +class Pdf extends AbstractGenerator +{ + /** + * {@inheritDoc} + */ + public function __construct($binary = null, array $options = array()) + { + $this->setDefaultExtension('pdf'); + + parent::__construct($binary, $options); + } + + /** + * {@inheritDoc} + */ + protected function configure() + { + $this->addOptions(array( + 'ignore-load-errors' => null, // old v0.9 + 'lowquality' => true, + 'collate' => null, + 'no-collate' => null, + 'cookie-jar' => null, + 'copies' => null, + 'dpi' => null, + 'extended-help' => null, + 'grayscale' => null, + 'help' => null, + 'htmldoc' => null, + 'image-dpi' => null, + 'image-quality' => null, + 'manpage' => null, + 'margin-bottom' => null, + 'margin-left' => null, + 'margin-right' => null, + 'margin-top' => null, + 'orientation' => null, + 'output-format' => null, + 'page-height' => null, + 'page-size' => null, + 'page-width' => null, + 'no-pdf-compression' => null, + 'quiet' => true, + 'read-args-from-stdin' => null, + 'title' => null, + 'use-xserver' => null, + 'version' => null, + 'dump-default-toc-xsl' => null, + 'dump-outline' => null, + 'outline' => null, + 'no-outline' => null, + 'outline-depth' => null, + 'allow' => null, + 'background' => null, + 'no-background' => null, + 'checkbox-checked-svg' => null, + 'checkbox-svg' => null, + 'cookie' => null, + 'custom-header' => null, + 'custom-header-propagation' => null, + 'no-custom-header-propagation' => null, + 'debug-javascript' => null, + 'no-debug-javascript' => null, + 'default-header' => null, + 'encoding' => null, + 'disable-external-links' => null, + 'enable-external-links' => null, + 'disable-forms' => null, + 'enable-forms' => null, + 'images' => null, + 'no-images' => null, + 'disable-internal-links' => null, + 'enable-internal-links' => null, + 'disable-javascript' => null, + 'enable-javascript' => null, + 'javascript-delay' => null, + 'load-error-handling' => null, + 'disable-local-file-access' => null, + 'enable-local-file-access' => null, + 'minimum-font-size' => null, + 'exclude-from-outline' => null, + 'include-in-outline' => null, + 'page-offset' => null, + 'password' => null, + 'disable-plugins' => null, + 'enable-plugins' => null, + 'post' => null, + 'post-file' => null, + 'print-media-type' => null, + 'no-print-media-type' => null, + 'proxy' => null, + 'radiobutton-checked-svg' => null, + 'radiobutton-svg' => null, + 'run-script' => null, + 'disable-smart-shrinking' => null, + 'enable-smart-shrinking' => null, + 'stop-slow-scripts' => null, + 'no-stop-slow-scripts' => null, + 'disable-toc-back-links' => null, + 'enable-toc-back-links' => null, + 'user-style-sheet' => null, + 'username' => null, + 'window-status' => null, + 'zoom' => null, + 'footer-center' => null, + 'footer-font-name' => null, + 'footer-font-size' => null, + 'footer-html' => null, + 'footer-left' => null, + 'footer-line' => null, + 'no-footer-line' => null, + 'footer-right' => null, + 'footer-spacing' => null, + 'header-center' => null, + 'header-font-name' => null, + 'header-font-size' => null, + 'header-html' => null, + 'header-left' => null, + 'header-line' => null, + 'no-header-line' => null, + 'header-right' => null, + 'header-spacing' => null, + 'replace' => null, + 'disable-dotted-lines' => null, + 'toc-header-text' => null, + 'toc-level-indentation' => null, + 'disable-toc-links' => null, + 'toc-text-size-shrink' => null, + 'xsl-style-sheet' => null, + )); + } +} -- 2.25.1