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>
Thu, 30 Nov 2023 20:03:25 +0000 (15:03 -0500)
CRM/Price/BAO/PriceSet.php

index fa7fea83243e5e4ff9bb5ab71d19d47871fe1673..919fabffcdcd48654fc142ebeb342dc5b427e476 100644 (file)
@@ -1203,12 +1203,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);