From 16e4c0a353566739be182e3f0217c12bbdb78a31 Mon Sep 17 00:00:00 2001 From: Pradeep Nayak Date: Thu, 13 Apr 2017 02:08:59 +0530 Subject: [PATCH] CRM-20384, added function to get Organization Name associated with Financial Account. ---------------------------------------- * CRM-20384: Bookkeeping report add contrib ID, filter by financial account owner (IIDA-85) https://issues.civicrm.org/jira/browse/CRM-20384 --- CRM/Financial/BAO/FinancialAccount.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/CRM/Financial/BAO/FinancialAccount.php b/CRM/Financial/BAO/FinancialAccount.php index 089d225a89..5b321634d8 100644 --- a/CRM/Financial/BAO/FinancialAccount.php +++ b/CRM/Financial/BAO/FinancialAccount.php @@ -455,4 +455,26 @@ LIMIT 1"; return $financialAccount; } + /** + * Get Organization Name associated with Financial Account. + * + * @param bool $checkPermissions + * + * @return array + * + */ + public static function getOrganizationNames($checkPermissions = TRUE) { + $result = civicrm_api3('FinancialAccount', 'get', array( + 'return' => array("contact_id.organization_name", "contact_id"), + 'contact_id.is_deleted' => 0, + 'options' => array('limit' => 0), + 'check_permissions' => $checkPermissions, + )); + $organizationNames = array(); + foreach ($result['values'] as $values) { + $organizationNames[$values['contact_id']] = $values['contact_id.organization_name']; + } + return $organizationNames; + } + } -- 2.25.1