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