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) »
  • Discussion »
  • Extensions (Moderators: mathieu, totten, kasiawaka) »
  • Adding custom information to the Contact summary or an additional tab
Pages: [1]

Author Topic: Adding custom information to the Contact summary or an additional tab  (Read 1146 times)

denishow

  • I’m new here
  • *
  • Posts: 19
  • Karma: 2
  • CiviCRM version: 4.2
  • CMS version: WordPress 3.4.2
  • MySQL version: 5.4
  • PHP version: 5.3.15
Adding custom information to the Contact summary or an additional tab
December 17, 2012, 10:58:16 am
Hi

I've added a new custom tab to the Contact display to show contributions of just one sort (members can make all sorts of contributions, but we want to be able to track one type separately and total up how much they've contributed for this type).

The tab all works, but you have to go to it to see the total contribution. Is there any way for me to put the total in the tab text? Alternatively could I add it to the summary screen (even though it's additional information which needs a new database query)?

Thanks in advance as always.
Denis

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 custom information to the Contact summary or an additional tab
December 17, 2012, 02:29:56 pm

I'm assuming u r using a hook to add this new tab

can u put the count in the title of the 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

denishow

  • I’m new here
  • *
  • Posts: 19
  • Karma: 2
  • CiviCRM version: 4.2
  • CMS version: WordPress 3.4.2
  • MySQL version: 5.4
  • PHP version: 5.3.15
Re: Adding custom information to the Contact summary or an additional tab
December 17, 2012, 11:39:00 pm
Hi Lobo,

Yes I'm using a hook to add the tab. I can't see how to add the count though? I can't find any examples. This is what I've got so far:


function xxx_civicrm_tabs( &$tabs, $contactID ) {
    // From the example code: let's add a new "contribution" tab with a different name and put it last
    $url = CRM_Utils_System::url( 'civicrm/raceFloat', "reset=1&snippet=1&force=1&cid=$contactID");
    $tabs[] = array( 'id' => 'xxxRaceFloat',
        'url' => $url,
        'title' => 'Race Float',
        'weight' => 300 );
}


Also, what I really want it the total amount not the count.

For background, we're using the one contribution type as a virtual float for members of a sports team. They make contributions which are credited to their float and then when they take part in an event, the event fee is deducted. We need to be able to see what their float balance is. I can already generate a report showing all the members with floats below £30. The next thing I want to be able to do is automatically once a week, send out an email to those whose float is too low asking them to top up.

Thanks
Denis

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Adding custom information to the Contact summary or an additional tab
December 18, 2012, 01:51:25 am
Hi,

If you put

$total = //do your calculation;
...
  'title' => 'Race Float ($total)' ,

you will have the total in the tab name.

As for how you calculate the total, don't think there is an api to directly fetch the total amount, so you probably have to fetch the contributions of the float type and do the sum in php
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Discussion »
  • Extensions (Moderators: mathieu, totten, kasiawaka) »
  • Adding custom information to the Contact summary or an additional tab

This forum was archived on 2017-11-26.