From: Dave Greenberg Date: Sat, 3 Oct 2015 20:09:15 +0000 (-0400) Subject: CRM-16725 - Add Preview PDF button to PDF Letter task so users can review PDF without... X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=a37ec997eb9969be1b3e6cbdac54c328a2146bc5;p=civicrm-core.git CRM-16725 - Add Preview PDF button to PDF Letter task so users can review PDF without creating activity. ---------------------------------------- * CRM-16725: https://issues.civicrm.org/jira/browse/CRM-16725 --- diff --git a/CRM/Contact/Form/Task/PDFLetterCommon.php b/CRM/Contact/Form/Task/PDFLetterCommon.php index 94f309254e..885b962ce2 100644 --- a/CRM/Contact/Form/Task/PDFLetterCommon.php +++ b/CRM/Contact/Form/Task/PDFLetterCommon.php @@ -171,6 +171,13 @@ class CRM_Contact_Form_Task_PDFLetterCommon { $buttons = array(); if ($form->get('action') != CRM_Core_Action::VIEW) { + $buttons[] = array( + 'type' => 'submit', + 'name' => $form->_single ? ts('Preview PDF') : ts('Preview PDFs'), + 'subName' => 'preview', + 'icon' => 'zoomin', + 'isDefault' => FALSE, + ); $buttons[] = array( 'type' => 'submit', 'name' => $form->_single ? ts('Make PDF') : ts('Make PDFs'), @@ -312,7 +319,7 @@ class CRM_Contact_Form_Task_PDFLetterCommon { */ public static function postProcess(&$form) { list($formValues, $categories, $html_message, $messageToken, $returnProperties) = self::processMessageTemplate($form); - + $buttonName = $form->controller->getButtonName(); $skipOnHold = isset($form->skipOnHold) ? $form->skipOnHold : FALSE; $skipDeceased = isset($form->skipDeceased) ? $form->skipDeceased : TRUE; @@ -345,7 +352,10 @@ class CRM_Contact_Form_Task_PDFLetterCommon { $html[] = $tokenHtml; } - self::createActivities($form, $html_message, $form->_contactIds); + // CRM-16725 Skip creation of activities if user is previewing their PDF letter(s) + if ($buttonName == '_qf_PDF_submit') { + self::createActivities($form, $html_message, $form->_contactIds); + } CRM_Utils_PDF_Utils::html2pdf($html, "CiviLetter.pdf", FALSE, $formValues);