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 »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Retrieve contribution ID from extension hook when sending receipt mail
Pages: [1]

Author Topic: Retrieve contribution ID from extension hook when sending receipt mail  (Read 1021 times)

seni

  • I’m new here
  • *
  • Posts: 3
  • Karma: 0
  • CiviCRM version: 4.3.7
  • CMS version: WordPress
  • MySQL version: Ver 14.14 Distrib 5.5.32
  • PHP version: PHP 5.4.9
Retrieve contribution ID from extension hook when sending receipt mail
October 12, 2013, 12:26:39 pm
Hi

I'm using civicrm 4.3.7 and I am trying to retrieve a contribution ID when generating/sending mail/pdf receipts. When using tokenValues hook only contact_id is available, however contact can have many contributions and when querying the database a wrong results can be retrieved. So I figured it would make more sense to filter by contribution id, but I can't figure it out how.

https://civicrm.org/blogs/colemanw/create-your-own-tokens-fun-and-profit sadly and other examples I found always show just how to get contributions based on contact_id which might return wrong results and when manually sending receipts from "Contributions->Find Contributions" and action "Print or Email contributions receipts" (with only one contributions selected from a certain user) the $_POST return just qfKey.

http://forum.civicrm.org/index.php/topic,25039.msg105638.html#msg105638 has an example that uses {contribution.contribution_id} token, but sadly it doesn't work in message template "Events - Registration Confirmation and Receipt (on-line)" or off-line.

So how do I get selected contribution id?
Is there a way to do this with civicrm_api?

Pretty much I have the same problem as http://forum.civicrm.org/index.php/topic,24497.msg103095.html#msg103095 or http://forum.civicrm.org/index.php?topic=24278.0

Thanks
seni


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: Retrieve contribution ID from extension hook when sending receipt mail
October 13, 2013, 10:32:41 am

I think some work at standardizing and cleaning this up across all the workflows would be a good thing and help add various object specific tokens. Maybe you can take the first stab at doing so?

I'd recommend that if we have it, we should expose:

contact_id OR array of contact_id
contribution_id OR array of contribution_id
participant_id OR ..

from the php level to the smarty level, and ensure it happens on all forms and pages. That way folks can write and implement a hook as needed.

We can help u get started on IRC

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

snoopers01

  • I’m new here
  • *
  • Posts: 18
  • Karma: 0
  • CiviCRM version: 4.2.7
  • CMS version: WordPress 3.5
  • MySQL version: 5.5.24
  • PHP version: 5.4.3
Re: Retrieve contribution ID from extension hook when sending receipt mail
March 22, 2014, 06:52:14 am
Has there been any more activity on the contribution id front. Can I help?

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: Retrieve contribution ID from extension hook when sending receipt mail
March 22, 2014, 06:58:35 am

i dont think so. If you have the time and skills, can you take a look at what i proposed above and start working on it

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

snoopers01

  • I’m new here
  • *
  • Posts: 18
  • Karma: 0
  • CiviCRM version: 4.2.7
  • CMS version: WordPress 3.5
  • MySQL version: 5.5.24
  • PHP version: 5.4.3
Re: Retrieve contribution ID from extension hook when sending receipt mail
March 22, 2014, 07:06:48 am
I don't think I have enough civi knowledge and skills to do it on my own but I'm willing to learn if someone will point me in the right direction. Don't know if that is a help or hindrance

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Retrieve contribution ID from extension hook when sending receipt mail

This forum was archived on 2017-11-26.