Merge pull request #11726 from scardinius/crm-21808
[civicrm-core.git] / CRM / Report / Form / Contribute / Sybunt.php
index 918965a81db3bb9d396e2074eed777e1bf70b00f..120a4d80ce58c215fdeaa2481ce6fbf4f0d363b4 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.7                                                |
+ | CiviCRM version 5                                                  |
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC (c) 2004-2018                                |
  +--------------------------------------------------------------------+
@@ -352,22 +352,13 @@ class CRM_Report_Form_Contribute_Sybunt extends CRM_Report_Form {
                       ON {$this->_aliases['civicrm_contact']}.id = {$this->_aliases['civicrm_contribution']}.contact_id
              {$this->_aclFrom}";
 
-    if ($this->isTableSelected('civicrm_email')) {
-      $this->_from .= "
-              LEFT  JOIN civicrm_email  {$this->_aliases['civicrm_email']}
-                      ON {$this->_aliases['civicrm_contact']}.id = {$this->_aliases['civicrm_email']}.contact_id
-                     AND {$this->_aliases['civicrm_email']}.is_primary = 1";
-    }
-    if ($this->isTableSelected('civicrm_phone')) {
-      $this->_from .= "
-              LEFT  JOIN civicrm_phone  {$this->_aliases['civicrm_phone']}
-                      ON {$this->_aliases['civicrm_contact']}.id = {$this->_aliases['civicrm_phone']}.contact_id AND
-                         {$this->_aliases['civicrm_phone']}.is_primary = 1";
-    }
+    $this->joinPhoneFromContact();
+    $this->joinEmailFromContact();
+
     // for credit card type
     $this->addFinancialTrxnFromClause();
 
-    $this->addAddressFromClause();
+    $this->joinAddressFromContact();
   }
 
   public function where() {
@@ -569,9 +560,9 @@ class CRM_Report_Form_Contribute_Sybunt extends CRM_Report_Form {
     $graphRows['value'] = $display;
     $config = CRM_Core_Config::Singleton();
     $chartInfo = array(
-      'legend' => 'Sybunt Report',
-      'xname' => 'Year',
-      'yname' => "Amount ({$config->defaultCurrency})",
+      'legend' => ts('Sybunt Report'),
+      'xname' => ts('Year'),
+      'yname' => ts('Amount (%1)', array(1 => $config->defaultCurrency)),
     );
     if ($this->_params['charts']) {
       // build the chart.