+--------------------------------------------------------------------+
| CiviCRM version 5 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2019 |
+ | Copyright CiviCRM LLC (c) 2004-2020 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
* @return array
*/
protected function getPassthruTokens() {
- return array(
+ return [
'contribution_page_id',
'receive_date',
'total_amount',
'trxn_id',
'invoice_id',
'currency',
- 'cancel_date',
+ 'contribution_cancel_date',
'receipt_date',
'thankyou_date',
'tax_amount',
- );
+ ];
}
/**
* @return array
*/
protected function getAliasTokens() {
- return array(
+ return [
'id' => 'contribution_id',
'payment_instrument' => 'payment_instrument_id',
'source' => 'contribution_source',
'status' => 'contribution_status_id',
'type' => 'financial_type_id',
- );
+ 'cancel_date' => 'contribution_cancel_date',
+ ];
}
/**
* @return bool
*/
public function checkActive(\Civi\Token\TokenProcessor $processor) {
- return
- !empty($processor->context['actionMapping'])
+ return !empty($processor->context['actionMapping'])
&& $processor->context['actionMapping']->getEntity() === 'civicrm_contribution';
}
$fieldValue = isset($actionSearchResult->{"contrib_$field"}) ? $actionSearchResult->{"contrib_$field"} : NULL;
$aliasTokens = $this->getAliasTokens();
- if (in_array($field, array('total_amount', 'fee_amount', 'net_amount'))) {
+ if (in_array($field, ['total_amount', 'fee_amount', 'net_amount'])) {
return $row->format('text/plain')->tokens($entity, $field,
\CRM_Utils_Money::format($fieldValue, $actionSearchResult->contrib_currency));
}