From 68eaf03cd3b6b054dc6380ccae20e6d2a216d370 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Wed, 12 Jan 2022 00:11:11 +1300 Subject: [PATCH] Smarty notice fix on Email help I dug around a bit on how to deal with the endless 'params' notice in full-smarty-grump-mode and I decided the help file was being called multiple times - so even if it is assigned in the specific call for that id it isn't on the next call. I decided that I could look up the setting & permission from within the template but only wanted to do it once per template load so I split out a help file for that field (I didn't think a whole directory structure was warranted to I added a folder 'Help' and then the next folder is the main help filename with the file being the help id --- templates/CRM/Contact/Form/Task/Email.hlp | 19 ------------------- templates/CRM/Contact/Form/Task/Email.tpl | 4 ++-- .../Form/Task/Help/Email/id-from_email.hlp | 19 +++++++++++++++++++ .../CRM/Contribute/Form/AdditionalPayment.tpl | 2 +- .../CRM/Contribute/Form/Contribution.tpl | 2 +- .../CRM/Contribute/Form/Task/Invoice.hlp | 3 --- .../CRM/Contribute/Form/Task/Invoice.tpl | 2 +- templates/CRM/Contribute/Form/Task/PDF.tpl | 2 +- .../CRM/Contribute/Form/Task/PDFLetter.tpl | 2 +- templates/CRM/Event/Form/EventFees.tpl | 4 ++-- .../Event/Form/ParticipantFeeSelection.tpl | 2 +- templates/CRM/Member/Form/Membership.hlp | 9 --------- templates/CRM/Member/Form/Membership.tpl | 2 +- .../CRM/Member/Form/MembershipRenewal.tpl | 2 +- templates/CRM/Pledge/Form/Pledge.tpl | 2 +- 15 files changed, 32 insertions(+), 44 deletions(-) create mode 100644 templates/CRM/Contact/Form/Task/Help/Email/id-from_email.hlp diff --git a/templates/CRM/Contact/Form/Task/Email.hlp b/templates/CRM/Contact/Form/Task/Email.hlp index 9ae2dcb3df..408e94bc45 100644 --- a/templates/CRM/Contact/Form/Task/Email.hlp +++ b/templates/CRM/Contact/Form/Task/Email.hlp @@ -8,25 +8,6 @@ +--------------------------------------------------------------------+ *} {capture assign=tokentext}{ts}Find out more about CiviCRM Tokens{/ts}{/capture} -{htxt id="id-from_email-title"} - {ts}From Address{/ts} -{/htxt} -{htxt id="id-from_email"} -{if !empty($params.logged_in_email_setting) and $params.logged_in_email_setting == "1"} -

{ts}By default, CiviCRM uses the primary email address of the logged in user as the FROM address when sending emails to contacts. However, users with Administer CiviCRM permission can configure one or more general email addresses that can be selected as an alternative. EXAMPLE: "Client Services" <clientservices@example.org>{/ts}

-{else} -

{ts}CiviCRM is currently configured to only use the defined From Email addresses. If you wish to be able to use the email address of the logged in user as the From Address you will need to set the setting "Allow mail from logged in contact" setting. Users with Administer CiviCRM can set this setting in the SMTP settings.{/ts}

- {if !empty($params.isAdmin)} - {capture assign="smtpUrl"}{crmURL p="civicrm/admin/setting/smtp" q="reset=1"}{/capture} -

{ts 1=$smtpUrl}Go to Settings - Outbound Mail to enable the usage of the logged in contact's email address as the from email{/ts}

- {/if} -{/if} -{if !empty($params.isAdmin)} - {capture assign="fromConfig"}{crmURL p="civicrm/admin/options/from_email_address" q="reset=1"}{/capture} -

{ts 1=$fromConfig}Go to Administer CiviCRM » Communications » FROM Email Addresses to add or edit general email addresses. Make sure these email addresses are valid email accounts with your email service provider.{/ts}

-{/if} -{/htxt} - {htxt id="id-to_email-title"} {ts}To Address{/ts} {/htxt} diff --git a/templates/CRM/Contact/Form/Task/Email.tpl b/templates/CRM/Contact/Form/Task/Email.tpl index c9b9b138a0..927cabd713 100644 --- a/templates/CRM/Contact/Form/Task/Email.tpl +++ b/templates/CRM/Contact/Form/Task/Email.tpl @@ -14,11 +14,11 @@

{ts count=$suppressedEmails plural='Email will NOT be sent to %count contacts - (no email address on file, or communication preferences specify DO NOT EMAIL, or contact is deceased).'}Email will NOT be sent to %count contact - (no email address on file, or communication preferences specify DO NOT EMAIL, or contact is deceased).{/ts}

{/if} -{crmSetting var="logged_in_email_setting" name="allow_mail_from_logged_in_contact"} + - + diff --git a/templates/CRM/Contact/Form/Task/Help/Email/id-from_email.hlp b/templates/CRM/Contact/Form/Task/Help/Email/id-from_email.hlp new file mode 100644 index 0000000000..d0ca4c2994 --- /dev/null +++ b/templates/CRM/Contact/Form/Task/Help/Email/id-from_email.hlp @@ -0,0 +1,19 @@ +{htxt id="id-from_email-title"} + {ts}From Address{/ts} +{/htxt} +{htxt id="id-from_email"} +{crmSetting var="allow_mail_from_logged_in_contact" name="allow_mail_from_logged_in_contact"} +{if $allow_mail_from_logged_in_contact} +

