Skip to content

Commit

Permalink
Merge pull request civicrm#18 from seamuslee001/CRM-17635-4.6
Browse files Browse the repository at this point in the history
Crm 17635 4.6
  • Loading branch information
eileenmcnaughton committed Feb 5, 2016
2 parents dbebaa4 + 47498fb commit df078f6
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 45 deletions.
3 changes: 2 additions & 1 deletion CRM/Member/Form/Membership.php
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,7 @@ public function buildQuickForm() {
$this->addElement('checkbox',
'send_receipt',
ts('Send Confirmation and Receipt?'), NULL,
array('onclick' => "showHideByValue( 'send_receipt', '', 'notice', 'table-row', 'radio', false); showHideByValue( 'send_receipt', '', 'fromEmail', 'table-row', 'radio', false);")
array('onclick' => "showEmailOptions()")
);

$this->add('select', 'from_email_address', ts('Receipt From'), $this->_fromEmails);
Expand Down Expand Up @@ -746,6 +746,7 @@ public function buildQuickForm() {
'mailing_backend'
);
$this->assign('outBound_option', $mailingInfo['outBound_option']);
$this->assign('isEmailEnabledForSite', ($mailingInfo['outBound_option'] != 2));

parent::buildQuickForm();
}
Expand Down
72 changes: 28 additions & 44 deletions templates/CRM/Member/Form/Membership.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -278,11 +278,13 @@
<tr id="send-receipt" class="crm-membership-form-block-send_receipt">
<td class="label">{$form.send_receipt.label}</td><td>{$form.send_receipt.html}<br />
<span class="description">{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}</span></td>
<span class="auto-renew-text">{ts}For auto-renewing memberships the emails are sent when each payment is received{/ts}</span>
</tr>
{elseif $context eq 'standalone' and $outBound_option != 2 }
<tr id="email-receipt" style="display:none;">
<td class="label">{$form.send_receipt.label}</td><td>{$form.send_receipt.html}<br />
<span class="description">{ts}Automatically email a membership confirmation and receipt to {/ts}<span id="email-address"></span>? {ts}OR if the payment is from a different contact, this email will only go to them.{/ts}</span></td>
<span class="auto-renew-text">{ts}For auto-renewing memberships the emails are sent when each payment is received{/ts}</span>
</tr>
{/if}
<tr id="fromEmail" style="display:none;">
Expand Down Expand Up @@ -479,26 +481,30 @@
</script>
{/literal}
{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}
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};
{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();
}
}
</script>
<script type="text/javascript">
{/literal}{if !$membershipMode}{literal}
Expand Down Expand Up @@ -551,6 +557,7 @@
if ( $(this).attr( 'readonly' ) ) {
$(this).prop('checked', true );
}
showEmailOptions();
});
}
Expand Down Expand Up @@ -627,6 +634,7 @@
if ( !processorId || !membershipType ) {
cj("#auto_renew").prop('checked', false );
cj("#autoRenew").hide( );
showEmailOptions();
return;
}
Expand Down Expand Up @@ -656,36 +664,12 @@
cj("#auto_renew").prop('checked', false );
cj("#autoRenew").hide( );
}
//play w/ receipt option.
if ( cj("#auto_renew").prop('checked' ) ) {
cj("#notice").hide( );
cj("#send_receipt").prop('checked', false );
cj("#send-receipt").hide( );
}
else {
cj("#send-receipt").show( );
if ( cj("#send_receipt").prop('checked' ) ) {
cj("#notice").show( );
}
}
showEmailOptions();
}
{/literal}
{/if}
{literal}
function buildReceiptANDNotice( ) {
if ( cj("#auto_renew").prop('checked' ) ) {
cj("#notice").hide( );
cj("#send-receipt").hide( );
}
else {
cj("#send-receipt").show( );
if ( cj("#send_receipt").prop('checked' ) ) {
cj("#notice").show( );
}
}
}
var customDataType = '{/literal}{$customDataType}{literal}';
Expand Down

0 comments on commit df078f6

Please sign in to comment.