From 8eacd5221c7d4d26c5b959b0ef0b636f76097ba4 Mon Sep 17 00:00:00 2001 From: Matthew Wire Date: Mon, 7 Sep 2020 16:32:18 +0100 Subject: [PATCH] Clarify what getMembershipCount does --- CRM/Price/BAO/PriceSet.php | 10 +++++++--- tests/phpunit/CRM/Price/BAO/PriceSetTest.php | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/CRM/Price/BAO/PriceSet.php b/CRM/Price/BAO/PriceSet.php index d2c1643071..7481dd09fa 100644 --- a/CRM/Price/BAO/PriceSet.php +++ b/CRM/Price/BAO/PriceSet.php @@ -1234,16 +1234,20 @@ INNER JOIN civicrm_price_set pset ON ( pset.id = field.price_set_id ) } /** - * @param $ids + * Return a count of priceFieldValueIDs that are memberships by organisation and membership type + * + * @param string $priceFieldValueIDs + * Comma separated string of priceFieldValue IDs * * @return array + * Returns an array of counts by membership organisation */ - public static function getMembershipCount($ids) { + public static function getMembershipCount($priceFieldValueIDs) { $queryString = " SELECT count( pfv.id ) AS count, mt.member_of_contact_id AS id FROM civicrm_price_field_value pfv INNER JOIN civicrm_membership_type mt ON mt.id = pfv.membership_type_id -WHERE pfv.id IN ( $ids ) +WHERE pfv.id IN ( $priceFieldValueIDs ) GROUP BY mt.member_of_contact_id "; $crmDAO = CRM_Core_DAO::executeQuery($queryString); diff --git a/tests/phpunit/CRM/Price/BAO/PriceSetTest.php b/tests/phpunit/CRM/Price/BAO/PriceSetTest.php index 1c311ed327..36e1e19285 100644 --- a/tests/phpunit/CRM/Price/BAO/PriceSetTest.php +++ b/tests/phpunit/CRM/Price/BAO/PriceSetTest.php @@ -82,7 +82,7 @@ class CRM_Price_BAO_PriceSetTest extends CiviUnitTestCase { /** * Test CRM_Price_BAO_PriceSet::getMembershipCount() that return correct number of - * membership type occurances against it's corresponding member orgaisation + * membership type occurrences against it's corresponding member organisation * * @throws \CRM_Core_Exception */ -- 2.25.1