$this->_component = 'event';
}
else {
- $this->_component = strtolower(CRM_Utils_Array::value('component', $input, 'contribute'));
+ $this->_component = $input['component'] ?? 'contribute';
}
}
+ // @todo remove strtolower - check consistency
+ $this->_component = strtolower($this->_component);
// If the object is not fully populated then make sure it is - this is a more about legacy paths & cautious
// refactoring than anything else, and has unit test coverage.
$this->find(TRUE);
}
- $paymentProcessorID = CRM_Utils_Array::value('payment_processor_id', $input, CRM_Utils_Array::value(
- 'paymentProcessor',
- $ids
- ));
+ $paymentProcessorID = $input['payment_processor_id'] ?? $ids['paymentProcessor'] ?? NULL;
if (!isset($input['payment_processor_id']) && !$paymentProcessorID && $this->contribution_page_id) {
$paymentProcessorID = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_ContributionPage',
}
$this->loadRelatedObjects($paymentProcessorID, $ids);
-
- if (empty($this->_component)) {
- $this->_component = $input['component'] ?? NULL;
- }
+ $paymentProcessor = $this->_relatedObjects['paymentProcessor'] ?? NULL;
//not really sure what params might be passed in but lets merge em into values
$values = array_merge($this->_gatherMessageValues($input, $values, $ids), $values);
$template = $this->_assignMessageVariablesToTemplate($values, $input, $returnMessageText);
//what does recur 'mean here - to do with payment processor return functionality but
// what is the importance
- if (!empty($this->contribution_recur_id) && !empty($this->_relatedObjects['paymentProcessor'])) {
- $paymentObject = Civi\Payment\System::singleton()->getByProcessor($this->_relatedObjects['paymentProcessor']);
+ if (!empty($this->contribution_recur_id) && !empty($paymentProcessor)) {
+ $paymentObject = Civi\Payment\System::singleton()->getByProcessor($paymentProcessor);
$entityID = $entity = NULL;
if (isset($ids['contribution'])) {
$entityID = $ids['contribution'];
}
if (!empty($ids['membership'])) {
- //not sure whether is is possible for this not to be an array - load related contacts loads an array but this code was expecting a string
+ // not sure whether it is possible for this not to be an array - load related contacts loads an array but this code was expecting a string
// the addition of the casting is in case it could get here & be a string. Added in 4.6 - maybe remove later? This AuthorizeNetIPN & PaypalIPN tests hit this
// line having loaded an array
$ids['membership'] = (array) $ids['membership'];
$template->assign('updateSubscriptionBillingUrl', $paymentObject->subscriptionURL($entityID, $entity, 'billing'));
$template->assign('updateSubscriptionUrl', $paymentObject->subscriptionURL($entityID, $entity, 'update'));
}
- // todo remove strtolower - check consistency
- if (strtolower($this->_component) === 'event') {
- $eventParams = ['id' => $this->_relatedObjects['participant']->event_id];
+
+ if ($this->_component === 'event') {
+ $eventID = $this->_relatedObjects['participant']->event_id;
+ $eventParams = ['id' => $eventID];
$values['event'] = [];
CRM_Event_BAO_Event::retrieve($eventParams, $values['event']);
//get location details
$locationParams = [
- 'entity_id' => $this->_relatedObjects['participant']->event_id,
+ 'entity_id' => $eventID,
'entity_table' => 'civicrm_event',
];
$values['location'] = CRM_Core_BAO_Location::getValues($locationParams);