CRM-16189, added function to get all financial type having Deferred Income account...
authorPradeep Nayak <pradpnayak@gmail.com>
Wed, 15 Jun 2016 10:56:34 +0000 (16:26 +0530)
committerPradeep Nayak <pradpnayak@gmail.com>
Thu, 23 Jun 2016 17:39:20 +0000 (23:09 +0530)
----------------------------------------
* CRM-16189:
  https://issues.civicrm.org/jira/browse/CRM-16189

Conflicts:

CRM/Financial/BAO/FinancialAccount.php

CRM/Financial/BAO/FinancialAccount.php

index 7bc08746eb4d2c917b2e3a0ea98cb1fc404a0834..db721d44c194c5c9f51fa25642e62d710613bfa5 100644 (file)
@@ -282,4 +282,24 @@ WHERE cft.id = %1
     return $financialAccountLinks;
   }
 
+  /**
+   * Get Deferred Financial type
+   *
+   * @return array
+   *
+   */
+  public static function getDeferredFinancialType() {
+    $deferredFinancialType = array();
+    $query = "SELECT ce.entity_id, cft.name FROM civicrm_entity_financial_account ce
+INNER JOIN civicrm_option_value cv ON ce.account_relationship = cv.value
+INNER JOIN civicrm_option_group cg ON cg.id= cv.option_group_id AND cg.name = 'account_relationship'
+INNER JOIN civicrm_financial_type cft ON ce.entity_id = cft.id
+WHERE `entity_table` = 'civicrm_financial_type' AND cv.name = 'Deferred Revenue Account is' AND cft.is_active = 1";
+    $dao = CRM_Core_DAO::executeQuery($query);
+    while ($dao->fetch()) {
+      $deferredFinancialType[$dao->entity_id] = $dao->name;
+    }
+    return $deferredFinancialType;
+  }
+
 }