CRM-21255 - PDFLetterCommon - Detect buttons in new popup style
Overview
--------------
Suppose you enable the extension `org.civicrm.civicase`, set the option
`recordGeneratedLetters=combined-attached`, and create a PDF based on the
instructions in [CRM-21255](https://issues.civicrm.org/jira/browse/CRM-21255).
The PDF generator tries to determine whether the clicked the button labeled
"Preview" or "Download Document". This works correctly with the CiviCase 4 popup
mechanism, but in the CiviCase 5 popup mechanism it doesn't work.
Before
--------------
When you click the "Download Document" button, the operates in a
quasi-preview mode and fails to create any activities. This eventually
leads to a crash because the expected activities are missing.
After
--------------
The controller uses a more accurate check which correctly differentiates
"Preview" and "Download Document" on both CiviCase 4+5.
Comments
--------------
I'm not a huge fan of this patch, but it helps demonstrate the
problem+solution. @colemanw, perhaps there's a better way to make
the buttons function consistently in CiviCase 4+5?