projects
/
civicrm-core.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Return FALSE instead of throwing Exception if package throws Exception
[civicrm-core.git]
/
CRM
/
Member
/
Tokens.php
diff --git
a/CRM/Member/Tokens.php
b/CRM/Member/Tokens.php
index 1e22252cdad65d8626c0cb5ea99e034e21151d40..455ba74ffa72e4c0fc52dcd4d6a88f39b6dd28d8 100644
(file)
--- a/
CRM/Member/Tokens.php
+++ b/
CRM/Member/Tokens.php
@@
-45,7
+45,7
@@
class CRM_Member_Tokens extends \Civi\Token\AbstractTokenSubscriber {
*/
public function __construct() {
parent::__construct('membership', array_merge(
*/
public function __construct() {
parent::__construct('membership', array_merge(
- array(
+ [
'fee' => ts('Membership Fee'),
'id' => ts('Membership ID'),
'join_date' => ts('Membership Join Date'),
'fee' => ts('Membership Fee'),
'id' => ts('Membership ID'),
'join_date' => ts('Membership Join Date'),
@@
-53,7
+53,7
@@
class CRM_Member_Tokens extends \Civi\Token\AbstractTokenSubscriber {
'end_date' => ts('Membership End Date'),
'status' => ts('Membership Status'),
'type' => ts('Membership Type'),
'end_date' => ts('Membership End Date'),
'status' => ts('Membership Status'),
'type' => ts('Membership Type'),
-
)
,
+
]
,
CRM_Utils_Token::getCustomFieldTokens('Membership')
));
}
CRM_Utils_Token::getCustomFieldTokens('Membership')
));
}
@@
-63,8
+63,7
@@
class CRM_Member_Tokens extends \Civi\Token\AbstractTokenSubscriber {
*/
public function checkActive(\Civi\Token\TokenProcessor $processor) {
// Extracted from scheduled-reminders code. See the class description.
*/
public function checkActive(\Civi\Token\TokenProcessor $processor) {
// Extracted from scheduled-reminders code. See the class description.
- return
- !empty($processor->context['actionMapping'])
+ return !empty($processor->context['actionMapping'])
&& $processor->context['actionMapping']->getEntity() === 'civicrm_membership';
}
&& $processor->context['actionMapping']->getEntity() === 'civicrm_membership';
}
@@
-92,9
+91,12
@@
class CRM_Member_Tokens extends \Civi\Token\AbstractTokenSubscriber {
public function evaluateToken(\Civi\Token\TokenRow $row, $entity, $field, $prefetch = NULL) {
$actionSearchResult = $row->context['actionSearchResult'];
public function evaluateToken(\Civi\Token\TokenRow $row, $entity, $field, $prefetch = NULL) {
$actionSearchResult = $row->context['actionSearchResult'];
- if (in_array($field,
array('start_date', 'end_date', 'join_date')
)) {
+ if (in_array($field,
['start_date', 'end_date', 'join_date']
)) {
$row->tokens($entity, $field, \CRM_Utils_Date::customFormat($actionSearchResult->$field));
}
$row->tokens($entity, $field, \CRM_Utils_Date::customFormat($actionSearchResult->$field));
}
+ elseif ($field == 'fee') {
+ $row->tokens($entity, $field, \CRM_Utils_Money::format($actionSearchResult->$field, NULL, NULL, TRUE));
+ }
elseif (isset($actionSearchResult->$field)) {
$row->tokens($entity, $field, $actionSearchResult->$field);
}
elseif (isset($actionSearchResult->$field)) {
$row->tokens($entity, $field, $actionSearchResult->$field);
}