Skip to content

Commit

Permalink
Stop passing parameters to previously shared now-private function
Browse files Browse the repository at this point in the history
  • Loading branch information
eileenmcnaughton committed Feb 23, 2024
1 parent c005064 commit 491381c
Showing 1 changed file with 10 additions and 29 deletions.
39 changes: 10 additions & 29 deletions CRM/Event/Form/Participant.php
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,8 @@ public function buildQuickForm() {
$this->assign('partiallyPaidStatusId', $partiallyPaidStatusId);

if ($this->isOverloadFeesMode()) {
return $this->buildEventFeeForm($this);
$this->buildEventFeeForm($this);
return;
}

if ($this->isSubmitted()) {
Expand Down Expand Up @@ -1237,7 +1238,7 @@ public function buildEventFeeForm($form) {
$form->assign('priceSet', $form->_priceSet ?? NULL);
}
else {
$this->buildAmount($form, $form->getDiscountID(), $this->getPriceSetID());
$this->buildAmount();
}
$discounts = [];
if (!empty($form->_values['discount'])) {
Expand Down Expand Up @@ -2048,35 +2049,15 @@ public function getInvoiceID(): string {
* @internal function is not currently called by any extentions in our civi
* 'universe' and is not supported for such use. Signature has changed & will
* change again.
*
* @param self $form
* Form object.
* @param int|null $discountId
* Discount id for the event.
* @param int|null $priceSetID
*
* @throws \CRM_Core_Exception
*/
private function buildAmount($form, $discountId, $priceSetID): void {
$feeFields = $form->_values['fee'] ?? NULL;

//check for discount.
$discountedFee = $form->_values['discount'] ?? NULL;
if (is_array($discountedFee) && !empty($discountedFee)) {
if (!$discountId) {
$form->_discountId = $discountId = CRM_Core_BAO_Discount::findSet($form->_eventId, 'civicrm_event');
}
if ($discountId) {
$feeFields = &$form->_values['discount'][$discountId];
}
}

private function buildAmount(): void {
$feeFields = $this->_values['fee'] ?? NULL;
//its time to call the hook.
CRM_Utils_Hook::buildAmount('event', $form, $feeFields);
CRM_Utils_Hook::buildAmount('event', $this, $feeFields);

//build the priceset fields.
// This is probably not required now - normally loaded from event ....
$form->add('hidden', 'priceSetId', $priceSetID);
$this->add('hidden', 'priceSetId', $this->getPriceSetID());

foreach ($feeFields as $field) {
// public AND admin visibility fields are included for back-office registration and back-office change selections
Expand All @@ -2095,7 +2076,7 @@ private function buildAmount($form, $discountId, $priceSetID): void {
//soft suppress required rule when option is full.
if (!empty($options)) {
//build the element.
CRM_Price_BAO_PriceField::addQuickFormElement($form,
CRM_Price_BAO_PriceField::addQuickFormElement($this,
$elementName,
$fieldId,
FALSE,
Expand All @@ -2105,8 +2086,8 @@ private function buildAmount($form, $discountId, $priceSetID): void {
);
}
}
$form->_priceSet['id'] ??= $priceSetID;
$form->assign('priceSet', $form->_priceSet);
$this->_priceSet['id'] ??= $this->getPriceSetID();
$this->assign('priceSet', $this->_priceSet);
}

}

0 comments on commit 491381c

Please sign in to comment.