Allow chart dropdown labels to be translatable.
authorBradley Taylor <hello@brad-taylor.co.uk>
Fri, 31 Dec 2021 12:19:19 +0000 (12:19 +0000)
committerBradley Taylor <hello@brad-taylor.co.uk>
Mon, 3 Jan 2022 11:52:25 +0000 (11:52 +0000)
Prior to this change, the strings 'Tabular', 'Bar Chart' and 'Pie Chart' were hardcoded.

16 files changed:
CRM/Report/Form.php
CRM/Report/Form/Contribute/Lybunt.php
CRM/Report/Form/Contribute/SoftCredit.php
CRM/Report/Form/Contribute/Summary.php
CRM/Report/Form/Contribute/Sybunt.php
CRM/Report/Form/Contribute/TopDonor.php
CRM/Report/Form/Event/IncomeCountSummary.php
CRM/Report/Form/Event/Summary.php
CRM/Report/Form/Mailing/Bounce.php
CRM/Report/Form/Mailing/Clicks.php
CRM/Report/Form/Mailing/Opened.php
CRM/Report/Form/Mailing/Summary.php
CRM/Report/Form/Member/Lapse.php
CRM/Report/Form/Member/Summary.php
CRM/Report/Form/Membership/Summary.php
CRM/Report/Form/Pledge/Pbnp.php

