Eileen has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/325463

Change subject: Alternate fix for reconciliation report doubling some rows.
......................................................................

Alternate fix for reconciliation report doubling some rows.

The previous fix was to filter fee rows out of the join. That works. But I 
wanted to trial
a bit more and to do so it seemed really useful to be able to see the total in 
the original
currency. Once I tried adding that it showed that the rows were still being 
duplicated,
only the value was blank for the 'wrong' rows. I feel replacing the left join 
with a WHERE
might save confusion later. Also, I think the option of original_amount total 
seems useful.

Bug: T152238
Change-Id: I63e2240da371bd18cb4bc37c9424365cbc27968b
---
M 
sites/all/modules/wmf_reports/CRM/Report/Form/Contribute/GatewayReconciliation.php
1 file changed, 17 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/63/325463/1

diff --git 
a/sites/all/modules/wmf_reports/CRM/Report/Form/Contribute/GatewayReconciliation.php
 
b/sites/all/modules/wmf_reports/CRM/Report/Form/Contribute/GatewayReconciliation.php
index 98511e5..b2402f8 100644
--- 
a/sites/all/modules/wmf_reports/CRM/Report/Form/Contribute/GatewayReconciliation.php
+++ 
b/sites/all/modules/wmf_reports/CRM/Report/Form/Contribute/GatewayReconciliation.php
@@ -107,6 +107,13 @@
                         'default' => false,
                         'no_display' => true,
                     ),
+                    'original_amount' => array(
+                      'title' => ts( 'Original Amount' ),
+                      'type' => CRM_Utils_Type::T_MONEY,
+                      'statistics' => array(
+                        'sum' => ts( 'Total Original Amount' ),
+                      ),
+                    ),
                     'original_currency' => array(
                         'title' => ts( 'Original Currency' ),
                         'required' => true,
@@ -204,12 +211,6 @@
     }
 
     function from( ) {
-
-        $depositFinancialAccountID = civicrm_api3('FinancialAccount', 
'getvalue', array(
-          'return' => 'id',
-          'name' => 'Deposit Bank Account',
-        ));
-
         $this->_from = <<<EOS
 FROM civicrm_contribution {$this->_aliases['civicrm_contribution']}
 LEFT JOIN wmf_contribution_extra {$this->_aliases['wmf_contribution_extra']}
@@ -221,7 +222,6 @@
 
   LEFT JOIN civicrm_financial_trxn {$this->_aliases['civicrm_financial_trxn']}
                     ON {$this->_aliases['civicrm_financial_trxn']}.id = 
entity_financial_trxn_civireport.financial_trxn_id
-                    AND 
{$this->_aliases['civicrm_financial_trxn']}.to_financial_account_id = 
{$depositFinancialAccountID}
 EOS;
         if ( $this->isTableSelected( 'civicrm_country' ) ) {
             $this->_from .= <<<EOS
@@ -291,6 +291,16 @@
         $this->_selectAliases[] = $field['dbAlias'];
     }
 
+    function storeWhereHavingClauseArray() {
+      parent::storeWhereHavingClauseArray();
+      $depositFinancialAccountID = civicrm_api3('FinancialAccount', 
'getvalue', array(
+        'return' => 'id',
+        'name' => 'Deposit Bank Account',
+      ));
+      $this->_whereClauses[] = 
"{$this->_aliases['civicrm_financial_trxn']}.to_financial_account_id = 
{$depositFinancialAccountID}";
+
+    }
+
   /**
    *
   * Alter display of rows.

-- 
To view, visit https://gerrit.wikimedia.org/r/325463
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I63e2240da371bd18cb4bc37c9424365cbc27968b
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: deployment
Gerrit-Owner: Eileen <emcnaugh...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to