2 +--------------------------------------------------------------------+
4 +--------------------------------------------------------------------+
5 | Copyright CiviCRM LLC (c) 2004-2019 |
6 +--------------------------------------------------------------------+
7 | This file is a part of CiviCRM. |
9 | CiviCRM is free software; you can copy, modify, and distribute it |
10 | under the terms of the GNU Affero General Public License |
11 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
13 | CiviCRM is distributed in the hope that it will be useful, but |
14 | WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
16 | See the GNU Affero General Public License for more details. |
18 | You should have received a copy of the GNU Affero General Public |
19 | License and the CiviCRM Licensing Exception along |
20 | with this program; if not, contact CiviCRM LLC |
21 | at info[AT]civicrm[DOT]org. If you have questions about the |
22 | GNU Affero General Public License or the licensing of CiviCRM, |
23 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
24 +--------------------------------------------------------------------+
26 {* this template is used for renewing memberships for a contact *}
27 {if $membershipMode == 'test' }
28 {assign var=registerMode value="TEST"}
29 {elseif $membershipMode == 'live'}
30 {assign var=registerMode value="LIVE"}
33 <div class="messages status no-popup">
34 <div class="icon inform-icon"></div>
35 <p>{ts}You will not be able to send an automatic email receipt for this Renew Membership because there is no email address recorded for this contact. If you want a receipt to be sent when this Membership is recorded, click Cancel and then click Edit from the Summary tab to add an email address before Renewal the Membership.{/ts}</p>
40 {ts 1=$displayName 2=$registerMode}Use this form to Renew Membership Record on behalf of %1.
41 <strong>A %2 transaction will be submitted</strong>
42 using the selected payment processor.{/ts}
47 <div class="messages status no-popup">
48 <div class="icon inform-icon"></div>
49 <p>{ts 1=$cancelAutoRenew}This membership is set to renew automatically {if $renewalDate}on {$renewalDate|crmDate}{/if}. You will need to cancel the auto-renew option if you want to modify the Membership Type, End Date or Membership Status.
50 <a href="%1">Click here</a>
51 if you want to cancel the automatic renewal option.{/ts}</p>
55 <div class="crm-block crm-form-block crm-member-membershiprenew-form-block">
56 <div id="help" class="description">
57 {ts}Renewing will add the normal membership period to the End Date of the previous period for members whose status is Current or Grace. For Expired memberships, renewing will create a membership period commencing from the 'Date Renewal Entered'. This date can be adjusted including being set to the day after the previous End Date - if continuous membership is required.{/ts}
59 <div>{include file="CRM/common/formButtons.tpl" location="top"}</div>
60 <table class="form-layout">
61 <tr class="crm-member-membershiprenew-form-block-org_name">
62 <td class="label">{ts}Membership Organization and Type{/ts}</td>
63 <td class="html-adjust">{$orgName} - {$memType}
64 {if $member_is_test} {ts}(test){/ts}{/if}
65 <a id="changeMembershipOrgType" href='#'
66 onclick='adjustMembershipOrgType(); return false;'>{ts}change membership type{/ts}</a>
69 <tr id="membershipOrgType" class="crm-member-membershiprenew-form-block-renew_org_name hiddenElement">
70 <td class="label">{$form.membership_type_id.label}</td>
71 <td>{$form.membership_type_id.html}
72 {if $member_is_test} {ts}(test){/ts}{/if}<br/>
73 <span class="description">{ts}Select Membership Organization and then Membership Type.{/ts}</span>
76 <tr class="crm-member-membershiprenew-form-block-membership_status">
77 <td class="label">{ts}Membership Status{/ts}</td>
78 <td class="html-adjust"> {$membershipStatus}<br/>
79 <span class="description">{ts}Status of this membership.{/ts}</span></td>
81 <tr class="crm-member-membershiprenew-form-block-end_date">
82 <td class="label">{ts}Membership End Date{/ts}</td>
83 <td class="html-adjust"> {$endDate}</td>
85 <tr class="crm-member-membershiprenew-form-block-renewal_date">
86 <td class="label">{$form.renewal_date.label}</td>
87 <td>{$form.renewal_date.html}</td>
89 <tr id="defaultNumTerms" class="crm-member-membershiprenew-form-block-default-num_terms">
90 <td colspan="2" class="description">
91 {ts}Renewal extends membership end date by one membership period{/ts}
92 <a id="changeTermsLink" href='#'
93 onclick='changeNumTerms(); return false;'>{ts}change{/ts}</a>
96 <tr id="changeNumTerms" class="crm-member-membershiprenew-form-block-change-num_terms">
97 <td class="label">{$form.num_terms.label}</td>
98 <td>{$form.num_terms.html|crmAddClass:two} {ts}membership periods{/ts}<br/>
100 class="description">{ts}Extend the membership end date by this many membership periods. Make sure the appropriate corresponding fee is entered below.{/ts}</span>
103 {if $accessContribution and ! $membershipMode}
104 <tr class="crm-member-membershiprenew-form-block-record_contribution">
105 <td class="label">{$form.record_contribution.label}</td>
106 <td class="html-adjust">{$form.record_contribution.html}<br/>
108 class="description">{ts}Check this box to enter payment information. You will also be able to generate a customized receipt.{/ts}</span>
111 <tr id="recordContribution" class="crm-member-membershiprenew-form-block-membership_renewal">
114 <legend>{ts}Renewal Payment and Receipt{/ts}</legend>
116 {include file="CRM/Member/Form/MembershipCommon.tpl"}
118 {if $emailExists and $outBound_option != 2}
119 <table class="form-layout">
120 <tr class="crm-{$formClass}-form-block-send_receipt">
121 <td class="label">{$form.send_receipt.label}</td>
122 <td>{$form.send_receipt.html}<br/>
123 <span class="description">{ts 1=$emailExists}Automatically email a membership confirmation and receipt to %1?{/ts}</span>
127 <td class="label">{$form.from_email_address.label}</td>
128 <td>{$form.from_email_address.html} {help id="id-from_email" file="CRM/Contact/Form/Task/Email.hlp" isAdmin=$isAdmin}</td>
130 <tr id="notice" class="crm-member-membershiprenew-form-block-receipt_text_renewal">
131 <td class="label">{$form.receipt_text_renewal.label}</td>
133 class="description">{ts}Enter a message you want included at the beginning of the emailed receipt. EXAMPLE: 'Thanks for supporting our organization with your membership.'{/ts}</span><br/>
134 {$form.receipt_text_renewal.html|crmAddClass:huge}</td>
139 {include file="CRM/common/customDataBlock.tpl"}
141 <div>{include file="CRM/common/formButtons.tpl" location="bottom"}</div>
143 <div class="spacer"></div>
145 {if $accessContribution and ! $membershipMode}
146 {include file="CRM/common/showHideByFieldValue.tpl"
147 trigger_field_id ="record_contribution"
149 target_element_id ="recordContribution"
150 target_element_type ="table-row"
156 {if $email and $outBound_option != 2}
157 {include file="CRM/common/showHideByFieldValue.tpl"
158 trigger_field_id ="send_receipt"
160 target_element_id ="notice"
161 target_element_type ="table-row"
165 {include file="CRM/common/showHideByFieldValue.tpl"
166 trigger_field_id ="send_receipt"
168 target_element_id ="fromEmail"
169 target_element_type ="table-row"
175 {if !$membershipMode}
176 {include file="CRM/common/showHideByFieldValue.tpl"
177 trigger_field_id ="send_receipt"
179 target_element_id ="fromEmail"
180 target_element_type ="table-row"
186 <script type="text/javascript">
188 $('#membershipOrgType').hide();
189 $('#changeNumTerms').hide();
192 function checkPayment() {
193 showHideByValue('record_contribution', '', 'recordContribution', 'table-row', 'radio', false);
194 {/literal}{if $email and $outBound_option != 2}{literal}
195 var record_contribution = document.getElementsByName('record_contribution');
196 if (record_contribution[0].checked) {
197 document.getElementsByName('send_receipt')[0].checked = true;
198 cj('#fromEmail').show();
201 document.getElementsByName('send_receipt')[0].checked = false;
203 showHideByValue('send_receipt', '', 'notice', 'table-row', 'radio', false);
204 {/literal}{/if}{literal}
207 function adjustMembershipOrgType() {
208 cj('#membershipOrgType').show();
209 cj('#changeMembershipOrgType').hide();
212 function changeNumTerms() {
213 cj('#changeNumTerms').show();
214 cj('#defaultNumTerms').hide();
218 cj('#record_contribution').click(function () {
219 if (cj(this).prop('checked')) {
220 cj('#recordContribution').show();
221 setPaymentBlock(true);
224 cj('#recordContribution').hide();
228 cj('#membership_type_id_1').change(function () {
234 function setPaymentBlock(checkboxEvent) {
235 var memType = cj('#membership_type_id_1').val();
241 var allMemberships = {/literal}{$allMembershipInfo}{literal};
242 var mode = {/literal}'{$membershipMode}'{literal};
245 // skip this for test and live modes because contribution type is set automatically
246 cj("#financial_type_id").val(allMemberships[memType]['financial_type_id']);
249 if (!checkboxEvent) {
250 if (allMemberships[memType]['total_amount_numeric'] > 0) {
251 cj('#record_contribution').prop('checked', true);
252 cj('#recordContribution').show();
255 cj('#record_contribution').prop('checked', false);
256 cj('#recordContribution').hide();
260 var term = cj("#num_terms").val();
262 var renewTotal = allMemberships[memType]['total_amount_numeric'] * term;
263 cj("#total_amount").val(CRM.formatMoney(renewTotal, true));
266 cj("#total_amount").val(allMemberships[memType]['total_amount']);
269 cj('.totaltaxAmount').html(allMemberships[memType]['tax_message']);
272 // show/hide different contact section
273 setDifferentContactBlock();
274 cj('#is_different_contribution_contact').change(function () {
275 setDifferentContactBlock();
278 function setDifferentContactBlock() {
280 if (cj('#is_different_contribution_contact').prop('checked')) {
281 cj('#record-different-contact').show();
284 cj('#record-different-contact').hide();