Commit | Line | Data |
---|---|---|
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 | {crmRegion name="billing-block"} | |
27 | {* Add 'required' marker to billing fields in this template for front-end / online contribution and event registration forms only. *} | |
28 | {if $context EQ 'front-end'} | |
29 | {assign var=reqMark value=' <span class="crm-marker" title="This field is required.">*</span>'} | |
30 | {else} | |
31 | {assign var=reqMark value=''} | |
32 | {/if} | |
33 | ||
34 | {if $form.credit_card_number or $form.bank_account_number} | |
35 | <div id="payment_information"> | |
36 | <fieldset class="billing_mode-group {if $paymentProcessor.payment_type & 2}direct_debit_info-group{else}credit_card_info-group{/if}"> | |
37 | <legend> | |
38 | {if $paymentProcessor.payment_type & 2} | |
39 | {ts}Direct Debit Information{/ts} | |
40 | {else} | |
41 | {ts}Credit Card Information{/ts} | |
42 | {/if} | |
43 | </legend> | |
44 | {if $paymentProcessor.billing_mode & 2 and !$hidePayPalExpress } | |
45 | <div class="crm-section no-label paypal_button_info-section"> | |
46 | <div class="content description"> | |
47 | {ts}If you have a PayPal account, you can click the PayPal button to continue. Otherwise, fill in the credit card and billing information on this form and click <strong>Continue</strong> at the bottom of the page.{/ts} | |
48 | </div> | |
49 | </div> | |
50 | <div class="crm-section no-label {$form.$expressButtonName.name}-section"> | |
51 | <div class="content description"> | |
52 | {$form.$expressButtonName.html} | |
53 | <div class="description">Save time. Checkout securely. Pay without sharing your financial information. </div> | |
54 | </div> | |
55 | </div> | |
56 | {/if} | |
57 | ||
58 | {if $paymentProcessor.billing_mode & 1} | |
59 | <div class="crm-section billing_mode-section {if $paymentProcessor.payment_type & 2}direct_debit_info-section{else}credit_card_info-section{/if}"> | |
60 | {if $paymentProcessor.payment_type & 2} | |
61 | <div class="crm-section {$form.account_holder.name}-section"> | |
62 | <div class="label">{$form.account_holder.label}</div> | |
63 | <div class="content">{$form.account_holder.html}</div> | |
64 | <div class="clear"></div> | |
65 | </div> | |
66 | <div class="crm-section {$form.bank_account_number.name}-section"> | |
67 | <div class="label">{$form.bank_account_number.label}</div> | |
68 | <div class="content">{$form.bank_account_number.html}</div> | |
69 | <div class="clear"></div> | |
70 | </div> | |
71 | <div class="crm-section {$form.bank_identification_number.name}-section"> | |
72 | <div class="label">{$form.bank_identification_number.label}</div> | |
73 | <div class="content">{$form.bank_identification_number.html}</div> | |
74 | <div class="clear"></div> | |
75 | </div> | |
76 | <div class="crm-section {$form.bank_name.name}-section"> | |
77 | <div class="label">{$form.bank_name.label}</div> | |
78 | <div class="content">{$form.bank_name.html}</div> | |
79 | <div class="clear"></div> | |
80 | </div> | |
81 | {else} | |
82 | <div class="crm-section {$form.credit_card_type.name}-section"> | |
83 | <div class="label">{$form.credit_card_type.label} {$reqMark}</div> | |
84 | <div class="content">{$form.credit_card_type.html}</div> | |
85 | <div class="clear"></div> | |
86 | </div> | |
87 | <div class="crm-section {$form.credit_card_number.name}-section"> | |
88 | <div class="label">{$form.credit_card_number.label} {$reqMark}</div> | |
89 | <div class="content">{$form.credit_card_number.html|crmAddClass:creditcard}</div> | |
90 | <div class="clear"></div> | |
91 | </div> | |
92 | <div class="crm-section {$form.cvv2.name}-section"> | |
93 | <div class="label">{$form.cvv2.label} {$reqMark}</div> | |
94 | <div class="content"> | |
95 | {$form.cvv2.html} | |
96 | <img src="{$config->resourceBase}i/mini_cvv2.gif" alt="{ts}Usually the last 3-4 digits in the signature area on the back of the card.{/ts}" title="{ts}Usually the last 3-4 digits in the signature area on the back of the card.{/ts}" style="vertical-align: text-bottom;" /> | |
97 | </div> | |
98 | <div class="clear"></div> | |
99 | </div> | |
100 | <div class="crm-section {$form.credit_card_exp_date.name}-section"> | |
101 | <div class="label">{$form.credit_card_exp_date.label} {$reqMark}</div> | |
102 | <div class="content">{$form.credit_card_exp_date.html}</div> | |
103 | <div class="clear"></div> | |
104 | </div> | |
105 | {/if} | |
106 | </div> | |
107 | </fieldset> | |
108 | ||
109 | {if $profileAddressFields} | |
110 | <input type="checkbox" id="billingcheckbox" value="0"> <label for="billingcheckbox">{ts}My billing address is the same as above{/ts}</label> | |
111 | {/if} | |
112 | <fieldset class="billing_name_address-group"> | |
113 | <legend>{ts}Billing Name and Address{/ts}</legend> | |
114 | <div class="crm-section billing_name_address-section"> | |
115 | <div class="crm-section {$form.billing_first_name.name}-section"> | |
116 | <div class="label">{$form.billing_first_name.label} {$reqMark}</div> | |
117 | <div class="content">{$form.billing_first_name.html}</div> | |
118 | <div class="clear"></div> | |
119 | </div> | |
120 | <div class="crm-section {$form.billing_middle_name.name}-section"> | |
121 | <div class="label">{$form.billing_middle_name.label}</div> | |
122 | <div class="content">{$form.billing_middle_name.html}</div> | |
123 | <div class="clear"></div> | |
124 | </div> | |
125 | <div class="crm-section {$form.billing_last_name.name}-section"> | |
126 | <div class="label">{$form.billing_last_name.label} {$reqMark}</div> | |
127 | <div class="content">{$form.billing_last_name.html}</div> | |
128 | <div class="clear"></div> | |
129 | </div> | |
130 | {assign var=n value=billing_street_address-$bltID} | |
131 | <div class="crm-section {$form.$n.name}-section"> | |
132 | <div class="label">{$form.$n.label} {$reqMark}</div> | |
133 | <div class="content">{$form.$n.html}</div> | |
134 | <div class="clear"></div> | |
135 | </div> | |
136 | {assign var=n value=billing_city-$bltID} | |
137 | <div class="crm-section {$form.$n.name}-section"> | |
138 | <div class="label">{$form.$n.label} {$reqMark}</div> | |
139 | <div class="content">{$form.$n.html}</div> | |
140 | <div class="clear"></div> | |
141 | </div> | |
142 | {assign var=n value=billing_country_id-$bltID} | |
143 | <div class="crm-section {$form.$n.name}-section"> | |
144 | <div class="label">{$form.$n.label} {$reqMark}</div> | |
145 | <div class="content">{$form.$n.html|crmAddClass:big}</div> | |
146 | <div class="clear"></div> | |
147 | </div> | |
148 | {assign var=n value=billing_state_province_id-$bltID} | |
149 | <div class="crm-section {$form.$n.name}-section"> | |
150 | <div class="label">{$form.$n.label} {$reqMark}</div> | |
151 | <div class="content">{$form.$n.html|crmAddClass:big}</div> | |
152 | <div class="clear"></div> | |
153 | </div> | |
154 | {assign var=n value=billing_postal_code-$bltID} | |
155 | <div class="crm-section {$form.$n.name}-section"> | |
156 | <div class="label">{$form.$n.label} {$reqMark}</div> | |
157 | <div class="content">{$form.$n.html}</div> | |
158 | <div class="clear"></div> | |
159 | </div> | |
160 | </div> | |
161 | </fieldset> | |
162 | {else} | |
163 | </fieldset> | |
164 | {/if} | |
165 | </div> | |
166 | ||
167 | {if $profileAddressFields} | |
168 | <script type="text/javascript"> | |
169 | {literal} | |
170 | ||
171 | cj( function( ) { | |
172 | // build list of ids to track changes on | |
173 | var address_fields = {/literal}{$profileAddressFields|@json_encode}{literal}; | |
174 | var input_ids = []; | |
175 | var select_ids = []; | |
176 | var orig_id = field = field_name = null; | |
177 | ||
178 | // build input ids | |
179 | cj('.billing_name_address-section input').each(function(i){ | |
180 | orig_id = cj(this).attr('id'); | |
181 | field = orig_id.split('-'); | |
182 | field_name = field[0].replace('billing_', ''); | |
183 | if(field[1]) { | |
184 | if(address_fields[field_name]) { | |
185 | input_ids['#'+field_name+'-'+address_fields[field_name]] = '#'+orig_id; | |
186 | } | |
187 | } | |
188 | }); | |
189 | if(cj('#first_name').length) | |
190 | input_ids['#first_name'] = '#billing_first_name'; | |
191 | if(cj('#middle_name').length) | |
192 | input_ids['#middle_name'] = '#billing_middle_name'; | |
193 | if(cj('#last_name').length) | |
194 | input_ids['#last_name'] = '#billing_last_name'; | |
195 | ||
196 | // build select ids | |
197 | cj('.billing_name_address-section select').each(function(i){ | |
198 | orig_id = cj(this).attr('id'); | |
199 | field = orig_id.split('-'); | |
200 | field_name = field[0].replace('billing_', '').replace('_id', ''); | |
201 | if(field[1]) { | |
202 | if(address_fields[field_name]) { | |
203 | select_ids['#'+field_name+'-'+address_fields[field_name]] = '#'+orig_id; | |
204 | } | |
205 | } | |
206 | }); | |
207 | ||
208 | // detect if billing checkbox should default to checked | |
209 | var checked = true; | |
210 | for(var id in input_ids) { | |
211 | var orig_id = input_ids[id]; | |
212 | if(cj(id).val() != cj(orig_id).val()) { | |
213 | checked = false; | |
214 | break; | |
215 | } | |
216 | } | |
217 | for(var id in select_ids) { | |
218 | var orig_id = select_ids[id]; | |
219 | if(cj(id).val() != cj(orig_id).val()) { | |
220 | checked = false; | |
221 | break; | |
222 | } | |
223 | } | |
224 | if(checked) { | |
225 | cj('#billingcheckbox').attr('checked', 'checked'); | |
226 | cj('.billing_name_address-group').hide(); | |
227 | } | |
228 | ||
229 | // onchange handlers for non-billing fields | |
230 | for(var id in input_ids) { | |
231 | var orig_id = input_ids[id]; | |
232 | cj(id).change(function(){ | |
233 | var id = '#'+cj(this).attr('id'); | |
234 | var orig_id = input_ids[id]; | |
235 | ||
236 | // if billing checkbox is active, copy other field into billing field | |
237 | if(cj('#billingcheckbox').attr('checked')) { | |
238 | cj(orig_id).val( cj(id).val() ); | |
239 | }; | |
240 | }); | |
241 | }; | |
242 | for(var id in select_ids) { | |
243 | var orig_id = select_ids[id]; | |
244 | cj(id).change(function(){ | |
245 | var id = '#'+cj(this).attr('id'); | |
246 | var orig_id = select_ids[id]; | |
247 | ||
248 | // if billing checkbox is active, copy other field into billing field | |
249 | if(cj('#billingcheckbox').attr('checked')) { | |
250 | cj(orig_id+' option').removeAttr('selected'); | |
251 | cj(orig_id+' option[value="'+cj(id).val()+'"]').attr('selected', 'selected'); | |
252 | }; | |
253 | ||
254 | if(orig_id == '#billing_country_id-5') { | |
255 | cj(orig_id).change(); | |
256 | } | |
257 | }); | |
258 | }; | |
259 | ||
260 | ||
261 | // toggle show/hide | |
262 | cj('#billingcheckbox').click(function(){ | |
263 | if(this.checked) { | |
264 | cj('.billing_name_address-group').hide(200); | |
265 | ||
266 | // copy all values | |
267 | for(var id in input_ids) { | |
268 | var orig_id = input_ids[id]; | |
269 | cj(orig_id).val( cj(id).val() ); | |
270 | }; | |
271 | for(var id in select_ids) { | |
272 | var orig_id = select_ids[id]; | |
273 | cj(orig_id+' option').removeAttr('selected'); | |
274 | cj(orig_id+' option[value="'+cj(id).val()+'"]').attr('selected', 'selected'); | |
275 | }; | |
276 | } else { | |
277 | cj('.billing_name_address-group').show(200); | |
278 | } | |
279 | }); | |
280 | ||
281 | // remove spaces, dashes from credit card number | |
282 | cj('#credit_card_number').change(function(){ | |
283 | var cc = cj('#credit_card_number').val() | |
284 | .replace(/ /g, '') | |
285 | .replace(/-/g, ''); | |
286 | cj('#credit_card_number').val(cc); | |
287 | }); | |
288 | }); | |
289 | {/literal} | |
290 | </script> | |
291 | {/if} | |
292 | {/if} | |
293 | {/crmRegion} |