-
-
Notifications
You must be signed in to change notification settings - Fork 825
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 userEnteredText as generic workflow template smarty variable #27162
Conversation
Thank you for contributing to CiviCRM! ❤️ We will need to test and review the PR. 👷 Introduction for new contributors
Quick links for reviewers |
protected $userEnteredText; | ||
|
||
public function getUserEnteredText(): ?string { | ||
return $this->userEnteredText ? htmlentities($this->userEnteredText): NULL; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure if this is best - but we should probably do some form of escaping
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would apply to text templates too, right? So I don't think we can (unless there's something that decodes them for that somewhere).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think I understand this as a generic thing that applies to all message types. It smells more like a reusable trait
.
Re: escaping - the main thing is to be clear about the intended format: plain text or rich text (HTML)?
- If content comes from an existing source, then it's an empirical question - what is that source? (If it's new content, then I guess it's discretionary - but still needs to be explicit.)
- If the content is plain-text, then any HTML email generator needs HTML-ization -- escaping at a minimum and/or maybe some newline handling. (Plain text email generators won't that stuff.)
- If the content is rich-text, then any HTML email generator should use a purifier. (Plain text email generators should use
striptags
orhtml2text
.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm - I was thinking this was something generic enough to put in the 'all template' category - so that any workflow template from a form could include user content. Currently not all of them do - but where they do then I think any text could be entered - it it is coming from a free-text quick form input box
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think moving towards being able to add user content to pretty much any message template being sent would be a good thing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the HTML versus plain text issue, see also #27173. I think it would make sense to have the user_text and the various receipt_texts all be HTML in the long run, then strip for plain text emails. It should be possible to use links in both the user_text and the receipt_texts. Our users have definitely complained about this in the past.
Approach makes sense to me. |
318e34a
to
a2d7a6f
Compare
@larssandergreen I updated to just have different variables for the html & plain versions |
a2d7a6f
to
3462bc6
Compare
b90fd11
to
c885b1b
Compare
@larssandergreen I've come back to this & I think addressed the issues - ie
I'm still pondering a follow up that would move this chunk into the userEnteredText - effectively moving that to the
|
This follows our historical practice of doing push receipts by - adding the relevant receipt to the array of template in the upgrade notification and - (optionally) noting deprecated params on CRM_Utils_Token::getDeprecatedTokens I didn't add lineItem to the deprecated array as it is pretty legit to assign that within a foreach loop. I also removed the assigns for the variables which are no longer relevant - this can be followed up with more tidy up (some of which resolves php8.x issues) Note that the template still uses $billingName & $address - resolved in civicrm#27692 $customGroup - resolved in civicrm#27596 (actually the variable remains but becomes non-leaky) $credit_card_date,$credit_card_type (I propose moving to a paymet token) $credit_card_expiry (I propose removing) $event.confirm_text - addressed in civicrm#27162
This follows our historical practice of doing push receipts by - adding the relevant receipt to the array of template in the upgrade notification and - (optionally) noting deprecated params on CRM_Utils_Token::getDeprecatedTokens I didn't add lineItem to the deprecated array as it is pretty legit to assign that within a foreach loop. I also removed the assigns for the variables which are no longer relevant - this can be followed up with more tidy up (some of which resolves php8.x issues) Note that the template still uses $billingName & $address - resolved in civicrm#27692 $customGroup - resolved in civicrm#27596 (actually the variable remains but becomes non-leaky) $credit_card_date,$credit_card_type (I propose moving to a paymet token) $credit_card_expiry (I propose removing) $event.confirm_text - addressed in civicrm#27162
This follows our historical practice of doing push receipts by - adding the relevant receipt to the array of template in the upgrade notification and - (optionally) noting deprecated params on CRM_Utils_Token::getDeprecatedTokens I didn't add lineItem to the deprecated array as it is pretty legit to assign that within a foreach loop. I also removed the assigns for the variables which are no longer relevant - this can be followed up with more tidy up (some of which resolves php8.x issues) Note that the template still uses $billingName & $address - resolved in civicrm#27692 $customGroup - resolved in civicrm#27596 (actually the variable remains but becomes non-leaky) $credit_card_date,$credit_card_type (I propose moving to a paymet token) $credit_card_expiry (I propose removing) $event.confirm_text - addressed in civicrm#27162
This follows our historical practice of doing push receipts by - adding the relevant receipt to the array of template in the upgrade notification and - (optionally) noting deprecated params on CRM_Utils_Token::getDeprecatedTokens I didn't add lineItem to the deprecated array as it is pretty legit to assign that within a foreach loop. I also removed the assigns for the variables which are no longer relevant - this can be followed up with more tidy up (some of which resolves php8.x issues) Note that the template still uses $billingName & $address - resolved in civicrm#27692 $customGroup - resolved in civicrm#27596 (actually the variable remains but becomes non-leaky) $credit_card_date,$credit_card_type (I propose moving to a paymet token) $credit_card_expiry (I propose removing) $event.confirm_text - addressed in civicrm#27162
This follows our historical practice of doing push receipts by - adding the relevant receipt to the array of template in the upgrade notification and - (optionally) noting deprecated params on CRM_Utils_Token::getDeprecatedTokens I didn't add lineItem to the deprecated array as it is pretty legit to assign that within a foreach loop. I also removed the assigns for the variables which are no longer relevant - this can be followed up with more tidy up (some of which resolves php8.x issues) Note that the template still uses $billingName & $address - resolved in civicrm#27692 $customGroup - resolved in civicrm#27596 (actually the variable remains but becomes non-leaky) $credit_card_date,$credit_card_type (I propose moving to a paymet token) $credit_card_expiry (I propose removing) $event.confirm_text - addressed in civicrm#27162
74aa2ab
to
b096fb8
Compare
This follows our historical practice of doing push receipts by - adding the relevant receipt to the array of template in the upgrade notification and - (optionally) noting deprecated params on CRM_Utils_Token::getDeprecatedTokens I didn't add lineItem to the deprecated array as it is pretty legit to assign that within a foreach loop. I also removed the assigns for the variables which are no longer relevant - this can be followed up with more tidy up (some of which resolves php8.x issues) Note that the template still uses $billingName & $address - resolved in civicrm#27692 $customGroup - resolved in civicrm#27596 (actually the variable remains but becomes non-leaky) $credit_card_date,$credit_card_type (I propose moving to a paymet token) $credit_card_expiry (I propose removing) $event.confirm_text - addressed in civicrm#27162
This follows our historical practice of doing push receipts by - adding the relevant receipt to the array of template in the upgrade notification and - (optionally) noting deprecated params on CRM_Utils_Token::getDeprecatedTokens I didn't add lineItem to the deprecated array as it is pretty legit to assign that within a foreach loop. I also removed the assigns for the variables which are no longer relevant - this can be followed up with more tidy up (some of which resolves php8.x issues) Note that the template still uses $billingName & $address - resolved in civicrm#27692 $customGroup - resolved in civicrm#27596 (actually the variable remains but becomes non-leaky) $credit_card_date,$credit_card_type (I propose moving to a paymet token) $credit_card_expiry (I propose removing) $event.confirm_text - addressed in civicrm#27162
This follows our historical practice of doing push receipts by - adding the relevant receipt to the array of template in the upgrade notification and - (optionally) noting deprecated params on CRM_Utils_Token::getDeprecatedTokens I didn't add lineItem to the deprecated array as it is pretty legit to assign that within a foreach loop. I also removed the assigns for the variables which are no longer relevant - this can be followed up with more tidy up (some of which resolves php8.x issues) Note that the template still uses $billingName & $address - resolved in civicrm#27692 $customGroup - resolved in civicrm#27596 (actually the variable remains but becomes non-leaky) $credit_card_date,$credit_card_type (I propose moving to a paymet token) $credit_card_expiry (I propose removing) $event.confirm_text - addressed in civicrm#27162
b096fb8
to
3435635
Compare
3435635
to
77f813d
Compare
This makes userEnteredText a property across all WorkflowMessages - with it outputting the smarty variable user_text We already had receipt_text on the membership forms - but that is a bit too specific - user is perhaps a bit impersonal - I did contemplate form_text :
all passed except style |
77f813d
to
40bce8b
Compare
I can take a look at this tomorrow. |
thanks @demeritcowboy |
I get |
Thanks @demeritcowboy - that invoice one looks like an easy fix - have you looked at a code fix? |
I think this change has introduced a problem, as reported here https://lab.civicrm.org/dev/core/-/issues/5025 |
Overview
This makes userEnteredText a property across all WorkflowMessages - with it outputting the smarty variable user_text
We already had receipt_text on the membership forms - but that is a bit too specific
Before
What is the old user-interface or technical-contract (as appropriate)?
For optimal clarity, include a concrete example such as a screenshot, GIF (LICEcap, SilentCast), or code-snippet.
After
What changed? What is new old user-interface or technical-contract?
For optimal clarity, include a concrete example such as a screenshot, GIF (LICEcap, SilentCast), or code-snippet.
Technical Details
If the PR involves technical details/changes/considerations which would not be manifest to a casual developer skimming the above sections, please describe the details here.
Comments
Anything else you would like the reviewer to note