CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviEvent (Moderator: Yashodha Chaku) »
  • Adding phone number to Event Participant Report
Pages: [1]

Author Topic: Adding phone number to Event Participant Report  (Read 3060 times)

sailormatt

  • I post occasionally
  • **
  • Posts: 39
  • Karma: 1
  • Explore, Dream, Discover!
    • Morvargh Sailing Project
  • CiviCRM version: 4.3.3
  • CMS version: Joomla 2.5.11
  • MySQL version: 5.1.41
  • PHP version: 5.5.30
Adding phone number to Event Participant Report
September 18, 2012, 01:59:06 am
Hi All

I wonder whether someone may be able to give me some pointers????

I'd like to customise the columns in the Event Participant Report by adding 'phone number' to the list of available fields.  I've read the forum post http://forum.civicrm.org/index.php/topic,13868.msg59187.html#msg59187 and understand that I need to edit ParticipantListing.php by adding the field in here.

I've looked at the file, but am not sure what the correct code needs to be. I think I've found where it pulls the email record from.
Code: [Select]
'civicrm_email' =>
      array(
        'dao' => 'CRM_Core_DAO_Email',
        'fields' =>
        array(
          'email' =>
          array('title' => ts('Email'),
            'no_repeat' => TRUE,
          ),
        ),
        'grouping' => 'contact-fields',
        'filters' =>
        array(
          'email' =>
          array('title' => ts('Participant E-mail'),
            'operator' => 'like',
          ),
        ),
      ),

Is it just a case of copying / pasting this and changing the references to Phone instead of email? If this is the case, where can I find the correct syntax for adding the phone field?

And finally, (thanks for all the help so far!!) do I then add this file into my custom_php folder as set under the custom directories settings?

Thanks for all your help all, I really couldn't have integrated Civi as well as I have without the help of everyone on the forums!

Matt

Yashodha Chaku

  • Forum Godess / God
  • Ask me questions
  • *****
  • Posts: 755
  • Karma: 57
    • CiviCRM
Re: Adding phone number to Event Participant Report
September 18, 2012, 04:09:44 am
sailormatt :
You might want to refer to CRM/Report/Form/Contact/Summary.php for adding the phone field.

You need to add it to the select clause as well as a left join in the from clause :
Code: [Select]
Index: CRM/Report/Form/Event/ParticipantListing.php
===================================================================
--- CRM/Report/Form/Event/ParticipantListing.php (revision 42376)
+++ CRM/Report/Form/Event/ParticipantListing.php (working copy)
@@ -81,6 +81,13 @@
           array('title' => ts('Last Name, First Name'), 'default' => '1', 'default_weight' => '0', 'default_order' => 'ASC'),
         ),
       ),
+      'civicrm_phone' =>
+      array(
+            'dao' => 'CRM_Core_DAO_Phone',
+            'fields' =>
+            array('phone' => NULL),
+            'grouping' => 'contact-fields',
+            ),
       'civicrm_email' =>
       array(
         'dao' => 'CRM_Core_DAO_Email',
@@ -275,8 +282,9 @@
                        {$this->_aliases['civicrm_address']}.is_primary = 1
              LEFT JOIN  civicrm_email {$this->_aliases['civicrm_email']}
                     ON ({$this->_aliases['civicrm_contact']}.id = {$this->_aliases['civicrm_email']}.contact_id AND
-                       {$this->_aliases['civicrm_email']}.is_primary = 1) ";
-  }
+                       {$this->_aliases['civicrm_email']}.is_primary = 1)
+            LEFT JOIN civicrm_phone {$this->_aliases['civicrm_phone']}                                                                                                                                                        ON {$this->_aliases['civicrm_contact']}.id = {$this->_aliases['civicrm_phone']}.contact_id AND                                                                                                                {$this->_aliases['civicrm_phone']}.is_primary = 1 ";
+    }

I would suggest using custom templates as a solution check :
http://wiki.civicrm.org/confluence/display/CRMDOC32/Customize+Built-in,+Profile,+Contribution+and+Event+Registration+Screens
HTH
-Yashodha
« Last Edit: September 18, 2012, 04:23:12 am by Yashodha Chaku »
Found this reply helpful? Contribute NOW and help us improve CiviCRM with the Make it Happen! initiative.

e_mason

  • I post occasionally
  • **
  • Posts: 65
  • Karma: 1
  • Eliot Mason
  • CiviCRM version: 4.05
  • CMS version: Drupal 7
  • MySQL version: 5.1xx
  • PHP version: 3.53
Re: Adding phone number to Event Participant Report
June 10, 2013, 06:44:57 am
Yashoda's code is missing part of the query that is necessary for this to run.   It should read:

Code: [Select]
LEFT JOIN civicrm_phone {$this->_aliases['civicrm_phone']} 
ON {$this->_aliases['civicrm_contact']}.id = {$this->_aliases['civicrm_phone']}.contact_id AND
                      {$this->_aliases['civicrm_phone']}.is_primary = 1

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviEvent (Moderator: Yashodha Chaku) »
  • Adding phone number to Event Participant Report

This forum was archived on 2017-11-26.