Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CRM-16734 participant tokens in participant pdf #8260

Conversation

johanv
Copy link
Contributor

@johanv johanv commented Apr 27, 2016

Continued @mallezie's work for CRM-16734 (participant tokens in PDF letters for participants). This pull request is a continuation of #8258, which provides event tokens for PDF letters to participants (CRM-16599). Now you can create PDF letters like this:

Hi {contact.first_name},

This is your letter. You subscribed for {event.title}; the event fee amount was {participant.participant_fee_amount}.


Tim Mallezie and others added 16 commits April 27, 2016 15:11
----------------------------------------
* CRM-16599: Add event tokens to participant pdf creation
  https://issues.civicrm.org/jira/browse/CRM-16599
fee_amount is a property of a participant, not of an event.

----------------------------------------
* CRM-16599: Add event tokens to participant pdf creation
  https://issues.civicrm.org/jira/browse/CRM-16599
Custom tokens defined with hook_civicrm_tokens and
hook_civicrm_tokenValues were ignored. This commit fixes
that problem.

----------------------------------------
* CRM-16734: Add participant tokens to participant pdf action
  https://issues.civicrm.org/jira/browse/CRM-16734
----------------------------------------
* CRM-15734: Dedupe contacts in group searches outside of group
  https://issues.civicrm.org/jira/browse/CRM-15734

----------------------------------------
* CRM-16734: Add participant tokens to participant pdf action
  https://issues.civicrm.org/jira/browse/CRM-16734
I think this is needed since CiviCRM 4.7.

----------------------------------------
* CRM-15734: Dedupe contacts in group searches outside of group
  https://issues.civicrm.org/jira/browse/CRM-15734

----------------------------------------
* CRM-16734: Add participant tokens to participant pdf action
  https://issues.civicrm.org/jira/browse/CRM-16734
----------------------------------------
* CRM-16734: Add participant tokens to participant pdf action
  https://issues.civicrm.org/jira/browse/CRM-16734

switch ($token) {
case 'balance':
$info = CRM_Contribute_BAO_Contribution::getPaymentInfo($params['participant_id'], 'event');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no key participant_id in the $params array.

@agh1
Copy link
Contributor

agh1 commented May 21, 2016

Thanks @johanv and @mallezie for all of this. This looks super-promising.

Unfortunately, it has some buggy things that should be worked out. I'm happy to help with these, but I don't think this will be ready to go for 4.7.8. Some things to address:

  • The {participant.participant_status_id} token gives you an integer, and there's no way to get the actual role label.
  • The {participant.participant_register_date} token is in the format YYYY-MM-DD HH:MM:SS. While different people might want different formats, that is probably the one format that nobody wants.
  • {participant.participant_fee_amount} could be combined with {participant.currency}, but CiviCRM has better ways to localize the amount. Currently, the token just gives you a number.
  • {event.location} is presented all in one line. I wonder if this could be broken into multiple tokens.
  • {event.fee_amount} is blank, at least in all of my examples. I notice a comment that it was removed: I wonder if it just needs to be excluded from the tokens list.
  • {event.balance} causes a fatal error (due to the issue in the note above). Anyway, the balance will be per-participant.
  • The miscellaneous small things in the inline notes should be resolved.

Looking through this, I feel like this and other token use cases need test coverage. It doesn't appear that there's anything at the moment.

@agh1
Copy link
Contributor

agh1 commented May 21, 2016

One separate note: I don't think this has anything to do with this issue, but I was getting an error trying to generate a PDF at all because vendor/dompdf/dompdf/lib/html5lib/Parser.php requires vendor/dompdf/dompdf/lib/html5lib/TreeBuilder.php, but TreeBuilder.php is deleted in tools/scripts/composer/dompdf-cleanup.sh. Commenting out the line in Parser.php that requires TreeBuilder.php makes everything work just fine, however.

@totten
Copy link
Member

totten commented May 21, 2016

@agh1 @xurizaemon - the TreeBuilder.php comment seems like a recent regression from #7991. Since it's tangential to this PR, suggest any further follow-up on TreeBuilder.php be on proposed fix #8419.

----------------------------------------
* CRM-16734: Add participant tokens to participant pdf action
  https://issues.civicrm.org/jira/browse/CRM-16734
Let's just remove it. Probably a copy-paste error somewhere.

----------------------------------------
* CRM-16734: Add participant tokens to participant pdf action
  https://issues.civicrm.org/jira/browse/CRM-16734
I hope CiviCRM will use the preferred format of the user now.

----------------------------------------
* CRM-16734: Add participant tokens to participant pdf action
  https://issues.civicrm.org/jira/browse/CRM-16734
----------------------------------------
* CRM-16734: Add participant tokens to participant pdf action
  https://issues.civicrm.org/jira/browse/CRM-16734
@eileenmcnaughton
Copy link
Contributor

@agh1 Can you check this again?

@jitendrapurohit
Copy link
Contributor

While working on QA for this PR, I found some minor issues related to the above changes after the update-

  1. Use of participant.role, participant.role_id tokens is displayed as Array and not the values for it.
  2. The {participant.participant_status_id} token gives you an integer. It should actually display as label.
  3. participant.transferred_to_contact_id token doesn't seem to be working.
  4. event.fee_amount is blank as @agh1 mentioned.
  5. Found some set of e-notices - http://goo.gl/iD1C8P

@johanv
Copy link
Contributor Author

johanv commented Sep 14, 2016

I will look at @jitendrapurohit 's comments, probably next week, but i will do some cleanup in this code first.

@eileenmcnaughton
Copy link
Contributor

It would be great if you would do a rebase -i on this & squash some patches

@johanv
Copy link
Contributor Author

johanv commented Sep 14, 2016

This PR is replaced by #9038.

@johanv johanv closed this Sep 14, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants