CRM-16929 price set calcs
authoreileen <emcnaughton@wikimedia.org>
Fri, 6 Nov 2015 07:52:02 +0000 (23:52 -0800)
committereileen <emcnaughton@wikimedia.org>
Wed, 11 Nov 2015 22:17:15 +0000 (14:17 -0800)
Consolidate calculation to a single function, always store calculated total on the form (even if not visible)
for consistent calcs.

This means the 'raw-data' attribute is calculated regardless of whether we are working with a
'price set' or a 'quick config' priceset and can always be used for calculating whether to show it

templates/CRM/Event/Form/ParticipantFeeSelection.tpl
templates/CRM/Price/Form/Calculate.tpl
templates/CRM/Price/Form/PriceSet.tpl

index b9c42612b0a90cd759e2b3150f02eccf7b213826..608d496c72b0ac468486cfb1fe22df1524f88117 100644 (file)
@@ -130,7 +130,7 @@ CRM.$(function($) {
       <table class='form-layout'>
         <tr class="crm-event-eventfees-form-block-price_set_amount">
           <td class="label" style="padding-top: 10px;">{$form.amount.label}</td>
-          <td class="view-value"><table class="form-layout">{include file="CRM/Price/Form/PriceSet.tpl" extends="Event" dontInclCal="true" context="participant"}</table></td>
+          <td class="view-value"><table class="form-layout">{include file="CRM/Price/Form/PriceSet.tpl" extends="Event" noCalcValueDisplay=0 context="participant"}</table></td>
         </tr>
      {if $paymentInfo}
        <tr><td></td><td>
@@ -143,7 +143,7 @@ CRM.$(function($) {
          </div>
          <div class='label'><strong>{ts}Balance Owed{/ts}</strong></div><div class='content'><strong id='balance-fee'></strong></div>
           </div>
-       {include file='CRM/Price/Form/Calculate.tpl' currencySymbol=$currencySymbol noCalcValueDisplay='false' displayOveride='true'}
+       {include file='CRM/Price/Form/Calculate.tpl' currencySymbol=$currencySymbol noCalcValueDisplay=1 displayOveride='true'}
        {/if}
       </table>
     </fieldset>
index 1227b798ce33c0ccac5b269e3d786e7f29d6b476..f460ee7864c326f7ee52133da7653bcaf8585bf8 100644 (file)
  | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
  +--------------------------------------------------------------------+
 *}
-{if $noCalcValueDisplay neq 'false'}
+
+{assign var='hideTotal' value=$quickConfig+$noCalcValueDisplay}
 <div id="pricesetTotal" class="crm-section section-pricesetTotal">
-  <div class="label" id="pricelabel"><label>
-    {if ( $extends eq 'Contribution' ) || ( $extends eq 'Membership' )}
-      {ts}Total Amount{/ts}{else}{ts}Total Fee(s){/ts}
-       {if $isAdditionalParticipants} {ts}for this participant{/ts}{/if}
-    {/if}</label></div>
-  <div class="content calc-value" id="pricevalue" ></div>
+  {if !$hideTotal}
+  <div class="label" id="pricelabel">
+    <label>
+      {if ( $extends eq 'Contribution' ) || ( $extends eq 'Membership' )}
+        {ts}Total Amount{/ts}{else}{ts}Total Fee(s){/ts}
+         {if $isAdditionalParticipants} {ts}for this participant{/ts}{/if}
+      {/if}
+    </label>
+  </div>
+  {/if}
+  <div class="content calc-value" {if $hideTotal}style="display:none;"{/if} id="pricevalue" ></div>
 </div>
-{/if}
+
 <script type="text/javascript">
 {literal}
 
index 7423358dc9832b669effed04846795f563247854..f80af271c57459e9b610abd3a0f1358a9faa5b23 100644 (file)
       <div class="messages help">{$priceSet.help_post}</div>
     {/if}
 
-{* Include the total calculation widget if this is NOT a quickconfig event/contribution page. *}
-{if !$quickConfig and !$dontInclCal}
     {include file="CRM/Price/Form/Calculate.tpl"}
-{/if}
 </div>
 {/crmRegion}