Commit | Line | Data |
---|---|---|
6a488035 | 1 | <?php |
6a488035 TO |
2 | /* |
3 | +--------------------------------------------------------------------+ | |
39de6fd5 | 4 | | CiviCRM version 4.6 | |
6a488035 | 5 | +--------------------------------------------------------------------+ |
06b69b18 | 6 | | Copyright CiviCRM LLC (c) 2004-2014 | |
6a488035 TO |
7 | +--------------------------------------------------------------------+ |
8 | | This file is a part of CiviCRM. | | |
9 | | | | |
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. | | |
13 | | | | |
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. | | |
18 | | | | |
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 | +--------------------------------------------------------------------+ | |
26 | */ | |
27 | ||
28 | /** | |
29 | * | |
30 | * @package CRM | |
06b69b18 | 31 | * @copyright CiviCRM LLC (c) 2004-2014 |
6a488035 TO |
32 | * $Id$ |
33 | * | |
34 | */ | |
35 | class CRM_Report_Form_Contribute_Lybunt extends CRM_Report_Form { | |
36 | ||
37 | ||
38 | protected $_charts = array( | |
39 | '' => 'Tabular', | |
40 | 'barChart' => 'Bar Chart', | |
41 | 'pieChart' => 'Pie Chart', | |
42 | ); | |
43 | ||
44 | public $_drilldownReport = array('contribute/detail' => 'Link to Detail Report'); | |
45 | ||
46 | protected $lifeTime_from = NULL; | |
430ae6dd TO |
47 | protected $lifeTime_where = NULL; |
48 | ||
74cf4551 | 49 | /** |
74cf4551 EM |
50 | */ |
51 | /** | |
74cf4551 | 52 | */ |
00be9182 | 53 | public function __construct() { |
9d72cede | 54 | $yearsInPast = 10; |
6a488035 | 55 | $yearsInFuture = 1; |
9d72cede EM |
56 | $date = CRM_Core_SelectValues::date('custom', NULL, $yearsInPast, $yearsInFuture); |
57 | $count = $date['maxYear']; | |
6a488035 TO |
58 | while ($date['minYear'] <= $count) { |
59 | $optionYear[$date['minYear']] = $date['minYear']; | |
60 | $date['minYear']++; | |
61 | } | |
62 | ||
d62fab33 RN |
63 | // Check if CiviCampaign is a) enabled and b) has active campaigns |
64 | $config = CRM_Core_Config::singleton(); | |
65 | $campaignEnabled = in_array("CiviCampaign", $config->enableComponents); | |
66 | if ($campaignEnabled) { | |
67 | $getCampaigns = CRM_Campaign_BAO_Campaign::getPermissionedCampaigns(NULL, NULL, TRUE, FALSE, TRUE); | |
68 | $this->activeCampaigns = $getCampaigns['campaigns']; | |
69 | asort($this->activeCampaigns); | |
f813f78e | 70 | } |
d62fab33 | 71 | |
6a488035 | 72 | $this->_columns = array( |
9d72cede EM |
73 | 'civicrm_contact' => array( |
74 | 'dao' => 'CRM_Contact_DAO_Contact', | |
75 | 'grouping' => 'contact-field', | |
76 | 'fields' => array( | |
77 | 'sort_name' => array( | |
78 | 'title' => ts('Donor Name'), | |
79 | 'default' => TRUE, | |
80 | 'required' => TRUE, | |
81 | ), | |
82 | 'first_name' => array( | |
83 | 'title' => ts('First Name'), | |
84 | ), | |
85 | 'last_name' => array( | |
86 | 'title' => ts('Last Name'), | |
87 | ), | |
88 | 'contact_type' => array( | |
89 | 'title' => ts('Contact Type'), | |
90 | ), | |
91 | 'contact_sub_type' => array( | |
92 | 'title' => ts('Contact Subtype'), | |
93 | ), | |
6a488035 | 94 | ), |
9d72cede EM |
95 | 'filters' => array( |
96 | 'sort_name' => array( | |
97 | 'title' => ts('Donor Name'), | |
98 | 'operator' => 'like', | |
99 | ), | |
6a488035 TO |
100 | ), |
101 | ), | |
9d72cede EM |
102 | 'civicrm_email' => array( |
103 | 'dao' => 'CRM_Core_DAO_Email', | |
104 | 'grouping' => 'contact-field', | |
105 | 'fields' => array( | |
106 | 'email' => array( | |
107 | 'title' => ts('Email'), | |
108 | 'default' => TRUE, | |
109 | ), | |
6a488035 TO |
110 | ), |
111 | ), | |
9d72cede EM |
112 | 'civicrm_phone' => array( |
113 | 'dao' => 'CRM_Core_DAO_Phone', | |
114 | 'grouping' => 'contact-field', | |
115 | 'fields' => array( | |
116 | 'phone' => array( | |
117 | 'title' => ts('Phone'), | |
118 | 'default' => TRUE, | |
119 | ), | |
6a488035 TO |
120 | ), |
121 | ), | |
9d72cede | 122 | ) |
353ffa53 TO |
123 | + $this->addAddressFields() |
124 | + array( | |
9d72cede EM |
125 | 'civicrm_contribution' => array( |
126 | 'dao' => 'CRM_Contribute_DAO_Contribution', | |
127 | 'fields' => array( | |
128 | 'contact_id' => array( | |
129 | 'title' => ts('contactId'), | |
130 | 'no_display' => TRUE, | |
131 | 'required' => TRUE, | |
132 | 'no_repeat' => TRUE, | |
133 | ), | |
134 | 'total_amount' => array( | |
135 | 'title' => ts('Total Amount'), | |
136 | 'no_display' => TRUE, | |
137 | 'required' => TRUE, | |
138 | 'no_repeat' => TRUE, | |
139 | ), | |
140 | 'receive_date' => array( | |
141 | 'title' => ts('Year'), | |
142 | 'no_display' => TRUE, | |
143 | 'required' => TRUE, | |
144 | 'no_repeat' => TRUE, | |
145 | ), | |
6a488035 | 146 | ), |
9d72cede EM |
147 | 'filters' => array( |
148 | 'yid' => array( | |
149 | 'name' => 'receive_date', | |
150 | 'title' => ts('This Year'), | |
151 | 'operatorType' => CRM_Report_Form::OP_SELECT, | |
152 | 'options' => $optionYear, | |
153 | 'default' => date('Y'), | |
154 | ), | |
155 | 'financial_type_id' => array( | |
156 | 'title' => ts('Financial Type'), | |
157 | 'operatorType' => CRM_Report_Form::OP_MULTISELECT, | |
158 | 'options' => CRM_Contribute_PseudoConstant::financialType(), | |
159 | ), | |
160 | 'contribution_status_id' => array( | |
161 | 'title' => ts('Contribution Status'), | |
162 | 'operatorType' => CRM_Report_Form::OP_MULTISELECT, | |
163 | 'options' => CRM_Contribute_PseudoConstant::contributionStatus(), | |
164 | 'default' => array('1'), | |
165 | ), | |
6a488035 TO |
166 | ), |
167 | ), | |
9d72cede | 168 | ); |
6a488035 | 169 | |
d62fab33 RN |
170 | // If we have a campaign, build out the relevant elements |
171 | if ($campaignEnabled && !empty($this->activeCampaigns)) { | |
172 | $this->_columns['civicrm_contribution']['fields']['campaign_id'] = array( | |
173 | 'title' => ts('Campaign'), | |
174 | 'default' => 'false', | |
175 | ); | |
9d72cede EM |
176 | $this->_columns['civicrm_contribution']['filters']['campaign_id'] = array( |
177 | 'title' => ts('Campaign'), | |
d62fab33 RN |
178 | 'operatorType' => CRM_Report_Form::OP_MULTISELECT, |
179 | 'options' => $this->activeCampaigns, | |
180 | ); | |
181 | } | |
182 | ||
16e2e80c | 183 | $this->_groupFilter = TRUE; |
6a488035 TO |
184 | $this->_tagFilter = TRUE; |
185 | parent::__construct(); | |
186 | } | |
187 | ||
00be9182 | 188 | public function preProcess() { |
6a488035 TO |
189 | parent::preProcess(); |
190 | } | |
191 | ||
00be9182 | 192 | public function select() { |
6a488035 TO |
193 | |
194 | $this->_columnHeaders = $select = array(); | |
195 | $current_year = $this->_params['yid_value']; | |
196 | $previous_year = $current_year - 1; | |
197 | ||
6a488035 TO |
198 | foreach ($this->_columns as $tableName => $table) { |
199 | ||
200 | if (array_key_exists('fields', $table)) { | |
201 | foreach ($table['fields'] as $fieldName => $field) { | |
202 | ||
9d72cede EM |
203 | if (!empty($field['required']) || |
204 | !empty($this->_params['fields'][$fieldName]) | |
205 | ) { | |
6a488035 TO |
206 | if ($fieldName == 'total_amount') { |
207 | $select[] = "SUM({$field['dbAlias']}) as {$tableName}_{$fieldName}"; | |
208 | ||
209 | $this->_columnHeaders["{$previous_year}"]['type'] = $field['type']; | |
210 | $this->_columnHeaders["{$previous_year}"]['title'] = $previous_year; | |
211 | ||
212 | $this->_columnHeaders["civicrm_life_time_total"]['type'] = $field['type']; | |
213 | $this->_columnHeaders["civicrm_life_time_total"]['title'] = 'LifeTime';; | |
214 | } | |
215 | elseif ($fieldName == 'receive_date') { | |
9d72cede EM |
216 | $select[] = self::fiscalYearOffset($field['dbAlias']) . |
217 | " as {$tableName}_{$fieldName} "; | |
6a488035 TO |
218 | } |
219 | else { | |
220 | $select[] = "{$field['dbAlias']} as {$tableName}_{$fieldName} "; | |
221 | $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = CRM_Utils_Array::value('type', $field); | |
222 | $this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = CRM_Utils_Array::value('title', $field); | |
223 | } | |
224 | ||
a7488080 | 225 | if (!empty($field['no_display'])) { |
6a488035 TO |
226 | $this->_columnHeaders["{$tableName}_{$fieldName}"]['no_display'] = TRUE; |
227 | } | |
228 | } | |
229 | } | |
230 | } | |
231 | } | |
232 | ||
233 | $this->_select = "SELECT " . implode(', ', $select) . " "; | |
234 | } | |
235 | ||
00be9182 | 236 | public function from() { |
6a488035 TO |
237 | |
238 | $this->_from = " | |
239 | FROM civicrm_contribution {$this->_aliases['civicrm_contribution']} | |
1c44e08e | 240 | INNER JOIN civicrm_contact {$this->_aliases['civicrm_contact']} |
6a488035 | 241 | ON {$this->_aliases['civicrm_contact']}.id = {$this->_aliases['civicrm_contribution']}.contact_id |
a27c90f2 NG |
242 | {$this->_aclFrom}"; |
243 | ||
244 | if ($this->isTableSelected('civicrm_email')) { | |
245 | $this->_from .= " | |
1c44e08e | 246 | LEFT JOIN civicrm_email {$this->_aliases['civicrm_email']} |
a27c90f2 NG |
247 | ON {$this->_aliases['civicrm_contact']}.id = {$this->_aliases['civicrm_email']}.contact_id |
248 | AND {$this->_aliases['civicrm_email']}.is_primary = 1"; | |
249 | } | |
250 | if ($this->isTableSelected('civicrm_phone')) { | |
251 | $this->_from .= " | |
1c44e08e | 252 | LEFT JOIN civicrm_phone {$this->_aliases['civicrm_phone']} |
6a488035 | 253 | ON {$this->_aliases['civicrm_contact']}.id = {$this->_aliases['civicrm_phone']}.contact_id AND |
a27c90f2 NG |
254 | {$this->_aliases['civicrm_phone']}.is_primary = 1"; |
255 | } | |
72a9af52 | 256 | $this->addAddressFromClause(); |
6a488035 TO |
257 | } |
258 | ||
00be9182 | 259 | public function where() { |
6a488035 | 260 | $this->_statusClause = ""; |
9d72cede EM |
261 | $clauses = array($this->_aliases['civicrm_contribution'] . '.is_test = 0'); |
262 | $current_year = $this->_params['yid_value']; | |
263 | $previous_year = $current_year - 1; | |
6a488035 TO |
264 | |
265 | foreach ($this->_columns as $tableName => $table) { | |
266 | if (array_key_exists('filters', $table)) { | |
267 | foreach ($table['filters'] as $fieldName => $field) { | |
268 | $clause = NULL; | |
269 | if ($fieldName == 'yid') { | |
270 | $clause = "contribution_civireport.contact_id NOT IN | |
1c44e08e | 271 | (SELECT distinct contri.contact_id FROM civicrm_contribution contri |
9d72cede EM |
272 | WHERE contri.is_test = 0 AND " . |
273 | self::fiscalYearOffset('contri.receive_date') . " = $current_year) AND contribution_civireport.contact_id IN (SELECT distinct contri.contact_id FROM civicrm_contribution contri | |
274 | WHERE " . self::fiscalYearOffset('contri.receive_date') . | |
275 | " = $previous_year AND contri.is_test = 0)"; | |
6a488035 | 276 | } |
84178120 | 277 | elseif (CRM_Utils_Array::value('type', $field) & CRM_Utils_Type::T_DATE |
9d72cede | 278 | ) { |
6a488035 | 279 | $relative = CRM_Utils_Array::value("{$fieldName}_relative", $this->_params); |
9d72cede EM |
280 | $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params); |
281 | $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params); | |
6a488035 TO |
282 | |
283 | if ($relative || $from || $to) { | |
284 | $clause = $this->dateClause($field['name'], $relative, $from, $to, $field['type']); | |
285 | } | |
286 | } | |
287 | else { | |
288 | $op = CRM_Utils_Array::value("{$fieldName}_op", $this->_params); | |
289 | if ($op) { | |
290 | $clause = $this->whereClause($field, | |
291 | $op, | |
292 | CRM_Utils_Array::value("{$fieldName}_value", $this->_params), | |
293 | CRM_Utils_Array::value("{$fieldName}_min", $this->_params), | |
294 | CRM_Utils_Array::value("{$fieldName}_max", $this->_params) | |
295 | ); | |
9d72cede EM |
296 | if (($fieldName == 'contribution_status_id' || |
297 | $fieldName == 'financial_type_id') && !empty($clause) | |
298 | ) { | |
6a488035 TO |
299 | $this->_statusClause .= " AND " . $clause; |
300 | } | |
301 | } | |
302 | } | |
303 | ||
304 | if (!empty($clause)) { | |
305 | $clauses[] = $clause; | |
306 | } | |
307 | } | |
308 | } | |
309 | } | |
310 | ||
311 | $this->_where = 'WHERE ' . implode(' AND ', $clauses); | |
312 | ||
313 | if ($this->_aclWhere) { | |
314 | $this->_where .= " AND {$this->_aclWhere} "; | |
315 | } | |
316 | } | |
317 | ||
00be9182 | 318 | public function groupBy() { |
9d72cede EM |
319 | $this->_groupBy = |
320 | "GROUP BY {$this->_aliases['civicrm_contribution']}.contact_id, " . | |
321 | self::fiscalYearOffset($this->_aliases['civicrm_contribution'] . | |
322 | '.receive_date') . " WITH ROLLUP"; | |
6a488035 TO |
323 | $this->assign('chartSupported', TRUE); |
324 | } | |
325 | ||
74cf4551 EM |
326 | /** |
327 | * @param $rows | |
328 | * | |
329 | * @return array | |
330 | */ | |
00be9182 | 331 | public function statistics(&$rows) { |
6a488035 TO |
332 | $statistics = parent::statistics($rows); |
333 | if (!empty($rows)) { | |
334 | $select = " | |
1c44e08e | 335 | SELECT |
6a488035 TO |
336 | SUM({$this->_aliases['civicrm_contribution']}.total_amount ) as amount "; |
337 | ||
338 | $sql = "{$select} {$this->_from} {$this->_where}"; | |
339 | $dao = CRM_Core_DAO::executeQuery($sql); | |
340 | if ($dao->fetch()) { | |
341 | $statistics['counts']['amount'] = array( | |
342 | 'value' => $dao->amount, | |
343 | 'title' => 'Total LifeTime', | |
344 | 'type' => CRM_Utils_Type::T_MONEY, | |
345 | ); | |
346 | } | |
347 | } | |
348 | ||
349 | return $statistics; | |
350 | } | |
351 | ||
00be9182 | 352 | public function postProcess() { |
6a488035 TO |
353 | |
354 | // get ready with post process params | |
355 | $this->beginPostProcess(); | |
356 | ||
357 | // get the acl clauses built before we assemble the query | |
358 | $this->buildACLClause($this->_aliases['civicrm_contact']); | |
359 | $this->select(); | |
360 | $this->from(); | |
361 | $this->where(); | |
362 | $this->groupBy(); | |
363 | ||
364 | $rows = $contactIds = array(); | |
a7488080 | 365 | if (empty($this->_params['charts'])) { |
6a488035 TO |
366 | $this->limit(); |
367 | $getContacts = "SELECT SQL_CALC_FOUND_ROWS {$this->_aliases['civicrm_contact']}.id as cid {$this->_from} {$this->_where} GROUP BY {$this->_aliases['civicrm_contact']}.id {$this->_limit}"; | |
368 | ||
369 | $dao = CRM_Core_DAO::executeQuery($getContacts); | |
370 | ||
371 | while ($dao->fetch()) { | |
372 | $contactIds[] = $dao->cid; | |
373 | } | |
374 | $dao->free(); | |
375 | $this->setPager(); | |
376 | } | |
377 | ||
8cc574cf | 378 | if (!empty($contactIds) || !empty($this->_params['charts'])) { |
a7488080 | 379 | if (!empty($this->_params['charts'])) { |
6a488035 TO |
380 | $sql = "{$this->_select} {$this->_from} {$this->_where} {$this->_groupBy}"; |
381 | } | |
382 | else { | |
9d72cede EM |
383 | $sql = |
384 | "{$this->_select} {$this->_from} WHERE {$this->_aliases['civicrm_contact']}.id IN (" . | |
385 | implode(',', $contactIds) . | |
386 | ") AND {$this->_aliases['civicrm_contribution']}.is_test = 0 {$this->_statusClause} {$this->_groupBy} "; | |
6a488035 TO |
387 | } |
388 | ||
9d72cede EM |
389 | $dao = CRM_Core_DAO::executeQuery($sql); |
390 | $current_year = $this->_params['yid_value']; | |
6a488035 TO |
391 | $previous_year = $current_year - 1; |
392 | ||
393 | while ($dao->fetch()) { | |
394 | ||
395 | if (!$dao->civicrm_contribution_contact_id) { | |
396 | continue; | |
397 | } | |
398 | ||
399 | $row = array(); | |
400 | foreach ($this->_columnHeaders as $key => $value) { | |
401 | if (property_exists($dao, $key)) { | |
402 | $rows[$dao->civicrm_contribution_contact_id][$key] = $dao->$key; | |
403 | } | |
404 | } | |
405 | ||
406 | if ($dao->civicrm_contribution_receive_date) { | |
407 | if ($dao->civicrm_contribution_receive_date == $previous_year) { | |
408 | $rows[$dao->civicrm_contribution_contact_id][$dao->civicrm_contribution_receive_date] = $dao->civicrm_contribution_total_amount; | |
409 | } | |
410 | } | |
411 | else { | |
412 | $rows[$dao->civicrm_contribution_contact_id]['civicrm_life_time_total'] = $dao->civicrm_contribution_total_amount; | |
413 | } | |
414 | } | |
415 | $dao->free(); | |
416 | } | |
417 | ||
418 | $this->formatDisplay($rows, FALSE); | |
419 | ||
420 | // assign variables to templates | |
421 | $this->doTemplateAssignment($rows); | |
422 | ||
423 | // do print / pdf / instance stuff if needed | |
424 | $this->endPostProcess($rows); | |
425 | } | |
426 | ||
74cf4551 EM |
427 | /** |
428 | * @param $rows | |
429 | */ | |
00be9182 | 430 | public function buildChart(&$rows) { |
6a488035 TO |
431 | |
432 | $graphRows = array(); | |
9d72cede EM |
433 | $count = 0; |
434 | $display = array(); | |
6a488035 TO |
435 | |
436 | $current_year = $this->_params['yid_value']; | |
437 | $previous_year = $current_year - 1; | |
438 | $interval[$previous_year] = $previous_year; | |
439 | $interval['life_time'] = 'Life Time'; | |
440 | ||
441 | foreach ($rows as $key => $row) { | |
9d72cede EM |
442 | $display['life_time'] = CRM_Utils_Array::value('life_time', $display) + |
443 | $row['civicrm_life_time_total']; | |
444 | $display[$previous_year] = | |
445 | CRM_Utils_Array::value($previous_year, $display) + $row[$previous_year]; | |
6a488035 TO |
446 | } |
447 | ||
9d72cede | 448 | $config = CRM_Core_Config::Singleton(); |
6a488035 | 449 | $graphRows['value'] = $display; |
9d72cede EM |
450 | $chartInfo = array( |
451 | 'legend' => ts('Lybunt Report'), | |
6a488035 TO |
452 | 'xname' => ts('Year'), |
453 | 'yname' => ts('Amount (%1)', array(1 => $config->defaultCurrency)), | |
454 | ); | |
455 | if ($this->_params['charts']) { | |
456 | // build chart. | |
457 | CRM_Utils_OpenFlashChart::reportChart($graphRows, $this->_params['charts'], $interval, $chartInfo); | |
458 | $this->assign('chartType', $this->_params['charts']); | |
459 | } | |
460 | } | |
461 | ||
74cf4551 EM |
462 | /** |
463 | * @param $rows | |
464 | */ | |
00be9182 | 465 | public function alterDisplay(&$rows) { |
72a9af52 NG |
466 | // custom code to alter rows |
467 | $entryFound = FALSE; | |
468 | ||
6a488035 TO |
469 | foreach ($rows as $rowNum => $row) { |
470 | //Convert Display name into link | |
471 | if (array_key_exists('civicrm_contact_sort_name', $row) && | |
472 | array_key_exists('civicrm_contribution_contact_id', $row) | |
473 | ) { | |
474 | $url = CRM_Report_Utils_Report::getNextUrl('contribute/detail', | |
9d72cede EM |
475 | 'reset=1&force=1&id_op=eq&id_value=' . |
476 | $row['civicrm_contribution_contact_id'], | |
6a488035 TO |
477 | $this->_absoluteUrl, $this->_id, $this->_drilldownReport |
478 | ); | |
479 | $rows[$rowNum]['civicrm_contact_sort_name_link'] = $url; | |
480 | $rows[$rowNum]['civicrm_contact_sort_name_hover'] = ts("View Contribution Details for this Contact."); | |
72a9af52 | 481 | $entryFound = TRUE; |
6a488035 | 482 | } |
d62fab33 RN |
483 | |
484 | // convert campaign_id to campaign title | |
485 | if (array_key_exists('civicrm_contribution_campaign_id', $row)) { | |
486 | if ($value = $row['civicrm_contribution_campaign_id']) { | |
487 | $rows[$rowNum]['civicrm_contribution_campaign_id'] = $this->activeCampaigns[$value]; | |
488 | $entryFound = TRUE; | |
489 | } | |
490 | } | |
a27c90f2 | 491 | |
72a9af52 NG |
492 | $entryFound = $this->alterDisplayAddressFields($row, $rows, $rowNum, 'contribute/detail', 'List all contribution(s)') ? TRUE : $entryFound; |
493 | ||
494 | // skip looking further in rows, if first row itself doesn't | |
495 | // have the column we need | |
496 | if (!$entryFound) { | |
497 | break; | |
a27c90f2 | 498 | } |
6a488035 TO |
499 | } |
500 | } | |
501 | ||
74cf4551 | 502 | /** |
4f1f1f2a | 503 | * Override "This Year" $op options |
74cf4551 EM |
504 | * @param string $type |
505 | * @param null $fieldName | |
506 | * | |
507 | * @return array | |
508 | */ | |
00be9182 | 509 | public function getOperationPair($type = "string", $fieldName = NULL) { |
6a488035 | 510 | if ($fieldName == 'yid') { |
9d72cede EM |
511 | return array( |
512 | 'calendar' => ts('Is Calendar Year'), | |
21dfd5f5 | 513 | 'fiscal' => ts('Fiscal Year Starting'), |
9d72cede | 514 | ); |
6a488035 TO |
515 | } |
516 | return parent::getOperationPair($type, $fieldName); | |
517 | } | |
518 | } |