])['values'];
if (!empty($participantRecords)) {
$entities['event'] = civicrm_api3('Event', 'getsingle', ['id' => $participantRecords[0]['api.Participant.get']['values'][0]['event_id']]);
+ if (!empty($entities['event']['is_show_location'])) {
+ $locationParams = [
+ 'entity_id' => $entities['event']['id'],
+ 'entity_table' => 'civicrm_event',
+ ];
+ $entities['location'] = CRM_Core_BAO_Location::getValues($locationParams, TRUE);
+ }
}
return $entities;
'totalAmount' => $entities['payment']['total'],
'amountOwed' => $entities['payment']['balance'],
'paymentAmount' => $entities['payment']['total_amount'],
- 'event' => NULL,
- 'component' => 'contribution',
'checkNumber' => CRM_Utils_Array::value('check_number', $entities['payment']),
'receive_date' => $entities['payment']['trxn_date'],
'paidBy' => CRM_Core_PseudoConstant::getLabel('CRM_Core_BAO_FinancialTrxn', 'payment_instrument_id', $entities['payment']['payment_instrument_id']),
+ 'isShowLocation' => (!empty($entities['event']) ? $entities['event']['is_show_location'] : FALSE),
+ 'location' => CRM_Utils_Array::value('location', $entities),
+ 'event' => CRM_Utils_Array::value('event', $entities),
+ 'component' => (!empty($entities['event']) ? 'event' : 'contribution'),
];
- if (!empty($entities['event'])) {
- $templateVariables['component'] = 'event';
- $templateVariables['event'] = $entities['event'];
- }
return self::filterUntestedTemplateVariables($templateVariables);
}
'checkNumber',
'receive_date',
'paidBy',
+ 'isShowLocation',
+ 'location',
];
// Need to do these before switching the form over...
$todoParams = [
'credit_card_type',
'credit_card_number',
'credit_card_exp_date',
- 'isShowLocation',
- 'location',
'eventEmail',
'$event.participant_role',
];
public function testPaymentEmailReceipt() {
$mut = new CiviMailUtils($this);
list($lineItems, $contribution) = $this->createParticipantWithContribution();
+ $event = $this->callAPISuccess('Event', 'get', []);
+ $this->addLocationToEvent($event['id']);
$params = array(
'contribution_id' => $contribution['id'],
'total_amount' => 50,
'Paid By: Check',
'Check Number: 345',
'Transaction Date: August 13th, 2018 5:57 PM',
+ 'event place',
+ 'streety street',
));
$mut->stop();
}
));
}
+ /**
+ * Add a location to our event.
+ *
+ * @param int $eventID
+ */
+ protected function addLocationToEvent($eventID) {
+ $addressParams = [
+ 'name' => 'event place',
+ 'street_address' => 'streety street',
+ 'location_type_id' => 1,
+ 'is_primary' => 1,
+ ];
+ // api requires contact_id - perhaps incorrectly but use add to get past that.
+ $address = CRM_Core_BAO_Address::add($addressParams);
+
+ $location = $this->callAPISuccess('LocBlock', 'create', ['address_id' => $address->id]);
+ $this->callAPISuccess('Event', 'create', [
+ 'id' => $eventID,
+ 'loc_block_id' => $location['id'],
+ 'is_show_location' => TRUE,
+ ]);
+ }
+
}