BIG HACK: Corrected frequency calculation for new members
authorRuben Rodriguez <ruben@fsf.org>
Mon, 12 Mar 2018 23:47:35 +0000 (19:47 -0400)
committerMichael McMahon <michael@fsf.org>
Tue, 27 Sep 2022 21:05:22 +0000 (17:05 -0400)
CRM/Price/BAO/PriceSet.php

index e55b4933f56137110ac428a325607cc45198b2e9..7c3dc591c0856f3dfd7d43c873258fcd8c6287bd 100644 (file)
@@ -1257,12 +1257,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);