CRM-19761 support docx, etc export
authorBrian Shaughnessy <brian@lcdservices.biz>
Tue, 20 Dec 2016 16:16:14 +0000 (11:16 -0500)
committerBrian Shaughnessy <brian@lcdservices.biz>
Tue, 20 Dec 2016 16:16:14 +0000 (11:16 -0500)
CRM/Contribute/Form/Task/PDFLetterCommon.php

index b93bd533a0306774a6aaa8b9678bd2fb8bd4b496..adc1e8de9fbf276282f806fd50d584cb7c49dfb1 100644 (file)
@@ -112,8 +112,17 @@ class CRM_Contribute_Form_Task_PDFLetterCommon extends CRM_Contact_Form_Task_PDF
     //@todo - figure out why
     $form->_contactIds = array_keys($contacts);
     self::createActivities($form, $html_message, $form->_contactIds);
+
+    //CRM-19761
     if (!empty($html)) {
-      CRM_Utils_PDF_Utils::html2pdf($html, "CiviLetter.pdf", FALSE, $formValues);
+      $type = $formValues['document_type'];
+
+      if ($type == 'pdf') {
+        CRM_Utils_PDF_Utils::html2pdf($html, "CiviLetter.pdf", FALSE, $formValues);
+      }
+      else {
+        CRM_Utils_PDF_Document::html2doc($html, "CiviLetter.$type", $formValues);
+      }
     }
 
     $form->postProcessHook();