Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-7940

Enable CiviReportMail.php to send a report as a CSV file

    Details

    • Type: Improvement
    • Status: Done/Fixed
    • Priority: Minor
    • Resolution: Fixed/Completed
    • Affects Version/s: 3.3.5
    • Fix Version/s: 3.4.1
    • Component/s: CiviReport
    • Labels:
      None

      Description

      This patch enables CiviReportMail.php to send a report as a CSV file, by adding '&output=csv' to the CiviReportMail.php URL. Files affected:

      bin/CiviReportMail.php

      • Added constructor, config & run methods so that it respects custom php & template directories. (Not essential for this feature but I was developing it in my custom php dir and this seems a relevant and worthwhile improvement).

      CRM/Report/Form.php

      • In processReportMode(): respect 'output' request parameter when 'sendmail' parameter present.
      • In endPostProcess(): create csv file under templateCompileDir and pass as attachment to CRM_Report_Utils_Report::mailReport.

      CRM/Report/Utils/Report.php

      • In mailReport: added attachments argument.
      • Pulled CSV creation code out of export2csv into new function makeCsv.

      templates/CRM/Report/Form/Settings.hlp

      • Documented '&output=csv'.

      The code was developed against 3.3.5 . It patches cleanly against 3.3.6 but hasn't been tested with that version. It works here but could do with being checked over in case I've done something naughty and un-civi-like.

        Attachments

          Activity

            People

            • Assignee:
              deepak Deepak Srivastava
              Reporter:
              davej Dave Jenkins
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: