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

Add participant tokens to pdf task #21695

Merged
merged 3 commits into from
Oct 5, 2021
Merged

Conversation

eileenmcnaughton
Copy link
Contributor

Overview

Add participant tokens to pdf task

Before

Only contact tokens available in pdf letter task

After

contact, domain, participant tokens available

Technical Details

I've got this working - but I'm gonna try to break it down a bit into some more PRs just to convince myself all the parts are correct.

Comments

@demeritcowboy this is on the pdf side - but the email side would wind up similar with the only difference being that I think on the email side we would have to check for enitty -specific tokens & if none then group by the contact id - ie 2 emails for a 2 contributions doesn't make sense if all the fields are identical.

@civibot
Copy link

civibot bot commented Oct 1, 2021

(Standard links)

@civibot civibot bot added the master label Oct 1, 2021
@eileenmcnaughton eileenmcnaughton force-pushed the submit branch 3 times, most recently from 8b46a40 to 8683eaf Compare October 1, 2021 23:23
@eileenmcnaughton
Copy link
Contributor Author

Fatal error: Cannot make non static method CRM_Core_Form_Task::getContactIds() static in class CRM_Contact_Form_Task in /home/jenkins/bknix-dfl/build/core-21695-3no2/web/sites/all/modules/civicrm/CRM/Contact/Form/Task.php on line 21

@colemanw
Copy link
Member

colemanw commented Oct 3, 2021

@eileenmcnaughton needs rebase

@eileenmcnaughton
Copy link
Contributor Author

@colemanw done - fyi #21696 is a sub-pr of this

@eileenmcnaughton
Copy link
Contributor Author

This PR is the last in the 'pdf tokens' strand of work - looking for someone to test so we can get it merged - maybe @magnolia61 ?

@magnolia61
Copy link
Contributor

I am glad to try and get this one tested as well.

Probably the cause is in my setup somewhere but I get
Fatal error: Allowed memory size of 536870912 bytes exhausted
I'll continue to test and keep you posted here.

@magnolia61
Copy link
Contributor

magnolia61 commented Oct 5, 2021

Result with pdf print/merge:
afbeelding

Same template but using scheduled reminders:
afbeelding

@eileenmcnaughton
Copy link
Contributor Author

@magnolia61 that's not good - can you past your message template text in here & I'll try it too

@magnolia61
Copy link
Contributor

<h2><strong>PARTICIPANT CORE</strong></h2>

<table border="1" bordercolor="#ccc" cellpadding="5" cellspacing="0" style="border-collapse: collapse; width: 100%;">
	<tbody>
		<tr>
			<td width="30%">Participant Rol</td>
			<td width="30%">participant.role : label</td>
			<td width="30%">{participant.role_id:label}</td>
		</tr>
		<tr>
			<td width="30%"> </td>
			<td width="30%">participant.role : name</td>
			<td width="30%">{participant.role_id:name}</td>
		</tr>
		<tr>
			<td width="30%">Participant Status</td>
			<td width="30%">participant.status : label</td>
			<td width="30%">{participant.status_id:label}</td>
		</tr>
		<tr>
			<td width="30%"> </td>
			<td width="30%">participant.status : name</td>
			<td width="30%">{participant.status_id:name}</td>
		</tr>
		<tr>
			<td width="30%">Participant Register Date</td>
			<td width="30%">participant.register_date</td>
			<td width="30%">{participant.register_date}</td>
		</tr>
		<tr>
			<td width="30%"> </td>
			<td width="30%">participant.register_date short</td>
			<td width="30%">{participant.register_date|crmDate:"shortdate"}</td>
		</tr>
		<tr>
			<td width="30%">Participant Wachtijst</td>
			<td width="30%">participant.must_wait</td>
			<td width="30%">{participant.must_wait}</td>
		</tr>
		<tr>
			<td width="30%">Participant Is_Paylater</td>
			<td width="30%">participant.is_pay_later</td>
			<td width="30%">{participant.is_pay_later}</td>
		</tr>
		<tr>
			<td width="30%">Participant ID</td>
			<td width="30%">participant.participant_id</td>
			<td width="30%">{participant.id}</td>
		</tr>
		<tr>
			<td width="30%">Participant Source</td>
			<td width="30%">participant.source</td>
			<td width="30%">{participant.source}</td>
		</tr>
		<tr>
			<td width="30%">Participant Is Test</td>
			<td width="30%">participant.is_test:label</td>
			<td width="30%">{participant.is_test:label}</td>
		</tr>
		<tr>
			<td width="30%"> </td>
			<td width="30%"> </td>
			<td width="30%"> </td>
		</tr>
	</tbody>
