*/
class CRM_Event_BAO_Event extends CRM_Event_DAO_Event {
- /**
- * Class constructor.
- */
- public function __construct() {
- parent::__construct();
- }
-
/**
* Fetch object based on array of properties.
*
* @param array $defaults
* (reference ) an assoc array to hold the flattened values.
*
- * @return CRM_Event_DAO_Event
+ * @return CRM_Event_DAO_Event|null
*/
public static function retrieve(&$params, &$defaults) {
$event = new CRM_Event_DAO_Event();
}
$transaction->commit();
-
+ if (!empty($params['id'])) {
+ // Note that this will specifically clear cached event tokens.
+ Civi::cache('metadata')->clear();
+ }
return $event;
}
}
/**
- * Get the information to map a event.
+ * Get the information to map an event.
*
* @param int $id
* For which we want map info.
*
- * @return null|string
- * title of the event
+ * @return array
*/
public static function &getMapInfo(&$id) {
TRUE,
$participantParams
);
- list($profileValues) = $profileValues;
+ [$profileValues] = $profileValues;
$val = [
'id' => $gId,
'values' => $profileValues,
if ($values['event']['is_email_confirm'] || $returnMessageText) {
list($displayName, $email) = CRM_Contact_BAO_Contact_Location::getEmailDetails($contactID);
-
+ $notifyEmail = CRM_Utils_Array::valueByRegexKey('/^email-/', $participantParams) ?? $email;
//send email only when email is present
- if (isset($email) || $returnMessageText) {
+ if (isset($notifyEmail) || $returnMessageText) {
$preProfileID = $values['custom_pre_id'] ?? NULL;
$postProfileID = $values['custom_post_id'] ?? NULL;
$customPostTitles = NULL;
}
$tplParams = array_merge($values, $participantParams, [
- 'email' => $email,
+ 'email' => $notifyEmail,
'confirm_email_text' => $values['event']['confirm_email_text'] ?? NULL,
'isShowLocation' => $values['event']['is_show_location'] ?? NULL,
// The concept of contributeMode is deprecated.
'credit_card_number' => CRM_Utils_System::mungeCreditCard(CRM_Utils_Array::value('credit_card_number', $participantParams)),
'credit_card_exp_date' => CRM_Utils_Date::mysqlToIso(CRM_Utils_Date::format(CRM_Utils_Array::value('credit_card_exp_date', $participantParams))),
'selfcancelxfer_time' => abs($values['event']['selfcancelxfer_time']),
- 'selfservice_preposition' => $values['event']['selfcancelxfer_time'] < 0 ? 'after' : 'before',
+ 'selfservice_preposition' => $values['event']['selfcancelxfer_time'] < 0 ? ts('after') : ts('before'),
'currency' => $values['event']['currency'] ?? CRM_Core_Config::singleton()->defaultCurrency,
]);
else {
$sendTemplateParams['from'] = CRM_Utils_Array::value('confirm_from_name', $values['event']) . " <" . CRM_Utils_Array::value('confirm_from_email', $values['event']) . ">";
$sendTemplateParams['toName'] = $displayName;
- $sendTemplateParams['toEmail'] = $email;
+ $sendTemplateParams['toEmail'] = $notifyEmail;
$sendTemplateParams['autoSubmitted'] = TRUE;
$sendTemplateParams['cc'] = CRM_Utils_Array::value('cc_confirm',
$values['event']
* @param int $id
* @param string $name
* @param int $cid
- * @param string $template
+ * @param \CRM_Core_Smarty $template
* @param int $participantId
* @param bool $isTest
* @param bool $returnResults
}
}
elseif ($dao->data_type == 'Float') {
- $customVal = (float ) ($params[$name]);
+ $customVal = (float) ($params[$name]);
}
elseif ($dao->data_type == 'Date') {
//@todo note the currently we are using default date time formatting. Since you can select/set
*
* @param int $eventId
* Event id.
- * @param sting $extraWhereClause
+ * @param string $extraWhereClause
* Extra filter on participants.
*
* @return int
// Special logic for fields whose options depend on context or properties
switch ($fieldName) {
case 'financial_type_id':
- // @fixme - this is going to ignore context, better to get conditions, add params, and call PseudoConstant::get
- // @fixme - https://lab.civicrm.org/dev/core/issues/547 if CiviContribute not enabled this causes an invalid query
- // because $relationTypeId is not set in CRM_Financial_BAO_FinancialType::getIncomeFinancialType()
- if (array_key_exists('CiviContribute', CRM_Core_Component::getEnabledComponents())) {
- return CRM_Financial_BAO_FinancialType::getIncomeFinancialType();
+ // https://lab.civicrm.org/dev/core/issues/547 if CiviContribute not enabled this causes an invalid query
+ // @todo - the component is enabled check should be done within getIncomeFinancialType
+ // It looks to me like test cover was NOT added to cover the change
+ // that added this so we need to assume there is no test cover
+ if (CRM_Core_Component::isEnabled('CiviContribute')) {
+ return CRM_Financial_BAO_FinancialType::getIncomeFinancialType($props['check_permissions'] ?? TRUE);
}
return [];
}