Update copyright date for 2020
[civicrm-core.git] / CRM / Report / Form / Contribute / HouseholdSummary.php
CommitLineData
6a488035 1<?php
6a488035
TO
2/*
3 +--------------------------------------------------------------------+
fee14197 4 | CiviCRM version 5 |
6a488035 5 +--------------------------------------------------------------------+
f299f7db 6 | Copyright CiviCRM LLC (c) 2004-2020 |
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 +--------------------------------------------------------------------+
d25dd0ee 26 */
6a488035
TO
27
28/**
29 *
30 * @package CRM
f299f7db 31 * @copyright CiviCRM LLC (c) 2004-2020
6a488035
TO
32 */
33class CRM_Report_Form_Contribute_HouseholdSummary extends CRM_Report_Form {
34
be2fb01f 35 public $_drilldownReport = ['contribute/detail' => 'Link to Detail Report'];
6a488035 36
eb3b4c04 37 protected $_summary = NULL;
2f4c2f5d 38
74cf4551 39 /**
d7e34fc6 40 * Class constructor.
74cf4551 41 */
00be9182 42 public function __construct() {
6a488035
TO
43 self::validRelationships();
44
be2fb01f
CW
45 $this->_columns = [
46 'civicrm_contact_household' => [
6a488035 47 'dao' => 'CRM_Contact_DAO_Contact',
be2fb01f
CW
48 'fields' => [
49 'household_name' => [
9d72cede
EM
50 'title' => ts('Household Name'),
51 'required' => TRUE,
be2fb01f
CW
52 ],
53 'id' => [
6a488035
TO
54 'no_display' => TRUE,
55 'required' => TRUE,
be2fb01f
CW
56 ],
57 'contact_type' => [
30f85891 58 'title' => ts('Contact Type'),
be2fb01f
CW
59 ],
60 'contact_sub_type' => [
b8f96eb8 61 'title' => ts('Contact Subtype'),
be2fb01f
CW
62 ],
63 ],
64 'filters' => [
65 'household_name' => [
d7e34fc6 66 'title' => ts('Household Name'),
be2fb01f
CW
67 ],
68 'is_deleted' => [
d7e34fc6 69 'default' => 0,
70 'type' => CRM_Utils_Type::T_BOOLEAN,
be2fb01f
CW
71 ],
72 ],
6a488035 73 'grouping' => 'household-fields',
be2fb01f
CW
74 ],
75 'civicrm_line_item' => [
08dd3452 76 'dao' => 'CRM_Price_DAO_LineItem',
be2fb01f
CW
77 ],
78 'civicrm_relationship' => [
6a488035 79 'dao' => 'CRM_Contact_DAO_Relationship',
be2fb01f
CW
80 'fields' => [
81 'relationship_type_id' => [
a92f4449 82 'title' => ts('Relationship Type'),
be2fb01f
CW
83 ],
84 ],
85 'filters' => [
86 'relationship_type_id' => [
6a488035
TO
87 'title' => ts('Relationship Type'),
88 'type' => CRM_Utils_Type::T_INT,
89 'operatorType' => CRM_Report_Form::OP_SELECT,
90 'options' => $this->relationTypes,
75f23035 91 'default' => key($this->relationTypes),
be2fb01f
CW
92 ],
93 ],
6a488035 94 'grouping' => 'household-fields',
be2fb01f
CW
95 ],
96 'civicrm_contact' => [
6a488035 97 'dao' => 'CRM_Contact_DAO_Contact',
be2fb01f
CW
98 'fields' => [
99 'sort_name' => [
a92f4449 100 'title' => ts('Contact Name'),
6a488035 101 'required' => TRUE,
be2fb01f
CW
102 ],
103 'id' => [
6a488035
TO
104 'no_display' => TRUE,
105 'required' => TRUE,
be2fb01f
CW
106 ],
107 ],
6a488035 108 'grouping' => 'contact-fields',
be2fb01f
CW
109 ],
110 'civicrm_contribution' => [
6a488035 111 'dao' => 'CRM_Contribute_DAO_Contribution',
be2fb01f
CW
112 'fields' => [
113 'total_amount' => [
a92f4449 114 'title' => ts('Amount'),
6a488035 115 'required' => TRUE,
be2fb01f
CW
116 ],
117 'id' => [
6a488035
TO
118 'no_display' => TRUE,
119 'required' => TRUE,
be2fb01f
CW
120 ],
121 'contribution_status_id' => [
fd6a6828 122 'title' => ts('Contribution Status'),
6a488035 123 'default' => TRUE,
be2fb01f
CW
124 ],
125 'check_number' => [
a92f4449 126 'title' => ts('Check Number'),
be2fb01f
CW
127 ],
128 'currency' => [
eb3b4c04 129 'required' => TRUE,
130 'no_display' => TRUE,
be2fb01f
CW
131 ],
132 'financial_type_id' => [
2feca82f 133 'title' => ts('Financial Type'),
be2fb01f 134 ],
6a488035 135 'trxn_id' => NULL,
be2fb01f 136 'receive_date' => ['default' => TRUE],
6a488035 137 'receipt_date' => NULL,
be2fb01f
CW
138 ],
139 'filters' => [
140 'receive_date' => ['operatorType' => CRM_Report_Form::OP_DATE],
141 'total_amount' => ['title' => ts('Amount Between')],
142 'currency' => [
fd6a6828 143 'title' => ts('Currency'),
eb3b4c04 144 'operatorType' => CRM_Report_Form::OP_MULTISELECT,
145 'options' => CRM_Core_OptionGroup::values('currencies_enabled'),
d1b0931b 146 'default' => NULL,
eb3b4c04 147 'type' => CRM_Utils_Type::T_STRING,
be2fb01f
CW
148 ],
149 'contribution_status_id' => [
a92f4449 150 'title' => ts('Contribution Status'),
6a488035 151 'operatorType' => CRM_Report_Form::OP_MULTISELECT,
c0aaecf9 152 'options' => CRM_Contribute_BAO_Contribution::buildOptions('contribution_status_id', 'search'),
be2fb01f
CW
153 'default' => [1],
154 ],
155 'financial_type_id' => [
2feca82f
AS
156 'title' => ts('Financial Type'),
157 'operatorType' => CRM_Report_Form::OP_MULTISELECT,
158 'options' => CRM_Contribute_PseudoConstant::financialType(),
be2fb01f
CW
159 ],
160 ],
6a488035 161 'grouping' => 'contri-fields',
be2fb01f
CW
162 ],
163 'civicrm_financial_trxn' => [
4d5f6da9 164 'dao' => 'CRM_Financial_DAO_FinancialTrxn',
be2fb01f
CW
165 'fields' => [
166 'card_type_id' => [
d72b084a 167 'title' => ts('Credit Card Type'),
5e0343e8 168 'dbAlias' => 'GROUP_CONCAT(financial_trxn_civireport.card_type_id SEPARATOR ",")',
be2fb01f
CW
169 ],
170 ],
171 'filters' => [
172 'card_type_id' => [
d72b084a 173 'title' => ts('Credit Card Type'),
4d5f6da9 174 'operatorType' => CRM_Report_Form::OP_MULTISELECT,
5e0343e8 175 'options' => CRM_Financial_DAO_FinancialTrxn::buildOptions('card_type_id'),
4d5f6da9
E
176 'default' => NULL,
177 'type' => CRM_Utils_Type::T_STRING,
be2fb01f
CW
178 ],
179 ],
180 ],
181 'civicrm_address' => [
6a488035 182 'dao' => 'CRM_Core_DAO_Address',
be2fb01f 183 'fields' => [
6a488035
TO
184 'street_address' => NULL,
185 'city' => NULL,
186 'postal_code' => NULL,
be2fb01f 187 'state_province_id' => [
a92f4449 188 'title' => ts('State/Province'),
be2fb01f
CW
189 ],
190 'country_id' => [
a92f4449 191 'title' => ts('Country'),
be2fb01f
CW
192 ],
193 ],
6a488035 194 'grouping' => 'contact-fields',
be2fb01f
CW
195 ],
196 'civicrm_email' => [
6a488035 197 'dao' => 'CRM_Core_DAO_Email',
be2fb01f 198 'fields' => [
21dfd5f5 199 'email' => NULL,
be2fb01f 200 ],
6a488035 201 'grouping' => 'contact-fields',
be2fb01f
CW
202 ],
203 ];
6a488035 204
51538a51 205 // If we have a campaign, build out the relevant elements
206 $this->addCampaignFields('civicrm_contribution');
207
eb3b4c04 208 $this->_currencyColumn = 'civicrm_contribution_currency';
6a488035
TO
209 parent::__construct();
210 }
211
00be9182 212 public function select() {
3b2bbbfb 213 // @todo remove this & use parent select.
be2fb01f 214 $this->_columnHeaders = $select = [];
6a488035
TO
215 foreach ($this->_columns as $tableName => $table) {
216 if (array_key_exists('fields', $table)) {
217 foreach ($table['fields'] as $fieldName => $field) {
9d72cede
EM
218 if (!empty($field['required']) ||
219 !empty($this->_params['fields'][$fieldName])
220 ) {
6a488035 221
a7488080 222 if (!empty($field['statistics'])) {
6a488035
TO
223 foreach ($field['statistics'] as $stat => $label) {
224 $select[] = "{$field['dbAlias']} as {$tableName}_{$fieldName}_{$stat}";
225 $this->_columnHeaders["{$tableName}_{$fieldName}_{$stat}"]['title'] = $label;
226 $this->_columnHeaders["{$tableName}_{$fieldName}_{$stat}"]['type'] = $field['type'];
227 $this->_statFields[] = "{$tableName}_{$fieldName}_{$stat}";
228 }
229 }
230 else {
22a17535 231 $select[] = "{$field['dbAlias']} as {$tableName}_{$fieldName}";
6a488035
TO
232
233 $this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = CRM_Utils_Array::value('title', $field);
234 $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = CRM_Utils_Array::value('type', $field);
235 }
236 }
237 }
238 }
239 }
d1641c51 240 $this->_selectClauses = $select;
6a488035
TO
241 $this->_select = "SELECT " . implode(', ', $select) . " ";
242 }
243
00be9182 244 public function from() {
6a488035 245 $this->_from = "
39eb89f4
DL
246 FROM civicrm_relationship {$this->_aliases['civicrm_relationship']}
247 LEFT JOIN civicrm_contact {$this->_aliases['civicrm_contact_household']} ON
6a488035 248 ({$this->_aliases['civicrm_contact_household']}.id = {$this->_aliases['civicrm_relationship']}.$this->householdContact AND {$this->_aliases['civicrm_contact_household']}.contact_type='Household')
39eb89f4
DL
249 LEFT JOIN civicrm_contact {$this->_aliases['civicrm_contact']} ON
250 ({$this->_aliases['civicrm_contact']}.id = {$this->_aliases['civicrm_relationship']}.$this->otherContact )
6a488035
TO
251 {$this->_aclFrom}
252 INNER JOIN civicrm_contribution {$this->_aliases['civicrm_contribution']} ON
e280410d 253 ({$this->_aliases['civicrm_contribution']}.contact_id = {$this->_aliases['civicrm_relationship']}.$this->otherContact ) AND {$this->_aliases['civicrm_contribution']}.is_test = 0 ";
6a488035 254
3b2bbbfb 255 $this->joinAddressFromContact();
256 $this->joinEmailFromContact();
4d5f6da9
E
257
258 // for credit card type
259 $this->addFinancialTrxnFromClause();
6a488035 260 }
40c655aa 261
00be9182 262 public function where() {
be2fb01f 263 $clauses = [];
6a488035
TO
264 foreach ($this->_columns as $tableName => $table) {
265 if (array_key_exists('filters', $table)) {
266 foreach ($table['filters'] as $fieldName => $field) {
267 $clause = NULL;
268 if (CRM_Utils_Array::value('type', $field) & CRM_Utils_Type::T_DATE) {
269 $relative = CRM_Utils_Array::value("{$fieldName}_relative", $this->_params);
a92f4449
EM
270 $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
271 $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
6a488035
TO
272 $clause = $this->dateClause($field['name'], $relative, $from, $to, $field['type']);
273 }
274 else {
275 $op = CRM_Utils_Array::value("{$fieldName}_op", $this->_params);
276 if ($op) {
277 if ($fieldName == 'relationship_type_id') {
389bcebf 278 $clause = "{$this->_aliases['civicrm_relationship']}.relationship_type_id=" . $this->relationshipId;
6a488035
TO
279 }
280 else {
281 $clause = $this->whereClause($field,
282 $op,
283 CRM_Utils_Array::value("{$fieldName}_value", $this->_params),
284 CRM_Utils_Array::value("{$fieldName}_min", $this->_params),
285 CRM_Utils_Array::value("{$fieldName}_max", $this->_params)
286 );
287 }
288 }
289 }
290
291 if (!empty($clause)) {
292 $clauses[] = $clause;
293 }
294 }
295 }
296 }
297
298 if (empty($clauses)) {
299 $this->_where = "WHERE ( 1 )";
300 }
301 else {
302 $this->_where = "WHERE " . implode(' AND ', $clauses);
303 }
304
305 if ($this->_aclWhere) {
306 $this->_where .= " AND {$this->_aclWhere} ";
307 }
308 }
309
00be9182 310 public function groupBy() {
be2fb01f 311 $groupBy = [
d1641c51 312 "{$this->_aliases['civicrm_relationship']}.$this->householdContact",
313 "{$this->_aliases['civicrm_relationship']}.$this->otherContact",
314 "{$this->_aliases['civicrm_contribution']}.id",
315 "{$this->_aliases['civicrm_relationship']}.relationship_type_id",
be2fb01f 316 ];
b708c08d 317 $this->_groupBy = CRM_Contact_BAO_Query::getGroupByFromSelectColumns($this->_selectClauses, $groupBy);
6a488035
TO
318 }
319
00be9182 320 public function orderBy() {
6a488035
TO
321 $this->_orderBy = " ORDER BY {$this->_aliases['civicrm_contact_household']}.household_name, {$this->_aliases['civicrm_relationship']}.$this->householdContact, {$this->_aliases['civicrm_contact']}.sort_name, {$this->_aliases['civicrm_relationship']}.$this->otherContact";
322 }
323
74cf4551
EM
324 /**
325 * @param $rows
326 *
327 * @return array
328 */
00be9182 329 public function statistics(&$rows) {
6a488035
TO
330 $statistics = parent::statistics($rows);
331
332 //hack filter display for relationship type
333 $type = substr($this->_params['relationship_type_id_value'], -3);
334 foreach ($statistics['filters'] as $id => $value) {
39eb89f4
DL
335 if (
336 $value['title'] == 'Relationship Type' &&
337 isset($this->relationTypes[$this->relationshipId . '_' . $type])
338 ) {
a92f4449
EM
339 $statistics['filters'][$id]['value'] = 'Is equal to ' .
340 $this->relationTypes[$this->relationshipId . '_' . $type];
6a488035
TO
341 }
342 }
343 return $statistics;
344 }
345
00be9182 346 public function postProcess() {
6a488035
TO
347
348 $this->beginPostProcess();
be2fb01f 349 $this->buildACLClause([
353ffa53
TO
350 $this->_aliases['civicrm_contact'],
351 $this->_aliases['civicrm_contact_household'],
be2fb01f 352 ]);
75f23035 353 $sql = $this->buildQuery(TRUE);
be2fb01f 354 $rows = [];
75f23035
EM
355
356 $this->buildRows($sql, $rows);
357 $this->formatDisplay($rows);
358 $this->doTemplateAssignment($rows);
359 $this->endPostProcess($rows);
360 }
361
362 /**
fe482240 363 * Set variables to be accessed by API and form layer in processing.
75f23035 364 */
00be9182 365 public function beginPostProcessCommon() {
6a488035
TO
366 $getRelationship = $this->_params['relationship_type_id_value'];
367 $type = substr($getRelationship, -3);
368 $this->relationshipId = intval((substr($getRelationship, 0, strpos($getRelationship, '_'))));
369 if ($type == 'b_a') {
370 $this->householdContact = 'contact_id_b';
371 $this->otherContact = 'contact_id_a';
372 }
373 else {
374 $this->householdContact = 'contact_id_a';
375 $this->otherContact = 'contact_id_b';
376 }
6a488035
TO
377 }
378
00be9182 379 public function validRelationships() {
be2fb01f 380 $this->relationTypes = $relationTypes = [];
6a488035 381
be2fb01f 382 $params = ['contact_type_b' => 'Household', 'version' => 3];
39eb89f4 383 $typesA = civicrm_api('relationship_type', 'get', $params);
a7488080 384 if (empty($typesA['is_error'])) {
6a488035
TO
385 foreach ($typesA['values'] as $rel) {
386 $relationTypes[$rel['id']][$rel['id'] . '_b_a'] = $rel['label_b_a'];
387 }
388 }
be2fb01f 389 $params = ['contact_type_a' => 'Household', 'version' => 3];
39eb89f4 390 $typesB = civicrm_api('relationship_type', 'get', $params);
a7488080 391 if (empty($typesB['is_error'])) {
6a488035
TO
392 foreach ($typesB['values'] as $rel) {
393 $relationTypes[$rel['id']][$rel['id'] . '_a_b'] = $rel['label_a_b'];
394 //$this->relationTypes[$rel['id'].'_a_b'] = $rel['label_a_b'];
395 }
396 }
397
398 ksort($relationTypes);
399 foreach ($relationTypes as $relationship) {
400 foreach ($relationship as $index => $label) {
401 $this->relationTypes[$index] = $label;
402 }
403 }
404 }
405
74cf4551 406 /**
ced9bfed
EM
407 * Alter display of rows.
408 *
409 * Iterate through the rows retrieved via SQL and make changes for display purposes,
410 * such as rendering contacts as links.
411 *
412 * @param array $rows
413 * Rows generated by SQL, with an array for each row.
74cf4551 414 */
00be9182 415 public function alterDisplay(&$rows) {
6a488035
TO
416 $type = substr($this->_params['relationship_type_id_value'], -3);
417
418 $entryFound = FALSE;
419 $flagHousehold = $flagContact = 0;
6a488035
TO
420 foreach ($rows as $rowNum => $row) {
421
422 //replace retionship id by relationship name
423 if (array_key_exists('civicrm_relationship_relationship_type_id', $row)) {
424 if ($value = $row['civicrm_relationship_relationship_type_id']) {
84178120 425 $rows[$rowNum]['civicrm_relationship_relationship_type_id'] = $this->relationTypes[$value . '_' . $type];
6a488035
TO
426 $entryFound = TRUE;
427 }
428 }
429
430 //remove duplicate Organization names
9d72cede
EM
431 if (array_key_exists('civicrm_contact_household_household_name', $row) &&
432 $this->_outputMode != 'csv'
433 ) {
6a488035
TO
434 if ($value = $row['civicrm_contact_household_household_name']) {
435 if ($rowNum == 0) {
436 $priviousHousehold = $value;
437 }
438 else {
439 if ($priviousHousehold == $value) {
440 $flagHousehold = 1;
441 $priviousHousehold = $value;
442 }
443 else {
444 $flagHousehold = 0;
445 $priviousHousehold = $value;
446 }
447 }
448
449 if ($flagHousehold == 1) {
450 $rows[$rowNum]['civicrm_contact_household_household_name'] = "";
451 }
452 else {
453 $url = CRM_Utils_System::url('civicrm/contact/view',
454 'reset=1&cid=' . $rows[$rowNum]['civicrm_contact_household_id'],
455 $this->_absoluteUrl
456 );
457
389bcebf 458 $rows[$rowNum]['civicrm_contact_household_household_name'] = "<a href='$url' title='" . ts('View contact summary for this househould') . "'>" . $value . '</a>';
6a488035
TO
459 }
460 $entryFound = TRUE;
461 }
462 }
463
464 //remove duplicate Contact names and relationship type
9d72cede
EM
465 if (array_key_exists('civicrm_contact_id', $row) &&
466 $this->_outputMode != 'csv'
467 ) {
6a488035
TO
468 if ($value = $row['civicrm_contact_id']) {
469 if ($rowNum == 0) {
470 $priviousContact = $value;
471 }
472 else {
473 if ($priviousContact == $value) {
474 $flagContact = 1;
475 $priviousContact = $value;
476 }
477 else {
478 $flagContact = 0;
479 $priviousContact = $value;
480 }
481 }
482
483 if ($flagContact == 1 && $flagHousehold == 1) {
484 $rows[$rowNum]['civicrm_contact_sort_name'] = "";
485 $rows[$rowNum]['civicrm_relationship_relationship_type_id'] = "";
486 }
487
488 $entryFound = TRUE;
489 }
490 }
491
492 if (array_key_exists('civicrm_contribution_contribution_status_id', $row)) {
493 if ($value = $row['civicrm_contribution_contribution_status_id']) {
28ee38ed 494 $rows[$rowNum]['civicrm_contribution_contribution_status_id'] = CRM_Contribute_PseudoConstant::contributionStatus($value, 'label');
6a488035
TO
495 }
496 }
497
2feca82f
AS
498 if (array_key_exists('civicrm_contribution_financial_type_id', $row)) {
499 if ($value = $row['civicrm_contribution_financial_type_id']) {
500 $rows[$rowNum]['civicrm_contribution_financial_type_id'] = CRM_Contribute_PseudoConstant::financialType($value);
501 }
502 }
503
6a488035
TO
504 // convert display name to links
505 if (array_key_exists('civicrm_contact_sort_name', $row) &&
506 $rows[$rowNum]['civicrm_contact_sort_name'] &&
507 array_key_exists('civicrm_contact_id', $row)
508 ) {
509 $url = CRM_Report_Utils_Report::getNextUrl('contribute/detail',
510 'reset=1&force=1&id_op=eq&id_value=' . $row['civicrm_contact_id'],
511 $this->_absoluteUrl, $this->_id, $this->_drilldownReport
512 );
513 $rows[$rowNum]['civicrm_contact_sort_name_link'] = $url;
514 $rows[$rowNum]['civicrm_contact_sort_name_hover'] = ts('View contribution details for this individual');
515
516 $entryFound = TRUE;
517 }
518
a7488080 519 if (!empty($row['civicrm_contribution_total_amount'])) {
eb3b4c04 520 $row['civicrm_contribution_total_amount'] = CRM_Utils_Money::format($row['civicrm_contribution_total_amount'], $row['civicrm_contribution_currency']);
521 }
522
5e0343e8 523 if (!empty($row['civicrm_financial_trxn_card_type_id'])) {
524 $rows[$rowNum]['civicrm_financial_trxn_card_type_id'] = $this->getLabels($row['civicrm_financial_trxn_card_type_id'], 'CRM_Financial_DAO_FinancialTrxn', 'card_type_id');
4d5f6da9
E
525 $entryFound = TRUE;
526 }
527
6a488035
TO
528 // Contribution amount links to view contribution
529 if (($value = CRM_Utils_Array::value('civicrm_contribution_total_amount', $row)) &&
530 CRM_Core_Permission::check('access CiviContribute')
531 ) {
532 $url = CRM_Utils_System::url("civicrm/contact/view/contribution",
9d72cede
EM
533 "reset=1&id=" . $row['civicrm_contribution_id'] . "&cid=" .
534 $row['civicrm_contact_id'] .
a92f4449 535 "&action=view&context=contribution&selectedChild=contribute",
6a488035
TO
536 $this->_absoluteUrl
537 );
538 $rows[$rowNum]['civicrm_contribution_total_amount_link'] = $url;
539 $rows[$rowNum]['civicrm_contribution_total_amount_hover'] = ts("View this contribution.");
540 $entryFound = TRUE;
541 }
542
543 // convert campaign_id to campaign title
544 if (array_key_exists('civicrm_contribution_campaign_id', $row)) {
545 if ($value = $row['civicrm_contribution_campaign_id']) {
51538a51 546 $rows[$rowNum]['civicrm_contribution_campaign_id'] = $this->campaigns[$value];
6a488035
TO
547 $entryFound = TRUE;
548 }
549 }
550
5e587dd3 551 $entryFound = $this->alterDisplayAddressFields($row, $rows, $rowNum, NULL, NULL) ? TRUE : $entryFound;
552
6a488035
TO
553 // skip looking further in rows, if first row itself doesn't
554 if (!$entryFound) {
555 break;
556 }
557 $lastKey = $rowNum;
558 }
559 }
96025800 560
6a488035 561}