From 81038e58b0e9a18d0a13f603a2284a5cfc082396 Mon Sep 17 00:00:00 2001
From: Kevin Cristiano <kcristiano@kcristiano.com>
Date: Tue, 14 Apr 2020 13:37:18 -0400
Subject: [PATCH] Export to Excel Patch

See https://lab.civicrm.org/extensions/civiexportexcel/-/commit/ded20d41796cb475018f5735cfd5f331c8c10075 and https://lab.civicrm.org/extensions/civiexportexcel/-/blob/master/civiexportexcel-core.patch

Signed-off-by: Kevin Cristiano <kcristiano@kcristiano.com>
---
 civicrm/CRM/Report/Form.php | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/civicrm/CRM/Report/Form.php b/civicrm/CRM/Report/Form.php
index 47adf78eed..56bfdd6f7e 100644
--- a/civicrm/CRM/Report/Form.php
+++ b/civicrm/CRM/Report/Form.php
@@ -139,6 +139,11 @@ class CRM_Report_Form extends CRM_Core_Form {
    */
   protected $_groupFilter = FALSE;
 
+  /**
+   * Required for civiexportexcel.
+   */
+  public $supportsExportExcel = TRUE;
+
   /**
    * Has the report been optimised for group filtering.
    *
@@ -1418,7 +1423,7 @@ class CRM_Report_Form extends CRM_Core_Form {
     if (!CRM_Core_Permission::check('view report sql')) {
       return;
     }
-    $ignored_output_modes = ['pdf', 'csv', 'print'];
+    $ignored_output_modes = ['pdf', 'csv', 'print', 'excel2007'];
     if (in_array($this->_outputMode, $ignored_output_modes)) {
       return;
     }
@@ -2845,6 +2850,11 @@ WHERE cg.extends IN ('" . implode("','", $this->_customGroupExtends) . "') AND
       $this->_absoluteUrl = TRUE;
       $this->addPaging = FALSE;
     }
+    elseif ($this->_outputMode == 'excel2007') {
+      $printOnly = TRUE;
+      $this->_absoluteUrl = TRUE;
+      $this->addPaging = FALSE;
+    }
     elseif ($this->_outputMode == 'group') {
       $this->assign('outputMode', 'group');
     }
@@ -3487,6 +3497,9 @@ WHERE cg.extends IN ('" . implode("','", $this->_customGroupExtends) . "') AND
     elseif ($this->_outputMode == 'csv') {
       CRM_Report_Utils_Report::export2csv($this, $rows);
     }
+    elseif ($this->_outputMode == 'excel2007') {
+      CRM_CiviExportExcel_Utils_Report::export2excel2007($this, $rows);
+    }
     elseif ($this->_outputMode == 'group') {
       $group = $this->_params['groups'];
       $this->add2group($group);
-- 
GitLab