Skip to content

Commit

Permalink
Merge pull request #11186 from totten/master-civicase-pdf
Browse files Browse the repository at this point in the history
CRM-21255 - PDFLetterCommon - Detect buttons in new popup style
  • Loading branch information
colemanw authored Oct 27, 2017
2 parents 50fc005 + 592172f commit b30f833
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions CRM/Contact/Form/Task/PDFLetterCommon.php
Original file line number Diff line number Diff line change
Expand Up @@ -363,8 +363,12 @@ public static function postProcess(&$form) {
$skipDeceased = isset($form->skipDeceased) ? $form->skipDeceased : TRUE;
$html = $activityIds = array();

// CRM-21255 - Hrm, CiviCase 4+5 seem to report buttons differently...
$c = $form->controller->container();
$isLiveMode = ($buttonName == '_qf_PDF_upload') || isset($c['values']['PDF']['buttons']['_qf_PDF_upload']);

// CRM-16725 Skip creation of activities if user is previewing their PDF letter(s)
if ($buttonName == '_qf_PDF_upload') {
if ($isLiveMode) {

// This seems silly, but the old behavior was to first check `_cid`
// and then use the provided `$contactIds`. Probably not even necessary,
Expand Down Expand Up @@ -418,7 +422,7 @@ public static function postProcess(&$form) {
}

$tee = NULL;
if (Civi::settings()->get('recordGeneratedLetters') === 'combined-attached') {
if ($isLiveMode && Civi::settings()->get('recordGeneratedLetters') === 'combined-attached') {
if (count($activityIds) !== 1) {
throw new CRM_Core_Exception("When recordGeneratedLetters=combined-attached, there should only be one activity.");
}
Expand Down

0 comments on commit b30f833

Please sign in to comment.