revert commit that modified getRecurDetails()
authorAndrew Engelbrecht <andrew@fsf.org>
Fri, 19 Jan 2018 02:16:08 +0000 (21:16 -0500)
committerMichael McMahon <michael@fsf.org>
Fri, 17 Apr 2020 15:37:17 +0000 (11:37 -0400)
we aren't quite sure what this was supposed to do, but this patch was
breaking our site, and it now works with these changes reverted.

CRM/Contribute/Form/ContributionBase.php
CRM/Price/BAO/PriceSet.php

index b74f075b6f181060f0adf1babbcdf7c48f539a6d..41fcb7da3e1b4ee6c9cd7f68c7e632ec2157909a 100644 (file)
@@ -1371,11 +1371,7 @@ class CRM_Contribute_Form_ContributionBase extends CRM_Core_Form {
       $this->_params['is_recur'] = $this->_values['is_recur'] = 1;
       // check if price set is not quick config
       if (!empty($this->_params['priceSetId']) && !CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $this->_params['priceSetId'], 'is_quick_config')) {
-        // based on Lisa's commit 520680c63f7b886643e80c2400d9e9b6f1a1fd52
-        // Extract the ids for all of the line items that have been
-        // chosen.
-        $priceFieldValueIds = array_keys($this->_lineItem[$this->_params['priceSetId']]);
-        list($this->_params['frequency_interval'], $this->_params['frequency_unit']) = CRM_Price_BAO_PriceSet::getRecurDetails($this->_params['priceSetId'], $priceFieldValueIds);
+        list($this->_params['frequency_interval'], $this->_params['frequency_unit']) = CRM_Price_BAO_PriceSet::getRecurDetails($this->_params['priceSetId']);
       }
       else {
         // FIXME: set interval and unit based on selected membership type
index d6915dc9c69c6373cc39665522e796dd14208303..191f85c814d3b4d72b5868ca73e3886adc02232b 100644 (file)
@@ -1333,18 +1333,13 @@ GROUP BY     mt.member_of_contact_id ";
    * @return array
    *   associate array of frequency interval and unit
    */
-  public static function getRecurDetails($priceSetId, $priceFieldValueIds) {
-    // Escape the array of ids.
-    foreach ($priceFieldValueIds as $index => $id) {
-      $priceFieldValueIds[$index] = CRM_Utils_Type::escape($id, 'Integer');
-    }
+  public static function getRecurDetails($priceSetId) {
 
     $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 AND pfv.id IN ('
-      . implode(',', $priceFieldValueIds) . ') LIMIT 1';
+            WHERE pf.price_set_id = %1 LIMIT 1';
 
     $params = [1 => [$priceSetId, 'Integer']];
     $dao = CRM_Core_DAO::executeQuery($query, $params);