From: Eileen McNaughton Date: Thu, 12 Oct 2023 22:23:17 +0000 (+1300) Subject: Remove now-always-true-param X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=27ff7533b26b350a438cb00962e3765417bf026b;p=civicrm-core.git Remove now-always-true-param --- diff --git a/CRM/Contribute/Form/Contribution/Main.php b/CRM/Contribute/Form/Contribution/Main.php index 0e34054ace..d1d2f8a232 100644 --- a/CRM/Contribute/Form/Contribution/Main.php +++ b/CRM/Contribute/Form/Contribution/Main.php @@ -473,14 +473,13 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu * * @param CRM_Core_Form $form * @param string|null $component - * @param bool $validFieldsOnly * * @return void * @throws \CRM_Core_Exception */ - private function buildPriceSet(&$form, $component = NULL, $validFieldsOnly = TRUE) { + private function buildPriceSet(&$form, $component = NULL) { $priceSetId = $this->getPriceSetID(); - $priceSet = CRM_Price_BAO_PriceSet::getSetDetail($priceSetId, TRUE, $validFieldsOnly); + $priceSet = CRM_Price_BAO_PriceSet::getSetDetail($priceSetId, TRUE, TRUE); $form->_priceSet = $priceSet[$priceSetId] ?? NULL; $validPriceFieldIds = array_keys($form->_priceSet['fields']); @@ -514,14 +513,12 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu // Call the buildAmount hook. CRM_Utils_Hook::buildAmount($component ?? 'contribution', $form, $feeBlock); - $hideAdminValues = !CRM_Core_Permission::check('edit contributions'); // CRM-14492 Admin price fields should show up on event registration if user has 'administer CiviCRM' permissions $adminFieldVisible = CRM_Core_Permission::check('administer CiviCRM'); $checklifetime = FALSE; foreach ($feeBlock as $id => $field) { - if (($field['visibility'] ?? NULL) == 'public' || - (($field['visibility'] ?? NULL) == 'admin' && $adminFieldVisible == TRUE) || - !$validFieldsOnly + if ($field['visibility'] === 'public' || + ($field['visibility'] === 'admin' && $adminFieldVisible) ) { $options = $field['options'] ?? NULL; $contactId = $form->getVar('_membershipContactID'); @@ -536,7 +533,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu if (!is_array($options) || !in_array($id, $validPriceFieldIds)) { continue; } - elseif ($hideAdminValues) { + if (!CRM_Core_Permission::check('edit contributions')) { foreach ($options as $key => $currentOption) { if ($currentOption['visibility_id'] == CRM_Price_BAO_PriceField::getVisibilityOptionID('admin')) { unset($options[$key]); diff --git a/CRM/Price/BAO/PriceSet.php b/CRM/Price/BAO/PriceSet.php index d1d8409576..f29b493c14 100644 --- a/CRM/Price/BAO/PriceSet.php +++ b/CRM/Price/BAO/PriceSet.php @@ -795,7 +795,6 @@ WHERE id = %1"; * @deprecated since 5.68. Will be removed around 5.80. */ public static function buildPriceSet(&$form, $component = NULL, $validFieldsOnly = TRUE) { - CRM_Core_Error::deprecatedFunctionWarning('copy & paste ....'); $priceSetId = $form->get('priceSetId'); if (!$priceSetId) { return;