Skip to content

Commit

Permalink
[REF] Fix Order class to not reload if already loaded
Browse files Browse the repository at this point in the history
  • Loading branch information
eileenmcnaughton committed Jan 17, 2021
1 parent efbd974 commit de668aa
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions CRM/Financial/BAO/Order.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,13 +176,21 @@ public function getPriceOptions():array {
* @param int $id
*
* @return array
* @throws \CiviCRM_API3_Exception
*/
public function getPriceFieldSpec(int $id) :array {
if (!isset($this->priceFieldMetadata[$id])) {
return $this->getPriceFieldsMetadata()[$id];
}

/**
* Get the metadata for the fields in the price set.
*
* @return array
*/
public function getPriceFieldsMetadata(): array {
if (empty($this->priceFieldMetadata)) {
$this->priceFieldMetadata = CRM_Price_BAO_PriceSet::getCachedPriceSetDetail($this->getPriceSetID())['fields'];
}
return $this->priceFieldMetadata[$id];
return $this->priceFieldMetadata;
}

/**
Expand All @@ -193,7 +201,7 @@ public function getPriceFieldSpec(int $id) :array {
*
* @param array $input
*/
public function setPriceSelectionFromUnfilteredInput(array $input) {
public function setPriceSelectionFromUnfilteredInput(array $input): void {
foreach ($input as $fieldName => $value) {
if (strpos($fieldName, 'price_') === 0) {
$fieldID = substr($fieldName, 6);
Expand Down

0 comments on commit de668aa

Please sign in to comment.