{ts}By default, CiviCRM uses the primary email address of the logged in user as the FROM address when sending emails to contacts. However, users with Administer CiviCRM permission can configure one or more general email addresses that can be selected as an alternative. EXAMPLE: "Client Services" <clientservices@example.org>{/ts}

+{else} +

{ts}CiviCRM is currently configured to only use the defined From Email addresses. If you wish to be able to use the email address of the logged in user as the From Address you will need to set the setting "Allow mail from logged in contact" setting. Users with Administer CiviCRM can set this setting in the SMTP settings.{/ts}

+ {if call_user_func(array('CRM_Core_Permission','check'), 'administer CiviCRM')} + {capture assign="smtpUrl"}{crmURL p="civicrm/admin/setting/smtp" q="reset=1"}{/capture} +

{ts 1=$smtpUrl}Go to Settings - Outbound Mail to enable the usage of the logged in contact's email address as the from email{/ts}

+ {/if} +{/if} +{if call_user_func(array('CRM_Core_Permission','check'), 'administer CiviCRM')} + {capture assign="fromConfig"}{crmURL p="civicrm/admin/options/from_email_address" q="reset=1"}{/capture} +

{ts 1=$fromConfig}Go to Administer CiviCRM » Communications » FROM Email Addresses to add or edit general email addresses. Make sure these email addresses are valid email accounts with your email service provider.{/ts}

