<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 5 |
- +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2019 |
- +--------------------------------------------------------------------+
- | This file is a part of CiviCRM. |
- | |
- | CiviCRM is free software; you can copy, modify, and distribute it |
- | under the terms of the GNU Affero General Public License |
- | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
+ | Copyright CiviCRM LLC. All rights reserved. |
| |
- | CiviCRM is distributed in the hope that it will be useful, but |
- | WITHOUT ANY WARRANTY; without even the implied warranty of |
- | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
- | See the GNU Affero General Public License for more details. |
- | |
- | You should have received a copy of the GNU Affero General Public |
- | License and the CiviCRM Licensing Exception along |
- | with this program; if not, contact CiviCRM LLC |
- | at info[AT]civicrm[DOT]org. If you have questions about the |
- | GNU Affero General Public License or the licensing of CiviCRM, |
- | see the CiviCRM license FAQ at http://civicrm.org/licensing |
+ | This work is published under the GNU AGPLv3 license with some |
+ | permitted exceptions and without any warranty. For full license |
+ | and copyright information, see https://civicrm.org/licensing |
+--------------------------------------------------------------------+
*/
/**
*
* @package CRM
- * @copyright CiviCRM LLC (c) 2004-2019
+ * @copyright CiviCRM LLC https://civicrm.org/licensing
*/
class CRM_Contact_Form_Search_Custom_TagContributions extends CRM_Contact_Form_Search_Custom_Base implements CRM_Contact_Form_Search_Interface {
/**
* Define the columns for search result rows
*/
- $this->_columns = array(
+ $this->_columns = [
ts('Contact ID') => 'contact_id',
ts('Full Name') => 'sort_name',
ts('First Name') => 'first_name',
ts('Last Name') => 'last_name',
ts('Tag') => 'tag_name',
ts('Totals') => 'amount',
- );
+ ];
}
/**
* Define the search form fields here
*/
- $form->add('datepicker', 'start_date', ts('Contribution Date From'), [], FALSE, array('time' => FALSE));
- $form->add('datepicker', 'end_date', ts('...through'), [], FALSE, array('time' => FALSE));
- $tag = array('' => ts('- any tag -')) + CRM_Core_PseudoConstant::get('CRM_Core_DAO_EntityTag', 'tag_id', array('onlyActive' => FALSE));
+ $form->add('datepicker', 'start_date', ts('Contribution Date From'), [], FALSE, ['time' => FALSE]);
+ $form->add('datepicker', 'end_date', ts('...through'), [], FALSE, ['time' => FALSE]);
+ $tag = ['' => ts('- any tag -')] + CRM_Core_PseudoConstant::get('CRM_Core_DAO_EntityTag', 'tag_id', ['onlyActive' => FALSE]);
$form->addElement('select', 'tag', ts('Tagged'), $tag);
/**
* If you are using the sample template, this array tells the template fields to render
* for the search form.
*/
- $form->assign('elements', array('start_date', 'end_date', 'tag'));
+ $form->assign('elements', ['start_date', 'end_date', 'tag']);
}
/**
* WHERE clause is an array built from any required JOINS plus conditional filters based on search criteria field values
*
*/
+
/**
* @param bool $includeContactIDs
*
* @return string
*/
public function where($includeContactIDs = FALSE) {
- $clauses = array();
+ $clauses = [];
$clauses[] = "contact_a.contact_type = 'Individual'";
$clauses[] = "civicrm_contribution.contact_id = contact_a.id";
}
if ($includeContactIDs) {
- $contactIDs = array();
+ $contactIDs = [];
foreach ($this->_formValues as $id => $value) {
if ($value &&
substr($id, 0, CRM_Core_Form::CB_PREFIX_LEN) == CRM_Core_Form::CB_PREFIX
return implode(' AND ', $clauses);
}
-
/*
* Functions below generally don't need to be modified
*/
public function count() {
$sql = $this->all();
- $dao = CRM_Core_DAO::executeQuery($sql,
- CRM_Core_DAO::$_nullArray
- );
+ $dao = CRM_Core_DAO::executeQuery($sql);
return $dao->N;
}
* @return array
*/
public static function formatSavedSearchFields($formValues) {
- $dateFields = array(
+ $dateFields = [
'start_date',
'end_date',
- );
+ ];
foreach ($formValues as $element => $value) {
if (in_array($element, $dateFields) && !empty($value)) {
$formValues[$element] = date('Y-m-d', strtotime($value));