</table>

@magnolia61
Copy link
Contributor

I am glad to try and get this one tested as well.

Probably the cause is in my setup somewhere but I get Fatal error: Allowed memory size of 536870912 bytes exhausted I'll continue to test and keep you posted here.

This error only happens when I include the {participant.balance} token

@magnolia61
Copy link
Contributor

magnolia61 commented Oct 5, 2021

Same for event core tokens:
afbeelding

@eileenmcnaughton
Copy link
Contributor Author

@magnolia61 - I'll have to recheck this -will try to put something up after dinner

This simplifies the code to 'listtokens' across most of the pdf & email classes.

The case tokens are a bit of a hold out as ideally we would have
one function on CRM_Case_Form_Task which email & pdf would use
but we are still getting to that point - see
civicrm#21688
@eileenmcnaughton
Copy link
Contributor Author

@magnolia61 I think I found it

@magnolia61
Copy link
Contributor

magnolia61 commented Oct 5, 2021

Yeah! For the participant core tokens your latest changes work!

afbeelding
and also for participant custom tokens:
afbeelding

the event tokens remain empty though:
afbeelding

@eileenmcnaughton
Copy link
Contributor Author

@magnolia61 I think that last update might fix the event tokens

@magnolia61
Copy link
Contributor

@magnolia61 I think that last update might fix the event tokens

They still render empty with me...

@eileenmcnaughton
Copy link
Contributor Author

@magnolia61 looks like I had a change locally that I thought was extraneous - but wasn't - just pushed it in

@magnolia61
Copy link
Contributor

Bingo! that was it. Now also rendering event core and custom tokens

(only issue now is the empty custom date field anomaly listed here: https://lab.civicrm.org/dev/core/-/issues/2891 but that is not pdf creation specific)

@eileenmcnaughton
Copy link
Contributor Author

Thanks @magnolia61 - hopefully if tests pass this time this will be mergeable (@colemanw )

@eileenmcnaughton
Copy link
Contributor Author

@magnolia61 I think I found the fix for your date token issue - I've pushed a fix in + a test (cross fingers this doesn't send me down another round of test-whackamole :-)

@magnolia61
Copy link
Contributor

magnolia61 commented Oct 5, 2021

@magnolia61 I think I found the fix for your date token issue - I've pushed a fix in + a test (cross fingers this doesn't send me down another round of test-whackamole :-)

You did it. Empty custom date fields do not mess up the other tokens anymore
(and the other stuff still works as well)

@eileenmcnaughton
Copy link
Contributor Author

@magnolia61 Yay - depending how this goes with getting merged & the other ones on the path (#21706 #21705 & #21688 & #21676) I might have a go at squeezing in participant tokens for email before the rc is cut - there is a bit of a gotcha there though https://lab.civicrm.org/dev/core/-/issues/2862

@magnolia61
Copy link
Contributor

Test passed ✅

@colemanw
Copy link
Member

colemanw commented Oct 5, 2021

Merging based on review from @magnolia61

@colemanw colemanw merged commit 110dbc7 into civicrm:master Oct 5, 2021
@colemanw colemanw deleted the submit branch October 5, 2021 15:22
@eileenmcnaughton
Copy link
Contributor Author

yay - thanks for your work on this @magnolia61

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.

3 participants