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 Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • View job title on Relationship tab
Pages: [1] 2

Author Topic: View job title on Relationship tab  (Read 3210 times)

Slovak

  • I post occasionally
  • **
  • Posts: 89
  • Karma: 3
    • My website
  • CiviCRM version: 3.4.x, 4.2.x
  • CMS version: Drupal 6.x, 7.x
  • MySQL version: 5.5.29
  • PHP version: 5.3.10
View job title on Relationship tab
April 06, 2010, 09:40:58 pm
How would I go about adding the Job Title on the Relationship tab of a contact (organization)? I have the relationship set as Employer of, which then shows all employees for that organization contact. Often times the names may not ring a bell, but a job title may indicate the right person to choose from an extensive list.

Thanks!

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: View job title on Relationship tab
April 06, 2010, 09:49:40 pm

you will have to do this via the hook system. Check:

http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+hook+specification

most likely you will need to use the pageRun hook

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

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: View job title on Relationship tab
April 06, 2010, 10:26:38 pm
other option would be to do this via a Drupal View - with a page for each Organisation
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

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: View job title on Relationship tab
April 07, 2010, 12:23:59 am
Other option would be to override the classes that fetches the related contacts, and add the job_title.


Then modify the template to display it, obviously.

Lobo, as the job_title is in the civicrm_contact table (ie, no additional join), wouldn't it make sense to fetch it (in the php) and assign it to the template but not display it ?

No matter what, siovak, could you add a patch to this thread when you sort it out, I'm sure it would be useful for others.

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

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: View job title on Relationship tab
April 07, 2010, 06:41:38 am

I think such extensions are best done via a hook. There are quite a few fields in the contact/address table which we dont display and it makes sense for the code to retrieve only stuff that it will use, IMO

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: View job title on Relationship tab
April 07, 2010, 07:26:18 am
Have you tried to display job_title in the template ? It should be there.

At least just tested with the API (civicrm_relationship_get) and the job title is there.

X+

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

Slovak

  • I post occasionally
  • **
  • Posts: 89
  • Karma: 3
    • My website
  • CiviCRM version: 3.4.x, 4.2.x
  • CMS version: Drupal 6.x, 7.x
  • MySQL version: 5.5.29
  • PHP version: 5.3.10
Re: View job title on Relationship tab
April 07, 2010, 07:29:25 am
Quote from: xavier on April 07, 2010, 07:26:18 am
Have you tried to display job_title in the template ? It should be there.

At least just tested with the API (civicrm_relationship_get) and the job title is there.

X+



Still learning about hooks and such. Would you mind pointing me in the right direction regarding which template needs to be modified? Thanks!

Erik Hommel

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1773
  • Karma: 59
    • EE-atWork
  • CiviCRM version: all sorts
  • CMS version: Drupal
  • MySQL version: Ubuntu's latest LTS version
  • PHP version: Ubuntu's latest LTS version
Re: View job title on Relationship tab
April 07, 2010, 09:15:32 am
More information can be found here:
http://wiki.civicrm.org/confluence/display/CRMDOC/Customize+Built-in%2C+Profile%2C+Contribution+and+Event+Registration+Screens
Does that help?
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

Slovak

  • I post occasionally
  • **
  • Posts: 89
  • Karma: 3
    • My website
  • CiviCRM version: 3.4.x, 4.2.x
  • CMS version: Drupal 6.x, 7.x
  • MySQL version: 5.5.29
  • PHP version: 5.3.10
Re: View job title on Relationship tab
April 07, 2010, 09:39:08 am
Quote from: Erik Hommel on April 07, 2010, 09:15:32 am
Does that help?

Tons!

It's still a challenge for me to navigate all the documentation and pointers. The quick responses and nudges in the right direction are GREATLY appreciated. Now that I have solved this puzzle, where is a good place for me to document it?

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: View job title on Relationship tab
April 07, 2010, 09:51:45 am

a couple of things will help future developers:

1. fixing / improving the current documentation as you use them and find errors in them

2. writing a blog post on what you did and why and how you found the info etc

3. sharing you code on the wiki / blog

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

Erik Hommel

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1773
  • Karma: 59
    • EE-atWork
  • CiviCRM version: all sorts
  • CMS version: Drupal
  • MySQL version: Ubuntu's latest LTS version
  • PHP version: Ubuntu's latest LTS version
Re: View job title on Relationship tab
April 07, 2010, 10:01:03 am
Great if you share your solution! I have (and still am!) struggling to find my way, and have had (and still get) lots of help from the forum.
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

Slovak

  • I post occasionally
  • **
  • Posts: 89
  • Karma: 3
    • My website
  • CiviCRM version: 3.4.x, 4.2.x
  • CMS version: Drupal 6.x, 7.x
  • MySQL version: 5.5.29
  • PHP version: 5.3.10
Re: View job title on Relationship tab
April 08, 2010, 07:11:56 am
In short, I followed documentation on modifying a template. The one in question was sites/all/modules/civicrm/templates/CRM/Contact/Page/View/Relationship.tpl

Around line 55, the HTML table headers are defined, so I added
Code: [Select]
<th>{ts}Position{/ts}</th>
Around line 80, the actual values are written out. To help me figure out the correct name, I searched Summary.tpl for clues. Adding into Relationship.tpl
Code: [Select]
<td>{$rel.job_title}</td>was the solution.

I saved the modified Relationship.tpl in a separate directory as suggested in the documentation referenced above.

Thanks to all that provided help!

Erik Hommel

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1773
  • Karma: 59
    • EE-atWork
  • CiviCRM version: all sorts
  • CMS version: Drupal
  • MySQL version: Ubuntu's latest LTS version
  • PHP version: Ubuntu's latest LTS version
Re: View job title on Relationship tab
April 08, 2010, 07:21:13 am
If you want to know what variables are available in a particular screen/template you can use smarty debug:
* switch on debug in CiviCRM administer (Administer/Configure/Global Settings/Debugging)
* add smartyDebug=1 to the end of the URL calling the specific page (e.g. xxxxxxxx?q=civicrm/contact/view&reset=1&cid=1&smartyDebug=1)

You will then get a separate window with all the available variables on that specific template
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

Slovak

  • I post occasionally
  • **
  • Posts: 89
  • Karma: 3
    • My website
  • CiviCRM version: 3.4.x, 4.2.x
  • CMS version: Drupal 6.x, 7.x
  • MySQL version: 5.5.29
  • PHP version: 5.3.10
Re: View job title on Relationship tab
April 08, 2010, 07:28:49 am
Quote from: Erik Hommel on April 08, 2010, 07:21:13 am
switch on debug in CiviCRM administer

Great suggestion, just tried it out. How would I go about getting the variable list on a contact tab, such as Relationships or Groups?

Erik Hommel

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1773
  • Karma: 59
    • EE-atWork
  • CiviCRM version: all sorts
  • CMS version: Drupal
  • MySQL version: Ubuntu's latest LTS version
  • PHP version: Ubuntu's latest LTS version
Re: View job title on Relationship tab
April 08, 2010, 07:31:25 am
There are the exceptions that have been AJAXified :-) Still figuring that out, I will use Firebug but need to play with that....
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

Pages: [1] 2
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • View job title on Relationship tab

This forum was archived on 2017-11-26.