Tweak layout on contribution view screen to make payments clearer
authoreileen <emcnaughton@wikimedia.org>
Thu, 22 Mar 2018 12:52:39 +0000 (01:52 +1300)
committereileen <emcnaughton@wikimedia.org>
Thu, 22 Mar 2018 12:52:39 +0000 (01:52 +1300)
CRM/Contribute/Form/ContributionView.php
templates/CRM/Contribute/Form/ContributionView.tpl
templates/CRM/Contribute/Page/PaymentInfo.tpl

index feb6f0c8e5a3465b9e14334da3d4de5957851913..50752ca04863988e782b157e3a4c284372d55475 100644 (file)
@@ -249,6 +249,7 @@ class CRM_Contribute_Form_ContributionView extends CRM_Core_Form {
       $this->assign('componentId', $id);
       $this->assign('component', 'contribution');
     }
+    $this->assignPaymentInfoBlock($id);
   }
 
   /**
@@ -266,4 +267,27 @@ class CRM_Contribute_Form_ContributionView extends CRM_Core_Form {
     ));
   }
 
+  /**
+   * Assign the values to build the payment info block.
+   *
+   * @todo - this is a bit too much copy & paste from AbstractEditPayment
+   * (justifying on the basis it's 'pretty short' and in a different inheritance
+   * tree. I feel like traits are probably the longer term answer).
+   *
+   * @param int $id
+   *
+   * @return string $title
+   *   Block title.
+   */
+  protected function assignPaymentInfoBlock($id) {
+    // component is used in getPaymentInfo primarily to retrieve the contribution id, we
+    // already have that.
+    $paymentInfo = CRM_Contribute_BAO_Contribution::getPaymentInfo($id, 'contribution', TRUE);
+    $title = ts('View Payment');
+    $this->assign('transaction', TRUE);
+    $this->assign('payments', $paymentInfo['transaction']);
+    $this->assign('paymentLinks', $paymentInfo['payment_links']);
+    return $title;
+  }
+
 }
index 305cbeaff8ee962a18cd93cb53203e709311a5fd..d3b4b42f188d46557eb7ff1049fc171616a3640f 100644 (file)
   {else}
     <tr>
       <td class="label">{ts}Total Amount{/ts}</td>
-      <td><strong><a class="nowrap bold crm-expand-row" title="{ts}view payments{/ts}"
-        href="{crmURL p='civicrm/payment' q="view=transaction&component=contribution&action=browse&cid=`$contact_id`&id=`$contribution_id`&selector=1"}">
-               &nbsp; {$total_amount|crmMoney:$currency}
-            </strong></a>&nbsp;
+      <td><strong>{$total_amount|crmMoney:$currency}</strong>
         {if $contribution_recur_id}
           <a class="crm-hover-button" href='{crmURL p="civicrm/contact/view/contributionrecur" q="reset=1&id=`$contribution_recur_id`&cid=`$contact_id`&context=contribution"}'>
             <strong>{ts}Recurring Contribution{/ts}</strong>
       <td>{$thankyou_date|crmDate}</td>
     </tr>
   {/if}
+  <tr>
+    <td class="label">{ts}Payment Details{/ts}</td>
+    <td>{include file="CRM/Contribute/Form/PaymentInfoBlock.tpl"}</td>
+  </tr>
   {if $addRecordPayment}
     <tr>
-      <td class='label'>{ts}Fees{/ts}</td>
+      <td class='label'>{ts}Payment Summary{/ts}</td>
       <td id='payment-info'></td>
     </tr>
   {/if}
index b27cad046c8f99c45cf18ff961206c93fec3d20a..039eacaa9d3ddf4d55d9542b1259f1e494beb8a0 100644 (file)
@@ -55,7 +55,7 @@ CRM.$(function($) {
     {if $component eq "event"}
       <th>{ts}Total Fee(s){/ts}</th>
     {else}
-      <th>{ts}Contribution Amount(s){/ts}</th>
+      <th>{ts}Contribution Total{/ts}</th>
     {/if}
     <th class="right">{ts}Total Paid{/ts}</th>
     <th class="right">{ts}Balance{/ts}</th>