Merge pull request #16142 from eileenmcnaughton/deadlock_err
[civicrm-core.git] / CRM / Member / Form / Task / PDFLetter.php
CommitLineData
2d3e3c7b 1<?php
2/*
3 +--------------------------------------------------------------------+
bc77d7c0 4 | Copyright CiviCRM LLC. All rights reserved. |
2d3e3c7b 5 | |
bc77d7c0
TO
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
2d3e3c7b 9 +--------------------------------------------------------------------+
d25dd0ee 10 */
2d3e3c7b 11
12/**
13 *
14 * @package CRM
ca5cec67 15 * @copyright CiviCRM LLC https://civicrm.org/licensing
2d3e3c7b 16 * $Id$
17 *
18 */
19
20/**
21 * This class provides the functionality to create PDF letter for a group of
22 * contacts or a single contact.
23 */
24class CRM_Member_Form_Task_PDFLetter extends CRM_Member_Form_Task {
25
26 /**
fe482240 27 * All the existing templates in the system.
2d3e3c7b 28 *
29 * @var array
30 */
31 public $_templates = NULL;
32
33 public $_single = NULL;
34
35 public $_cid = NULL;
36
37 /**
fe482240 38 * Build all the data structures needed to build the form.
2d3e3c7b 39 *
40 * @return void
2d3e3c7b 41 */
00be9182 42 public function preProcess() {
2d3e3c7b 43 $this->skipOnHold = $this->skipDeceased = FALSE;
44 parent::preProcess();
45 $this->setContactIDs();
46 CRM_Contact_Form_Task_PDFLetterCommon::preProcess($this);
47 }
48
49 /**
fe482240 50 * Set defaults.
2d3e3c7b 51 * (non-PHPdoc)
52 * @see CRM_Core_Form::setDefaultValues()
53 */
00be9182 54 public function setDefaultValues() {
b09fe5ed 55 return CRM_Contact_Form_Task_PDFLetterCommon::setDefaultValues();
2d3e3c7b 56 }
57
58 /**
fe482240 59 * Build the form object.
2d3e3c7b 60 *
2d3e3c7b 61 *
62 * @return void
63 */
64 public function buildQuickForm() {
65 //enable form element
66 $this->assign('suppressForm', FALSE);
2d3e3c7b 67 CRM_Contact_Form_Task_PDFLetterCommon::buildQuickForm($this);
2d3e3c7b 68 }
69
70 /**
fe482240 71 * Process the form after the input has been submitted and validated.
2d3e3c7b 72 *
2d3e3c7b 73 *
355ba699 74 * @return void
2d3e3c7b 75 */
76 public function postProcess() {
77 // TODO: rewrite using contribution token and one letter by contribution
78 $this->setContactIDs();
79 $skipOnHold = isset($this->skipOnHold) ? $this->skipOnHold : FALSE;
80 $skipDeceased = isset($this->skipDeceased) ? $this->skipDeceased : TRUE;
53e258d3
DL
81 CRM_Member_Form_Task_PDFLetterCommon::postProcessMembers(
82 $this, $this->_memberIds, $skipOnHold, $skipDeceased, $this->_contactIds
83 );
2d3e3c7b 84 }
85
86 /**
5ec6b0ad
TM
87 * List available tokens for this form.
88 *
4a2db77c 89 * @return array
2d3e3c7b 90 */
91 public function listTokens() {
5ec6b0ad
TM
92 $tokens = CRM_Core_SelectValues::contactTokens();
93 $tokens = array_merge(CRM_Core_SelectValues::membershipTokens(), $tokens);
94 return $tokens;
2d3e3c7b 95 }
96025800 96
2d3e3c7b 97}