copyright and version fixes
[civicrm-core.git] / templates / CRM / Member / Form / MembershipRenewal.tpl
CommitLineData
6a488035
TO
1{*
2 +--------------------------------------------------------------------+
819d0d41 3 | CiviCRM version 4.5 |
6a488035 4 +--------------------------------------------------------------------+
819d0d41 5 | Copyright CiviCRM LLC (c) 2004-2014 |
6a488035
TO
6 +--------------------------------------------------------------------+
7 | This file is a part of CiviCRM. |
8 | |
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. |
12 | |
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. |
17 | |
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 +--------------------------------------------------------------------+
25*}
26{* this template is used for renewing memberships for a contact *}
27{if $cdType }
28 {include file="CRM/Custom/Form/CustomData.tpl"}
29{else}
bdb15e5b 30 {if $membershipMode == 'test' }
6a488035 31 {assign var=registerMode value="TEST"}
bdb15e5b 32 {elseif $membershipMode == 'live'}
6a488035 33 {assign var=registerMode value="LIVE"}
bdb15e5b
DG
34 {/if}
35 {if !$email}
36 <div class="messages status no-popup">
37 <div class="icon inform-icon"></div>
38 <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>
6a488035 39 </div>
bdb15e5b
DG
40 {/if}
41 {if $membershipMode}
42 <div id="help">
43 {ts 1=$displayName 2=$registerMode}Use this form to Renew Membership Record on behalf of %1.
44 <strong>A %2 transaction will be submitted</strong>
45 using the selected payment processor.{/ts}
46 </div>
47 {/if}
48 {if $action eq 32768}
49 {if $cancelAutoRenew}
50 <div class="messages status no-popup">
51 <div class="icon inform-icon"></div>
52 <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.
53 <a href="%1">Click here</a>
54 if you want to cancel the automatic renewal option.{/ts}</p>
55 </div>
56 {/if}
57 <h3>{ts}Renew Membership{/ts}</h3>
58 {/if}
59 <div class="crm-block crm-form-block crm-member-membershiprenew-form-block">
6a488035 60 <div id="help" class="description">
bdb15e5b 61 {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}
6a488035
TO
62 </div>
63 <div>{include file="CRM/common/formButtons.tpl" location="top"}</div>
64 <table class="form-layout">
bdb15e5b
DG
65 <tr class="crm-member-membershiprenew-form-block-payment_processor_id">
66 <td class="label">{$form.payment_processor_id.label}</td>
67 <td class="html-adjust">{$form.payment_processor_id.html}</td>
68 </tr>
69 <tr class="crm-member-membershiprenew-form-block-org_name">
70 <td class="label">{ts}Membership Organization and Type{/ts}</td>
71 <td class="html-adjust">{$orgName}&nbsp;&nbsp;-&nbsp;&nbsp;{$memType}
72 {if $member_is_test} {ts}(test){/ts}{/if}
73 &nbsp; <a id="changeMembershipOrgType" href='#'
74 onclick='adjustMembershipOrgType(); return false;'>{ts}change membership type{/ts}</a>
75 </td>
76 </tr>
77 <tr id="membershipOrgType" class="crm-member-membershiprenew-form-block-renew_org_name">
78 <td class="label">{$form.membership_type_id.label}</td>
79 <td>{$form.membership_type_id.html}
80 {if $member_is_test} {ts}(test){/ts}{/if}<br/>
81 <span class="description">{ts}Select Membership Organization and then Membership Type.{/ts}</span>
82 </td>
83 </tr>
84 <tr class="crm-member-membershiprenew-form-block-membership_status">
85 <td class="label">{ts}Membership Status{/ts}</td>
86 <td class="html-adjust">&nbsp;{$membershipStatus}<br/>
87 <span class="description">{ts}Status of this membership.{/ts}</span></td>
88 </tr>
89 <tr class="crm-member-membershiprenew-form-block-end_date">
90 <td class="label">{ts}Membership End Date{/ts}</td>
91 <td class="html-adjust">&nbsp;{$endDate}</td>
92 </tr>
93 <tr class="crm-member-membershiprenew-form-block-renewal_date">
94 <td class="label">{$form.renewal_date.label}</td>
95 <td>{include file="CRM/common/jcalendar.tpl" elementName=renewal_date}</td>
96 </tr>
97 {if $membershipMode}
98 <tr class="crm-member-membershiprenew-form-block-financial_type_id">
99 <td class="label">{$form.financial_type_id.label}</td>
100 <td>{$form.financial_type_id.html}<br/>
101 <span class="description">{ts}Select the appropriate financial type for this payment.{/ts}</span></td>
6a488035 102 </tr>
bdb15e5b
DG
103 {/if}
104 {if $accessContribution and ! $membershipMode}
105 <tr class="crm-member-membershiprenew-form-block-record_contribution">
106 <td class="label">{$form.record_contribution.label}</td>
107 <td class="html-adjust">{$form.record_contribution.html}<br/>
108 <span
109 class="description">{ts}Check this box to enter payment information. You will also be able to generate a customized receipt.{/ts}</span>
6a488035
TO
110 </td>
111 </tr>
bdb15e5b
DG
112 <tr id="recordContribution" class="crm-member-membershiprenew-form-block-membership_renewal">
113 <td colspan="2">
114 <fieldset>
115 <legend>{ts}Renewal Payment and Receipt{/ts}</legend>
116 <table class="form-layout-compressed">
117 <tr id="defaultNumTerms" class="crm-member-membershiprenew-form-block-default-num_terms">
118 <td colspan="2" class="description">
119 {ts}Renewal extends membership end date by one membership period{/ts}
120 &nbsp; <a id="changeTermsLink" href='#'
121 onclick='changeNumTerms(); return false;'>{ts}change{/ts}</a>
122 </td>
123 </tr>
124 <tr id="changeNumTerms" class="crm-member-membershiprenew-form-block-change-num_terms">
125 <td class="label">{$form.num_terms.label}</td>
126 <td>{$form.num_terms.html|crmAddClass:two} {ts}membership periods{/ts}<br/>
127 <span
128 class="description">{ts}Extend the membership end date by this many membership periods. Make sure the appropriate corresponding fee is entered below.{/ts}</span>
129 </td>
130 </tr>
131 {if $context neq 'standalone'}
132 <tr class="crm-membership-form-block-contribution-contact">
133 <td class="label">{$form.contribution_contact.label}</td>
134 <td>{$form.contribution_contact.html}&nbsp;&nbsp;{help id="id-contribution_contact"}</td>
135 </tr>
136 <tr id="record-different-contact">
137 <td>&nbsp;</td>
138 <td>
139 <table class="compressed">
4c7aa1f7 140 <tr class="crm-membership-form-block-soft-credit-type">
133e2c99 141 <td class="label">{$form.soft_credit_type_id.label}</td>
142 <td>{$form.soft_credit_type_id.html}</td>
bdb15e5b 143 </tr>
4c7aa1f7
CW
144 <tr class="crm-membership-form-block-soft-credit-contact-id">
145 <td class="label">{$form.soft_credit_contact_id.label}</td>
146 <td>{$form.soft_credit_contact_id.html}</td>
bdb15e5b
DG
147 </tr>
148 </table>
149 </td>
150 </tr>
151 {/if}
152 <tr class="crm-member-membershiprenew-form-block-financial_type_id">
153 <td class="label">{$form.financial_type_id.label}</td>
154 <td>{$form.financial_type_id.html}<br/>
155 <span class="description">{ts}Select the appropriate financial type for this payment.{/ts}</span>
156 </td>
157 </tr>
158 <tr class="crm-member-membershiprenew-form-block-total_amount">
159 <td class="label">{$form.total_amount.label}</td>
160 <td>{$form.total_amount.html}<br/>
161 <span
162 class="description">{ts}Membership payment amount. A contribution record will be created for this amount.{/ts}</span>
163 </td>
164 </tr>
165 <tr class="crm-membershiprenew-form-block-receive_date">
166 <td class="label">{$form.receive_date.label}</td>
167 <td>{include file="CRM/common/jcalendar.tpl" elementName=receive_date}</td>
168 </tr>
169 <tr class="crm-member-membershiprenew-form-block-payment_instrument_id">
d96cf288 170 <td class="label">{$form.payment_instrument_id.label}<span class='marker'>*</span></td>
d20225bb 171 <td>{$form.payment_instrument_id.html} {help id="payment_instrument_id" file="CRM/Contribute/Page/Tab.hlp"}</td>
bdb15e5b
DG
172 </tr>
173 <tr id="checkNumber" class="crm-member-membershiprenew-form-block-check_number">
174 <td class="label">{$form.check_number.label}</td>
175 <td>{$form.check_number.html|crmAddClass:six}</td>
176 </tr>
177 <tr class="crm-member-membershiprenew-form-block-trxn_id">
178 <td class="label">{$form.trxn_id.label}</td>
179 <td>{$form.trxn_id.html}</td>
180 </tr>
181 <tr class="crm-member-membershiprenew-form-block-contribution_status_id">
182 <td class="label">{$form.contribution_status_id.label}</td>
183 <td>{$form.contribution_status_id.html}</td>
184 </tr>
185 </table>
186 </fieldset>
6a488035
TO
187 </td>
188 </tr>
bdb15e5b
DG
189 {else}
190 <tr class="crm-member-membershiprenew-form-block-total_amount">
191 <td class="label">{$form.total_amount.label}</td>
192 <td>{$form.total_amount.html}<br/>
193 <span
194 class="description">{ts}Membership payment amount. A contribution record will be created for this amount.{/ts}</span>
6a488035
TO
195 </td>
196 </tr>
bdb15e5b 197 {/if}
6a488035
TO
198 </table>
199 {if $membershipMode}
bdb15e5b
DG
200 {if $context neq 'standalone'}
201 <table class="form-layout-compressed">
202 <tr class="crm-membership-form-block-contribution-contact">
203 <td class="label">{$form.contribution_contact.label}</td>
204 <td>{$form.contribution_contact.html}&nbsp;&nbsp;{help id="id-contribution_contact"}</td>
205 </tr>
206 <tr id="record-different-contact">
207 <td>&nbsp;</td>
208 <td>
209 <table class="form-layout-compressed">
4c7aa1f7
CW
210 <tr class="crm-membership-form-block-soft-credit-type">
211 <td class="label">{$form.soft_credit_type_id.label}</td>
212 <td>{$form.soft_credit_type_id.html}</td>
bdb15e5b 213 </tr>
4c7aa1f7
CW
214 <tr class="crm-membership-form-soft-credit-contact-id">
215 <td class="label">{$form.soft_credit_contact_id.label}</td>
216 <td>{$form.soft_credit_contact_id.html}</td>
bdb15e5b
DG
217 </tr>
218 </table>
219 </td>
220 </tr>
6a488035 221 </table>
bdb15e5b
DG
222 {/if}
223 <div class="spacer"></div>
224 {include file='CRM/Core/BillingBlock.tpl'}
225 {/if}
226 {if $email and $outBound_option != 2}
227 <table class="form-layout">
228 <tr class="crm-member-membershiprenew-form-block-send_receipt">
6a488035 229 <td class="label">{$form.send_receipt.label}</td>
bdb15e5b
DG
230 <td>{$form.send_receipt.html}<br/>
231 <span
232 class="description">{ts 1=$email}Automatically email a membership confirmation and receipt to %1?{/ts}</span>
233 </td>
234 </tr>
235 <tr id="fromEmail">
236 <td class="label">{$form.from_email_address.label}</td>
237 <td>{$form.from_email_address.html}</td>
238 </tr>
239 <tr id="notice" class="crm-member-membershiprenew-form-block-receipt_text_renewal">
240 <td class="label">{$form.receipt_text_renewal.label}</td>
241 <td><span
242 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/>
243 {$form.receipt_text_renewal.html|crmAddClass:huge}</td>
244 </tr>
245 </table>
246 {/if}
6a488035 247
bdb15e5b
DG
248 <div id="customData"></div>
249 {*include custom data js file*}
250 {include file="CRM/common/customData.tpl"}
6a488035 251
bdb15e5b 252 <div>{include file="CRM/common/formButtons.tpl" location="bottom"}</div>
6a488035 253
bdb15e5b
DG
254 <div class="spacer"></div>
255 </div>
256 {if $accessContribution and ! $membershipMode}
6a488035 257 {include file="CRM/common/showHideByFieldValue.tpl"
bdb15e5b
DG
258 trigger_field_id ="record_contribution"
259 trigger_value =""
260 target_element_id ="recordContribution"
261 target_element_type ="table-row"
262 field_type ="radio"
263 invert = 0
6a488035 264 }
bdb15e5b 265 {/if}
6a488035 266
bdb15e5b 267 {if $email and $outBound_option != 2}
6a488035 268 {include file="CRM/common/showHideByFieldValue.tpl"
bdb15e5b
DG
269 trigger_field_id ="send_receipt"
270 trigger_value =""
271 target_element_id ="notice"
272 target_element_type ="table-row"
273 field_type ="radio"
274 invert = 0
6a488035
TO
275 }
276 {include file="CRM/common/showHideByFieldValue.tpl"
bdb15e5b
DG
277 trigger_field_id ="send_receipt"
278 trigger_value =""
279 target_element_id ="fromEmail"
280 target_element_type ="table-row"
281 field_type ="radio"
282 invert = 0
6a488035 283 }
bdb15e5b 284 {/if}
6a488035 285
bdb15e5b 286 {if !$membershipMode}
6a488035 287 {include file="CRM/common/showHideByFieldValue.tpl"
bdb15e5b
DG
288 trigger_field_id ="payment_instrument_id"
289 trigger_value = '4'
290 target_element_id ="checkNumber"
291 target_element_type ="table-row"
292 field_type ="select"
293 invert = 0
6a488035
TO
294 }
295 {include file="CRM/common/showHideByFieldValue.tpl"
bdb15e5b
DG
296 trigger_field_id ="send_receipt"
297 trigger_value =""
298 target_element_id ="fromEmail"
299 target_element_type ="table-row"
300 field_type ="radio"
301 invert = 0
6a488035 302 }
bdb15e5b 303 {/if}
6a488035 304{literal}
bdb15e5b
DG
305 <script type="text/javascript">
306 cj(function () {
307 cj('#membershipOrgType').hide();
308 cj('#changeNumTerms').hide();
309 {/literal}
310 CRM.buildCustomData('{$customDataType}');
311 {if $customDataSubType}
312 CRM.buildCustomData('{$customDataType}', {$customDataSubType});
313 {/if}
314 {literal}
315 });
6a488035 316
bdb15e5b
DG
317 function checkPayment() {
318 showHideByValue('record_contribution', '', 'recordContribution', 'table-row', 'radio', false);
319 {/literal}{if $email and $outBound_option != 2}{literal}
320 var record_contribution = document.getElementsByName('record_contribution');
321 if (record_contribution[0].checked) {
322 document.getElementsByName('send_receipt')[0].checked = true;
323 cj('#fromEmail').show();
324 }
325 else {
326 document.getElementsByName('send_receipt')[0].checked = false;
327 }
328 showHideByValue('send_receipt', '', 'notice', 'table-row', 'radio', false);
329 {/literal}{/if}{literal}
330 }
6a488035 331
bdb15e5b
DG
332 function adjustMembershipOrgType() {
333 cj('#membershipOrgType').show();
334 cj('#changeMembershipOrgType').hide();
6a488035 335 }
bdb15e5b
DG
336
337 function changeNumTerms() {
338 cj('#changeNumTerms').show();
339 cj('#defaultNumTerms').hide();
6a488035 340 }
6a488035 341
bdb15e5b
DG
342 cj(function () {
343 cj('#record_contribution').click(function () {
8539f25d 344 if (cj(this).prop('checked')) {
bdb15e5b
DG
345 cj('#recordContribution').show();
346 setPaymentBlock(true);
347 }
348 else {
349 cj('#recordContribution').hide();
350 }
351 });
6a488035 352
bdb15e5b
DG
353 cj('#membership_type_id_1').change(function () {
354 setPaymentBlock();
355 });
356 setPaymentBlock();
357 });
6a488035 358
bdb15e5b
DG
359 function setPaymentBlock(checkboxEvent) {
360 var memType = cj('#membership_type_id_1').val();
6a488035 361
bdb15e5b
DG
362 if (!memType) {
363 return;
364 }
6a488035 365
bdb15e5b
DG
366 var allMemberships = {/literal}{$allMembershipInfo}{literal};
367 var mode = {/literal}'{$membershipMode}'{literal};
6a488035 368
bdb15e5b
DG
369 if (!mode) {
370 // skip this for test and live modes because contribution type is set automatically
371 cj("#financial_type_id").val(allMemberships[memType]['financial_type_id']);
372 }
373
374 if (!checkboxEvent) {
375 if (allMemberships[memType]['total_amount_numeric'] > 0) {
8539f25d 376 cj('#record_contribution').prop('checked', true);
bdb15e5b
DG
377 cj('#recordContribution').show();
378 }
379 else {
8539f25d 380 cj('#record_contribution').prop('checked', false);
bdb15e5b
DG
381 cj('#recordContribution').hide();
382 }
383 }
6a488035 384
bdb15e5b
DG
385 var term = cj("#num_terms").val();
386 if (term) {
387 var renewTotal = allMemberships[memType]['total_amount_numeric'] * term;
388 cj("#total_amount").val(renewTotal.toFixed(2));
389 }
390 else {
391 cj("#total_amount").val(allMemberships[memType]['total_amount']);
392 }
393 }
6a488035 394
bdb15e5b
DG
395 // show/hide different contact section
396 setDifferentContactBlock();
397 cj('#contribution_contact').change(function () {
398 setDifferentContactBlock();
399 });
6a488035 400
bdb15e5b
DG
401 function setDifferentContactBlock() {
402 //get the
8539f25d 403 if (cj('#contribution_contact').prop('checked')) {
bdb15e5b
DG
404 cj('#record-different-contact').show();
405 }
406 else {
407 cj('#record-different-contact').hide();
408 }
409 }
410 </script>
6a488035
TO
411{/literal}
412{/if}{* closing of custom data if *}