index 322a8d9b1124d8d6de61e57203ef654ae8e931be..6b6d37768da0a4d35f1ffa7f7fd34790c7249272 100644 (file)
@@ -539,6 +539,12 @@ class CRM_Report_Form extends CRM_Core_Form {
    */
   public $optimisedForOnlyFullGroupBy = TRUE;
 
+  /**
+   * Determines which chart types are supported for this report
+   * @var string[]
+   */
+  protected $_charts = [];
+
   /**
    * Get the number of rows to show
    * @return int
index 95789c10a9f908611ea2e879204f0f39480eca64..759a62a74b30eb8fa5a8c43504187d8babeca947 100644 (file)
  */
 class CRM_Report_Form_Contribute_Lybunt extends CRM_Report_Form {
 
-  protected $_charts = [
-    '' => 'Tabular',
-    'barChart' => 'Bar Chart',
-    'pieChart' => 'Pie Chart',
-  ];
-
   /**
    * This is the report that links will lead to.
    *
@@ -249,6 +243,13 @@ class CRM_Report_Form_Contribute_Lybunt extends CRM_Report_Form {
     // If we have a campaign, build out the relevant elements
     $this->addCampaignFields('civicrm_contribution');
 
+    // Add charts support
+    $this->_charts = [
+      '' => ts('Tabular'),
+      'barChart' => ts('Bar Chart'),
+      'pieChart' => ts('Pie Chart'),
+    ];
+
     $this->_groupFilter = TRUE;
     $this->_tagFilter = TRUE;
     parent::__construct();
@@ -630,7 +631,7 @@ class CRM_Report_Form_Contribute_Lybunt extends CRM_Report_Form {
     $current_year = $this->_params['yid_value'];
     $previous_year = $current_year - 1;
     $interval[$previous_year] = $previous_year;
-    $interval['life_time'] = 'Life Time';
+    $interval['life_time'] = ts('Life Time');
 
     foreach ($rows as $key => $row) {
       // The final row contains the totals so we don't need to include it here.
index a5d1f927d137ae4bf3cb2cc6724d3e0fdcedb5ba..15db3e5c938f58a9e3a7c8d13bd0af839ae47dac 100644 (file)
@@ -20,11 +20,6 @@ class CRM_Report_Form_Contribute_SoftCredit extends CRM_Report_Form {
   protected $_emailFieldCredit = FALSE;
   protected $_phoneField = FALSE;
   protected $_phoneFieldCredit = FALSE;
-  protected $_charts = [
-    '' => 'Tabular',
-    'barChart' => 'Bar Chart',
-    'pieChart' => 'Pie Chart',
-  ];
 
   protected $_customGroupExtends = [
     'Contact',
@@ -299,6 +294,13 @@ class CRM_Report_Form_Contribute_SoftCredit extends CRM_Report_Form {
     // If we have a campaign, build out the relevant elements
     $this->addCampaignFields('civicrm_contribution');
 
+    // Add charts support
+    $this->_charts = [
+      '' => ts('Tabular'),
+      'barChart' => ts('Bar Chart'),
+      'pieChart' => ts('Pie Chart'),
+    ];
+
     $this->_groupFilter = TRUE;
     $this->_tagFilter = TRUE;
 
index 0d829bf8be40e2096eba6b9ebac3d8d3b2d56252..cb7a89af498b5a43237f793c9e8605c19dfa751e 100644 (file)
  */
 class CRM_Report_Form_Contribute_Summary extends CRM_Report_Form {
 
-  protected $_charts = [
-    '' => 'Tabular',
-    'barChart' => 'Bar Chart',
-    'pieChart' => 'Pie Chart',
-  ];
   protected $_customGroupExtends = ['Contribution', 'Contact', 'Individual'];
   protected $_customGroupGroupBy = TRUE;
 
@@ -338,6 +333,13 @@ class CRM_Report_Form_Contribute_Summary extends CRM_Report_Form {
 
     $this->addCampaignFields('civicrm_contribution', TRUE);
 
+    // Add charts support
+    $this->_charts = [
+      '' => ts('Tabular'),
+      'barChart' => ts('Bar Chart'),
+      'pieChart' => ts('Pie Chart'),
+    ];
+
     $this->_tagFilter = TRUE;
     $this->_groupFilter = TRUE;
     $this->_currencyColumn = 'civicrm_contribution_currency';
index 4349dae5a7c0f368c9207218f47e1ddd4c2c3616..7b77b6827eee30451712f8fcbba173774a7a5a26 100644 (file)
  */
 class CRM_Report_Form_Contribute_Sybunt extends CRM_Report_Form {
 
-  protected $_charts = [
-    '' => 'Tabular',
-    'barChart' => 'Bar Chart',
-    'pieChart' => 'Pie Chart',
-  ];
-
   protected $_customGroupExtends = [
     'Contact',
     'Individual',
@@ -244,6 +238,13 @@ class CRM_Report_Form_Contribute_Sybunt extends CRM_Report_Form {
     // If we have a campaign, build out the relevant elements
     $this->addCampaignFields('civicrm_contribution');
 
+    // Add charts support
+    $this->_charts = [
+      '' => ts('Tabular'),
+      'barChart' => ts('Bar Chart'),
+      'pieChart' => ts('Pie Chart'),
+    ];
+
     $this->_groupFilter = TRUE;
     $this->_tagFilter = TRUE;
     parent::__construct();
index 4e3ae6e87f1a275a6bd3844efa9e75bff76f122f..4f11326c08788f478a06495718afdef8f41678c7 100644 (file)
@@ -37,12 +37,6 @@ class CRM_Report_Form_Contribute_TopDonor extends CRM_Report_Form {
 
   public $_drilldownReport = ['contribute/detail' => 'Link to Detail Report'];
 
-  protected $_charts = [
-    '' => 'Tabular',
-    'barChart' => 'Bar Chart',
-    'pieChart' => 'Pie Chart',
-  ];
-
   /**
    */
   public function __construct() {
@@ -188,6 +182,13 @@ class CRM_Report_Form_Contribute_TopDonor extends CRM_Report_Form {
       ],
     ];
 
+    // Add charts support
+    $this->_charts = [
+      '' => ts('Tabular'),
+      'barChart' => ts('Bar Chart'),
+      'pieChart' => ts('Pie Chart'),
+    ];
+
     $this->_groupFilter = TRUE;
     $this->_tagFilter = TRUE;
     $this->_currencyColumn = 'civicrm_contribution_currency';
index fea8a0de4b1614d3be0a470a11d6a779712dcefa..c5b7bb2705b6d55d475416c3adec1b9fbde82340 100644 (file)
@@ -18,12 +18,6 @@ class CRM_Report_Form_Event_IncomeCountSummary extends CRM_Report_Form {
 
   protected $_summary = NULL;
 
-  protected $_charts = [
-    '' => 'Tabular',
-    'barChart' => 'Bar Chart',
-    'pieChart' => 'Pie Chart',
-  ];
-
   protected $_add2groupSupported = FALSE;
 
   protected $_customGroupExtends = [
@@ -136,6 +130,14 @@ class CRM_Report_Form_Event_IncomeCountSummary extends CRM_Report_Form {
         ],
       ],
     ];
+
+    // Add charts support
+    $this->_charts = [
+      '' => ts('Tabular'),
+      'barChart' => ts('Bar Chart'),
+      'pieChart' => ts('Pie Chart'),
+    ];
+
     parent::__construct();
   }
 
index 308d07edaf977604cd478286ddd9796b3dc0aee8..a6265e6663fda1625e8609d28c04dfc358bf3560 100644 (file)
@@ -18,12 +18,6 @@ class CRM_Report_Form_Event_Summary extends CRM_Report_Form {
 
   protected $_summary = NULL;
 
-  protected $_charts = [
-    '' => 'Tabular',
-    'barChart' => 'Bar Chart',
-    'pieChart' => 'Pie Chart',
-  ];
-
   protected $_add2groupSupported = FALSE;
 
   protected $_customGroupExtends = [
@@ -105,6 +99,14 @@ class CRM_Report_Form_Event_Summary extends CRM_Report_Form {
       ],
     ];
     $this->_currencyColumn = 'civicrm_participant_fee_currency';
+
+    // Add charts support
+    $this->_charts = [
+      '' => ts('Tabular'),
+      'barChart' => ts('Bar Chart'),
+      'pieChart' => ts('Pie Chart'),
+    ];
+
     parent::__construct();
   }
 
index 4df40865086b52d78bc4ed5a1de1b5b495a218cb..27027d3586106e04391663fce985bed06b7ab11d 100644 (file)
@@ -29,12 +29,6 @@ class CRM_Report_Form_Mailing_Bounce extends CRM_Report_Form {
     'Organization',
   ];
 
-  protected $_charts = [
-    '' => 'Tabular',
-    'barChart' => 'Bar Chart',
-    'pieChart' => 'Pie Chart',
-  ];
-
   /**
    * This report has not been optimised for group filtering.
    *
@@ -242,6 +236,13 @@ class CRM_Report_Form_Mailing_Bounce extends CRM_Report_Form {
       'grouping' => 'contact-fields',
     ];
 
+    // Add charts support
+    $this->_charts = [
+      '' => ts('Tabular'),
+      'barChart' => ts('Bar Chart'),
+      'pieChart' => ts('Pie Chart'),
+    ];
+
     $this->_groupFilter = TRUE;
     $this->_tagFilter = TRUE;
     parent::__construct();
index 7634844176f763dfa6676862fc49dda0cec9c8ee..d56739014c7081019599c8d3e22a11f587d5fef9 100644 (file)
@@ -29,12 +29,6 @@ class CRM_Report_Form_Mailing_Clicks extends CRM_Report_Form {
     'Organization',
   ];
 
-  protected $_charts = [
-    '' => 'Tabular',
-    'barChart' => 'Bar Chart',
-    'pieChart' => 'Pie Chart',
-  ];
-
   /**
    * This report has not been optimised for group filtering.
    *
@@ -199,6 +193,13 @@ class CRM_Report_Form_Mailing_Clicks extends CRM_Report_Form {
       'grouping' => 'mailing-fields',
     ];
 
+    // Add charts support
+    $this->_charts = [
+      '' => ts('Tabular'),
+      'barChart' => ts('Bar Chart'),
+      'pieChart' => ts('Pie Chart'),
+    ];
+
     $this->_groupFilter = TRUE;
     $this->_tagFilter = TRUE;
     parent::__construct();
index 142d8d3d3295f9de9a48a4963324f441eeebe0c3..c7a68f2cb45cbdc67c5f7b5c6ac66c5117287ba3 100644 (file)
@@ -29,12 +29,6 @@ class CRM_Report_Form_Mailing_Opened extends CRM_Report_Form {
     'Organization',
   ];
 
-  protected $_charts = [
-    '' => 'Tabular',
-    'barChart' => 'Bar Chart',
-    'pieChart' => 'Pie Chart',
-  ];
-
   /**
    * This report has not been optimised for group filtering.
    *
@@ -190,6 +184,13 @@ class CRM_Report_Form_Mailing_Opened extends CRM_Report_Form {
       'grouping' => 'mailing-fields',
     ];
 
+    // Add charts support
+    $this->_charts = [
+      '' => ts('Tabular'),
+      'barChart' => ts('Bar Chart'),
+      'pieChart' => ts('Pie Chart'),
+    ];
+
     $this->_groupFilter = TRUE;
     $this->_tagFilter = TRUE;
     parent::__construct();
index 1bee34bd33051989f05e73c883163d11669c2290..4b3f5a2b8e95cbf2600339021ddefa4edd810a5e 100644 (file)
@@ -24,11 +24,6 @@ class CRM_Report_Form_Mailing_Summary extends CRM_Report_Form {
 
   public $_drilldownReport = ['mailing/detail' => 'Link to Detail Report'];
 
-  protected $_charts = [
-    '' => 'Tabular',
-    'barchart' => 'Bar Chart',
-  ];
-
   /**
    * Class constructor.
    */
@@ -287,6 +282,13 @@ class CRM_Report_Form_Mailing_Summary extends CRM_Report_Form {
     ];
     // If we have campaigns enabled, add those elements to both the fields, filters.
     $this->addCampaignFields('civicrm_mailing');
+
+    // Add charts support
+    $this->_charts = [
+      '' => ts('Tabular'),
+      'barChart' => ts('Bar Chart'),
+    ];
+
     parent::__construct();
   }
 
index 864c70ef34c800cf8018330491e86145b88e7b79..dad64c28fb5d89ef04e9efcdcdfb5a215539db2d 100644 (file)
@@ -17,7 +17,6 @@
 class CRM_Report_Form_Member_Lapse extends CRM_Report_Form {
 
   protected $_summary = NULL;
-  protected $_charts = ['' => 'Tabular'];
   protected $_customGroupExtends = [
     'Membership',
   ];
index 7cb3dd125ff1af6d9897ab37b7a1e069855f9261..38ca5d7f8b60c9dfbd8b00b5a90e3f2a0c3a5e7b 100644 (file)
@@ -18,11 +18,7 @@ class CRM_Report_Form_Member_Summary extends CRM_Report_Form {
 
   protected $_summary = NULL;
   protected $_interval = NULL;
-  protected $_charts = [
-    '' => 'Tabular',
-    'barChart' => 'Bar Chart',
-    'pieChart' => 'Pie Chart',
-  ];
+
   protected $_add2groupSupported = FALSE;
 
   protected $_customGroupExtends = ['Membership'];
@@ -159,6 +155,13 @@ class CRM_Report_Form_Member_Summary extends CRM_Report_Form {
     // If we have campaigns enabled, add those elements to both the fields, filters and group by
     $this->addCampaignFields('civicrm_membership', TRUE);
 
+    // Add charts support
+    $this->_charts = [
+      '' => ts('Tabular'),
+      'barChart' => ts('Bar Chart'),
+      'pieChart' => ts('Pie Chart'),
+    ];
+
     $this->_groupFilter = TRUE;
     $this->_currencyColumn = 'civicrm_contribution_currency';
     parent::__construct();
index ddceca33870d84f77d8b377978316044c13a067e..4ba26fb9d8ef54b2ca77be637ca2f55e2a30b4c1 100644 (file)
@@ -18,12 +18,6 @@ class CRM_Report_Form_Membership_Summary extends CRM_Report_Form {
 
   protected $_summary = NULL;
 
-  protected $_charts = [
-    '' => 'Tabular',
-    'barChart' => 'Bar Chart',
-    'pieChart' => 'Pie Chart',
-  ];
-
   /**
    * Constructor function.
    */
@@ -117,6 +111,14 @@ class CRM_Report_Form_Membership_Summary extends CRM_Report_Form {
         ],
       ],
     ];
+
+    // Add charts support
+    $this->_charts = [
+      '' => ts('Tabular'),
+      'barChart' => ts('Bar Chart'),
+      'pieChart' => ts('Pie Chart'),
+    ];
+
     parent::__construct();
   }
 
index e9b97fbf07be745692ca6e1e1c4159bab1e29079..e0e6f9f1175f882977dc14e592ef4e2417893c6a 100644 (file)
  * @copyright CiviCRM LLC https://civicrm.org/licensing
  */
 class CRM_Report_Form_Pledge_Pbnp extends CRM_Report_Form {
-  protected $_charts = [
-    '' => 'Tabular',
-    'barChart' => 'Bar Chart',
-    'pieChart' => 'Pie Chart',
-  ];
   public $_drilldownReport = ['pledge/summary' => 'Link to Detail Report'];
 
   protected $_customGroupExtends = [
@@ -160,6 +155,13 @@ class CRM_Report_Form_Pledge_Pbnp extends CRM_Report_Form {
     // If we have a campaign, build out the relevant elements
     $this->addCampaignFields('civicrm_pledge');
 
+    // Add charts support
+    $this->_charts = [
+      '' => ts('Tabular'),
+      'barChart' => ts('Bar Chart'),
+      'pieChart' => ts('Pie Chart'),
+    ];
+
     $this->_groupFilter = TRUE;
     $this->_tagFilter = TRUE;
     $this->_currencyColumn = 'civicrm_pledge_currency';