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 CiviReport (Moderator: Dave Greenberg) »
  • Adding phone to PBNP Report
Pages: [1]

Author Topic: Adding phone to PBNP Report  (Read 1614 times)

immanuel

  • Guest
Adding phone to PBNP Report
August 30, 2010, 06:48:15 pm
I would like to add the phone field to the Pledged but not Paid report. I just need to have the contacts phone number listed in the report.

I have tried adding it to the php file, but keep getting a db error "no such field exists"

I am sure that this is probably a simple problem, but I am new to CiviCRM and php. Any help is greatly appreciated.

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Adding phone to PBNP Report
August 30, 2010, 06:52:30 pm

since u r not familiar with php/mysql and civicrm, please consider hiring someone from http://civicrm.org/professional/

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Rahul Bile

  • I post occasionally
  • **
  • Posts: 112
  • Karma: 16
  • impossible says, I M Possible
    • I AM POSSIBLE
Re: Adding phone to PBNP Report
August 30, 2010, 09:53:44 pm
Hello immanuel,

try below patch, will work for you.
Code: [Select]
Index: CRM/Report/Form/Pledge/Pbnp.php
===================================================================
--- CRM/Report/Form/Pledge/Pbnp.php (revision 29469)
+++ CRM/Report/Form/Pledge/Pbnp.php (working copy)
@@ -124,6 +124,12 @@
                           array( 'email' => null),
                           'grouping'=> 'contact-fields',
                           ),
+                   'civicrm_phone' =>
+                   array( 'dao'    => 'CRM_Core_DAO_Phone',
+                          'fields' =>
+                          array( 'phone' => null),
+                          'grouping'=> 'contact-fields',
+                          ),
                    
                    'civicrm_group' =>
                    array( 'dao'    => 'CRM_Contact_DAO_Group',
@@ -161,7 +167,10 @@
                             $this->_emailField = true;
                         } else if ( $tableName == 'civicrm_email' ) {
                             $this->_emailField = true;  
+                        } else if ( $tableName == 'civicrm_phone' ) {
+                            $this->_phoneField = true;  
                         }                    
                         $select[] = "{$field['dbAlias']} as {$tableName}_{$fieldName}";
                         $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = CRM_Utils_Array::value( 'type', $field );
                         $this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = CRM_Utils_Array::value( 'title', $field );
@@ -202,6 +211,13 @@
                            {$this->_aliases['civicrm_email']}.contact_id) AND
                            {$this->_aliases['civicrm_email']}.is_primary = 1\n";    
         }
+        if ( $this->_phoneField ) {
+            $this->_from .= "
+            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\n";    
+        }
     }      
    

Hope this helps.

Rahul.
« Last Edit: August 30, 2010, 10:13:06 pm by rahulbile »
Consider donating to CiviCRM if you use it. http://civicrm.org/donate

immanuel

  • Guest
Re: Adding phone to PBNP Report
August 31, 2010, 06:18:22 am
Rahul,

Thank You!!! That worked perfectly!

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviReport (Moderator: Dave Greenberg) »
  • Adding phone to PBNP Report

This forum was archived on 2017-11-26.