X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=templates%2FCRM%2FMember%2FForm%2FMembership.tpl;h=178993f02cceaf606596c9c5dde74b282d70c66f;hb=8c80f3f9e9d6726f4ff060cf4c16d76d8a975450;hp=f577373959e81d85fe3f64ac9e59b45d8f9c6c1b;hpb=23ce7183ccd99b5d6ff4ed36eda0610cf8820a02;p=civicrm-core.git
diff --git a/templates/CRM/Member/Form/Membership.tpl b/templates/CRM/Member/Form/Membership.tpl
index f577373959..178993f02c 100644
--- a/templates/CRM/Member/Form/Membership.tpl
+++ b/templates/CRM/Member/Form/Membership.tpl
@@ -174,12 +174,12 @@
{/if}
{include file="CRM/Member/Form/MembershipCommon.tpl"}
- {if $emailExists and $outBound_option != 2}
+ {if $emailExists and $isEmailEnabledForSite}
{$form.send_receipt.label} | {$form.send_receipt.html}
{ts 1=$emailExists}Automatically email a membership confirmation and receipt to %1 ?{/ts} {ts}OR if the payment is from a different contact, this email will only go to them.{/ts} |
- {elseif $context eq 'standalone' and $outBound_option != 2}
+ {elseif $context eq 'standalone' and $isEmailEnabledForSite}
{$form.send_receipt.label} | {$form.send_receipt.html}
{ts}Automatically email a membership confirmation and receipt to {/ts}? {ts}OR if the payment is from a different contact, this email will only go to them.{/ts} |
@@ -377,35 +377,36 @@
}
}
-
- {/literal}
+ function showEmailOptions() {
+ {/literal}
+ // @todo emailExists refers to the primary contact for the page.
+ // elsewhere some script determines if there is a paying contact the
+ // email should go to instead (e.g gift membership). This should be checked for here
+ // and that merged into that code as currently behaviour is inconsistent.
+ var emailExists = '{$emailExists}';
+ var isStandalone = ('{$context}' == 'standalone');
+ var isEmailEnabledForSite = {$isEmailEnabledForSite};
- {if ($emailExists and $outBound_option != 2) OR $context eq 'standalone' }
- {include file="CRM/common/showHideByFieldValue.tpl"
- trigger_field_id ="send_receipt"
- trigger_value =""
- target_element_id ="notice"
- target_element_type ="table-row"
- field_type ="radio"
- invert = 0
- }
- {include file="CRM/common/showHideByFieldValue.tpl"
- trigger_field_id ="send_receipt"
- trigger_value =""
- target_element_id ="fromEmail"
- target_element_type ="table-row"
- field_type ="radio"
- invert = 0
- }
- {/if}
- {literal}
+ {literal}
+ var isEmailable = (isEmailEnabledForSite && (emailExists || isStandalone));
+ if (isEmailable && cj('#send_receipt').prop('checked') && !cj('#auto_renew').prop('checked')) {
+ // Hide extra message and from email for recurring as they cannot be stored until use.
+ cj('#notice').show();
+ cj('#fromEmail').show();
+ }
+ else {
+ cj('#notice').hide();
+ cj('#fromEmail').hide();
+ }
+ }
+