+{/if} +{/htxt} diff --git a/templates/CRM/Contribute/Form/AdditionalPayment.tpl b/templates/CRM/Contribute/Form/AdditionalPayment.tpl index 40049945e7..1f887ffb95 100644 --- a/templates/CRM/Contribute/Form/AdditionalPayment.tpl +++ b/templates/CRM/Contribute/Form/AdditionalPayment.tpl @@ -61,7 +61,7 @@ - + {/if} {if $contributionMode} diff --git a/templates/CRM/Contribute/Form/Contribution.tpl b/templates/CRM/Contribute/Form/Contribution.tpl index a0e62b165d..6bda33a8f5 100644 --- a/templates/CRM/Contribute/Form/Contribution.tpl +++ b/templates/CRM/Contribute/Form/Contribution.tpl @@ -217,7 +217,7 @@ {if empty($is_template)} - + {/if} {if empty($is_template)} diff --git a/templates/CRM/Contribute/Form/Task/Invoice.hlp b/templates/CRM/Contribute/Form/Task/Invoice.hlp index 3a64ef0dfe..fd235fe855 100644 --- a/templates/CRM/Contribute/Form/Task/Invoice.hlp +++ b/templates/CRM/Contribute/Form/Task/Invoice.hlp @@ -7,9 +7,6 @@ | and copyright information, see https://civicrm.org/licensing | +--------------------------------------------------------------------+ *} -{htxt id ="id-from_email-title"} - {ts}From Address{/ts} -{/htxt} {htxt id="content-intro-title"} {ts}Message Formats{/ts} {/htxt} diff --git a/templates/CRM/Contribute/Form/Task/Invoice.tpl b/templates/CRM/Contribute/Form/Task/Invoice.tpl index 777354f29f..208d0a8223 100644 --- a/templates/CRM/Contribute/Form/Task/Invoice.tpl +++ b/templates/CRM/Contribute/Form/Task/Invoice.tpl @@ -26,7 +26,7 @@ {/if} - + diff --git a/templates/CRM/Contribute/Form/Task/PDF.tpl b/templates/CRM/Contribute/Form/Task/PDF.tpl index ca5b3e1228..b799bac83c 100644 --- a/templates/CRM/Contribute/Form/Task/PDF.tpl +++ b/templates/CRM/Contribute/Form/Task/PDF.tpl @@ -21,7 +21,7 @@ - + diff --git a/templates/CRM/Contribute/Form/Task/PDFLetter.tpl b/templates/CRM/Contribute/Form/Task/PDFLetter.tpl index 22b090590e..701a68f4d6 100644 --- a/templates/CRM/Contribute/Form/Task/PDFLetter.tpl +++ b/templates/CRM/Contribute/Form/Task/PDFLetter.tpl @@ -36,7 +36,7 @@ - +
{if $single eq false}{ts}Recipient(s){/ts}{else}{$form.to.label}{/if}
{$form.output.pdf_receipt.html}{$form.email_options.html}
{$form.from_email_address.label} {help id="id-from_email" file="CRM/Contact/Form/Task/Email.hlp" isAdmin=$isAdmin}{$form.from_email_address.label} {help id="id-from_email" file="CRM/Contact/Form/Task/Help/Email/id-from_email.hlp"} {$form.from_email_address.html}
diff --git a/templates/CRM/Event/Form/EventFees.tpl b/templates/CRM/Event/Form/EventFees.tpl index 2274143108..a82fa8b2f4 100644 --- a/templates/CRM/Event/Form/EventFees.tpl +++ b/templates/CRM/Event/Form/EventFees.tpl @@ -105,7 +105,7 @@ {$form.from_email_address.label} - {$form.from_email_address.html} {help id="id-from_email" file="CRM/Contact/Form/Task/Email.hlp" isAdmin=$isAdmin} + {$form.from_email_address.html} {help id="id-from_email" file="CRM/Contact/Form/Task/Help/Email/id-from_email.hlp"} {$form.receipt_text.label} @@ -132,7 +132,7 @@ {$form.from_email_address.label} - {$form.from_email_address.html} {help id="id-from_email" file="CRM/Contact/Form/Task/Email.hlp" isAdmin=$isAdmin} + {$form.from_email_address.html} {help id="id-from_email" file="CRM/Contact/Form/Task/Help/Email/id-from_email.hlp"} {$form.receipt_text.label} diff --git a/templates/CRM/Event/Form/ParticipantFeeSelection.tpl b/templates/CRM/Event/Form/ParticipantFeeSelection.tpl index 5f89ee8a6d..f4972c8db2 100644 --- a/templates/CRM/Event/Form/ParticipantFeeSelection.tpl +++ b/templates/CRM/Event/Form/ParticipantFeeSelection.tpl @@ -143,7 +143,7 @@ CRM.$(function($) { {$form.from_email_address.label} - {$form.from_email_address.html} {help id="id-from_email" file="CRM/Contact/Form/Task/Email.hlp" isAdmin=$isAdmin} + {$form.from_email_address.html} {help id="id-from_email" file="CRM/Contact/Form/Task/Help/Email/id-from_email.hlp"} {$form.receipt_text.label} diff --git a/templates/CRM/Member/Form/Membership.hlp b/templates/CRM/Member/Form/Membership.hlp index 3e26e0ea0c..d8f9c28aa1 100644 --- a/templates/CRM/Member/Form/Membership.hlp +++ b/templates/CRM/Member/Form/Membership.hlp @@ -20,12 +20,3 @@ {/if} {/htxt} -{htxt id ="id-from_email"} -

{ts}Select the "FROM" Email Address for this mailing from the dropdown list. Available email addresses are configurable by users with Administer CiviCRM permission. EXAMPLE: "Client Services" <clientservices@example.org>{/ts}

-{if $params.isAdmin} - {capture assign="fromConfig"}{crmURL p="civicrm/admin/options/from_email_address" q="reset=1"}{/capture} -

{ts 1=$fromConfig}Go to Administer CiviCRM » Communications » FROM Email Addresses to add or edit email addresses. Make sure these email addresses are valid email accounts with your email service provider.{/ts}

-{else} - {ts}Contact your site administrator if you need to use a "FROM" Email Address which is not in the dropdown list.{/ts} -{/if} -{/htxt} diff --git a/templates/CRM/Member/Form/Membership.tpl b/templates/CRM/Member/Form/Membership.tpl index 4cf2f8d956..e35c0d60f2 100644 --- a/templates/CRM/Member/Form/Membership.tpl +++ b/templates/CRM/Member/Form/Membership.tpl @@ -198,7 +198,7 @@ {/if} {$form.from_email_address.label} - {$form.from_email_address.html} {help id="id-from_email" file="CRM/Contact/Form/Task/Email.hlp" isAdmin=$isAdmin} + {$form.from_email_address.html} {help id="id-from_email" file="CRM/Contact/Form/Task/Help/Email/id-from_email.hlp"} {$form.receipt_text.label} diff --git a/templates/CRM/Member/Form/MembershipRenewal.tpl b/templates/CRM/Member/Form/MembershipRenewal.tpl index 7aa5b9dff9..0c6afa812d 100644 --- a/templates/CRM/Member/Form/MembershipRenewal.tpl +++ b/templates/CRM/Member/Form/MembershipRenewal.tpl @@ -118,7 +118,7 @@ {$form.from_email_address.label} - {$form.from_email_address.html} {help id="id-from_email" file="CRM/Contact/Form/Task/Email.hlp" isAdmin=$isAdmin} + {$form.from_email_address.html} {help id="id-from_email" file="CRM/Contact/Form/Task/Help/Email/id-from_email.hlp"} {$form.receipt_text_renewal.label} diff --git a/templates/CRM/Pledge/Form/Pledge.tpl b/templates/CRM/Pledge/Form/Pledge.tpl index d49e3013be..b14178a710 100644 --- a/templates/CRM/Pledge/Form/Pledge.tpl +++ b/templates/CRM/Pledge/Form/Pledge.tpl @@ -99,7 +99,7 @@ {/if} {$form.from_email_address.label} - {$form.from_email_address.html} {help id="id-from_email" file="CRM/Contact/Form/Task/Email.hlp" isAdmin=$isAdmin} + {$form.from_email_address.html} {help id="id-from_email" file="CRM/Contact/Form/Task/Help/Email/id-from_email.hlp"} {$form.acknowledge_date.label} -- 2.25.1