From 0a1606dbbe06e3d2c6c3edddfc091e4f04ab3807 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Fri, 2 Jun 2023 09:55:45 +1200 Subject: [PATCH] Use Permission=FALSE when retrieving price sets in examples Doing a check causes the whole example to fail - and this feels like fairly public info --- .../WorkflowMessage/Contribution/BasicContribution.php | 5 ++--- CRM/Event/WorkflowMessage/EventExamples.php | 1 - CRM/Member/WorkflowMessage/Membership/Membership.php | 3 +-- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/CRM/Contribute/WorkflowMessage/Contribution/BasicContribution.php b/CRM/Contribute/WorkflowMessage/Contribution/BasicContribution.php index 98f1f3e43c..d3477bb3da 100644 --- a/CRM/Contribute/WorkflowMessage/Contribution/BasicContribution.php +++ b/CRM/Contribute/WorkflowMessage/Contribution/BasicContribution.php @@ -134,7 +134,7 @@ class CRM_Contribute_WorkflowMessage_Contribution_BasicContribution extends Work $mockOrder->setDefaultFinancialTypeID($priceSet['financial_type_id']); } } - foreach (PriceField::get()->addWhere('price_set_id', '=', $mockOrder->getPriceSetID())->execute() as $index => $priceField) { + foreach (PriceField::get(FALSE)->addWhere('price_set_id', '=', $mockOrder->getPriceSetID())->execute() as $index => $priceField) { $priceFieldValue = PriceFieldValue::get()->addWhere('price_field_id', '=', $priceField['id'])->execute()->first(); if (empty($example['is_show_line_items'])) { $priceFieldValue['amount'] = $contribution['total_amount']; @@ -157,8 +157,7 @@ class CRM_Contribute_WorkflowMessage_Contribution_BasicContribution extends Work * @throws \CRM_Core_Exception */ private function getNonQuickConfigPriceSet(): ?array { - // Permission check defaults to true - likely implicitly OK but may need to be false. - return PriceSet::get() + return PriceSet::get(FALSE) ->addWhere('is_quick_config', '=', FALSE) ->execute() ->first(); diff --git a/CRM/Event/WorkflowMessage/EventExamples.php b/CRM/Event/WorkflowMessage/EventExamples.php index 76dde4684f..556bb42b26 100644 --- a/CRM/Event/WorkflowMessage/EventExamples.php +++ b/CRM/Event/WorkflowMessage/EventExamples.php @@ -72,7 +72,6 @@ class CRM_Event_WorkflowMessage_EventExamples extends WorkflowMessageExample { * @throws \CRM_Core_Exception */ private function getPriceSets(): ?array { - // Permission check defaults to true - likely implicitly OK but may need to be false. $quickConfigPriceSet = $this->getPriceSet(TRUE); $nonQuickConfigPriceSet = $this->getPriceSet(FALSE); diff --git a/CRM/Member/WorkflowMessage/Membership/Membership.php b/CRM/Member/WorkflowMessage/Membership/Membership.php index 25c46a6950..03d134e289 100644 --- a/CRM/Member/WorkflowMessage/Membership/Membership.php +++ b/CRM/Member/WorkflowMessage/Membership/Membership.php @@ -145,8 +145,7 @@ class CRM_Member_WorkflowMessage_Membership_Membership extends WorkflowMessageEx * @throws \CRM_Core_Exception */ private function getPriceSet(): ?array { - // Permission check defaults to true - likely implicitly OK but may need to be false. - return (array) PriceSet::get() + return (array) PriceSet::get(FALSE) ->addWhere('extends', '=', CRM_Core_Component::getComponentID('CiviMember')) ->addOrderBy('is_quick_config', 'DESC') ->execute()->indexBy('id'); -- 2.25.1