From b3406e109fc745da4ba59f0b37c9b88329ce9bcb Mon Sep 17 00:00:00 2001 From: Ruben Rodriguez Date: Mon, 12 Mar 2018 19:47:35 -0400 Subject: [PATCH] BIG HACK: Corrected frequency calculation for new members --- CRM/Price/BAO/PriceSet.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/CRM/Price/BAO/PriceSet.php b/CRM/Price/BAO/PriceSet.php index 6b123b2a48..c711ed0b1e 100644 --- a/CRM/Price/BAO/PriceSet.php +++ b/CRM/Price/BAO/PriceSet.php @@ -1209,12 +1209,14 @@ GROUP BY mt.member_of_contact_id "; * @return array * associate array of frequency interval and unit */ - public static function getRecurDetails($priceSetId) { + // Ruben Added `, $priceFieldValueIds` here. + public static function getRecurDetails($priceSetId, $priceFieldValueIds) { $query = 'SELECT mt.duration_interval, mt.duration_unit FROM civicrm_price_field_value pfv INNER JOIN civicrm_membership_type mt ON pfv.membership_type_id = mt.id INNER JOIN civicrm_price_field pf ON pfv.price_field_id = pf.id - WHERE pf.price_set_id = %1 LIMIT 1'; + WHERE pf.price_set_id = %1 AND pfv.id = ' + . $priceFieldValueIds . ' LIMIT 1'; $params = [1 => [$priceSetId, 'Integer']]; $dao = CRM_Core_DAO::executeQuery($query, $params); -- 2.25.1