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) »
  • Connect Grants to Campaigns
Pages: [1]

Author Topic: Connect Grants to Campaigns  (Read 675 times)

pederb

  • I’m new here
  • *
  • Posts: 27
  • Karma: 0
  • CiviCRM version: 4.3.5
  • CMS version: Drupal 7.22
  • MySQL version: MySql 5.1
  • PHP version: 5.3
Connect Grants to Campaigns
January 25, 2013, 01:38:13 pm
In CiviCRM Contributions can be given to specific Campaigns.

We need to have a link also between Grants and Campaigns.
This is because Grants can only be given within the revenue of a certain campaign.
We also need to make balance reports showing incoming contributions and outgoing grants for a campaign.
Any hints for doing this?

lolas

  • I post frequently
  • ***
  • Posts: 134
  • Karma: 9
    • Freeform Solutions
  • CiviCRM version: Several
  • CMS version: Drupal
  • MySQL version: 5.1+
  • PHP version: Several
Re: Connect Grants to Campaigns
February 01, 2013, 10:14:41 am
I haven't done a lot of work with the grants part. If grants linking to campaigns is not supported in the core then the easiest way to link them would be to add a custom field on the grant - Called Campaign that displays the Campaign Name and stores the campaign id. If you only have a few campaigns it would be easy enough to maintain the list of campaigns as allowable values of the custom field. If you have a lot of campaigns or they change frequently then you can write a hook to provide the drop down options for that field.
I checked that this would work on the demo:, you can take a look if you get there before it gets erased:
http://drupal.demo.civicrm.org/civicrm/contact/view/grant?reset=1&id=1&cid=11&action=view&context=grant&selectedChild=grant&key=8383ef99d0d6f9c54284c0288d7c5b1f_4394
The custom field group:
http://drupal.demo.civicrm.org/civicrm/admin/custom/group?reset=1

Finally you will need to write a custom report that uses that link.
Freeform Solutions provides technology and management consulting, website and database development, and managed internet hosting solutions for not-for-profit organizations (NFPs).

pederb

  • I’m new here
  • *
  • Posts: 27
  • Karma: 0
  • CiviCRM version: 4.3.5
  • CMS version: Drupal 7.22
  • MySQL version: MySql 5.1
  • PHP version: 5.3
Re: Connect Grants to Campaigns
February 01, 2013, 10:43:37 am
Thx lolas  :)

It looks right. We have more than 100 campaigns so I'll try to implement the "hook".

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: Connect Grants to Campaigns
February 01, 2013, 10:56:19 am

Might be worth doing it as a patch to core and adding campaign_id to the grant table and extend the grant code to deal with it natively

we'd be happy to merge the changes into the next civi release (4.4)

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

lolas

  • I post frequently
  • ***
  • Posts: 134
  • Karma: 9
    • Freeform Solutions
  • CiviCRM version: Several
  • CMS version: Drupal
  • MySQL version: 5.1+
  • PHP version: Several
Re: Connect Grants to Campaigns
February 01, 2013, 12:42:54 pm
Yes, if you can modify and submit a patch to the core that would be ideal.

If you decide to go the hook route you will need this one: http://wiki.civicrm.org/confluence/display/CRMDOC42/Hook+Reference#HookReference-hook_civicrm_customFieldOptions

If you only have 100 campaigns to bring in and they don't change too often it still might be easy enough to add them to the db manually or import them using this extension: http://civicrm.org/extensions/option-value-importer
Freeform Solutions provides technology and management consulting, website and database development, and managed internet hosting solutions for not-for-profit organizations (NFPs).

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Connect Grants to Campaigns

This forum was archived on 2017-11-26.