5 +--------------------------------------------------------------------+
6 | CiviCRM version 4.3 |
7 +--------------------------------------------------------------------+
8 | Copyright CiviCRM LLC (c) 2004-2013 |
9 +--------------------------------------------------------------------+
10 | This file is a part of CiviCRM. |
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. |
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. |
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 +--------------------------------------------------------------------+
33 * @copyright CiviCRM LLC (c) 2004-2013
37 class CRM_Report_Form_Contact_Detail
extends CRM_Report_Form
{
38 CONST ROW_COUNT_LIMIT
= 10;
40 protected $_summary = NULL;
42 protected $_customGroupExtends = array(
43 'Contact', 'Individual', 'Household', 'Organization');
45 function __construct() {
46 $this->_autoIncludeIndexedFieldsAsOrderBys
= 1;
47 $this->_columns
= array(
50 'dao' => 'CRM_Contact_DAO_Contact',
54 array('title' => ts('Contact Name'),
58 'first_name' => array('title' => ts('First Name'),
60 'last_name' => array('title' => ts('Last Name'),
71 array('title' => ts('Contact ID'),
75 array('title' => ts('Contact Name'),
78 'grouping' => 'contact-fields',
82 array('title' => ts('Last Name, First Name'), 'default' => '1', 'default_weight' => '0', 'default_order' => 'ASC'),
87 'dao' => 'CRM_Core_DAO_Address',
88 'grouping' => 'contact-fields',
91 'street_address' => NULL,
93 'postal_code' => NULL,
94 'state_province_id' =>
95 array('title' => ts('State/Province'),
99 array('state_province_id' => array('title' => 'State/Province'),
100 'city' => array('title' => 'City'),
101 'postal_code' => array('title' => 'Postal Code'),
106 'dao' => 'CRM_Core_DAO_Country',
110 array('title' => 'Country', 'default' => TRUE),
115 array('title' => 'Country'),
117 'grouping' => 'contact-fields',
121 'dao' => 'CRM_Core_DAO_Email',
125 array('title' => ts('Email'),
129 'grouping' => 'contact-fields',
133 array('title' => ts('Email'),
137 'civicrm_contribution' =>
139 'dao' => 'CRM_Contribute_DAO_Contribution',
144 'no_display' => TRUE,
148 array('title' => ts('Contribution'),
152 'total_amount' => array('default' => TRUE),
153 'financial_type_id' => array('title' => ts('Financial Type'),
157 'receive_date' => array('default' => TRUE),
158 'receipt_date' => NULL,
159 'contribution_status_id' => array('title' => ts('Contribution Status'),
162 'contribution_source' => NULL,
165 'civicrm_membership' =>
167 'dao' => 'CRM_Member_DAO_Membership',
172 'no_display' => TRUE,
176 array('title' => ts('Membership'),
180 'membership_type_id' => array('title' => ts('Membership Type'),
184 'membership_start_date' => array('title' => ts('Start Date'),
187 'membership_end_date' => array('title' => ts('End Date'),
190 'membership_status_id' => array(
191 'name' => 'status_id',
192 'title' => ts('Membership Status'),
195 'source' => array('title' => 'Membership Source'),
198 'civicrm_participant' =>
200 'dao' => 'CRM_Event_DAO_Participant',
205 'no_display' => TRUE,
209 array('title' => ts('Participant'),
213 'event_id' => array('default' => TRUE),
214 'participant_status_id' => array(
215 'name' => 'status_id',
216 'title' => ts('Participant Status'),
219 'role_id' => array('title' => ts('Role'),
222 'participant_register_date' => array('title' => ts('Register Date'),
225 'fee_level' => array('title' => ts('Fee Level'),
228 'fee_amount' => array('title' => ts('Fee Amount'),
233 'civicrm_relationship' =>
235 'dao' => 'CRM_Contact_DAO_Relationship',
241 'title' => ts('Relationship'),
245 'relationship_type_id' =>
246 array('title' => ts('Relationship Type'),
250 array('title' => ts('Relationship With'),
255 'title' => 'Start Date ',
256 'type' => CRM_Report_Form
::OP_DATE
,
260 'title' => 'End Date ',
261 'type' => CRM_Report_Form
::OP_DATE
,
265 'civicrm_activity' =>
267 'dao' => 'CRM_Activity_DAO_Activity',
271 array('title' => ts('Activity'),
275 'activity_type_id' =>
276 array('title' => ts('Activity Type'),
280 array('title' => ts('Subject'),
283 'source_contact_id' =>
284 array('title' => ts('Added By'),
287 'activity_date_time' =>
288 array('title' => ts('Activity Date'),
291 'activity_status_id' =>
293 'name' => 'status_id',
294 'title' => ts('Activity Status'),
298 'grouping' => 'activity-fields',
300 'civicrm_activity_target' =>
302 'dao' => 'CRM_Activity_DAO_ActivityTarget',
305 'target_contact_id' =>
306 array('title' => ts('With Contact'),
310 'grouping' => 'activity-fields',
312 'civicrm_activity_assignment' =>
314 'dao' => 'CRM_Activity_DAO_ActivityAssignment',
317 'assignee_contact_id' =>
318 array('title' => ts('Assigned To'),
322 'grouping' => 'activity-fields',
326 'dao' => 'CRM_Contact_DAO_Group',
332 'name' => 'group_id',
333 'title' => ts('Group'),
334 'operatorType' => CRM_Report_Form
::OP_MULTISELECT
,
336 'options' => CRM_Core_PseudoConstant
::group(),
342 'dao' => 'CRM_Core_DAO_Phone',
344 array('phone' => NULL),
345 'grouping' => 'contact-fields',
349 $this->_tagFilter
= TRUE;
350 parent
::__construct();
353 function preProcess() {
354 $this->_csvSupported
= FALSE;
355 parent
::preProcess();
360 $this->_columnHeaders
= array();
361 $this->_component
= array('contribution_civireport', 'membership_civireport', 'participant_civireport', 'relationship_civireport', 'activity_civireport');
362 foreach ($this->_columns
as $tableName => $table) {
363 if (array_key_exists('fields', $table)) {
364 foreach ($table['fields'] as $fieldName => $field) {
365 if (CRM_Utils_Array
::value('required', $field) ||
366 CRM_Utils_Array
::value($fieldName, $this->_params
['fields'])
368 //isolate the select clause compoenent wise
369 if (in_array($table['alias'], $this->_component
)) {
370 $select[$table['alias']][] = "{$field['dbAlias']} as {$tableName}_{$fieldName}";
371 $this->_columnHeadersComponent
[$table['alias']]["{$tableName}_{$fieldName}"]['type'] = CRM_Utils_Array
::value('type', $field);
372 $this->_columnHeadersComponent
[$table['alias']]["{$tableName}_{$fieldName}"]['title'] = CRM_Utils_Array
::value('title', $field);
374 elseif ($table['alias'] == $this->_aliases
['civicrm_activity_target'] ||
375 $table['alias'] == $this->_aliases
['civicrm_activity_assignment']
377 if ($table['alias'] == $this->_aliases
['civicrm_activity_target']) {
378 $addCotactId = 'target_contact_id';
381 $addCotactId = 'assignee_contact_id';
383 $tableName = $table['alias'];
384 $select['activity_civireport'][] = "$tableName.display_name as {$tableName}_{$fieldName}, $addCotactId ";
385 $this->_columnHeadersComponent
['activity_civireport']["{$tableName}_{$fieldName}"]['type'] = CRM_Utils_Array
::value('type', $field);
386 $this->_columnHeadersComponent
['activity_civireport']["{$tableName}_{$fieldName}"]['title'] = CRM_Utils_Array
::value('title', $field);
389 $select[] = "{$field['dbAlias']} as {$tableName}_{$fieldName}";
390 $this->_columnHeaders
["{$tableName}_{$fieldName}"]['type'] = CRM_Utils_Array
::value('type', $field);
391 $this->_columnHeaders
["{$tableName}_{$fieldName}"]['title'] = $field['title'];
398 foreach ($this->_component
as $val) {
399 if (CRM_Utils_Array
::value($val, $select)) {
400 $this->_selectComponent
[$val] = "SELECT " . implode(', ', $select[$val]) . " ";
401 unset($select[$val]);
405 $this->_select
= "SELECT " . implode(', ', $select) . " ";
408 static function formRule($fields, $files, $self) {
416 FROM civicrm_contact {$this->_aliases['civicrm_contact']} {$this->_aclFrom}";
418 if ($this->isTableSelected('civicrm_country') ||
$this->isTableSelected('civicrm_address')) {
420 LEFT JOIN civicrm_address {$this->_aliases['civicrm_address']}
421 ON ({$this->_aliases['civicrm_contact']}.id = {$this->_aliases['civicrm_address']}.contact_id AND
422 {$this->_aliases['civicrm_address']}.is_primary = 1 ) ";
425 if ($this->isTableSelected('civicrm_email')) {
427 LEFT JOIN civicrm_email {$this->_aliases['civicrm_email']}
428 ON ({$this->_aliases['civicrm_contact']}.id = {$this->_aliases['civicrm_email']}.contact_id AND
429 {$this->_aliases['civicrm_email']}.is_primary = 1) ";
432 if ($this->isTableSelected('civicrm_phone')) {
434 LEFT JOIN civicrm_phone {$this->_aliases['civicrm_phone']}
435 ON {$this->_aliases['civicrm_contact']}.id = {$this->_aliases['civicrm_phone']}.contact_id AND
436 {$this->_aliases['civicrm_phone']}.is_primary = 1 ";
439 if ($this->isTableSelected('civicrm_country')) {
441 LEFT JOIN civicrm_country {$this->_aliases['civicrm_country']}
442 ON {$this->_aliases['civicrm_address']}.country_id = {$this->_aliases['civicrm_country']}.id AND
443 {$this->_aliases['civicrm_address']}.is_primary = 1 ";
446 $this->_from
.= "{$group}";
448 foreach ($this->_component
as $val) {
449 if (CRM_Utils_Array
::value('contribution_civireport', $this->_selectComponent
)) {
450 $this->_formComponent
['contribution_civireport'] = " FROM
451 civicrm_contact {$this->_aliases['civicrm_contact']}
452 INNER JOIN civicrm_contribution {$this->_aliases['civicrm_contribution']}
453 ON {$this->_aliases['civicrm_contact']}.id = {$this->_aliases['civicrm_contribution']}.contact_id
457 if (CRM_Utils_Array
::value('membership_civireport', $this->_selectComponent
)) {
458 $this->_formComponent
['membership_civireport'] = " FROM
459 civicrm_contact {$this->_aliases['civicrm_contact']}
460 INNER JOIN civicrm_membership {$this->_aliases['civicrm_membership']}
461 ON {$this->_aliases['civicrm_contact']}.id = {$this->_aliases['civicrm_membership']}.contact_id
464 if (CRM_Utils_Array
::value('participant_civireport', $this->_selectComponent
)) {
465 $this->_formComponent
['participant_civireport'] = " FROM
466 civicrm_contact {$this->_aliases['civicrm_contact']}
467 INNER JOIN civicrm_participant {$this->_aliases['civicrm_participant']}
468 ON {$this->_aliases['civicrm_contact']}.id = {$this->_aliases['civicrm_participant']}.contact_id
472 if (CRM_Utils_Array
::value('activity_civireport', $this->_selectComponent
)) {
473 $this->_formComponent
['activity_civireport'] = "FROM
474 civicrm_activity {$this->_aliases['civicrm_activity']}
475 LEFT JOIN civicrm_activity_target ON
476 {$this->_aliases['civicrm_activity']}.id = civicrm_activity_target.activity_id
477 LEFT JOIN civicrm_activity_assignment ON
478 {$this->_aliases['civicrm_activity']}.id = civicrm_activity_assignment.activity_id
479 LEFT JOIN civicrm_contact sourceContact ON
480 {$this->_aliases['civicrm_activity']}.source_contact_id = sourceContact.id
481 LEFT JOIN civicrm_contact {$this->_aliases['civicrm_activity_target']} ON
482 target_contact_id = {$this->_aliases['civicrm_activity_target']}.id
484 LEFT JOIN civicrm_contact {$this->_aliases['civicrm_activity_assignment']} ON
485 assignee_contact_id = {$this->_aliases['civicrm_activity_assignment']}.id
486 LEFT JOIN civicrm_option_value ON
487 ( {$this->_aliases['civicrm_activity']}.activity_type_id = civicrm_option_value.value )
488 LEFT JOIN civicrm_option_group ON
489 civicrm_option_group.id = civicrm_option_value.option_group_id
490 LEFT JOIN civicrm_case_activity ON
491 civicrm_case_activity.activity_id = {$this->_aliases['civicrm_activity']}.id
492 LEFT JOIN civicrm_case ON
493 civicrm_case_activity.case_id = civicrm_case.id
494 LEFT JOIN civicrm_case_contact ON
495 civicrm_case_contact.case_id = civicrm_case.id ";
498 if (CRM_Utils_Array
::value('relationship_civireport', $this->_selectComponent
)) {
499 $this->_formComponent
['relationship_civireport'] = "FROM
500 civicrm_relationship {$this->_aliases['civicrm_relationship']}
502 LEFT JOIN civicrm_contact {$this->_aliases['civicrm_contact']} ON
503 {$this->_aliases['civicrm_contact']}.id = {$this->_aliases['civicrm_relationship']}.contact_id_b
504 LEFT JOIN civicrm_contact contact_a ON
505 contact_a.id = {$this->_aliases['civicrm_relationship']}.contact_id_a ";
513 foreach ($this->_columns
as $tableName => $table) {
514 if (array_key_exists('filters', $table)) {
515 foreach ($table['filters'] as $fieldName => $field) {
517 $op = CRM_Utils_Array
::value("{$fieldName}_op", $this->_params
);
519 $clause = $this->whereClause($field,
521 CRM_Utils_Array
::value("{$fieldName}_value", $this->_params
),
522 CRM_Utils_Array
::value("{$fieldName}_min", $this->_params
),
523 CRM_Utils_Array
::value("{$fieldName}_max", $this->_params
)
526 if (!empty($clause)) {
527 $clauses[] = $clause;
533 if (empty($clauses)) {
534 $this->_where
= "WHERE ( 1 ) ";
537 $this->_where
= "WHERE " . implode(' AND ', $clauses);
540 if ($this->_aclWhere
) {
541 $this->_where
.= " AND {$this->_aclWhere} ";
544 $this->_where
.= " GROUP BY {$this->_aliases['civicrm_contact']}.id ";
547 function clauseComponent() {
548 $selectedContacts = implode(',', $this->_contactSelected
);
549 $contribution = $membership = $participant = NULL;
550 $eligibleResult = $rows = $tempArray = array();
551 foreach ($this->_component
as $val) {
552 if (CRM_Utils_Array
::value($val, $this->_selectComponent
) && ($val != 'activity_civireport' && $val != 'relationship_civireport')) {
553 $sql = "{$this->_selectComponent[$val]} {$this->_formComponent[$val]}
554 WHERE {$this->_aliases['civicrm_contact']}.id IN ( $selectedContacts )
555 GROUP BY {$this->_aliases['civicrm_contact']}.id,{$val}.id ";
557 $dao = CRM_Core_DAO
::executeQuery($sql);
558 while ($dao->fetch()) {
560 $eligibleResult[$val] = $val;
561 $CC = "civicrm_" . substr_replace($val, '', -11, 11) . "_contact_id";
563 foreach ($this->_columnHeadersComponent
[$val] as $key => $value) {
565 $row[$key] = $dao->$key;
568 //if record exist for component(except contact_id)
569 //since contact_id is selected for every component
570 if ($countRecord > 1) {
571 $rows[$dao->$CC][$val][] = $row;
573 $tempArray[$dao->$CC] = $dao->$CC;
578 if (CRM_Utils_Array
::value('relationship_civireport', $this->_selectComponent
)) {
580 $relTypes = CRM_Contact_BAO_Relationship
::getContactRelationshipType(NULL, 'null', NULL, NULL, TRUE);
582 $val = 'relationship_civireport';
583 $eligibleResult[$val] = $val;
584 $sql = "{$this->_selectComponent[$val]},{$this->_aliases['civicrm_contact']}.display_name as contact_b_name, contact_a.id as contact_a_id , contact_a.display_name as contact_a_name {$this->_formComponent[$val]}
585 WHERE ({$this->_aliases['civicrm_contact']}.id IN ( $selectedContacts )
587 contact_a.id IN ( $selectedContacts ) ) AND
588 {$this->_aliases['civicrm_relationship']}.is_active = 1 AND
589 contact_a.is_deleted = 0 AND
590 {$this->_aliases['civicrm_contact']}.is_deleted = 0
591 GROUP BY {$this->_aliases['civicrm_relationship']}.id";
593 $dao = CRM_Core_DAO
::executeQuery($sql);
594 while ($dao->fetch()) {
595 foreach ($this->_columnHeadersComponent
[$val] as $key => $value) {
596 if ($key == 'civicrm_relationship_contact_id_b') {
597 $row[$key] = $dao->contact_b_name
;
601 $row[$key] = $dao->$key;
604 $relTitle = "" . $dao->civicrm_relationship_relationship_type_id
. "_a_b";
605 $row['civicrm_relationship_relationship_type_id'] = $relTypes[$relTitle];
607 $rows[$dao->contact_a_id
][$val][] = $row;
609 $row['civicrm_relationship_contact_id_b'] = $dao->contact_a_name
;
610 $relTitle = "" . $dao->civicrm_relationship_relationship_type_id
. "_b_a";
611 if (isset($relTypes[$relTitle])) {
612 $row['civicrm_relationship_relationship_type_id'] = $relTypes[$relTitle];
614 $rows[$dao->civicrm_relationship_contact_id_b
][$val][] = $row;
618 if (CRM_Utils_Array
::value('activity_civireport', $this->_selectComponent
)) {
620 $componentClause = "civicrm_option_value.component_id IS NULL";
621 $componentsIn = NULL;
622 $compInfo = CRM_Core_Component
::getEnabledComponents();
623 foreach ($compInfo as $compObj) {
624 if ($compObj->info
['showActivitiesInCore']) {
625 $componentsIn = $componentsIn ?
($componentsIn . ', ' . $compObj->componentID
) : $compObj->componentID
;
629 $componentClause = "( $componentClause OR
630 civicrm_option_value.component_id IN ($componentsIn) )";
633 $val = 'activity_civireport';
634 $eligibleResult[$val] = $val;
635 $sql = "{$this->_selectComponent[$val]} ,
636 sourceContact.display_name as added_by {$this->_formComponent[$val]}
638 WHERE ( {$this->_aliases['civicrm_activity']}.source_contact_id IN ($selectedContacts) OR
639 target_contact_id IN ($selectedContacts) OR
640 assignee_contact_id IN ($selectedContacts) OR
641 civicrm_case_contact.contact_id IN ($selectedContacts) ) AND
642 civicrm_option_group.name = 'activity_type' AND
643 {$this->_aliases['civicrm_activity']}.is_test = 0 AND
646 GROUP BY {$this->_aliases['civicrm_activity']}.id
648 ORDER BY {$this->_aliases['civicrm_activity']}.activity_date_time desc ";
650 $dao = CRM_Core_DAO
::executeQuery($sql);
651 while ($dao->fetch()) {
652 foreach ($this->_columnHeadersComponent
[$val] as $key => $value) {
653 if ($key == 'civicrm_activity_source_contact_id') {
654 $row[$key] = $dao->added_by
;
657 $row[$key] = $dao->$key;
660 if (isset($dao->civicrm_activity_source_contact_id
)) {
661 $rows[$dao->civicrm_activity_source_contact_id
][$val][] = $row;
663 if (isset($dao->target_contact_id
)) {
664 $rows[$dao->target_contact_id
][$val][] = $row;
666 if (isset($dao->assignee_contact_id
)) {
667 $rows[$dao->assignee_contact_id
][$val][] = $row;
671 //unset the component header if data is not present
672 foreach ($this->_component
as $val) {
673 if (!in_array($val, $eligibleResult)) {
675 unset($this->_columnHeadersComponent
[$val]);
683 function statistics(&$rows) {
684 $statistics = array();
686 $count = count($rows);
687 if ($this->_rollup
&& ($this->_rollup
!= '')) {
691 $this->countStat($statistics, $count);
692 $this->filterStat($statistics);
697 //Override to set limit is 10
698 function limit($rowCount = self
::ROW_COUNT_LIMIT
) {
699 parent
::limit($rowCount);
702 //Override to set pager with limit is 10
703 function setPager($rowCount = self
::ROW_COUNT_LIMIT
) {
704 parent
::setPager($rowCount);
707 function postProcess() {
709 $this->beginPostProcess();
711 // get the acl clauses built before we assemble the query
712 $this->buildACLClause($this->_aliases
['civicrm_contact']);
714 $sql = $this->buildQuery(TRUE);
716 $rows = $graphRows = $this->_contactSelected
= array();
717 $this->buildRows($sql, $rows);
718 foreach ($rows as $key => $val) {
719 $rows[$key]['contactID'] = $val['civicrm_contact_id'];
720 $this->_contactSelected
[] = $val['civicrm_contact_id'];
723 $this->formatDisplay($rows);
725 if (!empty($this->_contactSelected
)) {
726 $componentRows = $this->clauseComponent();
727 $this->alterComponentDisplay($componentRows);
729 //unset Conmponent id and contact id from display
730 foreach ($this->_columnHeadersComponent
as $componentTitle => $headers) {
731 $id_header = "civicrm_" . substr_replace($componentTitle, '', -11, 11) . "_" . substr_replace($componentTitle, '', -11, 11) . "_id";
732 $contact_header = "civicrm_" . substr_replace($componentTitle, '', -11, 11) . "_contact_id";
733 if ($componentTitle == 'activity_civireport') {
734 $id_header = "civicrm_" . substr_replace($componentTitle, '', -11, 11) . "_id";
737 unset($this->_columnHeadersComponent
[$componentTitle][$id_header]);
738 unset($this->_columnHeadersComponent
[$componentTitle][$contact_header]);
741 $this->assign_by_ref('columnHeadersComponent', $this->_columnHeadersComponent
);
742 $this->assign_by_ref('componentRows', $componentRows);
745 $this->doTemplateAssignment($rows);
746 $this->endPostProcess();
749 function alterDisplay(&$rows) {
750 // custom code to alter rows
754 foreach ($rows as $rowNum => $row) {
755 // make count columns point to detail report
757 // change contact name with link
758 if (array_key_exists('civicrm_contact_sort_name', $row) &&
759 array_key_exists('civicrm_contact_id', $row)
762 $url = CRM_Utils_System
::url("civicrm/contact/view",
763 'reset=1&cid=' . $row['civicrm_contact_id'],
766 $rows[$rowNum]['civicrm_contact_sort_name_link'] = $url;
767 $rows[$rowNum]['civicrm_contact_sort_name_hover'] = ts("View Contact Summary for this Contact");
771 if (array_key_exists('civicrm_address_state_province_id', $row)) {
772 if ($value = $row['civicrm_address_state_province_id']) {
773 $rows[$rowNum]['civicrm_address_state_province_id'] = CRM_Core_PseudoConstant
::stateProvince($value, FALSE);
779 // skip looking further in rows, if first row itself doesn't
780 // have the column we need
787 function alterComponentDisplay(&$componentRows) {
788 // custom code to alter rows
789 $activityTypes = CRM_Core_PseudoConstant
::activityType(TRUE, TRUE, FALSE, 'label', TRUE);
790 $activityStatus = CRM_Core_PseudoConstant
::activityStatus();
793 foreach ($componentRows as $contactID => $components) {
794 foreach ($components as $component => $rows) {
795 foreach ($rows as $rowNum => $row) {
796 // handle contribution
797 if ($component == 'contribution_civireport') {
798 if ($val = CRM_Utils_Array
::value('civicrm_contribution_financial_type_id', $row)) {
799 $componentRows[$contactID][$component][$rowNum]['civicrm_contribution_financial_type_id'] =
800 CRM_Contribute_PseudoConstant
::financialType($val, false);
803 if ($val = CRM_Utils_Array
::value('civicrm_contribution_contribution_status_id', $row)) {
804 $componentRows[$contactID][$component][$rowNum]['civicrm_contribution_contribution_status_id'] = CRM_Contribute_PseudoConstant
::contributionStatus($val);
809 if ($component == 'membership_civireport') {
810 if ($val = CRM_Utils_Array
::value('civicrm_membership_membership_type_id', $row)) {
811 $componentRows[$contactID][$component][$rowNum]['civicrm_membership_membership_type_id'] = CRM_Member_PseudoConstant
::membershipType($val, FALSE);
814 if ($val = CRM_Utils_Array
::value('civicrm_membership_status_id', $row)) {
815 $componentRows[$contactID][$component][$rowNum]['civicrm_membership_status_id'] = CRM_Member_PseudoConstant
::membershipStatus($val, FALSE);
820 if ($component == 'participant_civireport') {
821 if ($val = CRM_Utils_Array
::value('civicrm_participant_event_id', $row)) {
822 $componentRows[$contactID][$component][$rowNum]['civicrm_participant_event_id'] = CRM_Event_PseudoConstant
::event($val, FALSE);
823 $url = CRM_Report_Utils_Report
::getNextUrl('event/income',
824 'reset=1&force=1&id_op=in&id_value=' . $val,
825 $this->_absoluteUrl
, $this->_id
827 $componentRows[$contactID][$component][$rowNum]['civicrm_participant_event_id_link'] = $url;
828 $componentRows[$contactID][$component][$rowNum]['civicrm_participant_event_id_hover'] = ts("View Event Income details for this Event.");
832 if ($val = CRM_Utils_Array
::value('civicrm_participant_participant_status_id', $row)) {
833 $componentRows[$contactID][$component][$rowNum]['civicrm_participant_participant_status_id'] = CRM_Event_PseudoConstant
::participantStatus($val, FALSE);
835 if ($val = CRM_Utils_Array
::value('civicrm_participant_role_id', $row)) {
836 $roles = explode(CRM_Core_DAO
::VALUE_SEPARATOR
, $val);
838 foreach ($roles as $role) {
839 $value[$role] = CRM_Event_PseudoConstant
::participantRole($role, FALSE);
841 $componentRows[$contactID][$component][$rowNum]['civicrm_participant_role_id'] = implode(', ', $value);
847 if ($component == 'activity_civireport') {
848 if ($val = CRM_Utils_Array
::value('civicrm_activity_activity_type_id', $row)) {
849 $componentRows[$contactID][$component][$rowNum]['civicrm_activity_activity_type_id'] = $activityTypes[$val];
851 if ($val = CRM_Utils_Array
::value('civicrm_activity_activity_status_id', $row)) {
852 $componentRows[$contactID][$component][$rowNum]['civicrm_activity_activity_status_id'] = $activityStatus[$val];
857 if ($component == 'membership_civireport') {
858 if ($val = CRM_Utils_Array
::value('civicrm_membership_membership_status_id', $row)) {
859 $componentRows[$contactID][$component][$rowNum]['civicrm_membership_membership_status_id'] = CRM_Member_PseudoConstant
::membershipStatus($val);
864 // skip looking further in rows, if first row itself doesn't
865 // have the column we need