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 Drupal Modules (Moderator: Donald Lobo) »
  • Views2 integration - doing an audit of missing CiviCRM fields in Views
Pages: [1]

Author Topic: Views2 integration - doing an audit of missing CiviCRM fields in Views  (Read 3385 times)

CiviTeacher.com

  • I live on this forum
  • *****
  • Posts: 1282
  • Karma: 118
    • CiviTeacher
  • CiviCRM version: 3.4 - 4.5
  • CMS version: Drupal 6&7, Wordpress
  • MySQL version: 5.1 - 5.5
  • PHP version: 5.2 - 5.4
Views2 integration - doing an audit of missing CiviCRM fields in Views
April 16, 2009, 06:05:44 pm
Hi I'm doing a little bit of Views + CiviCRM integration, and I realize this is kind of a new area for the whole CiviCRM team.  During my work, thanks for the docs by the way, I was able to get Views finding a great deal of assorted fields.  However, some fields seem to be missing.  The most obvious one is "postal_code" from the civicrm_address table.  I search for about 1/2 hour trying to find out how these fields are determined and can't. 

I'm not expert, I'd like to volunteer to do an audit of the default fields available to Views and submit a patch....if someone can guide me in the right direction and point me to the files in question it would help me get started.

Thanks.

« Last Edit: April 16, 2009, 06:08:20 pm by Stoob »
Try CiviTeacher: the online video tutorial CiviCRM learning library.

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: Views2 integration - doing an audit of missing CiviCRM fields in Views
April 17, 2009, 01:20:39 pm

for the core tables, the fields are inserted via manual specification. Check: drupal/modules/views/civicrm.views.inc

You can add support for postal code (and other missing fields). Please file an issue and then attach it as a patch

Most of the other tables, all the fields are added automatically by checking the table definition

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

DanilaD

  • I post occasionally
  • **
  • Posts: 93
  • Karma: 11
Re: Views2 integration - doing an audit of missing CiviCRM fields in Views
April 18, 2009, 12:29:24 am
Take a look at function civicrm_views_data(), you will need to add code similar to this one:

Code: [Select]
//CITY OR SUBURB THE ADDRESS IS AT
    $data['civicrm_address']['city'] = array(
                                             'title' => t('City / Suburb'),
                                             'help' => t('The City or Suburb the address is at'),
                                             'field' => array(
                                                              'handler' => 'views_handler_field',
                                                              'click sortable' => TRUE,
                                                              ),

                                             'argument' => array(
                                                                 'handler' => 'views_handler_argument',
                                                                 ),

                                             'filter' => array(
                                                               'handler' => 'views_handler_filter_string',
                                                               ),

                                             'sort' => array(
                                                             'handler' => 'views_handler_sort',
                                                             ),
                                             );

There are examples in the code on how to add different data type fields...

Regards,
Danila

CiviTeacher.com

  • I live on this forum
  • *****
  • Posts: 1282
  • Karma: 118
    • CiviTeacher
  • CiviCRM version: 3.4 - 4.5
  • CMS version: Drupal 6&7, Wordpress
  • MySQL version: 5.1 - 5.5
  • PHP version: 5.2 - 5.4
Re: Views2 integration - doing an audit of missing CiviCRM fields in Views
April 20, 2009, 01:33:50 pm
Thank you both.

I have created an issue: http://issues.civicrm.org/jira/browse/CRM-4397

And uploaded the patch.  I tested it on my install and it worked but did not test it elsewhere.  Therefore it is still marked as "open" in case you have a more rigorous testing process.

Let me know if I can be of any other assistance in this matter.  It has fixed my issue and I hope it will help others.
Try CiviTeacher: the online video tutorial CiviCRM learning library.

alfred_nutile

  • Ask me questions
  • ****
  • Posts: 464
  • Karma: 14
    • River Valley Tech Collective
Re: Views2 integration - doing an audit of missing CiviCRM fields in Views
April 27, 2009, 05:04:22 pm
Tried all of this and even though I see a ton of civicrm fields to choose from in views 2 (which is great!!!)
still no way to filter on group?
Am I just missing something?
My settings.php is set according to the output of that global setting in civicrm.
???
Thanks

