BIG HACK: Corrected frequency calculation for new members
authorRuben Rodriguez <ruben@fsf.org>
Mon, 12 Mar 2018 23:47:35 +0000 (19:47 -0400)
committerRuben Rodriguez <ruben@trisquel.org>
Mon, 5 Jun 2023 20:53:22 +0000 (16:53 -0400)
CRM/Price/BAO/PriceSet.php

index 49a7a3b06c8afa69473b7c6759c7efeed3f85f3a..aa861d8bff874d1fc79a80051dbae05cd416b10b 100644 (file)
@@ -1245,12 +1245,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);