[REF] Complete decommissioning of CRM/Contribute/Form/Task/PDFLetterCommon.php #20172
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
[REF] Complete decommissioning of CRM/Contribute/Form/Task/PDFLetterCommon.php - a class which caused the functionality of
CRM/Contribute/Form/Task/PDFLetter
to be 'spread' across 2 classesThis removes the last function fromCRM/Contribute/Form/Task/PDFLetterCommon.php, allowing the file to be deleted.
Before
Resolve tokens on CRM/Contribute/Form/Task/PDFLetterCommon.php
After
Resolve tokens on CRM/Contribute/Form/Task/PDFLetter.php , CRM/Contribute/Form/Task/PDFLetterCommon.php deleted
Technical Details
The function was calling a protected function on the parent which had to be unravelled.
I used the method we used in
civicrm-core/CRM/SMS/Form/Upload.php
Line 341 in 5e67eb7
to replace the code with the part that we have tested as being done in via render - ie replacing
hook, contact, domain tokens & smarty parsing.
However, there are quite a few tests on this code & one checked that we don't over-call
the token hook. I added some caching for the results of this hook so we can start to
eliminate these but I also allowed the calls to increment by 1 because it is not 1 per row
I made the results of this hook optional to replaceHookTokens & in general I think that
is the only place it needs to be called - perhaps once it used to pass more parameters &
the results were dynamic but now they really aren't
Comments
@seamuslee001 this change is pretty similar to the other you merged, test cover is good