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 (Moderator: Dave Greenberg) »
  • Need to expose addressee core field to Drupal views
Pages: [1]

Author Topic: Need to expose addressee core field to Drupal views  (Read 4766 times)

carlitos

  • I’m new here
  • *
  • Posts: 25
  • Karma: 1
    • International Council for Traditional Music
  • CiviCRM version: 4.4.4
  • CMS version: Drupal 6
  • MySQL version: 5
  • PHP version: 5
Need to expose addressee core field to Drupal views
August 16, 2013, 03:22:34 pm
Hello all!

This is my first post, so please excuse my being a sheer newbie. I'm cutting my teeth with Drupal (6) Views, trying to query some contact CiviCRM data, and I realised there is no 'addressee' field available to Views.

I need to show this field to the user, because we have different ways of showing full names (just showing 'display name' won't work for Vietnamese names, for instance), and Addressee is the field which has the right information.

Could anyone please point me into the right direction to solve this problem? I must admit I don't know whether this is a Drupal, Views, or CiviCRM issue -- I come from the WordPress world, and Drupal is a very strange animal at first contact.

Thanks a lot, and best from Slovenia!

Carlitos

Coleman Watts

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 2346
  • Karma: 183
  • CiviCRM version: The Bleeding Edge
  • CMS version: Various
Re: Need to expose addressee core field to Drupal views
August 16, 2013, 08:45:36 pm
This should be pretty straightforward, it's basically the same as any other contact name field as far as display is concerned. Look in /civicrm/drupal/modules/views/components/civicrm.core.inc and basically just copy how first_name, middle_name, etc. are done.
Try asking your question on the new CiviCRM help site.

carlitos

  • I’m new here
  • *
  • Posts: 25
  • Karma: 1
    • International Council for Traditional Music
  • CiviCRM version: 4.4.4
  • CMS version: Drupal 6
  • MySQL version: 5
  • PHP version: 5
Re: Need to expose addressee core field to Drupal views
August 17, 2013, 02:19:54 am
Dear Coleman,

Thanks a lot for your help -- it now works! To help fellow users googling for similar answers I'll add that the file I ended up editing was /civicrm/drupal/modules/views/civicrm.views.inc. That should be because I'm on 4.1, I presume?

Anyway, the field name to use is 'addressee_display', and I had to flush all caches for Views to see the new field. Pretty straightforward indeed!

What concerns me now, is whether every CiviCRM upgrade will flatten this custom code out. Is that so? Anyone knows how to prevent that from happening?

Thanks a lot!

Carlitos

Coleman Watts

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 2346
  • Karma: 183
  • CiviCRM version: The Bleeding Edge
  • CMS version: Various
Re: Need to expose addressee core field to Drupal views
August 17, 2013, 11:17:39 am
You are of course talking about the fundamental nature of open source software. If you contribute your code back to the project, then it will not only be available to you in future versions, but everyone else as well. The whole community gets stronger this way.
Try asking your question on the new CiviCRM help site.

BrightBold

  • I’m new here
  • *
  • Posts: 16
  • Karma: 0
  • CiviCRM version: 4.4.4
  • CMS version: Drupal 7
  • MySQL version: Pantheon
  • PHP version: Pantheon
Re: Need to expose addressee core field to Drupal views
December 10, 2013, 12:33:14 pm
Carlitos it would be great if you would contribute back your work! I also was looking for this functionality and was surprised not to find it.

carlitos

  • I’m new here
  • *
  • Posts: 25
  • Karma: 1
    • International Council for Traditional Music
  • CiviCRM version: 4.4.4
  • CMS version: Drupal 6
  • MySQL version: 5
  • PHP version: 5
Re: Need to expose addressee core field to Drupal views
December 11, 2013, 01:28:38 am
Quote from: BrightBold on December 10, 2013, 12:33:14 pm
Carlitos it would be great if you would contribute back your work! I also was looking for this functionality and was surprised not to find it.

Well, I thought I had! In my previous message, I mean.

petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Re: Need to expose addressee core field to Drupal views
December 11, 2013, 10:10:47 am
carlitos - i think the request is "please wrap your fix up as a patch and add to a new JIRA ticket" which you can do via the Issue Tracker link in top menu - hope that helps
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

carlitos

  • I’m new here
  • *
  • Posts: 25
  • Karma: 1
    • International Council for Traditional Music
  • CiviCRM version: 4.4.4
  • CMS version: Drupal 6
  • MySQL version: 5
  • PHP version: 5
Re: Need to expose addressee core field to Drupal views
December 12, 2013, 12:32:10 am
Quote from: petednz on December 11, 2013, 10:10:47 am
carlitos - i think the request is "please wrap your fix up as a patch and add to a new JIRA ticket" which you can do via the Issue Tracker link in top menu - hope that helps

Oh, I see. I'm afraid I have no idea how to do that, sorry :( But still, I wouldn't consider my tinkering as a 'patch', more like guidelines on how to accomplish a task. As I see it, there's nothing inherently wrong with the default functionality -- I just needed to extend it to suit my particular needs.

Sorry to disappoint, I guess!

petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Re: Need to expose addressee core field to Drupal views
December 12, 2013, 01:03:42 am
Quote
the file I ended up editing was /civicrm/drupal/modules/views/civicrm.views.inc

can you at least flag what lines you changed, and what those changes were - might save someone else some brainache ;-)
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

carlitos

  • I’m new here
  • *
  • Posts: 25
  • Karma: 1
    • International Council for Traditional Music
  • CiviCRM version: 4.4.4
  • CMS version: Drupal 6
  • MySQL version: 5
  • PHP version: 5
Re: Need to expose addressee core field to Drupal views
December 12, 2013, 03:37:33 am
Alright, noblesse oblige.

I added the following code to civicrm/drupal/modules/views/civicrm.views.inc, after a similar block, at line 321.

  //ADDRESSEE (added by Carlos Yoder on 17 August 2013)
  $data['civicrm_contact']['addressee_display'] = array(
    'title' => t('Addressee'),
    'help' => t('Addressee'),
    'field' => array(
      'handler' => 'civicrm_handler_field_contact_link',
      'click sortable' => TRUE,
    ),
    'argument' => array(
      'handler' => 'views_handler_argument',
    ),
    'filter' => array(
      'handler' => 'views_handler_filter_string',
      'allow empty' => TRUE,
    ),
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
  );

Hope this helps!

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: Need to expose addressee core field to Drupal views
December 12, 2013, 09:18:41 am

carlitos/petednz:

can we request one of u'll to file an issue and attach a PR to this. Might be a good addition to 4.4 :)

thanx

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

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM (Moderator: Dave Greenberg) »
  • Need to expose addressee core field to Drupal views

This forum was archived on 2017-11-26.