4 * This class provides the common functionality for creating PDF letter for
7 class CRM_Member_Form_Task_PDFLetterCommon
extends CRM_Contact_Form_Task_PDFLetterCommon
{
10 * Process the form after the input has been submitted and validated.
11 * @todo this is horrible copy & paste code because there is so much risk of breakage
12 * in fixing the existing pdfLetter classes to be suitably generic
14 * @param CRM_Core_Form $form
15 * @param $membershipIDs
17 * @param $skipDeceased
22 public static function postProcessMembers(&$form, $membershipIDs, $skipOnHold, $skipDeceased, $contactIDs) {
24 list($formValues, $categories, $html_message, $messageToken, $returnProperties)
25 = self
::processMessageTemplate($form);
37 self
::createActivities($form, $html_message, $contactIDs);
39 CRM_Utils_PDF_Utils
::html2pdf($html, "CiviLetter.pdf", FALSE, $formValues);
41 $form->postProcessHook();
43 CRM_Utils_System
::civiExit(1);
47 * Generate htmlfor pdf letters.
49 * @param array $membershipIDs
50 * @param array $returnProperties
51 * @param bool $skipOnHold
52 * @param bool $skipDeceased
53 * @param unknown_type $messageToken
54 * @param $html_message
59 public static function generateHTML($membershipIDs, $returnProperties, $skipOnHold, $skipDeceased, $messageToken, $html_message, $categories) {
60 $memberships = CRM_Utils_Token
::getMembershipTokenDetails($membershipIDs);
62 foreach ($membershipIDs as $membershipID) {
63 $membership = $memberships[$membershipID];
64 // get contact information
65 $contactId = $membership['contact_id'];
66 $params = array('contact_id' => $contactId);
67 //getTokenDetails is much like calling the api contact.get function - but - with some minor
68 // special handlings. It precedes the existence of the api
69 list($contacts) = CRM_Utils_Token
::getTokenDetails(
76 'CRM_Contribution_Form_Task_PDFLetterCommon'
79 $tokenHtml = CRM_Utils_Token
::replaceContactTokens($html_message, $contacts[$contactId], TRUE, $messageToken);
80 $tokenHtml = CRM_Utils_Token
::replaceEntityTokens('membership', $membership, $tokenHtml, $messageToken);
81 $tokenHtml = CRM_Utils_Token
::replaceHookTokens($tokenHtml, $contacts[$contactId], $categories, TRUE);
82 $tokenHtml = CRM_Utils_Token
::parseThroughSmarty($tokenHtml, $contacts[$contactId]);