skipOnHold = $this->skipDeceased = FALSE; CRM_Contact_Form_Task_PDFLetterCommon::preProcess($this); // store case id if present $this->_caseId = CRM_Utils_Request::retrieve('caseid', 'Positive', $this, FALSE); // retrieve contact ID if this is 'single' mode $cid = CRM_Utils_Request::retrieve('cid', 'Positive', $this, FALSE); $this->_activityId = CRM_Utils_Request::retrieve('id', 'Positive', $this, FALSE); if ($cid) { CRM_Contact_Form_Task_PDFLetterCommon::preProcessSingle($this, $cid); $this->_single = TRUE; $this->_cid = $cid; } else { parent::preProcess(); } $this->assign('single', $this->_single); } /** * This virtual function is used to set the default values of * various form elements * * access public * * @return array * reference to the array of default values */ /** * @return array */ public function setDefaultValues() { $defaults = array(); if (isset($this->_activityId)) { $params = array('id' => $this->_activityId); CRM_Activity_BAO_Activity::retrieve($params, $defaults); $defaults['html_message'] = CRM_Utils_Array::value('details', $defaults); } else { $defaults['thankyou_update'] = 1; } $defaults = $defaults + CRM_Contact_Form_Task_PDFLetterCommon::setDefaultValues(); return $defaults; } /** * 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(), "
", 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(), "
", FALSE); $this->addButtons(array( array( 'type' => 'submit', 'name' => ts('Make Thank-you Letters'), 'isDefault' => TRUE, ), array( 'type' => 'cancel', 'name' => ts('Done'), ), ) ); } /** * Process the form after the input has been submitted and validated. * * * @return void */ public function postProcess() { CRM_Contribute_Form_Task_PDFLetterCommon::postProcess($this); } }