Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | // $Id$ | |
3 | ||
4 | /* | |
5 | +--------------------------------------------------------------------+ | |
6 | | CiviCRM version 4.3 | | |
7 | +--------------------------------------------------------------------+ | |
8 | | Copyright CiviCRM LLC (c) 2004-2013 | | |
9 | +--------------------------------------------------------------------+ | |
10 | | This file is a part of CiviCRM. | | |
11 | | | | |
12 | | CiviCRM is free software; you can copy, modify, and distribute it | | |
13 | | under the terms of the GNU Affero General Public License | | |
14 | | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. | | |
15 | | | | |
16 | | CiviCRM is distributed in the hope that it will be useful, but | | |
17 | | WITHOUT ANY WARRANTY; without even the implied warranty of | | |
18 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | | |
19 | | See the GNU Affero General Public License for more details. | | |
20 | | | | |
21 | | You should have received a copy of the GNU Affero General Public | | |
22 | | License and the CiviCRM Licensing Exception along | | |
23 | | with this program; if not, contact CiviCRM LLC | | |
24 | | at info[AT]civicrm[DOT]org. If you have questions about the | | |
25 | | GNU Affero General Public License or the licensing of CiviCRM, | | |
26 | | see the CiviCRM license FAQ at http://civicrm.org/licensing | | |
27 | +--------------------------------------------------------------------+ | |
28 | */ | |
29 | ||
30 | /** | |
31 | * | |
32 | * @package CRM | |
33 | * @copyright CiviCRM LLC (c) 2004-2013 | |
34 | * $Id$ | |
35 | * | |
36 | */ | |
37 | class CRM_Report_Form_Contribute_OrganizationSummary extends CRM_Report_Form { | |
38 | ||
39 | protected $_addressField = FALSE; | |
40 | ||
41 | protected $_emailField = FALSE; | |
42 | ||
43 | public $_drilldownReport = array('contribute/detail' => 'Link to Detail Report'); | |
44 | ||
88d7961a | 45 | protected $_summary = NULL; |
46 | ||
47 | function __construct() { | |
6a488035 TO |
48 | self::validRelationships(); |
49 | $config = CRM_Core_Config::singleton(); | |
88d7961a | 50 | $campaignEnabled = in_array('CiviCampaign', $config->enableComponents); |
6a488035 TO |
51 | if ($campaignEnabled) { |
52 | $getCampaigns = CRM_Campaign_BAO_Campaign::getPermissionedCampaigns(NULL, NULL, TRUE, FALSE, TRUE); | |
53 | $this->activeCampaigns = $getCampaigns['campaigns']; | |
54 | asort($this->activeCampaigns); | |
55 | } | |
56 | ||
57 | $this->_columns = array( | |
58 | 'civicrm_contact_organization' => | |
59 | array( | |
60 | 'dao' => 'CRM_Contact_DAO_Contact', | |
61 | 'fields' => | |
62 | array( | |
63 | 'organization_name' => | |
64 | array('title' => ts('Organization Name'), | |
65 | 'required' => TRUE, | |
66 | 'no_repeat' => TRUE, | |
67 | ), | |
68 | 'id' => | |
69 | array( | |
70 | 'no_display' => TRUE, | |
71 | 'required' => TRUE, | |
72 | ), | |
73 | ), | |
74 | 'filters' => | |
75 | array( | |
76 | 'organization_name' => | |
77 | array('title' => ts('Organization Name')), | |
78 | ), | |
79 | 'grouping' => 'organization-fields', | |
80 | ), | |
81 | 'civicrm_relationship' => | |
82 | array( | |
83 | 'dao' => 'CRM_Contact_DAO_Relationship', | |
84 | 'fields' => | |
85 | array( | |
86 | 'relationship_type_id' => | |
87 | array('title' => ts('Relationship Type'), | |
88 | ), | |
89 | ), | |
90 | 'filters' => | |
91 | array( | |
92 | 'relationship_type_id' => | |
93 | array( | |
94 | 'title' => ts('Relationship Type'), | |
95 | 'type' => CRM_Utils_Type::T_INT, | |
96 | 'operatorType' => CRM_Report_Form::OP_SELECT, | |
97 | 'options' => $this->relationTypes, | |
98 | 'default' => array(1), | |
99 | ), | |
100 | ), | |
101 | 'grouping' => 'organization-fields', | |
102 | ), | |
103 | 'civicrm_contact' => | |
104 | array( | |
105 | 'dao' => 'CRM_Contact_DAO_Contact', | |
106 | 'fields' => | |
107 | array( | |
108 | 'sort_name' => | |
109 | array('title' => ts('Contact Name'), | |
110 | 'required' => TRUE, | |
111 | ), | |
112 | 'id' => | |
113 | array( | |
114 | 'no_display' => TRUE, | |
115 | 'required' => TRUE, | |
116 | ), | |
117 | ), | |
118 | 'grouping' => 'contact-fields', | |
119 | ), | |
120 | 'civicrm_contribution' => | |
121 | array( | |
122 | 'dao' => 'CRM_Contribute_DAO_Contribution', | |
123 | 'fields' => | |
124 | array('total_amount' => array('title' => ts('Amount'), | |
125 | 'required' => TRUE, | |
126 | ), | |
127 | 'id' => array( | |
128 | 'no_display' => TRUE, | |
129 | 'required' => TRUE, | |
130 | ), | |
131 | 'contribution_status_id' => array( | |
132 | 'title' => 'Contribution Status', | |
133 | 'default' => TRUE, | |
134 | ), | |
88d7961a | 135 | 'currency' => array( |
136 | 'required' => TRUE, | |
137 | 'no_display' => TRUE, | |
138 | ), | |
6a488035 TO |
139 | 'trxn_id' => NULL, |
140 | 'receive_date' => array('default' => TRUE), | |
141 | 'receipt_date' => NULL, | |
142 | ), | |
143 | 'filters' => | |
144 | array( | |
145 | 'receive_date' => | |
146 | array('operatorType' => CRM_Report_Form::OP_DATE), | |
147 | 'total_amount' => | |
148 | array('title' => ts('Amount Between')), | |
88d7961a | 149 | 'currency' => |
150 | array('title' => 'Currency', | |
151 | 'operatorType' => CRM_Report_Form::OP_MULTISELECT, | |
152 | 'options' => CRM_Core_OptionGroup::values('currencies_enabled'), | |
153 | 'type' => CRM_Utils_Type::T_STRING, | |
154 | ), | |
6a488035 TO |
155 | 'contribution_status_id' => |
156 | array('title' => ts('Contribution Status'), | |
157 | 'operatorType' => CRM_Report_Form::OP_MULTISELECT, | |
158 | 'options' => CRM_Contribute_PseudoConstant::contributionStatus(), | |
159 | 'default' => array(1), | |
160 | ), | |
161 | ), | |
162 | 'grouping' => 'contri-fields', | |
163 | ), | |
164 | 'civicrm_address' => | |
165 | array( | |
166 | 'dao' => 'CRM_Core_DAO_Address', | |
167 | 'fields' => | |
168 | array( | |
169 | 'street_address' => NULL, | |
170 | 'city' => NULL, | |
171 | 'postal_code' => NULL, | |
172 | 'state_province_id' => | |
173 | array('title' => ts('State/Province'), | |
174 | ), | |
175 | 'country_id' => | |
176 | array('title' => ts('Country'), | |
177 | ), | |
178 | ), | |
179 | 'grouping' => 'contact-fields', | |
180 | ), | |
181 | 'civicrm_email' => | |
182 | array( | |
183 | 'dao' => 'CRM_Core_DAO_Email', | |
184 | 'fields' => | |
185 | array('email' => NULL), | |
186 | 'grouping' => 'contact-fields', | |
187 | ), | |
188 | ); | |
189 | ||
190 | if ($campaignEnabled && !empty($this->activeCampaigns)) { | |
191 | $this->_columns['civicrm_contribution']['fields']['campaign_id'] = array( | |
192 | 'title' => 'Campaign', | |
193 | 'default' => 'false', | |
194 | ); | |
195 | $this->_columns['civicrm_contribution']['filters']['campaign_id'] = array('title' => ts('Campaign'), | |
196 | 'operatorType' => CRM_Report_Form::OP_MULTISELECT, | |
197 | 'options' => $this->activeCampaigns, | |
198 | ); | |
199 | } | |
88d7961a | 200 | |
201 | $this->_currencyColumn = 'civicrm_contribution_currency'; | |
6a488035 TO |
202 | parent::__construct(); |
203 | } | |
204 | ||
205 | function preProcess() { | |
206 | parent::preProcess(); | |
207 | } | |
208 | ||
209 | function select() { | |
210 | $this->_columnHeaders = $select = array(); | |
211 | foreach ($this->_columns as $tableName => $table) { | |
212 | if (array_key_exists('fields', $table)) { | |
213 | foreach ($table['fields'] as $fieldName => $field) { | |
214 | if (CRM_Utils_Array::value('required', $field) || | |
215 | CRM_Utils_Array::value($fieldName, $this->_params['fields']) | |
216 | ) { | |
217 | if ($tableName == 'civicrm_address') { | |
218 | $this->_addressField = TRUE; | |
219 | } | |
220 | elseif ($tableName == 'civicrm_email') { | |
221 | $this->_emailField = TRUE; | |
222 | } | |
223 | ||
224 | if (CRM_Utils_Array::value('statistics', $field)) { | |
225 | foreach ($field['statistics'] as $stat => $label) { | |
226 | $select[] = "{$field['dbAlias']} as {$tableName}_{$fieldName}_{$stat}"; | |
227 | $this->_columnHeaders["{$tableName}_{$fieldName}_{$stat}"]['title'] = $label; | |
228 | $this->_columnHeaders["{$tableName}_{$fieldName}_{$stat}"]['type'] = $field['type']; | |
229 | $this->_statFields[] = "{$tableName}_{$fieldName}_{$stat}"; | |
230 | } | |
231 | } | |
232 | else { | |
233 | $select[] = "{$table['alias']}.{$fieldName} as {$tableName}_{$fieldName}"; | |
234 | ||
235 | $this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = CRM_Utils_Array::value('title', $field); | |
236 | $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = CRM_Utils_Array::value('type', $field); | |
237 | } | |
238 | } | |
239 | } | |
240 | } | |
241 | } | |
242 | $this->_select = "SELECT " . implode(', ', $select) . " "; | |
243 | } | |
244 | ||
245 | function from() { | |
246 | ||
247 | $this->_from = NULL; | |
248 | $this->_from = " | |
249 | FROM civicrm_relationship {$this->_aliases['civicrm_relationship']} | |
250 | LEFT JOIN civicrm_contact {$this->_aliases['civicrm_contact_organization']} ON | |
251 | ({$this->_aliases['civicrm_contact_organization']}.id = {$this->_aliases['civicrm_relationship']}.$this->orgContact AND {$this->_aliases['civicrm_contact_organization']}.contact_type='Organization') | |
252 | LEFT JOIN civicrm_contact {$this->_aliases['civicrm_contact']} ON | |
253 | ({$this->_aliases['civicrm_contact']}.id = {$this->_aliases['civicrm_relationship']}.$this->otherContact ) | |
254 | {$this->_aclFrom} | |
255 | INNER JOIN civicrm_contribution {$this->_aliases['civicrm_contribution']} ON | |
256 | ({$this->_aliases['civicrm_contribution']}.contact_id = {$this->_aliases['civicrm_relationship']}.$this->otherContact ) AND {$this->_aliases['civicrm_contribution']}.is_test = 0 "; | |
257 | ||
258 | if ($this->_addressField) { | |
259 | $this->_from .= " | |
260 | LEFT JOIN civicrm_address {$this->_aliases['civicrm_address']} ON | |
261 | {$this->_aliases['civicrm_contact']}.id = {$this->_aliases['civicrm_address']}.contact_id AND | |
262 | {$this->_aliases['civicrm_address']}.is_primary = 1\n "; | |
263 | } | |
264 | if ($this->_emailField) { | |
265 | $this->_from .= " | |
266 | LEFT JOIN civicrm_email {$this->_aliases['civicrm_email']} ON | |
267 | {$this->_aliases['civicrm_contact']}.id = {$this->_aliases['civicrm_email']}.contact_id AND | |
268 | {$this->_aliases['civicrm_email']}.is_primary = 1\n "; | |
269 | } | |
270 | } | |
271 | ||
272 | function where() { | |
273 | $clauses = array(); | |
274 | foreach ($this->_columns as $tableName => $table) { | |
275 | if (array_key_exists('filters', $table)) { | |
276 | foreach ($table['filters'] as $fieldName => $field) { | |
277 | $clause = NULL; | |
278 | if (CRM_Utils_Array::value('type', $field) & CRM_Utils_Type::T_DATE) { | |
279 | $relative = CRM_Utils_Array::value("{$fieldName}_relative", $this->_params); | |
280 | $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params); | |
281 | $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params); | |
282 | ||
283 | $clause = $this->dateClause($field['name'], $relative, $from, $to, $field['type']); | |
284 | } | |
285 | else { | |
286 | $op = CRM_Utils_Array::value("{$fieldName}_op", $this->_params); | |
287 | if ($op) { | |
288 | if ($fieldName == 'relationship_type_id') { | |
289 | $clause = "{$this->_aliases['civicrm_relationship']}.relationship_type_id=" . $this->relationshipId; | |
290 | } | |
291 | else { | |
292 | $clause = $this->whereClause($field, | |
293 | $op, | |
294 | CRM_Utils_Array::value("{$fieldName}_value", $this->_params), | |
295 | CRM_Utils_Array::value("{$fieldName}_min", $this->_params), | |
296 | CRM_Utils_Array::value("{$fieldName}_max", $this->_params) | |
297 | ); | |
298 | } | |
299 | } | |
300 | } | |
301 | ||
302 | if (!empty($clause)) { | |
303 | $clauses[] = $clause; | |
304 | } | |
305 | } | |
306 | } | |
307 | } | |
308 | ||
309 | if (empty($clauses)) { | |
310 | $this->_where = "WHERE ( 1 )"; | |
311 | } | |
312 | else { | |
313 | $this->_where = "WHERE " . implode(' AND ', $clauses); | |
314 | } | |
315 | ||
316 | if ($this->_aclWhere) { | |
317 | $this->_where .= " AND {$this->_aclWhere} "; | |
318 | } | |
319 | } | |
320 | ||
321 | function groupBy() { | |
322 | $this->_groupBy = " GROUP BY {$this->_aliases['civicrm_relationship']}.$this->orgContact, {$this->_aliases['civicrm_relationship']}.$this->otherContact , {$this->_aliases['civicrm_contribution']}.id, {$this->_aliases['civicrm_relationship']}.relationship_type_id "; | |
323 | } | |
324 | ||
325 | function orderBy() { | |
326 | $this->_orderBy = " ORDER BY {$this->_aliases['civicrm_contact_organization']}.organization_name, {$this->_aliases['civicrm_relationship']}.$this->orgContact, {$this->_aliases['civicrm_contact']}.sort_name, {$this->_aliases['civicrm_relationship']}.$this->otherContact"; | |
327 | } | |
328 | ||
329 | function statistics(&$rows) { | |
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) { | |
335 | if ($value['title'] == 'Relationship Type') { | |
336 | $statistics['filters'][$id]['value'] = 'Is equal to ' . $this->relationTypes[$this->relationshipId . '_' . $type]; | |
337 | } | |
338 | } | |
339 | return $statistics; | |
340 | } | |
341 | ||
342 | function postProcess() { | |
343 | ||
344 | $this->beginPostProcess(); | |
345 | $getRelationship = $this->_params['relationship_type_id_value']; | |
346 | $type = substr($getRelationship, -3); | |
347 | $this->relationshipId = intval((substr($getRelationship, 0, strpos($getRelationship, '_')))); | |
348 | if ($type == 'b_a') { | |
349 | $this->orgContact = 'contact_id_b'; | |
350 | $this->otherContact = 'contact_id_a'; | |
351 | } | |
352 | else { | |
353 | $this->orgContact = 'contact_id_a'; | |
354 | $this->otherContact = 'contact_id_b'; | |
355 | } | |
356 | ||
357 | $this->buildACLClause(array($this->_aliases['civicrm_contact'], $this->_aliases['civicrm_contact_organization'])); | |
358 | $sql = $this->buildQuery(TRUE); | |
359 | $rows = array(); | |
360 | ||
361 | $this->buildRows($sql, $rows); | |
362 | $this->formatDisplay($rows); | |
363 | $this->doTemplateAssignment($rows); | |
364 | $this->endPostProcess($rows); | |
365 | } | |
366 | ||
367 | function validRelationships() { | |
368 | $this->relationTypes = $relationTypes = array(); | |
369 | ||
370 | $params = array('contact_type_b' => 'Organization', 'version' => 3); | |
371 | $typesA = &civicrm_api('relationship_type', 'get', $params); | |
372 | ||
373 | if (!CRM_Utils_Array::value('is_error', $typesA)) { | |
374 | foreach ($typesA['values'] as $rel) { | |
375 | $relationTypes[$rel['id']][$rel['id'] . '_b_a'] = $rel['label_b_a']; | |
376 | } | |
377 | } | |
378 | ||
379 | $params = array('contact_type_a' => 'Organization', 'version' => 3); | |
380 | $typesB = &civicrm_api('relationship_type', 'get', $params); | |
381 | ||
382 | if (!CRM_Utils_Array::value('is_error', $typesB)) { | |
383 | foreach ($typesB['values'] as $rel) { | |
384 | $relationTypes[$rel['id']][$rel['id'] . '_a_b'] = $rel['label_a_b']; | |
385 | } | |
386 | } | |
387 | ||
388 | ksort($relationTypes); | |
389 | foreach ($relationTypes as $relationship) { | |
390 | foreach ($relationship as $index => $label) { | |
391 | $this->relationTypes[$index] = $label; | |
392 | } | |
393 | } | |
394 | } | |
395 | ||
396 | function alterDisplay(&$rows) { | |
397 | // custom code to alter rows | |
398 | $type = substr($this->_params['relationship_type_id_value'], -3); | |
399 | ||
400 | $entryFound = FALSE; | |
401 | $flagOrganization = $flagContact = 0; | |
402 | ||
403 | foreach ($rows as $rowNum => $row) { | |
404 | ||
405 | //replace retionship id by relationship name | |
406 | if (array_key_exists('civicrm_relationship_relationship_type_id', $row)) { | |
407 | if ($value = $row['civicrm_relationship_relationship_type_id']) { | |
408 | $rows[$rowNum]['civicrm_relationship_relationship_type_id'] = $this->relationTypes[$value . '_' . $type]; | |
409 | $entryFound = TRUE; | |
410 | } | |
411 | } | |
412 | ||
413 | //remove duplicate Organization names | |
414 | if (array_key_exists('civicrm_contact_organization_id', $row) && $this->_outputMode != 'csv') { | |
415 | if ($value = $row['civicrm_contact_organization_id']) { | |
416 | if ($rowNum == 0) { | |
417 | $previousOrganization = $value; | |
418 | } | |
419 | else { | |
420 | if ($previousOrganization == $value) { | |
421 | $flagOrganization = 1; | |
422 | $previousOrganization = $value; | |
423 | } | |
424 | else { | |
425 | $flagOrganization = 0; | |
426 | $previousOrganization = $value; | |
427 | } | |
428 | } | |
429 | ||
430 | if ($flagOrganization == 1) { | |
431 | foreach ($row as $colName => $colVal) { | |
432 | if (in_array($colName, $this->_noRepeats)) { | |
433 | unset($rows[$rowNum][$colName]); | |
434 | } | |
435 | } | |
436 | } | |
437 | $entryFound = TRUE; | |
438 | } | |
439 | } | |
440 | ||
441 | // convert Organization display name to links | |
442 | if (array_key_exists('civicrm_contact_organization_organization_name', $row) && | |
443 | CRM_Utils_Array::value('civicrm_contact_organization_organization_name', | |
444 | $rows[$rowNum] | |
445 | ) && | |
446 | array_key_exists('civicrm_contact_organization_id', $row) | |
447 | ) { | |
88d7961a | 448 | $url = CRM_Utils_System::url('civicrm/contact/view', |
6a488035 TO |
449 | 'reset=1&cid=' . |
450 | $rows[$rowNum]['civicrm_contact_organization_id'], | |
451 | $this->_absoluteUrl | |
452 | ); | |
453 | ||
454 | $rows[$rowNum]['civicrm_contact_organization_organization_name_link'] = $url; | |
88d7961a | 455 | $rows[$rowNum]['civicrm_contact_organization_organization_name_hover'] = ts('View contact summary for this organization.'); |
6a488035 TO |
456 | } |
457 | ||
458 | //remove duplicate Contact names and relationship type | |
459 | if (array_key_exists('civicrm_contact_id', $row) && $this->_outputMode != 'csv') { | |
460 | if ($value = $row['civicrm_contact_id']) { | |
461 | if ($rowNum == 0) { | |
462 | $previousContact = $value; | |
463 | } | |
464 | else { | |
465 | if ($previousContact == $value) { | |
466 | $flagContact = 1; | |
467 | $previousContact = $value; | |
468 | } | |
469 | else { | |
470 | $flagContact = 0; | |
471 | $previousContact = $value; | |
472 | } | |
473 | } | |
474 | ||
475 | if ($flagContact == 1 && $flagOrganization == 1) { | |
476 | $rows[$rowNum]['civicrm_contact_sort_name'] = ""; | |
477 | $rows[$rowNum]['civicrm_relationship_relationship_type_id'] = ""; | |
478 | } | |
479 | ||
480 | $entryFound = TRUE; | |
481 | } | |
482 | } | |
483 | ||
484 | if (array_key_exists('civicrm_contribution_contribution_status_id', $row)) { | |
485 | if ($value = $row['civicrm_contribution_contribution_status_id']) { | |
486 | $rows[$rowNum]['civicrm_contribution_contribution_status_id'] = CRM_Contribute_PseudoConstant::contributionStatus($value); | |
487 | } | |
488 | } | |
489 | ||
490 | // handle state province | |
491 | if (array_key_exists('civicrm_address_state_province_id', $row)) { | |
492 | if ($value = $row['civicrm_address_state_province_id']) { | |
493 | $rows[$rowNum]['civicrm_address_state_province_id'] = CRM_Core_PseudoConstant::stateProvinceAbbreviation($value, FALSE); | |
494 | } | |
495 | $entryFound = TRUE; | |
496 | } | |
497 | ||
498 | // handle country | |
499 | if (array_key_exists('civicrm_address_country_id', $row)) { | |
500 | if ($value = $row['civicrm_address_country_id']) { | |
501 | $rows[$rowNum]['civicrm_address_country_id'] = CRM_Core_PseudoConstant::country($value, FALSE); | |
502 | } | |
503 | $entryFound = TRUE; | |
504 | } | |
505 | ||
506 | // convert Individual display name to links | |
507 | if (array_key_exists('civicrm_contact_sort_name', $row) && | |
508 | $rows[$rowNum]['civicrm_contact_sort_name'] && | |
509 | array_key_exists('civicrm_contact_id', $row) | |
510 | ) { | |
511 | $url = CRM_Report_Utils_Report::getNextUrl('contribute/detail', | |
512 | 'reset=1&force=1&id_op=eq&id_value=' . | |
513 | $row['civicrm_contact_id'], | |
514 | $this->_absoluteUrl, $this->_id, $this->_drilldownReport | |
515 | ); | |
516 | $rows[$rowNum]['civicrm_contact_sort_name_link'] = $url; | |
517 | $rows[$rowNum]['civicrm_contact_sort_name_hover'] = ts('View contribution details for this individual'); | |
518 | ||
519 | $entryFound = TRUE; | |
520 | } | |
521 | ||
522 | // Contribution amount links to view contribution | |
523 | if (($value = CRM_Utils_Array::value('civicrm_contribution_total_amount', $row)) && | |
524 | CRM_Core_Permission::check('access CiviContribute') | |
525 | ) { | |
88d7961a | 526 | $url = CRM_Utils_System::url('civicrm/contact/view/contribution', |
6a488035 TO |
527 | "reset=1&id=" . $row['civicrm_contribution_id'] . "&cid=" . $row['civicrm_contact_id'] . "&action=view&context=contribution&selectedChild=contribute", |
528 | $this->_absoluteUrl | |
529 | ); | |
530 | $rows[$rowNum]['civicrm_contribution_total_amount_link'] = $url; | |
88d7961a | 531 | $rows[$rowNum]['civicrm_contribution_total_amount_hover'] = ts('View this contribution.'); |
6a488035 TO |
532 | $entryFound = TRUE; |
533 | } | |
534 | ||
535 | // convert campaign_id to campaign title | |
536 | if (array_key_exists('civicrm_contribution_campaign_id', $row)) { | |
537 | if ($value = $row['civicrm_contribution_campaign_id']) { | |
538 | $rows[$rowNum]['civicrm_contribution_campaign_id'] = $this->activeCampaigns[$value]; | |
539 | $entryFound = TRUE; | |
540 | } | |
541 | } | |
542 | ||
543 | // skip looking further in rows, if first row itself doesn't | |
544 | if (!$entryFound) { | |
545 | break; | |
546 | } | |
547 | $lastKey = $rowNum; | |
548 | } | |
549 | } | |
550 | } | |
551 |