$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'),
*/
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;
$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);