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