3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
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 +--------------------------------------------------------------------+
15 * @copyright CiviCRM LLC https://civicrm.org/licensing
17 class CRM_Contribute_Form_SearchContribution
extends CRM_Core_Form
{
20 * Build the form object.
22 public function buildQuickForm() {
23 $attributes = CRM_Core_DAO
::getAttribute('CRM_Contribute_DAO_ContributionPage', 'title');
24 $attributes['style'] = 'width: 90%';
26 $this->add('text', 'title', ts('Find'), $attributes);
28 $financial_account = CRM_Contribute_PseudoConstant
::financialType();
29 foreach ($financial_account as $contributionId => $contributionName) {
30 $this->addElement('checkbox', "financial_type_id[$contributionId]", 'Financial Type', $contributionName);
33 CRM_Campaign_BAO_Campaign
::addCampaignInComponentSearch($this);
38 'name' => ts('Search'),
44 public function postProcess() {
45 $params = $this->controller
->exportValues($this->_name
);
46 $parent = $this->controller
->getParent();
47 $parent->set('searchResult', 1);
48 if (!empty($params)) {
49 $fields = ['title', 'financial_type_id', 'campaign_id'];
50 foreach ($fields as $field) {
51 if (isset($params[$field]) &&
52 !CRM_Utils_System
::isNull($params[$field])
54 $parent->set($field, $params[$field]);
57 $parent->set($field, NULL);