From 418c6c533171100320e1642907f51d82f2b29bb3 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Mon, 18 Dec 2023 09:14:51 +1300 Subject: [PATCH] Remove deprecated function initSet --- CRM/Price/BAO/PriceSet.php | 96 -------------------------------------- 1 file changed, 96 deletions(-) diff --git a/CRM/Price/BAO/PriceSet.php b/CRM/Price/BAO/PriceSet.php index 13c8572a14..4f7b3f638d 100644 --- a/CRM/Price/BAO/PriceSet.php +++ b/CRM/Price/BAO/PriceSet.php @@ -535,102 +535,6 @@ WHERE id = %1"; return (int) implode('_', array_keys($priceSet['fields'][$priceFieldID]['options'])); } - /** - * Initiate price set such that various non-BAO things are set on the form. - * - * This function is not really a BAO function so the location is misleading. - * - * @param CRM_Core_Form $form - * Form entity id. - * @param string $entityTable - * @param bool $doNotIncludeExpiredFields - * @param int $priceSetId - * Price Set ID - * - * @throws \CRM_Core_Exception - * @deprecated in CiviCRM 5.58, will be removed around CiviCRM 5.70. - */ - public static function initSet(&$form, $entityTable = 'civicrm_event', $doNotIncludeExpiredFields = FALSE, $priceSetId = NULL) { - CRM_Core_Error::deprecatedFunctionWarning('no alternative'); - - // get price info - if ($priceSetId) { - if ($form->_action & CRM_Core_Action::UPDATE) { - $entityId = $entity = NULL; - - switch ($entityTable) { - case 'civicrm_event': - $entity = 'participant'; - if (in_array(CRM_Utils_System::getClassName($form), ['CRM_Event_Form_Participant', 'CRM_Event_Form_Task_Register'])) { - $entityId = $form->_id; - } - else { - $entityId = $form->_participantId; - } - break; - - case 'civicrm_contribution_page': - case 'civicrm_contribution': - $entity = 'contribution'; - $entityId = $form->_id; - break; - } - - if ($entityId && $entity) { - $form->_values['line_items'] = CRM_Price_BAO_LineItem::getLineItems($entityId, $entity); - } - $required = FALSE; - } - else { - $required = TRUE; - } - - $form->_priceSetId = $priceSetId; - $priceSet = self::getSetDetail($priceSetId, $required, $doNotIncludeExpiredFields); - $form->_priceSet = $priceSet[$priceSetId] ?? NULL; - $form->_values['fee'] = $form->_priceSet['fields'] ?? NULL; - - //get the price set fields participant count. - if ($entityTable === 'civicrm_event') { - //get option count info. - $form->_priceSet['optionsCountTotal'] = self::getPricesetCount($priceSetId); - if ($form->_priceSet['optionsCountTotal']) { - $optionsCountDetails = []; - if (!empty($form->_priceSet['fields'])) { - foreach ($form->_priceSet['fields'] as $field) { - foreach ($field['options'] as $option) { - $count = $option['count'] ?? 0; - $optionsCountDetails['fields'][$field['id']]['options'][$option['id']] = $count; - } - } - } - $form->_priceSet['optionsCountDetails'] = $optionsCountDetails; - } - - //get option max value info. - $optionsMaxValueTotal = 0; - $optionsMaxValueDetails = []; - - if (!empty($form->_priceSet['fields'])) { - foreach ($form->_priceSet['fields'] as $field) { - foreach ($field['options'] as $option) { - $maxVal = $option['max_value'] ?? 0; - $optionsMaxValueDetails['fields'][$field['id']]['options'][$option['id']] = $maxVal; - $optionsMaxValueTotal += $maxVal; - } - } - } - - $form->_priceSet['optionsMaxValueTotal'] = $optionsMaxValueTotal; - if ($optionsMaxValueTotal) { - $form->_priceSet['optionsMaxValueDetails'] = $optionsMaxValueDetails; - } - } - $form->set('priceSetId', $form->_priceSetId); - $form->set('priceSet', $form->_priceSet); - } - } - /** * Get line item purchase information. * -- 2.25.1