Forward porting our changes crm-dev
authorLisa Marie Maginnis <lisam@fsf.org>
Mon, 6 Oct 2014 15:03:49 +0000 (11:03 -0400)
committerDavid Thompson <davet@gnu.org>
Mon, 6 Oct 2014 15:51:24 +0000 (11:51 -0400)
Conflicts:

packages/snappy/src/Knp/Snappy/Pdf.php

CRM/Contact/Form/Task/PDFLatexCommon.php
CRM/Member/Import/Form/DataSource.php
CRM/Utils/PDF/Utils.php
packages/snappy/src/Knp/Snappy/Pdf.php [new file with mode: 0644]

index a0ca45339c14114d26b6b21c68dcedc5c46a2759..4dbdb1806b492a46902d35538e2bfdcd223dbc81 100644 (file)
@@ -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);
     }
   }
 
index f9ccde2a9a4034871a280dd8926a7c35ef12020a..107f536d4fd0fd383d677bcd731af46a1b0c1c6a 100644 (file)
@@ -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) {
index 492dae75f41c63860a9d9b4c4ebfce7fb1089b82..8b51f8341f97900cb30c23f63545efbba9935d3d 100644 (file)
@@ -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 (file)
index 0000000..6ea79ea
--- /dev/null
@@ -0,0 +1,144 @@
+<?php
+
+namespace Knp\Snappy;
+
+/**
+ * Use this class to transform a html/a url to a pdf
+ *
+ * @package Snappy
+ *
+ * @author  Matthieu Bontemps <matthieu.bontemps@knplabs.com>
+ * @author  Antoine Hérault <antoine.herault@knplabs.com>
+ */
+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,
+        ));
+    }
+}