3 +--------------------------------------------------------------------+
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2018 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
19 | You should have received a copy of the GNU Affero General Public |
20 | License and the CiviCRM Licensing Exception along |
21 | with this program; if not, contact CiviCRM LLC |
22 | at info[AT]civicrm[DOT]org. If you have questions about the |
23 | GNU Affero General Public License or the licensing of CiviCRM, |
24 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
25 +--------------------------------------------------------------------+
31 * @copyright CiviCRM LLC (c) 2004-2018
33 class CRM_Report_Form_Contribute_Lybunt
extends CRM_Report_Form
{
35 protected $_charts = array(
37 'barChart' => 'Bar Chart',
38 'pieChart' => 'Pie Chart',
42 * This is the report that links will lead to.
44 * It is a bit problematic to use contribute/detail for anything other than a single contact
45 * as the filtering from this report does not carry over to that report.
49 public $_drilldownReport = array('contribute/detail' => 'Link to Detail Report');
51 protected $lifeTime_from = NULL;
52 protected $lifeTime_where = NULL;
53 protected $_customGroupExtends = array(
61 * Table containing list of contact IDs.
65 protected $contactTempTable = '';
68 * This report has been optimised for group filtering.
74 protected $groupFilterNotOptimised = FALSE;
79 public function __construct() {
80 $this->optimisedForOnlyFullGroupBy
= FALSE;
81 $this->_rollup
= 'WITH ROLLUP';
82 $this->_autoIncludeIndexedFieldsAsOrderBys
= 1;
85 $date = CRM_Core_SelectValues
::date('custom', NULL, $yearsInPast, $yearsInFuture);
86 $count = $date['maxYear'];
87 while ($date['minYear'] <= $count) {
88 $optionYear[$date['minYear']] = $date['minYear'];
92 // Check if CiviCampaign is a) enabled and b) has active campaigns
93 $config = CRM_Core_Config
::singleton();
94 $campaignEnabled = in_array("CiviCampaign", $config->enableComponents
);
95 if ($campaignEnabled) {
96 $getCampaigns = CRM_Campaign_BAO_Campaign
::getPermissionedCampaigns(NULL, NULL, TRUE, FALSE, TRUE);
97 $this->activeCampaigns
= $getCampaigns['campaigns'];
98 asort($this->activeCampaigns
);
101 $this->_columns
= array(
102 'civicrm_contact' => array(
103 'dao' => 'CRM_Contact_DAO_Contact',
104 'grouping' => 'contact-field',
105 'fields' => $this->getBasicContactFields(),
106 'order_bys' => array(
107 'sort_name' => array(
108 'title' => ts('Last Name, First Name'),
110 'default_order' => 'ASC',
112 'first_name' => array(
113 'name' => 'first_name',
114 'title' => ts('First Name'),
116 'gender_id' => array(
117 'name' => 'gender_id',
118 'title' => ts('Gender'),
120 'birth_date' => array(
121 'name' => 'birth_date',
122 'title' => ts('Birth Date'),
124 'contact_type' => array(
125 'title' => ts('Contact Type'),
127 'contact_sub_type' => array(
128 'title' => ts('Contact Subtype'),
132 'sort_name' => array(
133 'title' => ts('Donor Name'),
134 'operator' => 'like',
137 'title' => ts('Contact ID'),
138 'no_display' => TRUE,
140 'gender_id' => array(
141 'title' => ts('Gender'),
142 'operatorType' => CRM_Report_Form
::OP_MULTISELECT
,
143 'options' => CRM_Core_PseudoConstant
::get('CRM_Contact_DAO_Contact', 'gender_id'),
145 'birth_date' => array(
146 'title' => ts('Birth Date'),
147 'operatorType' => CRM_Report_Form
::OP_DATE
,
149 'contact_type' => array(
150 'title' => ts('Contact Type'),
152 'contact_sub_type' => array(
153 'title' => ts('Contact Subtype'),
155 'is_deceased' => array(),
156 'do_not_phone' => array(),
157 'do_not_email' => array(),
158 'do_not_sms' => array(),
159 'do_not_mail' => array(),
160 'is_opt_out' => array(),
163 'civicrm_line_item' => array(
164 'dao' => 'CRM_Price_DAO_LineItem',
166 'civicrm_email' => array(
167 'dao' => 'CRM_Core_DAO_Email',
168 'grouping' => 'contact-field',
171 'title' => ts('Email'),
175 'title' => ts('Email on hold'),
179 'civicrm_phone' => array(
180 'dao' => 'CRM_Core_DAO_Phone',
181 'grouping' => 'contact-field',
184 'title' => ts('Phone'),
190 $this->_columns +
= $this->addAddressFields(FALSE);
191 $this->_columns +
= array(
192 'civicrm_contribution' => array(
193 'dao' => 'CRM_Contribute_DAO_Contribution',
195 'contact_id' => array(
196 'title' => ts('contactId'),
197 'no_display' => TRUE,
201 'receive_date' => array(
202 'title' => ts('Year'),
203 'no_display' => TRUE,
207 'last_year_total_amount' => array(
208 'title' => ts('Last Year Total'),
210 'type' => CRM_Utils_Type
::T_MONEY
,
213 'civicrm_life_time_total' => array(
214 'title' => ts('Lifetime Total'),
216 'type' => CRM_Utils_Type
::T_MONEY
,
217 'statistics' => array('sum' => ts('Lifetime total')),
222 'name' => 'receive_date',
223 'title' => ts('This Year'),
224 'operatorType' => CRM_Report_Form
::OP_SELECT
,
225 'options' => $optionYear,
226 'default' => date('Y'),
227 'type' => CRM_Utils_Type
::T_INT
,
229 'financial_type_id' => array(
230 'title' => ts('Financial Type'),
231 'type' => CRM_Utils_Type
::T_INT
,
232 'operatorType' => CRM_Report_Form
::OP_MULTISELECT
,
233 'options' => CRM_Financial_BAO_FinancialType
::getAvailableFinancialTypes(),
235 'contribution_status_id' => array(
236 'title' => ts('Contribution Status'),
237 'operatorType' => CRM_Report_Form
::OP_MULTISELECT
,
238 'options' => CRM_Contribute_PseudoConstant
::contributionStatus(),
239 'default' => array('1'),
242 'order_bys' => array(
243 'last_year_total_amount' => array(
244 'title' => ts('Total amount last year'),
246 'default_weight' => '0',
247 'default_order' => 'DESC',
252 $this->_columns +
= array(
253 'civicrm_financial_trxn' => array(
254 'dao' => 'CRM_Financial_DAO_FinancialTrxn',
256 'card_type_id' => array(
257 'title' => ts('Credit Card Type'),
258 'dbAlias' => 'GROUP_CONCAT(financial_trxn_civireport.card_type_id SEPARATOR ",")',
262 'card_type_id' => array(
263 'title' => ts('Credit Card Type'),
264 'operatorType' => CRM_Report_Form
::OP_MULTISELECT
,
265 'options' => CRM_Financial_DAO_FinancialTrxn
::buildOptions('card_type_id'),
267 'type' => CRM_Utils_Type
::T_STRING
,
273 // If we have a campaign, build out the relevant elements
274 if ($campaignEnabled && !empty($this->activeCampaigns
)) {
275 $this->_columns
['civicrm_contribution']['fields']['campaign_id'] = array(
276 'title' => ts('Campaign'),
277 'default' => 'false',
278 'type' => CRM_Utils_Type
::T_INT
,
280 $this->_columns
['civicrm_contribution']['filters']['campaign_id'] = array(
281 'title' => ts('Campaign'),
282 'operatorType' => CRM_Report_Form
::OP_MULTISELECT
,
283 'options' => $this->activeCampaigns
,
284 'type' => CRM_Utils_Type
::T_INT
,
288 $this->_groupFilter
= TRUE;
289 $this->_tagFilter
= TRUE;
290 parent
::__construct();
294 * Build select clause for a single field.
296 * @param string $tableName
297 * @param string $tableKey
298 * @param string $fieldName
299 * @param string $field
303 public function selectClause(&$tableName, $tableKey, &$fieldName, &$field) {
304 if ($fieldName == 'last_year_total_amount') {
305 $this->_columnHeaders
["{$tableName}_{$fieldName}"] = $field;
306 $this->_columnHeaders
["{$tableName}_{$fieldName}"]['title'] = $this->getLastYearColumnTitle();
307 $this->_statFields
[$this->getLastYearColumnTitle()] = "{$tableName}_{$fieldName}";
308 return "SUM(IF(" . $this->whereClauseLastYear('contribution_civireport.receive_date') . ", contribution_civireport.total_amount, 0)) as {$tableName}_{$fieldName}";
310 if ($fieldName == 'civicrm_life_time_total') {
311 $this->_columnHeaders
["{$tableName}_{$fieldName}"] = $field;
312 $this->_statFields
[$field['title']] = "{$tableName}_{$fieldName}";
313 return "SUM({$this->_aliases[$tableName]}.total_amount) as {$tableName}_{$fieldName}";
315 if ($fieldName == 'receive_date') {
316 return self
::fiscalYearOffset($field['dbAlias']) .
317 " as {$tableName}_{$fieldName} ";
323 * Get the title for the last year column.
325 public function getLastYearColumnTitle() {
326 if ($this->getYearFilterType() == 'calendar') {
327 return ts('Total for ') . ($this->getCurrentYear() - 1);
329 return ts('Total for Fiscal Year ') . ($this->getCurrentYear() - 1) . '-' . ($this->getCurrentYear());
333 * Construct from clause.
335 * On the first run we are creating a table of contacts to include in the report.
337 * Once contactTempTable is populated we should avoid using any further filters that affect
338 * the contacts that should be visible.
340 public function from() {
341 if (!empty($this->contactTempTable
)) {
343 FROM civicrm_contribution {$this->_aliases['civicrm_contribution']}
344 INNER JOIN $this->contactTempTable restricted_contacts
345 ON restricted_contacts.cid = {$this->_aliases['civicrm_contribution']}.contact_id
346 AND {$this->_aliases['civicrm_contribution']}.is_test = 0
347 INNER JOIN civicrm_contact {$this->_aliases['civicrm_contact']}
348 ON restricted_contacts.cid = {$this->_aliases['civicrm_contact']}.id";
350 $this->joinAddressFromContact();
351 $this->joinPhoneFromContact();
352 $this->joinEmailFromContact();
355 $this->setFromBase('civicrm_contact');
357 $this->_from
.= " INNER JOIN civicrm_contribution {$this->_aliases['civicrm_contribution']} ";
358 if (!$this->groupTempTable
) {
359 // The received_date index is better than the contribution_status_id index (fairly substantially).
360 // But if we have already pre-filtered down to a group of contacts then we want that to be the
361 // primary filter and the index hint will block that.
362 $this->_from
.= "USE index (received_date)";
364 $this->_from
.= " ON {$this->_aliases['civicrm_contribution']}.contact_id = {$this->_aliases['civicrm_contact']}.id
365 AND {$this->_aliases['civicrm_contribution']}.is_test = 0
366 AND " . $this->whereClauseLastYear("{$this->_aliases['civicrm_contribution']}.receive_date") . "
368 LEFT JOIN civicrm_contribution cont_exclude ON cont_exclude.contact_id = {$this->_aliases['civicrm_contact']}.id
369 AND " . $this->whereClauseThisYear('cont_exclude.receive_date');
370 $this->selectivelyAddLocationTablesJoinsToFilterQuery();
373 // for credit card type
374 $this->addFinancialTrxnFromClause();
378 * Generate where clause.
380 * We are overriding this primarily for 'before-after' handling of the receive_date placeholder field.
382 * We call this twice. The first time we are generating a temp table and we want to do an IS NULL on the
383 * join that draws in contributions from this year. The second time we are filtering elsewhere (contacts via
384 * the temp table & contributions via selective addition of contributions in the select function).
386 * If lifetime total is NOT selected we can add a further filter here to possibly improve performance
387 * but the benefit if unproven as yet.
388 * $clause = $this->whereClauseLastYear("{$this->_aliases['civicrm_contribution']}.receive_date");
390 * @param array $field Field specifications
391 * @param string $op Query operator (not an exact match to sql)
392 * @param mixed $value
396 * @return null|string
398 public function whereClause(&$field, $op, $value, $min, $max) {
399 if ($field['name'] == 'receive_date') {
401 if (empty($this->contactTempTable
)) {
402 $this->_whereClauses
[] = "cont_exclude.id IS NULL";
405 // Group filtering is already done so skip.
406 elseif (!empty($field['group']) && $this->contactTempTable
) {
410 $clause = parent
::whereClause($field, $op, $value, $min, $max);
416 * Generate where clause for last calendar year or fiscal year.
418 * @todo must be possible to re-use relative dates stuff.
420 * @param string $fieldName
424 public function whereClauseLastYear($fieldName) {
425 return "$fieldName BETWEEN '" . $this->getFirstDateOfPriorRange() . "' AND '" . $this->getLastDateOfPriorRange() . "'";
429 * Generate where clause for last calendar year or fiscal year.
431 * @todo must be possible to re-use relative dates stuff.
433 * @param string $fieldName
435 * @param int $current_year
436 * @return null|string
438 public function whereClauseThisYear($fieldName, $current_year = NULL) {
439 return "$fieldName BETWEEN '" . $this->getFirstDateOfCurrentRange() . "' AND '" . $this->getLastDateOfCurrentRange() . "'";
444 * Get the year value for the current year.
448 public function getCurrentYear() {
449 return $this->_params
['yid_value'];
453 * Get the date time of the first date in the 'this year' range.
457 public function getFirstDateOfCurrentRange() {
458 $current_year = $this->getCurrentYear();
459 if ($this->getYearFilterType() == 'calendar') {
460 return "{$current_year }-01-01";
463 $fiscalYear = CRM_Core_Config
::singleton()->fiscalYearStart
;
464 return "{$current_year}-{$fiscalYear['M']}-{$fiscalYear['d']}";
469 * Get the year value for the current year.
473 public function getYearFilterType() {
474 return CRM_Utils_Array
::value('yid_op', $this->_params
, 'calendar');
478 * Get the date time of the last date in the 'this year' range.
482 public function getLastDateOfCurrentRange() {
483 return date('YmdHis', strtotime('+ 1 year - 1 second', strtotime($this->getFirstDateOfCurrentRange())));
487 * Get the date time of the first date in the 'last year' range.
491 public function getFirstDateOfPriorRange() {
492 return date('YmdHis', strtotime('- 1 year', strtotime($this->getFirstDateOfCurrentRange())));
496 * Get the date time of the last date in the 'last year' range.
500 public function getLastDateOfPriorRange() {
501 return date('YmdHis', strtotime('+ 1 year - 1 second', strtotime($this->getFirstDateOfPriorRange())));
505 public function groupBy() {
506 $this->_groupBy
= "GROUP BY {$this->_aliases['civicrm_contribution']}.contact_id ";
507 $this->_select
= CRM_Contact_BAO_Query
::appendAnyValueToSelect($this->_selectClauses
, "{$this->_aliases['civicrm_contribution']}.contact_id");
508 $this->assign('chartSupported', TRUE);
516 public function statistics(&$rows) {
518 $statistics = parent
::statistics($rows);
519 // The parent class does something odd where it adds an extra row to the count for the grand total.
520 // Perhaps that works on some other report? But here it just seems odd.
521 $this->countStat($statistics, count($rows));
523 if (!empty($this->rollupRow
) && !empty($this->rollupRow
['civicrm_contribution_last_year_total_amount'])) {
524 $statistics['counts']['civicrm_contribution_last_year_total_amount'] = array(
525 'value' => $this->rollupRow
['civicrm_contribution_last_year_total_amount'],
526 'title' => $this->getLastYearColumnTitle(),
527 'type' => CRM_Utils_Type
::T_MONEY
,
531 if (!empty($this->rollupRow
) && !empty($this->rollupRow
['civicrm_contribution_civicrm_life_time_total'])) {
532 $statistics['counts']['civicrm_contribution_civicrm_life_time_total'] = array(
533 'value' => $this->rollupRow
['civicrm_contribution_civicrm_life_time_total'],
534 'title' => ts('Total LifeTime'),
535 'type' => CRM_Utils_Type
::T_MONEY
,
539 $select = "SELECT SUM({$this->_aliases['civicrm_contribution']}.total_amount) as amount,
540 SUM(IF( " . $this->whereClauseLastYear('contribution_civireport.receive_date') . ", contribution_civireport.total_amount, 0)) as last_year
542 $sql = "{$select} {$this->_from} {$this->_where}";
543 $dao = CRM_Core_DAO
::executeQuery($sql);
545 $statistics['counts']['amount'] = array(
546 'value' => $dao->amount
,
547 'title' => ts('Total LifeTime'),
548 'type' => CRM_Utils_Type
::T_MONEY
,
550 $statistics['counts']['last_year'] = array(
551 'value' => $dao->last_year
,
552 'title' => $this->getLastYearColumnTitle(),
553 'type' => CRM_Utils_Type
::T_MONEY
,
563 * This function is called by both the api (tests) and the UI.
565 public function beginPostProcessCommon() {
567 // @todo this acl has no test coverage and is very hard to test manually so could be fragile.
568 $this->resetFormSqlAndWhereHavingClauses();
570 $this->contactTempTable
= 'civicrm_report_temp_lybunt_c_' . date('Ymd_') . uniqid();
573 CREATE TEMPORARY TABLE $this->contactTempTable {$this->_databaseAttributes}
574 SELECT SQL_CALC_FOUND_ROWS {$this->_aliases['civicrm_contact']}.id as cid {$this->_from} {$this->_where}
575 GROUP BY {$this->_aliases['civicrm_contact']}.id";
576 $this->executeReportQuery($getContacts);
577 if (empty($this->_params
['charts'])) {
581 // Reset where clauses to be regenerated in postProcess.
582 $this->_whereClauses
= array();
586 * Build the report query.
588 * The issue we are hitting is that if we want to do group by & then ORDER BY we have to
589 * wrap the query in an outer query with the order by - otherwise the group by takes precedent.
590 * This is an issue when we want to group by contact but order by the maximum aggregate donation.
592 * @param bool $applyLimit
596 public function buildQuery($applyLimit = TRUE) {
597 $this->buildGroupTempTable();
598 $this->buildPermissionClause();
599 // Calling where & select before FROM allows us to build temp tables to use in from.
603 $this->customDataFrom(empty($this->contactTempTable
));
609 // order_by columns not selected for display need to be included in SELECT
610 // This differs from parent in that we are getting those not in order by rather than not in
611 // sections, as we need to adapt to our contact group by.
612 $unselectedSectionColumns = array_diff_key($this->_orderByFields
, $this->getSelectColumns());
613 foreach ($unselectedSectionColumns as $alias => $section) {
614 $this->_select
.= ", {$section['dbAlias']} as {$alias}";
617 if ($applyLimit && empty($this->_params
['charts'])) {
621 $sql = "{$this->_select} {$this->_from} {$this->_where} {$limitFilter} {$this->_groupBy} {$this->_having} {$this->_rollup}";
623 if (!empty($this->_orderByArray
)) {
624 $this->_orderBy
= str_replace('contact_civireport.', 'civicrm_contact_', "ORDER BY ISNULL(civicrm_contribution_contact_id), " . implode(', ', $this->_orderByArray
));
625 $this->_orderBy
= str_replace('contribution_civireport.', 'civicrm_contribution_', $this->_orderBy
);
626 foreach ($this->_orderByFields
as $field) {
627 $this->_orderBy
= str_replace($field['dbAlias'], $field['tplField'], $this->_orderBy
);
629 $sql = str_replace('SQL_CALC_FOUND_ROWS', '', $sql);
630 $sql = "SELECT SQL_CALC_FOUND_ROWS * FROM ( $sql ) as inner_query {$this->_orderBy} $this->_limit";
633 CRM_Utils_Hook
::alterReportVar('sql', $this, $this);
634 $this->addToDeveloperTab($sql);
640 * Reset the form sql and where / having clause arrays.
642 * We do an early iteration of the report queries to generate the temp table.
644 * However, that iteration populates the sql for the developer tab,
645 * the whereClauses & the havingClauses and they are populated again in the normal
646 * report flow. This is harmless but confusing - ie. the where clause winds up repeating
647 * the same filters and the dev tab shows the query twice, so we rest them.
649 protected function resetFormSqlAndWhereHavingClauses() {
651 $this->_havingClauses
= array();
652 $this->_whereClauses
= array();
653 $this->sqlArray
= array();
659 public function buildChart(&$rows) {
661 $graphRows = array();
665 $current_year = $this->_params
['yid_value'];
666 $previous_year = $current_year - 1;
667 $interval[$previous_year] = $previous_year;
668 $interval['life_time'] = 'Life Time';
670 foreach ($rows as $key => $row) {
671 $display['life_time'] = CRM_Utils_Array
::value('life_time', $display) +
672 $row['civicrm_life_time_total'];
673 $display[$previous_year] = CRM_Utils_Array
::value($previous_year, $display) +
$row[$previous_year];
676 $config = CRM_Core_Config
::Singleton();
677 $graphRows['value'] = $display;
679 'legend' => ts('Lybunt Report'),
680 'xname' => ts('Year'),
681 'yname' => ts('Amount (%1)', array(1 => $config->defaultCurrency
)),
683 if ($this->_params
['charts']) {
685 CRM_Utils_OpenFlashChart
::reportChart($graphRows, $this->_params
['charts'], $interval, $chartInfo);
686 $this->assign('chartType', $this->_params
['charts']);
691 * Alter display of rows.
693 * Iterate through the rows retrieved via SQL and make changes for display purposes,
694 * such as rendering contacts as links.
697 * Rows generated by SQL, with an array for each row.
699 public function alterDisplay(&$rows) {
702 foreach ($rows as $rowNum => $row) {
703 //Convert Display name into link
704 if (array_key_exists('civicrm_contact_sort_name', $row) &&
705 array_key_exists('civicrm_contribution_contact_id', $row)
707 $url = CRM_Report_Utils_Report
::getNextUrl('contribute/detail',
708 'reset=1&force=1&id_op=eq&id_value=' .
709 $row['civicrm_contribution_contact_id'],
710 $this->_absoluteUrl
, $this->_id
, $this->_drilldownReport
712 $rows[$rowNum]['civicrm_contact_sort_name_link'] = $url;
713 $rows[$rowNum]['civicrm_contact_sort_name_hover'] = ts("View Contribution Details for this Contact.");
717 // convert campaign_id to campaign title
718 if (array_key_exists('civicrm_contribution_campaign_id', $row)) {
719 if ($value = $row['civicrm_contribution_campaign_id']) {
720 $rows[$rowNum]['civicrm_contribution_campaign_id'] = $this->activeCampaigns
[$value];
724 // Display 'Yes' if the email is on hold (leave blank for no so it stands out better).
725 if (array_key_exists('civicrm_email_on_hold', $row)) {
726 $rows[$rowNum]['civicrm_email_on_hold'] = $row['civicrm_email_on_hold'] ?
ts('Yes') : '';
730 $entryFound = $this->alterDisplayAddressFields($row, $rows, $rowNum, NULL, 'List all contribution(s)') ?
TRUE : $entryFound;
731 $entryFound = $this->alterDisplayContactFields($row, $rows, $rowNum, NULL, 'List all contribution(s)') ?
TRUE : $entryFound;
733 if (array_key_exists('civicrm_contact_gender_id', $row)) {
734 if ($value = $row['civicrm_contact_gender_id']) {
735 $gender = CRM_Core_PseudoConstant
::get('CRM_Contact_DAO_Contact', 'gender_id');
736 $rows[$rowNum]['civicrm_contact_gender_id'] = $gender[$value];
741 // display birthday in the configured custom format
742 if (array_key_exists('civicrm_contact_birth_date', $row)) {
743 $birthDate = $row['civicrm_contact_birth_date'];
745 $rows[$rowNum]['civicrm_contact_birth_date'] = CRM_Utils_Date
::customFormat($birthDate, '%Y%m%d');
750 if (!empty($row['civicrm_financial_trxn_card_type_id'])) {
751 $rows[$rowNum]['civicrm_financial_trxn_card_type_id'] = $this->getLabels($row['civicrm_financial_trxn_card_type_id'], 'CRM_Financial_DAO_FinancialTrxn', 'card_type_id');
755 // skip looking further in rows, if first row itself doesn't
756 // have the column we need
764 * Override "This Year" $op options
765 * @param string $type
766 * @param null $fieldName
770 public function getOperationPair($type = "string", $fieldName = NULL) {
771 if ($fieldName == 'yid') {
773 'calendar' => ts('Is Calendar Year'),
774 'fiscal' => ts('Fiscal Year Starting'),
777 return parent
::getOperationPair($type, $fieldName);