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 CiviContribute (Moderator: Donald Lobo) »
  • New Contribution Tokens
Pages: [1]

Author Topic: New Contribution Tokens  (Read 716 times)

FrTommy

  • I post frequently
  • ***
  • Posts: 273
  • Karma: 2
  • CiviCRM version: 4.5.x
  • CMS version: Drupal 7.x
  • MySQL version: 5.5.32
  • PHP version: 5.3
New Contribution Tokens
September 01, 2012, 12:31:55 pm

Great work Samuel on adding the tokens and Print PDF letter to the Find Contributions page!!!

One question/request: Can you add a token that will list all the contributions from the search in a list?

Currently the way it works is that if I do a letter with the following:

{contact.first_name} {contact.last_name} {contact.contact_id}

ID: {contribution.contribution_id}

receive date: {contribution.receive_date}

source: {contribution.contribution_source}

paid by: {contribution.payment_instrument}

total amt: {contribution.total_amount}

Then each contribution becomes a separate letter. I'd like to be able to do a letter like the following:


Dear {contact.first_name} {contact.last_name},

Thank you for your contributions for the past year. Below is a list of your contributions.

ID..........Date...............Paid by.................Source..............................Amount
100        1/1/12            Check 2020          Donations blah blah         200.00
232        2/2/12             Credit Card          Donation                          100.00
321        3/5/12             Cash                    Donation                          50.00


Is there a way I could do that with a foreach within the letter?

John Richardson

  • I post occasionally
  • **
  • Posts: 57
  • Karma: 0
    • Life Challenge of Southeastern Michigan
  • CiviCRM version: 4.5.4
  • CMS version: Drupal 7.x
  • MySQL version: 5.5.27
  • PHP version: 5.3.13
Re: New Contribution Tokens
January 17, 2013, 09:59:05 am
I want the same thing, please. Any help out there?
John Richardson

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: New Contribution Tokens
January 17, 2013, 10:45:44 am

This comes up quite often and is definitely a quite-requested feature

Ideaman, would be great if you can help with the implementation of this

FrTommy's idea, of sending in an "array token" with values for each contribution is probably a good way to go and allows multiple contributions easily. There are a few things that need to be adjustable including the dates / contribution types / contribution status with regard to the below

ping us on irc if u need help getting started. The two modules close to this work are:

http://civicrm.org/blogs/markimus/civicrm-contributions-and-year-end-tax-crunch
http://drupal.org/sandbox/semperit/1289724

lobo
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

John Richardson

  • I post occasionally
  • **
  • Posts: 57
  • Karma: 0
    • Life Challenge of Southeastern Michigan
  • CiviCRM version: 4.5.4
  • CMS version: Drupal 7.x
  • MySQL version: 5.5.27
  • PHP version: 5.3.13
Re: New Contribution Tokens
January 17, 2013, 11:31:57 am
Thanks, Lobo.
Unfortunately, I am using Wordpress. I have talked to Hershel and he was very helpful. What I am looking for now (I think) is a custom token for year-to-date receipts that I can add to a thank-you letter. This should be easy for a developer. I don't know how. It says this in the documentation:

Quote
Custom tokens
It is also possible to have custom tokens created by a developer. For instance, the total amount of contributions from a contact. To find out more about working with custom tokens, refer to the discussion about custom mail merge tokens in the Hooks chapter of the Extending CiviCRM section of this book and look at the wiki:http://wiki.civicrm.org/confluence/display/CRMDOC/Tokens.

Another task for a developer is to create if/then logic for your mail merge. This is done using the smarty template language as described herehttp://www.smarty.net/docs/en/language.function.if.tpl.

Do you know of anyone who can do this on Wordpress for me?
John Richardson

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: New Contribution Tokens
January 17, 2013, 11:40:42 am

You can hire someone from here:

http://civicrm.org/what/experts

to do the needful. I'd recommend you get this done as an extension so folks across multiple CMS's can benefit. They can use one of the drupal modules as a starting point

thanx for taking the initiative and helping push it forward

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

John Richardson

  • I post occasionally
  • **
  • Posts: 57
  • Karma: 0
    • Life Challenge of Southeastern Michigan
  • CiviCRM version: 4.5.4
  • CMS version: Drupal 7.x
  • MySQL version: 5.5.27
  • PHP version: 5.3.13
Re: New Contribution Tokens
January 17, 2013, 11:49:20 am
Thanks, will do as you suggest...

I am so grateful for this community of users!
John Richardson

FrTommy

  • I post frequently
  • ***
  • Posts: 273
  • Karma: 2
  • CiviCRM version: 4.5.x
  • CMS version: Drupal 7.x
  • MySQL version: 5.5.32
  • PHP version: 5.3
Re: New Contribution Tokens
January 17, 2013, 06:59:33 pm
I'm working on tweaking Hershel's CiviReceipts module. I really suck at SQL.

Here's what i'm trying to do:
Code: [Select]
SELECT ccontr.id,contact_id,display_name,payment_instrument_id as pid,total_amount,
          DATE_FORMAT(receive_date,'%b %d, %Y') as gift_date
          FROM civicrm_contribution ccontr
          LEFT JOIN civicrm_contact cc ON cc.id = ccontr.contact_id
          WHERE receive_date BETWEEN '2012-09-09 00:00:00' AND '2012-12-31 23:59:59'
          AND contact_id = 4476
 LEFT JOIN civicrm_option_value cov ON cov.value = pid
WHERE cov.option_group_id = 10

Code: [Select]
ORIGINAL CODE:
"SELECT id,contact_id,display_name,payment_instrument_id as pid,total_amount,
                 DATE_FORMAT(receive_date,'%b %d, %Y') as gift_date
          FROM civicrm_contribution ccontr
          LEFT JOIN civicrm_contact cc ON cc.id = ccontr.contact_id
          LEFT JOIN pid ON civicrm_option_value.value WHERE option_group_id = 10
          WHERE receive_date BETWEEN '$begin_date 00:00:00' AND '$end_date 23:59:59'
          AND contact_id = {$cid}";

Basically, I'm trying to add the fields id, payment_instrument_id (but have it lookup the actual type from the civicrm_option_group table) I can't get the sql right to make that look up. Anyone willing to help me with the sql?

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviContribute (Moderator: Donald Lobo) »
  • New Contribution Tokens

This forum was archived on 2017-11-26.