2 +--------------------------------------------------------------------+
3 | CiviCRM version 4.3 |
4 +--------------------------------------------------------------------+
5 | Copyright CiviCRM LLC (c) 2004-2013 |
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 adding/editing/deleting contributions and pledge payments *}
29 {include file="CRM/Custom/Form/CustomData.tpl"}
31 {include file="CRM/Price/Form/PriceSet.tpl" context="standalone" extends="Contribution"}
32 {elseif $showAdditionalInfo and $formType }
33 {include file="CRM/Contribute/Form/AdditionalInfo/$formType.tpl"}
36 {if $contributionMode}
37 <h3>{if $ppID}{ts}Credit Card Pledge Payment{/ts}{else}{ts}Credit Card Contribution{/ts}{/if}</h3>
38 {elseif $context NEQ 'standalone'}
39 <h3>{if $action eq 1 or $action eq 1024}{if $ppID}{ts}Pledge Payment{/ts}{else}{ts}New Contribution{/ts}{/if}{elseif $action eq 8}{ts}Delete Contribution{/ts}{else}{ts}Edit Contribution{/ts}{/if}</h3>
42 <div class="crm-block crm-form-block crm-contribution-form-block">
44 {if $contributionMode == 'test' }
45 {assign var=contribMode value="TEST"}
46 {elseif $contributionMode == 'live'}
47 {assign var=contribMode value="LIVE"}
50 {if !$email and $action neq 8 and $context neq 'standalone'}
51 <div class="messages status no-popup">
52 <div class="icon inform-icon"></div> {ts}You will not be able to send an automatic email receipt for this contribution because there is no email address recorded for this contact. If you want a receipt to be sent when this contribution is recorded, click Cancel and then click Edit from the Summary tab to add an email address before recording the contribution.{/ts}
55 {if $contributionMode}
58 {ts 1=$displayName 2=$contribMode}Use this form to submit a new contribution on behalf of %1. <strong>A %2 transaction will be submitted</strong> using the selected payment processor.{/ts}
60 {ts 1=$displayName 2=$contribMode}Use this form to submit a new contribution. <strong>A %2 transaction will be submitted</strong> using the selected payment processor.{/ts}
65 <div class="messages status no-popup">
66 <div class="icon inform-icon"></div>
67 {ts}WARNING: Deleting this contribution will result in the loss of the associated financial transactions (if any).{/ts} {ts}Do you want to continue?{/ts}
70 <div class="crm-submit-buttons">
71 {include file="CRM/common/formButtons.tpl"}
72 {if $newCredit AND $action EQ 1 AND $contributionMode EQ null}
74 {capture assign=ccModeLink}{crmURL p='civicrm/contact/view/contribution' q="reset=1&action=add&cid=`$contactId`&context=`$context`&mode=live"}{/capture}
76 {capture assign=ccModeLink}{crmURL p='civicrm/contact/view/contribution' q="reset=1&action=add&context=standalone&mode=live"}{/capture}
78 <span class="action-link crm-link-credit-card-mode"> <a href="{$ccModeLink}">» {ts}submit credit card contribution{/ts}</a>
81 {if $isOnline}{assign var=valueStyle value=" class='view-value'"}{else}{assign var=valueStyle value=""}{/if}
82 <table class="form-layout-compressed">
83 {if $context neq 'standalone'}
85 <td class="font-size12pt label"><strong><strong>{ts}Contributor{/ts}</strong></td><td class="font-size12pt"><strong>{$displayName}</strong></td>
88 {if !$contributionMode and !$email and $outBound_option != 2}
89 {assign var='profileCreateCallback' value=1 }
91 {* note that if we are using multiple instances of NewContact always pass values for blockNo and prefix *}
92 {include file="CRM/Contact/Form/NewContact.tpl" blockNo=1 prefix=''}
94 {if $contributionMode}
95 <tr class="crm-contribution-form-block-payment_processor_id"><td class="label nowrap">{$form.payment_processor_id.label}<span class="marker"> * </span></td><td>{$form.payment_processor_id.html}</td></tr>
97 <tr class="crm-contribution-form-block-contribution_type_id crm-contribution-form-block-financial_type_id">
98 <td class="label">{$form.financial_type_id.label}</td><td{$valueStyle}>{$form.financial_type_id.html}
101 {/if} {help id="id-financial_type"}
104 {if $action eq 2 and $lineItem and !$defaultContribution}
106 <td class="label">{ts}Contribution Amount{/ts}</td>
107 <td>{include file="CRM/Price/Page/LineItem.tpl" context="Contribution"}</td>
110 <tr class="crm-contribution-form-block-total_amount">
111 <td class="label">{$form.total_amount.label}</td>
113 <span id='totalAmount'>{$form.currency.html|crmAddClass:eight} {$form.total_amount.html|crmAddClass:eight}</span>
115 <span id='totalAmountORPriceSet'> {ts}OR{/ts}</span>
116 <span id='selectPriceSet'>{$form.price_set_id.html}</span>
117 <div id="priceset" class="hiddenElement"></div>
120 {if $ppID}{ts}<a href='#' onclick='adjustPayment();'>adjust payment amount</a>{/ts}{help id="adjust-payment-amount"}{/if}
121 <br /><span class="description">{ts}Actual amount given by contributor.{/ts}{if $hasPriceSets} {ts}Alternatively, you can use a price set.{/ts}{/if}</span>
125 {if $buildRecurBlock && !$ppID}
126 <tr id='recurringPaymentBlock' class='hiddenElement'>
129 <strong>{$form.is_recur.html} {ts}every{/ts}
130 {$form.frequency_interval.html}
131 {$form.frequency_unit.html}
133 {$form.installments.html}
134 {$form.installments.label}
137 <span class="description">
138 {ts}Your recurring contribution will be processed automatically for the number of installments you specify. You can leave the number of installments blank if you want to make an open-ended commitment. In either case, you can choose to cancel at any time. You will receive an email receipt for each recurring contribution. The receipts will include a link you can use if you decide to modify or cancel your future contributions.{/ts}
144 <tr id="adjust-option-type" class="crm-contribution-form-block-option_type">
145 <td class="label"></td><td {$valueStyle}>{$form.option_type.html}</td>
148 {if $contributionMode && $processorSupportsFutureStartDate}
149 <tr id='start_date' class="crm-contribution-form-block-receive_date">
150 <td class="label">{ts}Start Date{/ts}</td>
151 <td {$valueStyle}>{if $hideCalender neq true}{include file="CRM/common/jcalendar.tpl" elementName=receive_date}{else}{$receive_date|crmDate}{/if}<br />
152 <span class="description">{ts}You can set a start date for recurring contributions and the first payment will be on that date. For a single post-dated contribution you must select recurring and choose one installment{/ts}</span>
157 <tr class="crm-contribution-form-block-source">
158 <td class="label">{$form.source.label}</td>
159 <td {$valueStyle}>{$form.source.html|crmAddClass:huge} {help id="id-contrib_source"}
163 {* CRM-7362 --add campaign to contributions *}
164 {include file="CRM/Campaign/Form/addCampaignToComponent.tpl" campaignTrClass="crm-contribution-form-block-campaign_id"}
166 {if $contributionMode}
167 {if $email and $outBound_option != 2}
168 <tr class="crm-contribution-form-block-is_email_receipt">
169 <td class="label">{$form.is_email_receipt.label}</td>
170 <td>{$form.is_email_receipt.html} <span class="description">{ts 1=$email}Automatically email a receipt for this contribution to %1?{/ts}</span>
173 {elseif $context eq 'standalone' and $outBound_option != 2 }
174 <tr id="email-receipt" style="display:none;" class="crm-contribution-form-block-is_email_receipt"><td class="label">{$form.is_email_receipt.label}</td><td>{$form.is_email_receipt.html} <span class="description">{ts}Automatically email a receipt for this contribution to {/ts}<span id="email-address"></span>?</span></td></tr>
176 <tr id="fromEmail" style="display:none;" >
177 <td class="label">{$form.from_email_address.label}</td>
178 <td>{$form.from_email_address.html}</td>
180 <tr id="receiptDate" class="crm-contribution-form-block-receipt_date">
181 <td class="label">{$form.receipt_date.label}</td>
182 <td>{include file="CRM/common/jcalendar.tpl" elementName=receipt_date}<br />
183 <span class="description">{ts}Date that a receipt was sent to the contributor.{/ts}</span>
187 {if !$contributionMode}
188 <tr class="crm-contribution-form-block-contribution_status_id">
189 <td class="label">{$form.contribution_status_id.label}</td>
190 <td>{$form.contribution_status_id.html}
191 {if $contribution_status_id eq 2}{if $is_pay_later }: {ts}Pay Later{/ts} {else}: {ts}Incomplete Transaction{/ts}{/if}{/if}
195 {* Cancellation / Refunded fields are hidden unless contribution status is set to Cancelled or Refunded*}
196 <tr id="cancelInfo" class="crm-contribution-form-block-cancelInfo">
198 <td><fieldset><legend>{ts}Cancellation or Refund Information{/ts}</legend>
199 <table class="form-layout-compressed">
200 <tr id="cancelDate" class="crm-contribution-form-block-cancel_date">
201 <td class="label">{$form.cancel_date.label}</td>
203 {if $hideCalendar neq true}
204 {include file="CRM/common/jcalendar.tpl" elementName=cancel_date}
206 {$form.cancel_date.html|crmDate}
210 <tr id="cancelDescription" class="crm-contribution-form-block-cancel_reason">
211 <td class="label"> </td>
212 <td class="description">{ts}Enter the cancellation or refunded date, or you can skip this field and the cancellation date or refunded date will be automatically set to TODAY.{/ts}</td>
214 <tr id="cancelReason">
215 <td class="label" style="vertical-align: top;">{$form.cancel_reason.label}</td>
216 <td>{$form.cancel_reason.html|crmReplace:class:huge}</td>
225 <!-- start of soft credit -->
226 <div class="crm-accordion-wrapper crm-accordion_title-accordion crm-accordion-processed" id="softCredit">
227 <div class="crm-accordion-header">
228 {ts}Soft Credit{/ts} {help id="id-soft_credit"}
230 <div class="crm-accordion-body">
231 <table class="form-layout-compressed">
233 <tr class="crm-contribution-pcp-block-link">
236 <a href='#'>{ts}credit this contribution to a personal campaign page{/ts}</a>
240 <tr class="crm-contribution-pcp-block crm-contribution-form-block-pcp_made_through_id hiddenElement">
241 <td class="label">{$form.pcp_made_through.label}</td>
243 {$form.pcp_made_through.html}
244 <span class="showSoftCreditLink">
245 <a href="#" id="showSoftCredit">{ts}unlink from personal campaign page{/ts}</a>
247 <span class="description">{ts}Search for the Personal Campaign Page by the fund-raiser's last name or
248 email address.{/ts}</span>
250 <div class="spacer"></div>
251 <div class="crm-contribution-form-block-pcp_details">
252 <table class="crm-contribution-form-table-credit_to_pcp">
253 <tr id="pcpDisplayRollID" class="crm-contribution-form-block-pcp_display_in_roll">
254 <td class="label">{$form.pcp_display_in_roll.label}</td>
255 <td>{$form.pcp_display_in_roll.html}</td>
257 <tr id="nickID" class="crm-contribution-form-block-pcp_roll_nickname">
258 <td class="label">{$form.pcp_roll_nickname.label}</td>
259 <td>{$form.pcp_roll_nickname.html|crmAddClass:big}<br/>
260 <span class="description">{ts}Name or nickname contributor wants to be displayed in the Honor
261 Roll. Enter "Anonymous" for anonymous contributions.{/ts}</span>
264 <tr id="personalNoteID" class="crm-contribution-form-block-pcp_personal_note">
265 <td class="label" style="vertical-align: top">{$form.pcp_personal_note.label}</td>
267 {$form.pcp_personal_note.html}
269 class="description">{ts}Personal message submitted by contributor for display in the Honor Roll.{/ts}</span>
277 <tr class="crm-contribution-form-block-soft_credit_to">
279 {include file="CRM/Contribute/Form/SoftCredit.tpl"}
285 <!-- end of soft credit -->
286 {if !$contributionMode}
287 <div class="crm-accordion-wrapper crm-accordion_title-accordion crm-accordion-processed" id="paymentDetails_Information">
288 <div class="crm-accordion-header">
289 {ts}Payment Details{/ts}
291 <div class="crm-accordion-body">
292 <table class="form-layout-compressed" >
293 <tr class="crm-contribution-form-block-receive_date">
294 <td class="label">{$form.receive_date.label}</td>
295 <td {$valueStyle}>{include file="CRM/common/jcalendar.tpl" elementName=receive_date}<br />
296 <span class="description">{ts}The date this contribution was received.{/ts}</span>
299 <tr class="crm-contribution-form-block-payment_instrument_id">
300 <td class="label">{$form.payment_instrument_id.label}</td>
301 <td {$valueStyle}>{$form.payment_instrument_id.html}<br />
302 <span class="description">{ts}Leave blank for non-monetary contributions.{/ts}</span>
305 {if $showCheckNumber || !$isOnline}
306 <tr id="checkNumber" class="crm-contribution-form-block-check_number">
307 <td class="label">{$form.check_number.label}</td>
308 <td>{$form.check_number.html|crmReplace:class:six}</td>
311 <tr class="crm-contribution-form-block-trxn_id">
312 <td class="label">{$form.trxn_id.label}</td>
313 <td {$valueStyle}>{$form.trxn_id.html|crmReplace:class:twelve} {help id="id-trans_id"}</td>
315 {if $email and $outBound_option != 2}
316 <tr class="crm-contribution-form-block-is_email_receipt">
318 {$form.is_email_receipt.label}</td><td>{$form.is_email_receipt.html}
319 <span class="description">{ts 1=$email}Automatically email a receipt for this payment to %1?{/ts}</span>
322 {elseif $context eq 'standalone' and $outBound_option != 2 }
323 <tr id="email-receipt" style="display:none;" class="crm-contribution-form-block-is_email_receipt">
324 <td class="label">{$form.is_email_receipt.label}</td>
325 <td>{$form.is_email_receipt.html} <span class="description">{ts}Automatically email a receipt for this payment to {/ts}<span id="email-address"></span>?</span>
329 <tr id="receiptDate" class="crm-contribution-form-block-receipt_date">
330 <td class="label">{$form.receipt_date.label}</td>
331 <td>{include file="CRM/common/jcalendar.tpl" elementName=receipt_date}<br />
332 <span class="description">{ts}Date that a receipt was sent to the contributor.{/ts}</span>
335 <tr id="fromEmail" class="crm-contribution-form-block-receipt_date" style="display:none;">
336 <td class="label">{$form.from_email_address.label}</td>
337 <td>{$form.from_email_address.html}</td>
344 <div id="customData" class="crm-contribution-form-block-customData"></div>
346 {*include custom data js file*}
347 {include file="CRM/common/customData.tpl"}
350 <script type="text/javascript">
353 CRM.buildCustomData( '{$customDataType}' );
354 {if $customDataSubType}
355 CRM.buildCustomData( '{$customDataType}', {$customDataSubType} );
358 {if $buildPriceSet}{literal}buildAmount( );{/literal}{/if}
362 // bind first click of accordion header to load crm-accordion-body with snippet
363 // everything else taken care of by cj().crm-accordions()
365 cj('#adjust-option-type').hide();
366 cj('.crm-ajax-accordion .crm-accordion-header').one('click', function() {
367 loadPanes(cj(this).attr('id'));
369 cj('.crm-ajax-accordion:not(.collapsed) .crm-accordion-header').each(function(index) {
370 loadPanes(cj(this).attr('id'));
373 // load panes function calls for snippet based on id of crm-accordion-header
374 function loadPanes( id ) {
375 var url = "{/literal}{crmURL p='civicrm/contact/view/contribution' q='snippet=4&formType=' h=0}{literal}" + id;
377 {if $contributionMode}
378 url = url + "&mode={$contributionMode}";
381 url = url + "&qfKey={$qfKey}";
384 if (! cj('div.'+id).html()) {
385 var loading = '<img src="{/literal}{$config->resourceBase}i/loading.gif{literal}" alt="{/literal}{ts escape='js'}loading{/ts}{literal}" /> {/literal}{ts escape='js'}Loading{/ts}{literal}...';
386 cj('div.'+id).html(loading);
389 success: function(data) { cj('div.'+id).html(data); }
394 var url = "{/literal}{$dataUrl}{literal}";
397 {if $context eq 'standalone' and $outBound_option != 2 }
400 cj("#contact_1").blur( function( ) {
404 showHideByValue( 'is_email_receipt', '', 'receiptDate', 'table-row', 'radio', true);
405 showHideByValue( 'is_email_receipt', '', 'fromEmail', 'table-row', 'radio', false );
408 function checkEmail( ) {
409 var contactID = cj("input[name='contact_select_id[1]']").val();
411 var postUrl = "{/literal}{crmURL p='civicrm/ajax/checkemail' h=0}{literal}";
412 cj.post( postUrl, {contact_id: contactID},
413 function (response) {
415 cj("#email-receipt").show( );
416 cj("#email-address").html(response);
419 cj("#email-receipt").hide( );
425 cj("#email-receipt").hide( );
429 function profileCreateCallback( blockNo ) {
436 <div class="accordion ui-accordion ui-widget ui-helper-reset">
437 {* Additional Detail / Honoree Information / Premium Information *}
438 {foreach from=$allPanes key=paneName item=paneValue}
440 <div class="crm-accordion-wrapper crm-ajax-accordion crm-{$paneValue.id}-accordion {if $paneValue.open neq 'true'}collapsed{/if}">
441 <div class="crm-accordion-header" id="{$paneValue.id}">
444 </div><!-- /.crm-accordion-header -->
445 <div class="crm-accordion-body">
447 <div class="{$paneValue.id}"></div>
448 </div><!-- /.crm-accordion-body -->
449 </div><!-- /.crm-accordion-wrapper -->
456 <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="bottom"}</div>
460 <script type="text/javascript">
462 if (cj('#is_email_receipt').attr( 'checked' )) {
463 var ok = confirm( '{/literal}{ts escape='js'}Click OK to save this contribution record AND send a receipt to the contributor now{/ts}{literal}.' );
471 cj("#cancel_date").val('');
472 cj("#cancel_reason").val('');
480 <script type="text/javascript">
482 checkEmailDependancies( );
483 cj('#is_email_receipt').click( function( ) {
484 checkEmailDependancies( );
488 function checkEmailDependancies( ) {
489 if (cj('#is_email_receipt').attr( 'checked' )) {
490 cj('#fromEmail').show( );
491 cj('#receiptDate').hide( );
494 cj('#fromEmail').hide( );
495 cj('#receiptDate').show( );
499 {/literal}{if !$contributionMode}{literal}
501 showHideCancelInfo(cj('#contribution_status_id'));
503 cj('#contribution_status_id').change(function() {
504 showHideCancelInfo(this);
509 function showHideCancelInfo(obj) {
510 contributionStatus = cj(obj).val();
511 if (contributionStatus == 3 || contributionStatus == 7) {
512 cj('#cancelInfo').show( );
516 cj('#cancelInfo').hide( );
520 {/literal}{/if}{literal}
523 {if !$contributionMode}
524 {include file="CRM/common/showHideByFieldValue.tpl"
525 trigger_field_id ="payment_instrument_id"
527 target_element_id ="checkNumber"
528 target_element_type ="table-row"
533 {/if} {* not delete mode if*}
535 {* include jscript to warn if unsaved form field changes *}
536 {include file="CRM/common/formNavigate.tpl"}
538 {/if} {* closing of main custom data if *}
541 <script type="text/javascript">
543 cj().crmAccordions();
548 // load form during form rule.
549 {if $buildPriceSet}{literal}buildAmount( );{/literal}{/if}
552 function buildAmount( priceSetId ) {
553 if (!priceSetId) priceSetId = cj("#price_set_id").val( );
555 var fname = '#priceset';
557 // hide price set fields.
560 // show/hide price set amount and total amount.
561 cj("#totalAmountORPriceSet").show( );
562 cj("#totalAmount").show( );
563 var choose = "{/literal}{ts}Choose price set{/ts}{literal}";
564 cj("#price_set_id option[value='']").html( choose );
566 //we might want to build recur block.
567 if (cj("#is_recur")) buildRecurBlock( null );
571 //don't allow recurring w/ priceset.
572 if ( cj( "#is_recur" ) && cj( 'input:radio[name="is_recur"]:checked').val( ) ) {
573 //reset the values of recur block.
574 cj("#installments").val('');
575 cj("#frequency_interval").val('');
576 cj('input:radio[name="is_recur"]')[0].checked = true;
577 cj("#recurringPaymentBlock").hide( );
580 var dataUrl = {/literal}"{crmURL h=0 q='snippet=4'}"{literal} + '&priceSetId=' + priceSetId;
582 var response = cj.ajax({
587 cj( fname ).show( ).html( response );
588 // freeze total amount text field.
589 cj( "#total_amount").val('');
591 cj( "#totalAmountORPriceSet" ).hide( );
592 cj( "#totalAmount").hide( );
593 var manual = "{/literal}{ts}Manual contribution amount{/ts}{literal}";
594 cj("#price_set_id option[value='']").html( manual );
597 function adjustPayment( ) {
598 cj('#adjust-option-type').show();
599 cj("#total_amount").removeAttr("READONLY");
600 cj("#total_amount").css('background-color', '#ffffff');
603 {/literal}{if $processorSupportsFutureStartDate}{literal}
604 cj ('input:radio[name="is_recur"]').click( function( ) {
610 function showStartDate( ) {
611 if (cj( 'input:radio[name="is_recur"]:checked').val( ) == 0 ) {
612 cj('#start_date').hide( );
615 cj('#start_date').show( );
619 {/literal}{/if}{literal}
620 cj('#fee_amount').change( function() {
621 var totalAmount = cj('#total_amount').val();
622 var feeAmount = cj('#fee_amount').val();
623 var netAmount = totalAmount.replace(/,/g, '') - feeAmount.replace(/,/g, '');
624 if (!cj('#net_amount').val()) {
625 cj('#net_amount').val(netAmount);