/** * Assert the content of document * * @param array $formValues * @param array $type */ public function _testDocumentContent($formValues, $type) { $html = array(); $form = new CRM_Contact_Form_Task_PDFLetterCommon(); list($formValues, $categories, $html_message, $messageToken, $returnProperties) = $form->processMessageTemplate($formValues); list($html_message, $zip) = CRM_Utils_PDF_Document::unzipDoc($formValues['document_file_path'], $formValues['document_type']); foreach ($this->_contactIds as $item => $contactId) { $params = array('contact_id' => $contactId); list($contact) = CRM_Utils_Token::getTokenDetails($params, $returnProperties, FALSE, FALSE, NULL, $messageToken, 'CRM_Contact_Form_Task_PDFLetterCommon'); $html[] = CRM_Utils_Token::replaceContactTokens($html_message, $contact[$contactId], TRUE, $messageToken); } $returnContent = CRM_Utils_PDF_Document::printDocuments($formValues['document_file_path'], $html, $type, $zip, TRUE); $returnContent = strip_tags($returnContent); $this->assertTrue(strpos($returnContent, 'Hello Antonia D`souza') !== 0); $this->assertTrue(strpos($returnContent, 'Hello Anthony Collins') !== 0); }
/** * Set default values for the form. * * @return void */ public function setDefaultValues() { return CRM_Contact_Form_Task_PDFLetterCommon::setDefaultValues(); }
/** * Build the form object. * * * @return void */ public function buildQuickForm() { //enable form element $this->assign('suppressForm', FALSE); // use contact form as a base CRM_Contact_Form_Task_PDFLetterCommon::buildQuickForm($this); // specific need for contributions $this->add('static', 'more_options_header', NULL, ts('Thank-you Letter Options')); $this->add('checkbox', 'receipt_update', ts('Update receipt dates for these contributions'), FALSE); $this->add('checkbox', 'thankyou_update', ts('Update thank-you dates for these contributions'), FALSE); // Group options for tokens are not yet implemented. dgg $options = array('' => ts('- no grouping -'), 'contact_id' => ts('Contact'), 'contribution_recur_id' => ts('Contact and Recurring'), 'financial_type_id' => ts('Contact and Financial Type'), 'campaign_id' => ts('Contact and Campaign'), 'payment_instrument_id' => 'Contact and Payment Instrument'); $this->addElement('select', 'group_by', ts('Group contributions by'), $options, array(), "<br/>", FALSE); // this was going to be free-text but I opted for radio options in case there was a script injection risk $separatorOptions = array('comma' => 'Comma', 'td' => 'Table Cell'); $this->addElement('select', 'group_by_separator', ts('Separator (grouped contributions)'), $separatorOptions); $emailOptions = array('' => ts('Generate PDFs for printing (only)'), 'email' => ts('Send emails where possible. Generate printable PDFs for contacts who cannot receive email.'), 'both' => ts('Send emails where possible. Generate printable PDFs for all contacts.')); if (CRM_Core_Config::singleton()->doNotAttachPDFReceipt) { $emailOptions['pdfemail'] = ts('Send emails with an attached PDF where possible. Generate printable PDFs for contacts who cannot receive email.'); $emailOptions['pdfemail_both'] = ts('Send emails with an attached PDF where possible. Generate printable PDFs for all contacts.'); } $this->addElement('select', 'email_options', ts('Print and email options'), $emailOptions, array(), "<br/>", FALSE); $this->addButtons(array(array('type' => 'submit', 'name' => ts('Make Thank-you Letters'), 'isDefault' => TRUE), array('type' => 'cancel', 'name' => ts('Done')))); }
/** * Build the form object. * * * @return void */ public function buildQuickForm() { //enable form element $this->assign('suppressForm', FALSE); CRM_Contact_Form_Task_PDFLetterCommon::buildQuickForm($this); }
/** * Process the form after the input has been submitted and validated. */ public function postProcess() { CRM_Contact_Form_Task_PDFLetterCommon::postProcess($this); }
/** * Build the form * * @access public * * @return void */ public function buildQuickForm() { //enable form element $this->assign('suppressForm', FALSE); // use contact form as a base CRM_Contact_Form_Task_PDFLetterCommon::buildQuickForm($this); // specific need for contributions $this->add('static', 'more_options_header', NULL, ts('Record Update Options')); $this->add('checkbox', 'receipt_update', ts('Update receipt dates for these contributions'), FALSE); $this->add('checkbox', 'thankyou_update', ts('Update thank-you dates for these contributions'), FALSE); // Group options for tokens are not yet implemented. dgg $options = array(ts('Contact'), ts('Recurring')); $this->addRadio('is_group_by', ts('Grouping contributions in one letter based on'), $options, array('unselectable' => TRUE), "<br/>", FALSE); $this->addButtons(array(array('type' => 'submit', 'name' => ts('Make Thank-you Letters'), 'isDefault' => TRUE), array('type' => 'cancel', 'name' => ts('Done')))); }