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) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Following Contact Relationship on Export
Pages: [1]

Author Topic: Following Contact Relationship on Export  (Read 3709 times)

lobotomy42

  • Guest
Following Contact Relationship on Export
June 13, 2008, 03:16:40 pm
Hello all,

Background:  I am experienced with PHP/MySQL development, in addition to some Drupal work (for what it's worth.)
I'm fairly new to CiviCRM, but I've just inherited a fairly large website which is running CiviCRM 1.4, which now needs some changes.  The site is running on PHP5 and MySQL5, and an older version of Drupal (either 4.6 or 4.7.)

Problem: We need the "export" feature from the contact search results page to include fields from contact relationships. Specifically, if I am exporting individuals who are "employees of" an organization contact, I need certain fields from the related organization to appear in the individual drop down box and export along with the individual fields.

Example: Suppose a user "John Smith" is an "employee of" "Blacksmiths, Inc."  When I select "John Smith" from the search results page and choose "Export" and "Select fields to export," some of the available fields should be "Organization Name" and "Organization Address."  When I do finally export the contacts as a CSV, there should be one row, perhaps something like

"Smith","John","123 Home St","Blacksmiths, Inc.","456 Work Ave"

Solutions: This is where I need help.  What is the right approach to incorporate this functionality? Is there a CiviCRM plugin or module architecture I should be using to write a modification that provides this functionality?  Or should I just write my own little script that looks at the database independently and exports a report of what we need internally?  Should I just hack away at the core, and try to shoehorn in some organization fields in the individual contact type? (The latter is what I've been trying to do for a few hours now, but have, for the moment, abandoned.)

I'm fine with any approach, I just don't know what will be the easiest at this point in time. (Time is critical. Isn't it always, though?) What do you all think?

Any advice or guidance on how to proceed would be appreciated greatly!  Thanks in advance for helping out a total noob.


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: Following Contact Relationship on Export
June 13, 2008, 03:31:17 pm

Considering that both CiviCRM and Drupal are on fairly old versions and you are probably not planning to upgrade, i would probably do it as a standalone script and do what is required by the org. I suspect trying to understand / shoehorn it into core might not be really useful and will take longer (especially since our recollection of what 1.4 has is probably zero)

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

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Following Contact Relationship on Export
June 14, 2008, 01:45:18 am
On the 2.0, you have a custom export function, and one of the preset ones (and the example given in the doc) allows you to export the employer (ie the organisation that has a employer relationship with the contact).

I don't know how difficult it would be to upgrade, but having a old version means you'll be pretty much on your own if you have to maintain it, as the rest of the community has moved to something more recent.

Of course, if your export is to migrate to another CRM, that's not an issue.

Good luck

X+
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

lobotomy42

  • Guest
Re: Following Contact Relationship on Export
June 16, 2008, 04:16:22 pm
One more question:

The "Install 2.0 for Drupal Manually" page gives contradictory information.  At the top, it says:

Quote
Before beginning the install process, please verify that your server meets the requirements for CiviCRM 2.0.
...
Drupal 5.x : CiviCRM is compatible with the current generally available Drupal release.

A bit further down, it says

Quote
CiviCRM currently requires Drupal 4.7.x or 5.x. The paths mentioned here are recommended for Drupal 5.x. If you are using an older version of Drupal, please change sites/all/modules to modules in the below documentation

Is it realistically feasible to install Civi 2.0 on a Drupal 4.7 site?

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: Following Contact Relationship on Export
June 16, 2008, 05:04:05 pm

I've fixed the documentation to eliminate all references to Drupa 4.x :)

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

lobotomy42

  • Guest
Re: Following Contact Relationship on Export
June 16, 2008, 06:55:29 pm
Damn. Custom script it is, then.

Thanks for the answers. :)

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Following Contact Relationship on Export

This forum was archived on 2017-11-26.