Improve code readability - suggested by @jitendrapurohit at
authorAidan Saunders <aidan.saunders@squiffle.uk>
Thu, 11 May 2017 11:53:16 +0000 (12:53 +0100)
committerAidan Saunders <aidan.saunders@squiffle.uk>
Thu, 11 May 2017 11:53:16 +0000 (12:53 +0100)
https://github.com/civicrm/civicrm-core/pull/10306#pullrequestreview-37529657

CRM/Contribute/BAO/Contribution.php

index fed49664e5d90d580337c189ad46db8d3f89e815..6b2c79492e0fadca6afe7ef33c45335efad146b4 100644 (file)
@@ -2654,6 +2654,7 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac
         $lineItems = CRM_Price_BAO_LineItem::getLineItemsByContributionID($this->id);
         if (!empty($lineItems)) {
           $firstLineItem = reset($lineItems);
+          $priceSet = array();
           if (CRM_Utils_Array::value('price_set_id', $firstLineItem)) {
             $priceSet = civicrm_api3('PriceSet', 'getsingle', array('id' => $firstLineItem['price_set_id'], 'return' => 'is_quick_config, id'));
             $values['priceSetID'] = $priceSet['id'];
@@ -2668,7 +2669,7 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac
             }
             // This is actually used in conjunction with is_quick_config in the template & we should deprecate it.
             // However, that does create upgrade pain so would be better to be phased in.
-            $values['useForMember'] = !(isset($priceSet) && $priceSet['is_quick_config']);
+            $values['useForMember'] = empty($priceSet['is_quick_config']);
           }
           $values['lineItem'][0] = $lineItems;
         }