Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NFC Clarify what CRM_Price_BAO_Priceset::getMembershipCount does #18426

Merged
merged 1 commit into from
Sep 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions CRM/Price/BAO/PriceSet.php
Original file line number Diff line number Diff line change
Expand Up @@ -1234,16 +1234,20 @@ public static function getPricesetCount($sid, $onlyActive = TRUE) {
}

/**
* @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);
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/CRM/Price/BAO/PriceSetTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public function testCopyPriceSet() {

/**
* 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
*/
Expand Down