Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | /* | |
bc77d7c0 TO |
3 | +--------------------------------------------------------------------+ |
4 | | Copyright CiviCRM LLC. All rights reserved. | | |
5 | | | | |
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 | | |
9 | +--------------------------------------------------------------------+ | |
006389de | 10 | */ |
6a488035 TO |
11 | |
12 | /** | |
13 | * | |
14 | * @package CRM | |
ca5cec67 | 15 | * @copyright CiviCRM LLC https://civicrm.org/licensing |
6a488035 TO |
16 | */ |
17 | class CRM_Contribute_Form_SearchContribution extends CRM_Core_Form { | |
18 | ||
19 | /** | |
fe482240 | 20 | * Build the form object. |
6a488035 TO |
21 | */ |
22 | public function buildQuickForm() { | |
23 | $attributes = CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_ContributionPage', 'title'); | |
24 | $attributes['style'] = 'width: 90%'; | |
25 | ||
26 | $this->add('text', 'title', ts('Find'), $attributes); | |
27 | ||
481a74f4 | 28 | $financial_account = CRM_Contribute_PseudoConstant::financialType(); |
22e263ad | 29 | foreach ($financial_account as $contributionId => $contributionName) { |
8607c3f2 | 30 | $this->addElement('checkbox', "financial_type_id[$contributionId]", 'Financial Type', $contributionName); |
6a488035 TO |
31 | } |
32 | ||
33 | CRM_Campaign_BAO_Campaign::addCampaignInComponentSearch($this); | |
34 | ||
be2fb01f CW |
35 | $this->addButtons([ |
36 | [ | |
353ffa53 TO |
37 | 'type' => 'refresh', |
38 | 'name' => ts('Search'), | |
39 | 'isDefault' => TRUE, | |
be2fb01f CW |
40 | ], |
41 | ]); | |
6a488035 TO |
42 | } |
43 | ||
00be9182 | 44 | public function postProcess() { |
6a488035 TO |
45 | $params = $this->controller->exportValues($this->_name); |
46 | $parent = $this->controller->getParent(); | |
47 | $parent->set('searchResult', 1); | |
48 | if (!empty($params)) { | |
be2fb01f | 49 | $fields = ['title', 'financial_type_id', 'campaign_id']; |
6a488035 TO |
50 | foreach ($fields as $field) { |
51 | if (isset($params[$field]) && | |
52 | !CRM_Utils_System::isNull($params[$field]) | |
53 | ) { | |
54 | $parent->set($field, $params[$field]); | |
55 | } | |
56 | else { | |
57 | $parent->set($field, NULL); | |
58 | } | |
59 | } | |
60 | } | |
61 | } | |
96025800 | 62 | |
6a488035 | 63 | } |