From d9eeb0f4b002732ebf1254c13b1e0ad72f7d8fb5 Mon Sep 17 00:00:00 2001 From: Pradeep Nayak Date: Wed, 15 Jun 2016 16:26:34 +0530 Subject: [PATCH] CRM-16189, added function to get all financial type having Deferred Income account is relationship ---------------------------------------- * CRM-16189: https://issues.civicrm.org/jira/browse/CRM-16189 Conflicts: CRM/Financial/BAO/FinancialAccount.php --- CRM/Financial/BAO/FinancialAccount.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/CRM/Financial/BAO/FinancialAccount.php b/CRM/Financial/BAO/FinancialAccount.php index 7bc08746eb..db721d44c1 100644 --- a/CRM/Financial/BAO/FinancialAccount.php +++ b/CRM/Financial/BAO/FinancialAccount.php @@ -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; + } + } -- 2.25.1