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) »
  • Get contributions w/out thank-yous and receipts
Pages: [1]

Author Topic: Get contributions w/out thank-yous and receipts  (Read 4185 times)

prickeke

  • I post occasionally
  • **
  • Posts: 64
  • Karma: 4
Get contributions w/out thank-yous and receipts
November 08, 2009, 10:47:03 pm
I'm looking for a way to get all contributions w/out a thank-you date and receipt date set.  They also must be completed.  This is the API call I used:
Code: [Select]
$params = array(
        'rowCount'               => 9999999,
        'contribution_status_id' => 1,
        'receipt_date'           => '', 
        'thankyou_date'          => '', 
        'return.id'              => 1,   
        'return.contact_id'      => 1   
        );     
$contributions = civicrm_contribution_search( $params );


This call, unfortunately returns every single contribution.  Can someone suggest a call/parameter list that will return the query I desire?

Thanks,
--
Keith

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: Get contributions w/out thank-yous and receipts
November 09, 2009, 06:52:51 am

i dont think the api can do this, since the query needs to be the form:

thankyou_date IS NULL or receipt_date IS NULL

we dont have a protocol for specifying that in the params field. You might have to query the tables directly

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

prickeke

  • I post occasionally
  • **
  • Posts: 64
  • Karma: 4
Re: Get contributions w/out thank-yous and receipts
November 09, 2009, 09:12:18 am
The CiviContribute search allows this so it would be interesting to see the API improved to do something similar.  I've created an feature improvement issue here:

http://issues.civicrm.org/jira/browse/CRM-5365

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: Get contributions w/out thank-yous and receipts
November 09, 2009, 09:38:20 am

thanx for filing the issue. would be great for you to step up and also provide the patch that implements this within the contribution api (and potentially other search api's) along with a set of unit tests to validate the new functionality

We definitely need a lot more folks from the community to contribute more code and tests to help improve civicrm

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

prickeke

  • I post occasionally
  • **
  • Posts: 64
  • Karma: 4
Re: Get contributions w/out thank-yous and receipts
November 09, 2009, 09:39:45 am
Okay, since I am already knee deep I will take a look at this.  Where can I find how the params are parsed.  I tried looking in the code yesterday but I didn't see anything.  I didn't even see a complete list of what IS and is not supported for the $params array of any API call.

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: Get contributions w/out thank-yous and receipts
November 09, 2009, 11:49:21 am

you'll need to follow the code trail

most of the valid parameters that are processed are in CRM/Contribute/BAO/Query.php. The remaining are in CRM/Contact/BAO/Query.php

note that the custom field parameters are dynamic and based on the contents of the tables in each db

ping us on IRC if u have any questions

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

prickeke

  • I post occasionally
  • **
  • Posts: 64
  • Karma: 4
Re: Get contributions w/out thank-yous and receipts
November 10, 2009, 11:05:17 pm
What I am really after is printing thank-you letters to those who don't have a "thank-you" letter date set.  I'm thinking now I might copy the "receipt" printing capability that is currently in place from the contribution search menu.  Using the CiviContribute search I can already search for a thank-you date that "IS NULL."  Once I get my recipients I can generate a PDF, which is what I was going to do anyway.  I think I might generate some templates for a thank-you letter based off of how the print contribution receipts is already working. 

Any complaints?  Comments, suggestions?

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: Get contributions w/out thank-yous and receipts
November 11, 2009, 09:50:12 am
Sounds like an excellent feature addition. I'm wondering whether Thank-you letter content can come from a canned (although customizable) template.... OR if the sender will want to write / include a specific message each time they generate one or a batch of letters ???

If the latter, then perhaps the flow for the task should provide the user a textarea field to compose their message in step 2 - and then merge that into the template "shell" (which might contain header / footer / logo etc.).

Would be good to hear from other folks who have experience with this.
Protect your investment in CiviCRM by  becoming a Member!

prickeke

  • I post occasionally
  • **
  • Posts: 64
  • Karma: 4
Re: Get contributions w/out thank-yous and receipts
November 11, 2009, 10:21:04 am
I've always had it customizable with a textarea.  My logo, header, etc. was all hard-coded though, but I think I can make that all customizable as well on the same screen. 

My thought is that I will do a search on contributions, then select the contributions to send thank-yous for.  After that, click the drop-down menu and select "Print thank-you letters" (similar to how you can print contribution receipts today).  The "Print thank-you letters" screen will have the textarea and customization settings right there.  Once you fill out the form you can click Preview until you are satisfied with the PDFs and then you can click on save final and it will present your thank-you letters for printing or saving.

For my needs one of the features is that the thank-you date in the contribution is updated to the date that the letters were generated.  This allows me to track which contributions have had a thank-you letter sent or not for the next batch.

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: Get contributions w/out thank-yous and receipts
November 11, 2009, 03:14:11 pm
Keith  - you  might want to check out how HTML (and Text) message templates are now being handled for Contribution Receipts, Event Confirmations, etc. in 3.1 (alpha released today).

We are storing the layout (and "Smarty" template logic which handles conditional display of amounts, premiums, etc.) for each "workflow" in the msg_templates table in the DB. Some workflows - like offline Membership Signup receipting - allow the user to compose a specific message which then gets injected into a pre-determined spot in the template. The nice thing about this is that they layout / styling / logo stuff is controlled by the site admin(s) - and the user who is doing the task doesn't need to think about that stuff (which we assume is pretty static).

You can play with this a bit on the 3.1 sandbox (although emails are not sent - due to potential spam issues etc.).
http://sandbox.civicrm.org
Protect your investment in CiviCRM by  becoming a Member!

prickeke

  • I post occasionally
  • **
  • Posts: 64
  • Karma: 4
Re: Get contributions w/out thank-yous and receipts
November 11, 2009, 03:18:09 pm
Dave,

That is what I had in mind.  It's nice to see other people with the same ideas.  I'll check it out.


Thanks,
--
Keith

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Get contributions w/out thank-yous and receipts

This forum was archived on 2017-11-26.