projects
/
civicrm-core.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
CRM-18972: List of strings that cannot be localized cause the absence of ts() function
[civicrm-core.git]
/
Civi
/
Token
/
TokenCompatSubscriber.php
diff --git
a/Civi/Token/TokenCompatSubscriber.php
b/Civi/Token/TokenCompatSubscriber.php
index 152b5b7ae0fcd05ce6fc8b7bffca0a56e5a45a6f..3eaf57d3b7cc6ac6d92ccf948c9647a45825767b 100644
(file)
--- a/
Civi/Token/TokenCompatSubscriber.php
+++ b/
Civi/Token/TokenCompatSubscriber.php
@@
-49,9
+49,10
@@
class TokenCompatSubscriber implements EventSubscriberInterface {
$messageTokens = $e->getTokenProcessor()->getMessageTokens();
foreach ($e->getRows() as $row) {
$messageTokens = $e->getTokenProcessor()->getMessageTokens();
foreach ($e->getRows() as $row) {
+ $contactId = $row->context['contactId'];
if (empty($row->context['contact'])) {
$params = array(
if (empty($row->context['contact'])) {
$params = array(
- array('contact_id', '=', $
row->context['contactId']
, 0, 0),
+ array('contact_id', '=', $
contactId
, 0, 0),
);
list($contact, $_) = \CRM_Contact_BAO_Query::apiQuery($params);
$contact = reset($contact); //CRM-4524
);
list($contact, $_) = \CRM_Contact_BAO_Query::apiQuery($params);
$contact = reset($contact); //CRM-4524
@@
-70,16
+71,22
@@
class TokenCompatSubscriber implements EventSubscriberInterface {
$contact = array_merge($contact, $row->context['tmpTokenParams']);
}
$contact = array_merge($contact, $row->context['tmpTokenParams']);
}
+ $contactArray = !is_array($contactId) ? array($contactId => $contact) : $contact;
+
// Note: This is a small contract change from the past; data should be missing
// less randomly.
//\CRM_Utils_Hook::tokenValues($contact, $row->context['contactId']);
// Note: This is a small contract change from the past; data should be missing
// less randomly.
//\CRM_Utils_Hook::tokenValues($contact, $row->context['contactId']);
- \CRM_Utils_Hook::tokenValues($contact,
-
$row->context['contactId']
,
+ \CRM_Utils_Hook::tokenValues($contact
Array
,
+
(array) $contactId
,
empty($row->context['mailingJob']) ? NULL : $row->context['mailingJob']->id,
$messageTokens,
$row->context['controller']
);
empty($row->context['mailingJob']) ? NULL : $row->context['mailingJob']->id,
$messageTokens,
$row->context['controller']
);
+ // merge the custom tokens in the $contact array
+ if (!empty($contactArray[$contactId])) {
+ $contact = array_merge($contact, $contactArray[$contactId]);
+ }
$row->context('contact', $contact);
}
}
$row->context('contact', $contact);
}
}