--fixed filtering for CRM-12192
authorPradeep Nayak <pradeep@pradeep.(none)>
Mon, 25 Mar 2013 16:03:56 +0000 (21:33 +0530)
committerPradeep Nayak <pradeep@pradeep.(none)>
Mon, 25 Mar 2013 16:03:56 +0000 (21:33 +0530)
CRM/Financial/BAO/FinancialTypeAccount.php
CRM/Financial/Page/FinancialType.php

index 3a6899d74ac7756ac78e046578eeebf58458735b..8626f898e53e1bd36f353b25d77d3d8fe37d65af 100644 (file)
@@ -64,14 +64,15 @@ class CRM_Financial_BAO_FinancialTypeAccount extends CRM_Financial_DAO_EntityFin
    * @access public
    * @static
    */
-  static function retrieve( &$params, &$defaults ) {
-    $financialTypeAccount = new CRM_Financial_DAO_EntityFinancialAccount( );
-    $financialTypeAccount->copyValues( $params );
-    if ( $financialTypeAccount->find( true ) ) {
-      CRM_Core_DAO::storeValues( $financialTypeAccount, $defaults );
-      return $financialTypeAccount;
+  static function retrieve(&$params, &$defaults, &$allValues = array()) {
+    $financialTypeAccount = new CRM_Financial_DAO_EntityFinancialAccount();
+    $financialTypeAccount->copyValues($params);
+    $financialTypeAccount->find();
+    while ($financialTypeAccount->fetch()) {
+      CRM_Core_DAO::storeValues($financialTypeAccount, $defaults);
+      $allValues[] = $defaults;
     }
-    return null;
+    return $defaults;
   }
   
   /**
index b5b6a6e88702b5a99071863cb50ee5a941b87dc9..47ccc983bc05766292a2bef1cff804836da6e48b 100644 (file)
@@ -145,9 +145,12 @@ class CRM_Financial_Page_FinancialType extends CRM_Core_Page_Basic {
       $financialType[$dao->id] = array();
       CRM_Core_DAO::storeValues( $dao, $financialType[$dao->id]);
       $defaults = $financialAccountId = array();
-      $financialAccounts = CRM_Contribute_PseudoConstant::financialAccount( );
-      $financialAccountIds = CRM_Core_DAO::commonRetrieveAll( 'CRM_Financial_DAO_EntityFinancialAccount',
-        'entity_id', $dao->id, $defaults, array('financial_account_id'));
+      $financialAccounts = CRM_Contribute_PseudoConstant::financialAccount();
+      $financialAccountIds = array();
+     
+      $params['entity_id'] = $dao->id;
+      $params['entity_table'] = 'civicrm_financial_type';
+      CRM_Financial_BAO_FinancialTypeAccount::retrieve($params, CRM_Core_DAO::$_nullArray, $financialAccountIds);
 
       foreach( $financialAccountIds as $key => $values){
         if (CRM_Utils_Array::value($values['financial_account_id'], $financialAccounts)) {