CRM-18701 tidy up, stop setting an array key & use a variable.
authoreileen <emcnaughton@wikimedia.org>
Mon, 6 Jun 2016 20:20:50 +0000 (14:20 -0600)
committereileen <emcnaughton@wikimedia.org>
Mon, 6 Jun 2016 20:20:50 +0000 (14:20 -0600)
The array key is returned to the calling function but grepping did not find any more instances of it so we should limit it's scope to the function that uses it.

Really we want to pass in  as a non-reference or else it's too unpredictable but this is just a small step

CRM/Price/BAO/PriceSet.php

index 93c205b67441a734cb38b91549b942fcff213aa6..ff934adf209110dbe83fce9fadbee24dc266be55 100644 (file)
@@ -851,20 +851,20 @@ WHERE  id = %1";
           break;
 
         case 'CheckBox':
-          $params['amount_priceset_level_checkbox'] = $optionIds = array();
+          $amount_price_set_level_checkbox = $optionIds = array();
           foreach ($params["price_{$id}"] as $optionId => $option) {
             $optionIds[] = $optionId;
             $optionLabel = $field['options'][$optionId]['label'];
-            $params['amount_priceset_level_checkbox']["{$field['options'][$optionId]['id']}"] = $optionLabel;
+            $amount_price_set_level_checkbox["{$field['options'][$optionId]['id']}"] = $optionLabel;
             if (isset($checkboxLevel)) {
               $checkboxLevel = array_unique(array_merge(
                   $checkboxLevel,
-                  array_keys($params['amount_priceset_level_checkbox'])
+                  array_keys($amount_price_set_level_checkbox)
                 )
               );
             }
             else {
-              $checkboxLevel = array_keys($params['amount_priceset_level_checkbox']);
+              $checkboxLevel = array_keys($amount_price_set_level_checkbox);
             }
           }
           CRM_Price_BAO_LineItem::format($id, $params, $field, $lineItem);