Remove unused cancelledStatus assign
[civicrm-core.git] / CRM / Contribute / Tokens.php
index 2e27094620f64a7116d5914fdcaabb8b08a6d26f..e773317a23f6467f4515773ba3e91be13d968f03 100644 (file)
@@ -2,27 +2,11 @@
 
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 5                                                  |
- +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2018                                |
- +--------------------------------------------------------------------+
- | This file is a part of CiviCRM.                                    |
- |                                                                    |
- | CiviCRM is free software; you can copy, modify, and distribute it  |
- | under the terms of the GNU Affero General Public License           |
- | Version 3, 19 November 2007 and the CiviCRM Licensing Exception.   |
+ | Copyright CiviCRM LLC. All rights reserved.                        |
  |                                                                    |
- | CiviCRM is distributed in the hope that it will be useful, but     |
- | WITHOUT ANY WARRANTY; without even the implied warranty of         |
- | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.               |
- | See the GNU Affero General Public License for more details.        |
- |                                                                    |
- | You should have received a copy of the GNU Affero General Public   |
- | License and the CiviCRM Licensing Exception along                  |
- | with this program; if not, contact CiviCRM LLC                     |
- | at info[AT]civicrm[DOT]org. If you have questions about the        |
- | GNU Affero General Public License or the licensing of CiviCRM,     |
- | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
+ | This work is published under the GNU AGPLv3 license with some      |
+ | permitted exceptions and without any warranty. For full license    |
+ | and copyright information, see https://civicrm.org/licensing       |
  +--------------------------------------------------------------------+
  */
 
@@ -41,7 +25,7 @@ class CRM_Contribute_Tokens extends \Civi\Token\AbstractTokenSubscriber {
    * @return array
    */
   protected function getPassthruTokens() {
-    return array(
+    return [
       'contribution_page_id',
       'receive_date',
       'total_amount',
@@ -50,11 +34,11 @@ class CRM_Contribute_Tokens extends \Civi\Token\AbstractTokenSubscriber {
       'trxn_id',
       'invoice_id',
       'currency',
-      'cancel_date',
+      'contribution_cancel_date',
       'receipt_date',
       'thankyou_date',
       'tax_amount',
-    );
+    ];
   }
 
   /**
@@ -63,13 +47,14 @@ class CRM_Contribute_Tokens extends \Civi\Token\AbstractTokenSubscriber {
    * @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',
+    ];
   }
 
   /**
@@ -97,8 +82,7 @@ class CRM_Contribute_Tokens extends \Civi\Token\AbstractTokenSubscriber {
    * @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';
   }
 
@@ -129,7 +113,7 @@ class CRM_Contribute_Tokens extends \Civi\Token\AbstractTokenSubscriber {
     $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));
     }