more fixes for CRM-17286
[civicrm-core.git] / CRM / Contribute / BAO / Query.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2015 |
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
31 * @copyright CiviCRM LLC (c) 2004-2015
32 */
33 class CRM_Contribute_BAO_Query {
34
35 /**
36 * Static field for all the export/import contribution fields.
37 *
38 * @var array
39 */
40 static $_contributionFields = NULL;
41
42 static $_contribOrSoftCredit = "only_contribs";
43
44 /**
45 * Function get the import/export fields for contribution.
46 *
47 * @return array
48 * self::$_contributionFields associative array of contribution fields
49 */
50 public static function &getFields() {
51 if (!self::$_contributionFields) {
52 self::$_contributionFields = array();
53
54 $fields = CRM_Contribute_BAO_Contribution::exportableFields();
55
56 unset($fields['contribution_contact_id']);
57
58 self::$_contributionFields = $fields;
59 }
60 return self::$_contributionFields;
61 }
62
63 /**
64 * If contributions are involved, add the specific contribute fields.
65 *
66 * @param CRM_Contact_BAO_Query $query
67 */
68 public static function select(&$query) {
69 // if contribute mode add contribution id
70 if ($query->_mode & CRM_Contact_BAO_Query::MODE_CONTRIBUTE) {
71 $query->_select['contribution_id'] = "civicrm_contribution.id as contribution_id";
72 $query->_element['contribution_id'] = 1;
73 $query->_tables['civicrm_contribution'] = $query->_whereTables['civicrm_contribution'] = 1;
74 }
75
76 // get financial_type
77 if (!empty($query->_returnProperties['financial_type'])) {
78 $query->_select['financial_type'] = "civicrm_financial_type.name as financial_type";
79 $query->_element['financial_type'] = 1;
80 $query->_tables['civicrm_contribution'] = 1;
81 $query->_tables['civicrm_financial_type'] = 1;
82 }
83
84 // get accounting code
85 if (!empty($query->_returnProperties['accounting_code'])) {
86 $query->_select['accounting_code'] = "civicrm_financial_account.accounting_code as accounting_code";
87 $query->_element['accounting_code'] = 1;
88 $query->_tables['civicrm_accounting_code'] = 1;
89 $query->_tables['civicrm_financial_account'] = 1;
90 }
91
92 if (!empty($query->_returnProperties['contribution_note'])) {
93 $query->_select['contribution_note'] = "civicrm_note.note as contribution_note";
94 $query->_element['contribution_note'] = 1;
95 $query->_tables['contribution_note'] = 1;
96 $query->_tables['civicrm_contribution'] = 1;
97 }
98
99 if (!empty($query->_returnProperties['contribution_batch'])) {
100 $query->_select['contribution_batch'] = "civicrm_batch.title as contribution_batch";
101 $query->_element['contribution_batch'] = 1;
102 $query->_tables['contribution_batch'] = 1;
103 }
104
105 if (!empty($query->_returnProperties['contribution_source'])) {
106 $query->_select['contribution_source'] = "civicrm_contribution.source as contribution_source";
107 $query->_element['contribution_source'] = 1;
108 $query->_tables['civicrm_contribution'] = 1;
109 }
110
111 // get contribution_status
112 if (!empty($query->_returnProperties['contribution_status_id'])) {
113 $query->_select['contribution_status_id'] = "contribution_status.value as contribution_status_id";
114 $query->_element['contribution_status_id'] = 1;
115 $query->_tables['civicrm_contribution'] = 1;
116 $query->_tables['contribution_status'] = 1;
117 }
118
119 // get contribution_status label
120 if (!empty($query->_returnProperties['contribution_status'])) {
121 $query->_select['contribution_status'] = "contribution_status.label as contribution_status";
122 $query->_element['contribution_status'] = 1;
123 $query->_tables['civicrm_contribution'] = 1;
124 $query->_tables['contribution_status'] = 1;
125 }
126
127 // get payment instrument
128 if (!empty($query->_returnProperties['payment_instrument'])) {
129 $query->_select['payment_instrument'] = "contribution_payment_instrument.label as payment_instrument";
130 $query->_element['payment_instrument'] = 1;
131 $query->_tables['civicrm_contribution'] = 1;
132 $query->_tables['contribution_payment_instrument'] = 1;
133 }
134
135 // get payment instrument id
136 if (!empty($query->_returnProperties['payment_instrument_id'])) {
137 $query->_select['instrument_id'] = "contribution_payment_instrument.value as instrument_id";
138 $query->_select['payment_instrument_id'] = "contribution_payment_instrument.value as payment_instrument_id";
139 $query->_element['instrument_id'] = $query->_element['payment_instrument_id'] = 1;
140 $query->_tables['civicrm_contribution'] = 1;
141 $query->_tables['contribution_payment_instrument'] = 1;
142 }
143
144 if (!empty($query->_returnProperties['check_number'])) {
145 $query->_select['contribution_check_number'] = "civicrm_contribution.check_number as contribution_check_number";
146 $query->_element['contribution_check_number'] = 1;
147 $query->_tables['civicrm_contribution'] = 1;
148 }
149
150 if (!empty($query->_returnProperties['contribution_campaign_id'])) {
151 $query->_select['contribution_campaign_id'] = 'civicrm_contribution.campaign_id as contribution_campaign_id';
152 $query->_element['contribution_campaign_id'] = 1;
153 $query->_tables['civicrm_contribution'] = 1;
154 }
155
156 // LCD 716
157 $includeSoftCredits = self::isSoftCreditOptionEnabled($query->_params);
158 if (!empty($query->_returnProperties['contribution_soft_credit_name'])) {
159 if ($includeSoftCredits) {
160 $query->_select['contribution_soft_credit_name'] = "civicrm_contact_d.sort_name as contribution_soft_credit_name";
161 // also include contact id. Will help build hyperlinks
162 $query->_select['contribution_soft_credit_contact_id'] = "civicrm_contact_d.id as contribution_soft_credit_contact_id";
163 }
164 $query->_element['contribution_soft_credit_name'] = 1;
165 $query->_element['contribution_soft_credit_contact_id'] = 1;
166
167 $query->_tables['civicrm_contribution'] = 1;
168 $query->_tables['civicrm_contribution_soft'] = 1;
169 $query->_tables['civicrm_contribution_soft_contact'] = 1;
170 }
171
172 if (!empty($query->_returnProperties['contribution_soft_credit_contact_id'])) {
173 $query->_tables['civicrm_contribution'] = 1;
174 $query->_tables['civicrm_contribution_soft'] = 1;
175 $query->_tables['civicrm_contribution_soft_contact'] = 1;
176 }
177
178 if (!empty($query->_returnProperties['contribution_soft_credit_amount'])) {
179 if ($includeSoftCredits) {
180 $query->_select['contribution_soft_credit_amount'] = "civicrm_contribution_soft.amount as contribution_soft_credit_amount";
181 }
182 $query->_element['contribution_soft_credit_amount'] = 1;
183 $query->_tables['civicrm_contribution'] = 1;
184 $query->_tables['civicrm_contribution_soft'] = 1;
185 }
186
187 if (!empty($query->_returnProperties['contribution_soft_credit_type'])) {
188 if ($includeSoftCredits) {
189 $query->_select['contribution_soft_credit_type'] = "contribution_softcredit_type.label as contribution_soft_credit_type";
190 }
191 $query->_element['contribution_soft_credit_type'] = 1;
192 $query->_tables['civicrm_contribution'] = 1;
193 $query->_tables['contribution_softcredit_type'] = 1;
194 }
195
196 if (!empty($query->_returnProperties['contribution_soft_credit_contribution_id'])) {
197 if ($includeSoftCredits) {
198 $query->_select['contribution_soft_credit_contribution_id'] = "civicrm_contribution_soft.contribution_id as contribution_soft_credit_contribution_id";
199 }
200 $query->_element['contribution_soft_credit_contribution_id'] = 1;
201 $query->_tables['civicrm_contribution'] = 1;
202 $query->_tables['civicrm_contribution_soft'] = 1;
203 }
204
205 if (!empty($query->_returnProperties['contribution_soft_credit_email'])) {
206 $query->_select['contribution_soft_credit_email'] = "soft_email.email as contribution_soft_credit_email";
207 $query->_element['contribution_soft_credit_email'] = 1;
208 $query->_tables['civicrm_contribution'] = 1;
209 $query->_tables['civicrm_contribution_soft'] = 1;
210 $query->_tables['civicrm_contribution_soft_contact'] = 1;
211 $query->_tables['civicrm_contribution_soft_email'] = 1;
212 }
213
214 if (!empty($query->_returnProperties['contribution_soft_credit_phone'])) {
215 $query->_select['contribution_soft_credit_email'] = "soft_phone.phone as contribution_soft_credit_phone";
216 $query->_element['contribution_soft_credit_phone'] = 1;
217 $query->_tables['civicrm_contribution'] = 1;
218 $query->_tables['civicrm_contribution_soft'] = 1;
219 $query->_tables['civicrm_contribution_soft_contact'] = 1;
220 $query->_tables['civicrm_contribution_soft_phone'] = 1;
221 }
222 if (!empty($query->_returnProperties['contribution_campaign_title'])) {
223 $query->_select['contribution_campaign_title'] = "civicrm_campaign.title as contribution_campaign_title";
224 $query->_element['contribution_campaign_title'] = $query->_tables['civicrm_campaign'] = 1;
225 }
226
227 // Adding address_id in a way that is more easily extendable since the above is a bit ... wordy.
228 $supportedBasicReturnValues = array('address_id');
229 foreach ($supportedBasicReturnValues as $fieldName) {
230 if (!empty($query->_returnProperties[$fieldName])) {
231 $query->_select[$fieldName] = "civicrm_contribution.{$fieldName} as $fieldName";
232 $query->_element[$fieldName] = $query->_tables['civicrm_contribution'] = 1;
233 }
234 }
235
236 //CRM-16116: get financial_type_id
237 if (!empty($query->_returnProperties['financial_type_id'])) {
238 $query->_select['financial_type_id'] = "civicrm_contribution.financial_type_id as financial_type_id";
239 $query->_element['financial_type_id'] = $query->_tables['civicrm_contribution'] = 1;
240 }
241 // LCD 716 END
242 }
243
244 /**
245 * Get where clause.
246 *
247 * @param CRM_Contact_BAO_Query $query
248 */
249 public static function where(&$query) {
250 $grouping = NULL;
251 self::initializeAnySoftCreditClause($query);
252 foreach (array_keys($query->_params) as $id) {
253 if (empty($query->_params[$id][0])) {
254 continue;
255 }
256 if (substr($query->_params[$id][0], 0, 13) == 'contribution_' || substr($query->_params[$id][0], 0, 10) == 'financial_' || substr($query->_params[$id][0], 0, 8) == 'payment_') {
257 if ($query->_mode == CRM_Contact_BAO_QUERY::MODE_CONTACTS) {
258 $query->_useDistinct = TRUE;
259 }
260 // CRM-12065
261 if (
262 $query->_params[$id][0] == 'contribution_type_id' ||
263 $query->_params[$id][0] == 'contribution_type'
264 ) {
265 CRM_Core_Session::setStatus(
266 ts('The contribution type criteria is now obsolete, please update your smart group'),
267 '',
268 'alert'
269 );
270 continue;
271 }
272
273 $grouping = $query->_params[$id][3];
274 self::whereClauseSingle($query->_params[$id], $query);
275 }
276 }
277 }
278
279 /**
280 * Get where clause for a single value.
281 *
282 * @param array $values
283 * @param CRM_Contact_BAO_Query $query
284 */
285 public static function whereClauseSingle(&$values, &$query) {
286 list($name, $op, $value, $grouping, $wildcard) = $values;
287
288 $quoteValue = NULL;
289 $fields = array_merge(CRM_Contribute_BAO_Contribution::fields(), self::getFields());
290
291 if (!empty($value) && !is_array($value)) {
292 $quoteValue = "\"$value\"";
293 }
294
295 $strtolower = function_exists('mb_strtolower') ? 'mb_strtolower' : 'strtolower';
296 foreach (self::getRecurringFields() as $dateField => $dateFieldTitle) {
297 if (self::buildDateWhere($values, $query, $name, $dateField, $dateFieldTitle)) {
298 return;
299 }
300 }
301 switch ($name) {
302 case 'contribution_date':
303 case 'contribution_date_low':
304 case 'contribution_date_low_time':
305 case 'contribution_date_high':
306 case 'contribution_date_high_time':
307 // process to / from date
308 $query->dateQueryBuilder($values,
309 'civicrm_contribution', 'contribution_date', 'receive_date', 'Contribution Date'
310 );
311 return;
312
313 case 'contribution_amount':
314 case 'contribution_amount_low':
315 case 'contribution_amount_high':
316 // process min/max amount
317 $query->numberRangeBuilder($values,
318 'civicrm_contribution', 'contribution_amount',
319 'total_amount', 'Contribution Amount',
320 NULL
321 );
322 return;
323
324 case 'contribution_thankyou_date_is_not_null':
325 if ($value) {
326 $op = "IS NOT NULL";
327 $query->_qill[$grouping][] = ts('Contribution Thank-you Sent');
328 }
329 else {
330 $op = "IS NULL";
331 $query->_qill[$grouping][] = ts('Contribution Thank-you Not Sent');
332 }
333 $query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause("civicrm_contribution.thankyou_date", $op);
334 $query->_tables['civicrm_contribution'] = $query->_whereTables['civicrm_contribution'] = 1;
335 return;
336
337 case 'contribution_receipt_date_is_not_null':
338 if ($value) {
339 $op = "IS NOT NULL";
340 $query->_qill[$grouping][] = ts('Contribution Receipt Sent');
341 }
342 else {
343 $op = "IS NULL";
344 $query->_qill[$grouping][] = ts('Contribution Receipt Not Sent');
345 }
346 $query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause("civicrm_contribution.receipt_date", $op);
347 $query->_tables['civicrm_contribution'] = $query->_whereTables['civicrm_contribution'] = 1;
348 return;
349
350 case 'financial_type':
351 case 'contribution_page':
352 case 'payment_instrument':
353 case 'contribution_payment_instrument':
354 case 'contribution_status':
355 $name .= '_id';
356 case 'financial_type_id':
357 case 'invoice_id':
358 case 'payment_instrument_id':
359 case 'contribution_payment_instrument_id':
360 case 'contribution_page_id':
361 case 'contribution_status_id':
362 case 'contribution_id':
363 case 'contribution_currency_type':
364 case 'contribution_currency':
365 case 'contribution_source':
366 case 'contribution_trxn_id':
367 case 'contribution_check_number':
368 case 'contribution_contact_id':
369 case (strpos($name, '_amount') !== FALSE):
370 case (strpos($name, '_date') !== FALSE && $name != 'contribution_fulfilled_date'):
371 case 'contribution_campaign_id':
372 $qillName = $name;
373 $pseudoExtraParam = array();
374 // @todo including names using a switch statement & then using an 'if' to filter them out is ... odd!
375 if ((strpos($name, '_amount') !== FALSE) || (strpos($name, '_date') !== FALSE) || in_array($name,
376 array(
377 'contribution_id',
378 'contribution_currency',
379 'contribution_source',
380 'contribution_trxn_id',
381 'contribution_check_number',
382 'contribution_payment_instrument_id',
383 'contribution_contact_id',
384 'contribution_campaign_id',
385 )
386 )
387 ) {
388 $name = str_replace('contribution_', '', $name);
389 if (!in_array($name, array('source', 'id', 'contact_id', 'campaign_id'))) {
390 $qillName = str_replace('contribution_', '', $qillName);
391 }
392 }
393 if (in_array($name, array('contribution_currency', 'contribution_currency_type'))) {
394 $qillName = $name = 'currency';
395 $pseudoExtraParam = array('labelColumn' => 'name');
396 }
397
398 $dataType = !empty($fields[$qillName]['type']) ? CRM_Utils_Type::typeToString($fields[$qillName]['type']) : 'String';
399
400 $query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause("civicrm_contribution.$name", $op, $value, $dataType);
401 list($op, $value) = CRM_Contact_BAO_Query::buildQillForFieldValue('CRM_Contribute_DAO_Contribution', $name, $value, $op, $pseudoExtraParam);
402 $query->_qill[$grouping][] = ts('%1 %2 %3', array(1 => $fields[$qillName]['title'], 2 => $op, 3 => $value));
403 $query->_tables['civicrm_contribution'] = $query->_whereTables['civicrm_contribution'] = 1;
404 return;
405
406 case 'contribution_pcp_made_through_id':
407 case 'contribution_soft_credit_type_id':
408 $qillName = $name;
409 if ($name == 'contribution_pcp_made_through_id') {
410 $qillName = $name = 'pcp_id';
411 $fields[$name] = array('title' => ts('Personal Campaign Page'), 'type' => 2);
412 }
413 if ($name == 'contribution_soft_credit_type_id') {
414 $qillName = str_replace('_id', '', $qillName);
415 $fields[$qillName]['type'] = $fields[$qillName]['data_type'];
416 $name = str_replace('contribution_', '', $name);
417 }
418 $query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause("civicrm_contribution_soft.$name",
419 $op, $value, CRM_Utils_Type::typeToString($fields[$qillName]['type'])
420 );
421 list($op, $value) = CRM_Contact_BAO_Query::buildQillForFieldValue('CRM_Contribute_DAO_ContributionSoft', $name, $value, $op);
422 $query->_qill[$grouping][] = ts('%1 %2 %3', array(1 => $fields[$qillName]['title'], 2 => $op, 3 => $value));
423 $query->_tables['civicrm_contribution_soft'] = $query->_whereTables['civicrm_contribution_soft'] = 1;
424 return;
425
426 case 'contribution_or_softcredits':
427 if ($value == 'only_scredits') {
428 $query->_where[$grouping][] = "contribution_search_scredit_combined.scredit_id IS NOT NULL";
429 $query->_qill[$grouping][] = ts('Contributions OR Soft Credits? - Soft Credits Only');
430 $query->_tables['civicrm_contribution'] = $query->_whereTables['civicrm_contribution'] = 1;
431 $query->_tables['civicrm_contribution_soft'] = $query->_whereTables['civicrm_contribution_soft'] = 1;
432 }
433 elseif ($value == 'both_related') {
434 $query->_where[$grouping][] = "contribution_search_scredit_combined.filter_id IS NOT NULL";
435 $query->_qill[$grouping][] = ts('Contributions OR Soft Credits? - Soft Credits with related Hard Credit');
436 $query->_tables['civicrm_contribution'] = $query->_whereTables['civicrm_contribution'] = 1;
437 $query->_tables['civicrm_contribution_soft'] = $query->_whereTables['civicrm_contribution_soft'] = 1;
438 }
439 elseif ($value == 'both') {
440 $query->_qill[$grouping][] = ts('Contributions OR Soft Credits? - Both');
441 $query->_tables['civicrm_contribution'] = $query->_whereTables['civicrm_contribution'] = 1;
442 $query->_tables['civicrm_contribution_soft'] = $query->_whereTables['civicrm_contribution_soft'] = 1;
443 }
444 // default option: $value == 'only_contribs'
445 return;
446
447 case 'contribution_is_test':
448 // By default is Contribution Search form we choose is_test = 0 in otherwords always show active contribution
449 // so in case if any one choose any Yes/No avoid the default clause otherwise it will be conflict in whereClause
450 $key = array_search('civicrm_contribution.is_test = 0', $query->_where[$grouping]);
451 if (!empty($key)) {
452 unset($query->_where[$grouping][$key]);
453 }
454 case 'contribution_test':
455 // We dont want to include all tests for sql OR CRM-7827
456 if (!$value || $query->getOperator() != 'OR') {
457 $query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause("civicrm_contribution.is_test", $op, $value, "Boolean");
458 if ($value) {
459 $query->_qill[$grouping][] = ts("Only Display Test Contributions");
460 }
461 $query->_tables['civicrm_contribution'] = $query->_whereTables['civicrm_contribution'] = 1;
462 }
463 return;
464
465 case 'contribution_is_pay_later':
466 case 'contribution_pay_later':
467 $query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause("civicrm_contribution.is_pay_later", $op, $value, "Boolean");
468 if ($value) {
469 $query->_qill[$grouping][] = ts("Find Pay Later Contributions");
470 }
471 else {
472 $query->_qill[$grouping][] = ts("Exclude Pay Later Contributions");
473 }
474 $query->_tables['civicrm_contribution'] = $query->_whereTables['civicrm_contribution'] = 1;
475 return;
476
477 case 'contribution_recurring':
478 if ($value) {
479 $query->_where[$grouping][] = "civicrm_contribution.contribution_recur_id IS NOT NULL";
480 $query->_qill[$grouping][] = ts("Find Recurring Contributions");
481 $query->_tables['civicrm_contribution_recur'] = $query->_whereTables['civicrm_contribution_recur'] = 1;
482 }
483 else {
484 $query->_where[$grouping][] = "civicrm_contribution.contribution_recur_id IS NULL";
485 $query->_qill[$grouping][] = ts("Exclude Recurring Contributions");
486 }
487 return;
488
489 case 'contribution_recur_id':
490 $query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause("civicrm_contribution.contribution_recur_id",
491 $op, $value, "Integer"
492 );
493 $query->_tables['civicrm_contribution'] = $query->_whereTables['civicrm_contribution'] = 1;
494 return;
495
496 case 'contribution_note':
497 $value = $strtolower(CRM_Core_DAO::escapeString($value));
498 if ($wildcard) {
499 $value = "%$value%";
500 $op = 'LIKE';
501 }
502 $wc = ($op != 'LIKE') ? "LOWER(civicrm_note.note)" : "civicrm_note.note";
503 $query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause($wc, $op, $value, "String");
504 $query->_qill[$grouping][] = ts('Contribution Note %1 %2', array(1 => $op, 2 => $quoteValue));
505 $query->_tables['civicrm_contribution'] = $query->_whereTables['civicrm_contribution'] = $query->_whereTables['contribution_note'] = 1;
506 return;
507
508 case 'contribution_membership_id':
509 $query->_where[$grouping][] = " civicrm_membership.id $op $value";
510 $query->_tables['contribution_membership'] = $query->_whereTables['contribution_membership'] = 1;
511
512 return;
513
514 case 'contribution_participant_id':
515 $query->_where[$grouping][] = " civicrm_participant.id $op $value";
516 $query->_tables['contribution_participant'] = $query->_whereTables['contribution_participant'] = 1;
517 return;
518
519 case 'contribution_pcp_display_in_roll':
520 $query->_where[$grouping][] = " civicrm_contribution_soft.pcp_display_in_roll $op '$value'";
521 if ($value) {
522 $query->_qill[$grouping][] = ts("Personal Campaign Page Honor Roll");
523 }
524 else {
525 $query->_qill[$grouping][] = ts("NOT Personal Campaign Page Honor Roll");
526 }
527 $query->_tables['civicrm_contribution_soft'] = $query->_whereTables['civicrm_contribution_soft'] = 1;
528 return;
529
530 case 'contribution_batch_id':
531 $batches = CRM_Contribute_PseudoConstant::batch();
532 $query->_where[$grouping][] = " civicrm_entity_batch.batch_id $op $value";
533 $query->_qill[$grouping][] = ts('Batch Name %1 %2', array(1 => $op, 2 => $batches[$value]));
534 $query->_tables['civicrm_contribution'] = $query->_whereTables['civicrm_contribution'] = 1;
535 $query->_tables['contribution_batch'] = $query->_whereTables['contribution_batch'] = 1;
536 return;
537
538 case 'contribution_product_id':
539 // CRM-16713 - contribution search by premiums on 'Find Contribution' form.
540 $qillName = $name;
541 list($operator, $productValue) = CRM_Contact_BAO_Query::buildQillForFieldValue('CRM_Contribute_DAO_Product', $name, $value, $op);
542 $query->_qill[$grouping][] = ts('%1 %2 %3', array(1 => $fields[$qillName]['title'], 2 => $operator, 3 => $productValue));
543 $query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause("civicrm_product.id", $op, $value);
544 $query->_tables['civicrm_product'] = $query->_whereTables['civicrm_product'] = 1;
545 return;
546
547 default:
548 //all other elements are handle in this case
549 $fldName = substr($name, 13);
550 if (!isset($fields[$fldName])) {
551 // CRM-12597
552 CRM_Core_Session::setStatus(ts(
553 'We did not recognize the search field: %1. Please check and fix your contribution related smart groups.',
554 array(1 => $fldName)
555 )
556 );
557 return;
558 }
559 $whereTable = $fields[$fldName];
560 $value = trim($value);
561
562 $dataType = "String";
563 if (!empty($whereTable['type'])) {
564 $dataType = CRM_Utils_Type::typeToString($whereTable['type']);
565 }
566
567 $wc = ($op != 'LIKE' && $dataType != 'Date') ? "LOWER($whereTable[where])" : "$whereTable[where]";
568 $query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause($wc, $op, $value, $dataType);
569 $query->_qill[$grouping][] = "$whereTable[title] $op $quoteValue";
570 list($tableName, $fieldName) = explode('.', $whereTable['where'], 2);
571 $query->_tables[$tableName] = $query->_whereTables[$tableName] = 1;
572 if ($tableName == 'civicrm_contribution_product') {
573 $query->_tables['civicrm_product'] = $query->_whereTables['civicrm_product'] = 1;
574 $query->_tables['civicrm_contribution'] = $query->_whereTables['civicrm_contribution'] = 1;
575 }
576 else {
577 $query->_tables['civicrm_contribution'] = $query->_whereTables['civicrm_contribution'] = 1;
578 }
579 }
580 }
581
582 /**
583 * Get from clause.
584 *
585 * @param string $name
586 * @param string $mode
587 * @param string $side
588 *
589 * @return NULL|string
590 */
591 public static function from($name, $mode, $side) {
592 $from = NULL;
593 switch ($name) {
594 case 'civicrm_contribution':
595 $from = " $side JOIN civicrm_contribution ON civicrm_contribution.contact_id = contact_a.id ";
596 if (in_array(self::$_contribOrSoftCredit, array("only_scredits", "both_related", "both"))) {
597 // switch the from table if its only soft credit search
598 $from = " $side JOIN contribution_search_scredit_combined ON contribution_search_scredit_combined.contact_id = contact_a.id ";
599 $from .= " $side JOIN civicrm_contribution ON civicrm_contribution.id = contribution_search_scredit_combined.id ";
600 $from .= " $side JOIN civicrm_contribution_soft ON civicrm_contribution_soft.id = contribution_search_scredit_combined.scredit_id";
601 }
602 break;
603
604 case 'civicrm_contribution_recur':
605 if ($mode == 1) {
606 // in contact mode join directly onto profile - in case no contributions exist yet
607 $from = " $side JOIN civicrm_contribution_recur ON contact_a.id = civicrm_contribution_recur.contact_id ";
608 }
609 else {
610 $from = " $side JOIN civicrm_contribution_recur ON civicrm_contribution.contribution_recur_id = civicrm_contribution_recur.id ";
611 }
612 break;
613
614 case 'civicrm_financial_type':
615 if ($mode & CRM_Contact_BAO_Query::MODE_CONTRIBUTE) {
616 $from = " INNER JOIN civicrm_financial_type ON civicrm_contribution.financial_type_id = civicrm_financial_type.id ";
617 }
618 else {
619 $from = " $side JOIN civicrm_financial_type ON civicrm_contribution.financial_type_id = civicrm_financial_type.id ";
620 }
621 break;
622
623 case 'civicrm_financial_account':
624 if ($mode & CRM_Contact_BAO_Query::MODE_CONTACTS) {
625 $from = " $side JOIN civicrm_financial_account ON contact_a.id = civicrm_financial_account.contact_id ";
626 }
627 break;
628
629 case 'civicrm_accounting_code':
630 if ($mode & CRM_Contact_BAO_Query::MODE_CONTRIBUTE) {
631 $from = " $side JOIN civicrm_entity_financial_account ON civicrm_entity_financial_account.entity_id = civicrm_contribution.financial_type_id AND civicrm_entity_financial_account.entity_table = 'civicrm_financial_type' ";
632 $from .= " INNER JOIN civicrm_financial_account ON civicrm_financial_account.id = civicrm_entity_financial_account.financial_account_id ";
633 $from .= " INNER JOIN civicrm_option_value cov ON cov.value = civicrm_entity_financial_account.account_relationship AND cov.name = 'Income Account is' ";
634 $from .= " INNER JOIN civicrm_option_group cog ON cog.id = cov.option_group_id AND cog.name = 'account_relationship' ";
635 }
636 break;
637
638 case 'civicrm_contribution_page':
639 $from = " $side JOIN civicrm_contribution_page ON civicrm_contribution.contribution_page_id = civicrm_contribution_page.id";
640 break;
641
642 case 'civicrm_product':
643 $from = " $side JOIN civicrm_contribution_product ON civicrm_contribution_product.contribution_id = civicrm_contribution.id";
644 $from .= " $side JOIN civicrm_product ON civicrm_contribution_product.product_id =civicrm_product.id ";
645 break;
646
647 case 'contribution_payment_instrument':
648 $from = " $side JOIN civicrm_option_group option_group_payment_instrument ON ( option_group_payment_instrument.name = 'payment_instrument')";
649 $from .= " $side JOIN civicrm_option_value contribution_payment_instrument ON (civicrm_contribution.payment_instrument_id = contribution_payment_instrument.value
650 AND option_group_payment_instrument.id = contribution_payment_instrument.option_group_id ) ";
651 break;
652
653 case 'contribution_status':
654 $from = " $side JOIN civicrm_option_group option_group_contribution_status ON (option_group_contribution_status.name = 'contribution_status')";
655 $from .= " $side JOIN civicrm_option_value contribution_status ON (civicrm_contribution.contribution_status_id = contribution_status.value
656 AND option_group_contribution_status.id = contribution_status.option_group_id ) ";
657 break;
658
659 case 'contribution_softcredit_type':
660 $from = " $side JOIN civicrm_option_group option_group_contribution_softcredit_type ON
661 (option_group_contribution_softcredit_type.name = 'soft_credit_type')";
662 $from .= " $side JOIN civicrm_option_value contribution_softcredit_type ON
663 ( civicrm_contribution_soft.soft_credit_type_id = contribution_softcredit_type.value
664 AND option_group_contribution_softcredit_type.id = contribution_softcredit_type.option_group_id )";
665 break;
666
667 case 'contribution_note':
668 $from .= " $side JOIN civicrm_note ON ( civicrm_note.entity_table = 'civicrm_contribution' AND
669 civicrm_contribution.id = civicrm_note.entity_id )";
670 break;
671
672 case 'contribution_membership':
673 $from = " $side JOIN civicrm_membership_payment ON civicrm_membership_payment.contribution_id = civicrm_contribution.id";
674 $from .= " $side JOIN civicrm_membership ON civicrm_membership_payment.membership_id = civicrm_membership.id ";
675 break;
676
677 case 'civicrm_campaign':
678 //CRM-16764 - get survey clause from campaign bao
679 if (!CRM_Campaign_BAO_Query::$_applySurveyClause) {
680 $from = " $side JOIN civicrm_campaign ON civicrm_campaign.id = civicrm_contribution.campaign_id";
681 }
682 break;
683
684 case 'contribution_participant':
685 $from = " $side JOIN civicrm_participant_payment ON civicrm_participant_payment.contribution_id = civicrm_contribution.id";
686 $from .= " $side JOIN civicrm_participant ON civicrm_participant_payment.participant_id = civicrm_participant.id ";
687 break;
688
689 case 'civicrm_contribution_soft':
690 if (!in_array(self::$_contribOrSoftCredit, array("only_scredits", "both_related", "both"))) {
691 $from = " $side JOIN civicrm_contribution_soft ON civicrm_contribution_soft.contribution_id = civicrm_contribution.id";
692 }
693 break;
694
695 case 'civicrm_contribution_soft_contact':
696 if (in_array(self::$_contribOrSoftCredit, array("only_scredits", "both_related", "both"))) {
697 $from .= " $side JOIN civicrm_contact civicrm_contact_d ON (civicrm_contribution.contact_id = civicrm_contact_d.id )
698 AND contribution_search_scredit_combined.scredit_id IS NOT NULL";
699 }
700 else {
701 $from .= " $side JOIN civicrm_contact civicrm_contact_d ON (civicrm_contribution_soft.contact_id = civicrm_contact_d.id )";
702 }
703 break;
704
705 case 'civicrm_contribution_soft_email':
706 $from .= " $side JOIN civicrm_email as soft_email ON (civicrm_contact_d.id = soft_email.contact_id )";
707 break;
708
709 case 'civicrm_contribution_soft_phone':
710 $from .= " $side JOIN civicrm_phone as soft_phone ON (civicrm_contact_d.id = soft_phone.contact_id )";
711 break;
712
713 case 'contribution_batch':
714 $from .= " $side JOIN civicrm_entity_financial_trxn ON (
715 civicrm_entity_financial_trxn.entity_table = 'civicrm_contribution'
716 AND civicrm_contribution.id = civicrm_entity_financial_trxn.entity_id )";
717
718 $from .= " $side JOIN civicrm_financial_trxn ON (
719 civicrm_entity_financial_trxn.financial_trxn_id = civicrm_financial_trxn.id )";
720
721 $from .= " $side JOIN civicrm_entity_batch ON ( civicrm_entity_batch.entity_table = 'civicrm_financial_trxn'
722 AND civicrm_financial_trxn.id = civicrm_entity_batch.entity_id )";
723
724 $from .= " $side JOIN civicrm_batch ON civicrm_entity_batch.batch_id = civicrm_batch.id";
725 break;
726 }
727 return $from;
728 }
729
730 /**
731 * Initialise the soft credit clause.
732 *
733 * @param CRM_Contact_BAO_Query $query
734 */
735 public static function initializeAnySoftCreditClause(&$query) {
736 if (self::isSoftCreditOptionEnabled($query->_params)) {
737 if ($query->_mode & CRM_Contact_BAO_Query::MODE_CONTRIBUTE) {
738 unset($query->_distinctComponentClause);
739 $query->_rowCountClause = " count(civicrm_contribution.id)";
740 $query->_groupByComponentClause = " GROUP BY contribution_search_scredit_combined.id, contribution_search_scredit_combined.contact_id, contribution_search_scredit_combined.scredit_id ";
741 }
742 }
743 }
744
745 /**
746 * Check if soft credits are enables.
747 *
748 * @param array $queryParams
749 *
750 * @return bool
751 */
752 public static function isSoftCreditOptionEnabled($queryParams = array()) {
753 static $tempTableFilled = FALSE;
754 if (!empty($queryParams)) {
755 foreach (array_keys($queryParams) as $id) {
756 if (empty($queryParams[$id][0])) {
757 continue;
758 }
759 if ($queryParams[$id][0] == 'contribution_or_softcredits') {
760 self::$_contribOrSoftCredit = $queryParams[$id][2];
761 }
762 }
763 }
764 if (in_array(self::$_contribOrSoftCredit,
765 array("only_scredits", "both_related", "both"))) {
766 if (!$tempTableFilled) {
767 // build a temp table which is union of contributions and soft credits
768 // note: group-by in first part ensures uniqueness in counts
769 $tempQuery = "
770 CREATE TEMPORARY TABLE IF NOT EXISTS contribution_search_scredit_combined AS
771 SELECT con.id as id, con.contact_id, cso.id as filter_id, NULL as scredit_id
772 FROM civicrm_contribution con
773 LEFT JOIN civicrm_contribution_soft cso ON con.id = cso.contribution_id
774 GROUP BY id, contact_id, scredit_id
775 UNION ALL
776 SELECT scredit.contribution_id as id, scredit.contact_id, scredit.id as filter_id, scredit.id as scredit_id
777 FROM civicrm_contribution_soft as scredit";
778 CRM_Core_DAO::executeQuery($tempQuery);
779 $tempTableFilled = TRUE;
780 }
781 return TRUE;
782 }
783 return FALSE;
784 }
785
786 /**
787 * Get return properties for soft credits.
788 *
789 * @param bool $isExportMode
790 *
791 * @return array
792 */
793 public static function softCreditReturnProperties($isExportMode = FALSE) {
794 $properties = array(
795 'contribution_soft_credit_name' => 1,
796 'contribution_soft_credit_amount' => 1,
797 'contribution_soft_credit_type' => 1,
798 );
799 if ($isExportMode) {
800 $properties['contribution_soft_credit_contact_id'] = 1;
801 $properties['contribution_soft_credit_contribution_id'] = 1;
802 }
803 return $properties;
804 }
805
806 /**
807 * @param $mode
808 * @param bool $includeCustomFields
809 *
810 * @return array|NULL
811 */
812 public static function defaultReturnProperties($mode, $includeCustomFields = TRUE) {
813 $properties = NULL;
814 if ($mode & CRM_Contact_BAO_Query::MODE_CONTRIBUTE) {
815 $properties = array(
816 'contact_type' => 1,
817 'contact_sub_type' => 1,
818 'sort_name' => 1,
819 'display_name' => 1,
820 'financial_type' => 1,
821 'contribution_source' => 1,
822 'receive_date' => 1,
823 'thankyou_date' => 1,
824 'cancel_date' => 1,
825 'total_amount' => 1,
826 'accounting_code' => 1,
827 'payment_instrument' => 1,
828 'payment_instrument_id' => 1,
829 'check_number' => 1,
830 'non_deductible_amount' => 1,
831 'fee_amount' => 1,
832 'net_amount' => 1,
833 'trxn_id' => 1,
834 'invoice_id' => 1,
835 'currency' => 1,
836 'cancel_reason' => 1,
837 'receipt_date' => 1,
838 'product_name' => 1,
839 'sku' => 1,
840 'product_option' => 1,
841 'fulfilled_date' => 1,
842 'contribution_start_date' => 1,
843 'contribution_end_date' => 1,
844 'is_test' => 1,
845 'is_pay_later' => 1,
846 'contribution_status' => 1,
847 'contribution_status_id' => 1,
848 'contribution_recur_id' => 1,
849 'amount_level' => 1,
850 'contribution_note' => 1,
851 'contribution_batch' => 1,
852 'contribution_campaign_title' => 1,
853 'contribution_campaign_id' => 1,
854 'contribution_product_id' => 1,
855 );
856 if (self::isSoftCreditOptionEnabled()) {
857 $properties = array_merge($properties, self::softCreditReturnProperties());
858 }
859 if ($includeCustomFields) {
860 // also get all the custom contribution properties
861 $fields = CRM_Core_BAO_CustomField::getFieldsForImport('Contribution');
862 if (!empty($fields)) {
863 foreach ($fields as $name => $dontCare) {
864 $properties[$name] = 1;
865 }
866 }
867 }
868 }
869 return $properties;
870 }
871
872 /**
873 * Add all the elements shared between contribute search and advnaced search.
874 *
875 * @param CRM_Core_Form $form
876 */
877 public static function buildSearchForm(&$form) {
878
879 // Added contribution source
880 $form->addElement('text', 'contribution_source', ts('Contribution Source'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_Contribution', 'source'));
881
882 CRM_Core_Form_Date::buildDateRange($form, 'contribution_date', 1, '_low', '_high', ts('From:'), FALSE);
883
884 $form->add('text', 'contribution_amount_low', ts('From'), array('size' => 8, 'maxlength' => 8));
885 $form->addRule('contribution_amount_low', ts('Please enter a valid money value (e.g. %1).', array(1 => CRM_Utils_Money::format('9.99', ' '))), 'money');
886
887 $form->add('text', 'contribution_amount_high', ts('To'), array('size' => 8, 'maxlength' => 8));
888 $form->addRule('contribution_amount_high', ts('Please enter a valid money value (e.g. %1).', array(1 => CRM_Utils_Money::format('99.99', ' '))), 'money');
889
890 // Adding select option for curreny type -- CRM-4711
891 $form->add('select', 'contribution_currency_type',
892 ts('Currency Type'),
893 array(
894 '' => ts('- any -'),
895 ) +
896 CRM_Core_PseudoConstant::get('CRM_Contribute_DAO_Contribution', 'currency', array('labelColumn' => 'name')),
897 FALSE, array('class' => 'crm-select2')
898 );
899
900 // CRM-13848
901 $form->addSelect('financial_type_id',
902 array('entity' => 'contribution', 'multiple' => 'multiple', 'context' => 'search')
903 );
904
905 $form->add('select', 'contribution_page_id',
906 ts('Contribution Page'),
907 CRM_Contribute_PseudoConstant::contributionPage(),
908 FALSE, array('class' => 'crm-select2', 'multiple' => 'multiple', 'placeholder' => ts('- any -'))
909 );
910
911 $form->addSelect('payment_instrument_id',
912 array('entity' => 'contribution', 'multiple' => 'multiple', 'label' => ts('Payment Method'), 'option_url' => NULL, 'placeholder' => ts('- any -'))
913 );
914
915 $form->add('select',
916 'contribution_pcp_made_through_id',
917 ts('Personal Campaign Page'),
918 CRM_Contribute_PseudoConstant::pcPage(), FALSE, array('class' => 'crm-select2', 'multiple' => 'multiple', 'placeholder' => ts('- any -')));
919
920 $statusValues = CRM_Core_PseudoConstant::get('CRM_Contribute_DAO_Contribution', 'contribution_status_id');
921 // Remove status values that are only used for recurring contributions or pledges (In Progress, Overdue).
922 unset($statusValues['5'], $statusValues['6']);
923 $form->add('select', 'contribution_status_id',
924 ts('Contribution Status'), $statusValues,
925 FALSE, array('class' => 'crm-select2', 'multiple' => 'multiple')
926 );
927
928 // Add fields for thank you and receipt
929 $form->addYesNo('contribution_thankyou_date_is_not_null', ts('Thank-you sent?'), TRUE);
930 $form->addYesNo('contribution_receipt_date_is_not_null', ts('Receipt sent?'), TRUE);
931
932 $form->addYesNo('contribution_pay_later', ts('Contribution is Pay Later?'), TRUE);
933 $form->addYesNo('contribution_recurring', ts('Contribution is Recurring?'), TRUE);
934
935 // Recurring contribution fields
936 foreach (self::getRecurringFields() as $key => $label) {
937 CRM_Core_Form_Date::buildDateRange($form, $key, 1, '_low', '_high');
938 // If data has been entered for a recurring field, tell the tpl layer to open the pane
939 if (!empty($form->_formValues[$key . '_relative']) || !empty($form->_formValues[$key . '_low']) || !empty($form->_formValues[$key . '_high'])) {
940 $form->assign('contribution_recur_pane_open', TRUE);
941 }
942 }
943
944 $form->addYesNo('contribution_test', ts('Contribution is a Test?'), TRUE);
945
946 // Add field for transaction ID search
947 $form->addElement('text', 'contribution_trxn_id', ts("Transaction ID"));
948 $form->addElement('text', 'invoice_id', ts("Invoice ID"));
949 $form->addElement('text', 'contribution_check_number', ts('Check Number'));
950
951 // Add field for pcp display in roll search
952 $form->addYesNo('contribution_pcp_display_in_roll', ts('Personal Campaign Page Honor Roll?'), TRUE);
953
954 // Soft credit related fields
955 $options = array(
956 'only_contribs' => ts('Contributions Only'),
957 'only_scredits' => ts('Soft Credits Only'),
958 'both_related' => ts('Soft Credits with related Hard Credit'),
959 'both' => ts('Both'),
960 );
961 $form->add('select', 'contribution_or_softcredits', ts('Contributions OR Soft Credits?'), $options, FALSE, array('class' => "crm-select2"));
962 $form->addSelect(
963 'contribution_soft_credit_type_id',
964 array(
965 'entity' => 'contribution_soft',
966 'field' => 'soft_credit_type_id',
967 'multiple' => TRUE,
968 'context' => 'search',
969 )
970 );
971
972 // CRM-16713 - contribution search by premiums on 'Find Contribution' form.
973 $form->add('select', 'contribution_product_id',
974 ts('Premium'),
975 CRM_Contribute_PseudoConstant::products(),
976 FALSE, array('class' => 'crm-select2', 'multiple' => 'multiple', 'placeholder' => ts('- any -'))
977 );
978
979 // Add all the custom searchable fields
980 $contribution = array('Contribution');
981 $groupDetails = CRM_Core_BAO_CustomGroup::getGroupDetail(NULL, TRUE, $contribution);
982 if ($groupDetails) {
983 $form->assign('contributeGroupTree', $groupDetails);
984 foreach ($groupDetails as $group) {
985 foreach ($group['fields'] as $field) {
986 $fieldId = $field['id'];
987 $elementName = 'custom_' . $fieldId;
988 CRM_Core_BAO_CustomField::addQuickFormElement($form,
989 $elementName,
990 $fieldId,
991 FALSE, FALSE, TRUE
992 );
993 }
994 }
995 }
996
997 CRM_Campaign_BAO_Campaign::addCampaignInComponentSearch($form, 'contribution_campaign_id');
998
999 // Add batch select
1000 $batches = CRM_Contribute_PseudoConstant::batch();
1001
1002 if (!empty($batches)) {
1003 $form->add('select', 'contribution_batch_id',
1004 ts('Batch Name'),
1005 array('' => ts('- any -')) + $batches,
1006 FALSE, array('class' => 'crm-select2')
1007 );
1008 }
1009
1010 $form->assign('validCiviContribute', TRUE);
1011 $form->setDefaults(array('contribution_test' => 0));
1012 }
1013
1014 /**
1015 * Function that may not be needed.
1016 *
1017 * @param array $row
1018 * @param int $id
1019 */
1020 public static function searchAction(&$row, $id) {
1021 }
1022
1023 /**
1024 * Get table names.
1025 *
1026 * @todo better function comment needed - what IS the point of this?
1027 *
1028 * @param array $tables
1029 */
1030 public static function tableNames(&$tables) {
1031 // Add contribution table
1032 if (!empty($tables['civicrm_product'])) {
1033 $tables = array_merge(array('civicrm_contribution' => 1), $tables);
1034 }
1035
1036 if (!empty($tables['civicrm_contribution_product']) && empty($tables['civicrm_product'])) {
1037 $tables['civicrm_product'] = 1;
1038 }
1039 }
1040
1041 /**
1042 * Add the where for dates.
1043 *
1044 * @param array $values
1045 * Array of query values.
1046 * @param object $query
1047 * The query object.
1048 * @param string $name
1049 * Query field that is set.
1050 * @param string $field
1051 * Name of field to be set.
1052 * @param string $title
1053 * Title of the field.
1054 *
1055 * @return bool
1056 */
1057 public static function buildDateWhere(&$values, $query, $name, $field, $title) {
1058 $fieldPart = strpos($name, $field);
1059 if ($fieldPart === FALSE) {
1060 return NULL;
1061 }
1062 // we only have recurring dates using this ATM so lets' short cut to find the table name
1063 $table = 'contribution_recur';
1064 $fieldName = explode($table . '_', $field);
1065 $query->dateQueryBuilder($values,
1066 'civicrm_' . $table, $field, $fieldName[1], $title
1067 );
1068 return TRUE;
1069 }
1070
1071 /**
1072 * Get fields for recurring contributions.
1073 *
1074 * @return array
1075 */
1076 public static function getRecurringFields() {
1077 return array(
1078 'contribution_recur_start_date' => ts('Recurring Contribution Start Date'),
1079 'contribution_recur_next_sched_contribution_date' => ts('Next Scheduled Recurring Contribution'),
1080 'contribution_recur_cancel_date' => ts('Recurring Contribution Cancel Date'),
1081 'contribution_recur_end_date' => ts('Recurring Contribution End Date'),
1082 'contribution_recur_create_date' => ('Recurring Contribution Create Date'),
1083 'contribution_recur_modified_date' => ('Recurring Contribution Modified Date'),
1084 'contribution_recur_failure_retry_date' => ts('Failed Recurring Contribution Retry Date'),
1085 );
1086 }
1087
1088 }