mariagwyn

  • I post frequently
  • ***
  • Posts: 149
  • Karma: 4
  • CiviCRM version: CiviCRM 3.3.3
  • CMS version: Drupal 6.20
  • MySQL version: 5.2.14
  • PHP version: 5.0.91-50-log
Re: Views2 integration - doing an audit of missing CiviCRM fields in Views
July 09, 2009, 02:34:41 pm
likewise, looking for GROUP field in views.
Thanks,
Maria

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: Views2 integration - doing an audit of missing CiviCRM fields in Views
July 09, 2009, 04:21:41 pm

views2 is heavily driven by user contributions. So if something is missing, please submit a patch and/or hire a developer to do what you want and get them to submit a patch :)

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

CiviTeacher.com

  • I live on this forum
  • *****
  • Posts: 1282
  • Karma: 118
    • CiviTeacher
  • CiviCRM version: 3.4 - 4.5
  • CMS version: Drupal 6&7, Wordpress
  • MySQL version: 5.1 - 5.5
  • PHP version: 5.2 - 5.4
Re: Views2 integration - doing an audit of missing CiviCRM fields in Views
July 17, 2009, 10:01:36 am
Hi quick question on how do something in civicrm.views.inc

This CiviCRM file has a phone field, but if there are two phones at one location for instance... Home:Phone Home:Fax then this Views code will retrieve both phone numbers as 2 rows (and therefore as an array I think)... and mess up the Views display because Views isn't looking for an array, just a string.

How can I restrict it so that this code grabs the actual phone number of a certain type.  For instance

[phone_phone] = 999-999-9999
[phone_fax] = 999-999-4444

Or even I'd settle for pulling only the first phone number...

I tried looking into the handlers but they don't appear much as far as restricting the number of rows pulled.


Code: [Select]
    //FULL PHONE NUMBER
    $data['civicrm_phone']['phone'] = array(
                                            'title' => t('Phone Number'),
                                            'help' => t('Full Phone Number'),
                                            'field' => array(
                                                             'handler' => 'views_handler_field',
                                                             'click sortable' => TRUE,
                                                             ),

                                            'argument' => array(
                                                                'handler' => 'views_handler_argument',
                                                                ),

                                            'filter' => array(
                                                              'handler' => 'views_handler_filter_string',
                                                              ),

                                            'sort' => array(
                                                            'handler' => 'views_handler_sort',
                                                            ),
                                            );

    //TODO: Mobile Provider

    //PHONE TYPE  , Phone, Mobile, Fax or Pager
    $data['civicrm_phone']['phone_type'] = array(
                                                 'title' => t('Phone Type'),
                                                 'real field' => 'phone_type_id',
                                                 'help' => t('The Type, either Phone, Mobile, Fax or Pager'),
                                                 'field' => array(
                                                                  'handler' => 'civicrm_handler_field_phone_type',
                                                                  'click sortable' => TRUE,
                                                                  ),

                                                 'argument' => array(
                                                                     'handler' => 'views_handler_argument',
                                                                     ),

                       
                                                 'filter' => array(
                                                                   'handler' => 'civicrm_handler_filter_phone_type',
                                                                   ),

                                                 'sort' => array(
                                                                 'handler' => 'views_handler_sort',
                                                                 ),
                                                 );
Try CiviTeacher: the online video tutorial CiviCRM learning library.

jalama

  • I post frequently
  • ***
  • Posts: 176
  • Karma: 22
    • Rooty Hollow LLC
  • CiviCRM version: 3.3.5
  • CMS version: Drupal 6 and 7
  • MySQL version: 5.1
  • PHP version: 5.2.5 and 5.3
Re: Views2 integration - doing an audit of missing CiviCRM fields in Views
July 18, 2009, 01:20:06 pm
Yea the phone fields use the generic handler provided by views, which are expecting only one returned value.  you would have to create a custom handler for that one.
http://www.rootyhollow.com

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Drupal Modules (Moderator: Donald Lobo) »
  • Views2 integration - doing an audit of missing CiviCRM fields in Views

This forum was archived on 2017-11-26.