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 Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Print PDF Letter from Activities Display
Pages: [1]

Author Topic: Print PDF Letter from Activities Display  (Read 653 times)

unclejustin

  • I post occasionally
  • **
  • Posts: 38
  • Karma: 2
  • CiviCRM version: 4.3.x
  • CMS version: Drupal 7.x
  • MySQL version: 5.5
  • PHP version: 5.3.6
Print PDF Letter from Activities Display
November 30, 2011, 03:32:47 pm
I have an advanced search that I run based on activity. Works like a champ. I find all contacts with a given activity type and select "Print PDF Letter..." from the drop down which prints the letter I need perfectly. What I'm trying to do is find a way to sort based on when the activity was performed. If I change the display to Activity I can sort just like I want, but I can no longer print.

Is there a way to either sort by activity date on the contact display, or to print from activity display? Maybe some other way to skin this cat?
-justin

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: Print PDF Letter from Activities Display
November 30, 2011, 04:31:54 pm

I think the easiest option right now might be to add a "Print PDF Letter" to the list of tasks displayed when doing an activity from the activity search

There has been a long standing need to add the common tasks across all the searches. Would be good if someone can help shepherd the development of this. We can help out on IRC. Would be a great add for 4.2

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

unclejustin

  • I post occasionally
  • **
  • Posts: 38
  • Karma: 2
  • CiviCRM version: 4.3.x
  • CMS version: Drupal 7.x
  • MySQL version: 5.5
  • PHP version: 5.3.6
Re: Print PDF Letter from Activities Display
December 02, 2011, 09:42:30 am
Thanks Lobo, this helped a ton. Got it working, here's what I did using this as a guide as well http://wiki.civicrm.org/confluence/display/CRMDOC33/How+to+Add+Actions+to+the+Contact+Search+Dropdown

I copied the files I needed into my Drupal site's files directory as per my configuration. Changed all the "Contact" to "Activity" where relevant. And added this code:

Code: [Select]
foreach ($form->_activityHolderIds as $item => $aid) {
      $activity = civicrm_api("Activity","get", array ('version' =>'3', 'id' =>$aid));
      $cid = $activity['values'][$aid]['source_contact_id'];
      $form->_contactIds[] = $cid;
    }

Needed that because Activity does not populate the contact ids that are needed to run the rest of the script. Not sure if there is an easier way or not, but this worked for me. Thanks again Lobo!
-justin

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: Print PDF Letter from Activities Display
December 02, 2011, 11:59:00 am

cool. glad u got it working :)

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

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Print PDF Letter from Activities Display

This forum was archived on 2017-11-26.