Merge pull request #8636 from eileenmcnaughton/slow_query
[civicrm-core.git] / templates / CRM / Contribute / Form / Contribution.tpl
index 0eb42a2545cbf3ad3578b3e4dd46cb64768bdcfc..7a7ac144574ca99e284593596bfd75fd233017a9 100644 (file)
@@ -2,7 +2,7 @@
  +--------------------------------------------------------------------+
  | CiviCRM version 4.7                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2015                                |
+ | Copyright CiviCRM LLC (c) 2004-2016                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
         </td>
       </tr>
     {/if}
-
+    {if $form.revenue_recognition_date}
+      <tr class="crm-contribution-form-block-revenue_recognition_date">
+        <td class="label">{$form.revenue_recognition_date.label}</td>
+        <td>{$form.revenue_recognition_date.html}</td>
+      </tr>
+    {/if}
   </table>
 
   {include file='CRM/Core/BillingBlockWrapper.tpl'}
      });
 
      function showHideCancelInfo(obj) {
-       if (obj.find(":selected").text() == 'Refunded' || obj.find(":selected").text() == 'Cancelled') {
+       var cancelInfo_show_ids = [{/literal}{$cancelInfo_show_ids}{literal}];
+       if (cancelInfo_show_ids.indexOf(obj.val()) > -1) {
          cj('#cancelInfo').show( );
          cj('#total_amount').attr('readonly', true);
        }
@@ -607,11 +613,14 @@ function showStartDate( ) {
 }
 
 {/literal}{/if}{literal}
+var thousandMarker = "{/literal}{$config->monetaryThousandSeparator}{literal}";
+var separator = "{/literal}{$config->monetaryDecimalPoint}{literal}";
+
 cj('#fee_amount').change( function() {
-  var totalAmount = cj('#total_amount').val();
-  var feeAmount = cj('#fee_amount').val();
-  var netAmount = totalAmount.replace(/,/g, '') - feeAmount.replace(/,/g, '');
-  if (!cj('#net_amount').val() && totalAmount) {
+  var totalAmount = cj('#total_amount').val().replace(thousandMarker,'').replace(separator,'.');
+  var feeAmount = cj('#fee_amount').val().replace(thousandMarker,'').replace(separator,'.');
+  var netAmount = totalAmount - feeAmount;
+  if (totalAmount) {
     cj('#net_amount').val(CRM.formatMoney(netAmount, true));
   }
 });
@@ -649,16 +658,14 @@ CRM.$(function($) {
           cj("#totalTaxAmount").show( );
         }
         var totalAmount = $('#total_amount').val();
-        var thousandMarker = '{/literal}{$config->monetaryThousandSeparator}{literal}';
-        var seperator = '{/literal}{$config->monetaryDecimalPoint}{literal}';
-        // replace all thousandMarker and change the seperator to a dot
-  totalAmount = totalAmount.replace(thousandMarker,'').replace(seperator,'.');
+        // replace all thousandMarker and change the separator to a dot
+        totalAmount = totalAmount.replace(thousandMarker,'').replace(separator,'.');
 
         var totalTaxAmount = '{/literal}{$totalTaxAmount}{literal}';
         var taxAmount = (taxRate/100)*totalAmount;
         taxAmount = isNaN (taxAmount) ? 0:taxAmount;
         var totalTaxAmount = taxAmount + Number(totalAmount);
-        totalTaxAmount = formatMoney( totalTaxAmount, 2, seperator, thousandMarker );
+        totalTaxAmount = formatMoney( totalTaxAmount, 2, separator, thousandMarker );
 
         $("#totalTaxAmount" ).html('Amount with tax : <span id="currencySymbolShow">' + currencySymbol + '</span> '+ totalTaxAmount);
       }