CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviReport (Moderator: Dave Greenberg) »
  • CiviReportMail.php - send with PDF/CSV attachment
Pages: [1]

Author Topic: CiviReportMail.php - send with PDF/CSV attachment  (Read 1885 times)

theitd

  • I’m new here
  • *
  • Posts: 22
  • Karma: 1
    • the ITD
  • CiviCRM version: 3.4.7
  • CMS version: 1.15.26
  • MySQL version: 5.1.66
  • PHP version: 5.3
CiviReportMail.php - send with PDF/CSV attachment
September 01, 2010, 07:31:43 am
I'm using a CRON job to send various reports with CiviReportMail and I was wondering if there are additional values that could be included in the query string to create the reports as either a CSV or PDF and attach it to the generated email?

Thanks in advance for any help.
Too err is human, to really foul things up needs a computer.

theitd

  • I’m new here
  • *
  • Posts: 22
  • Karma: 1
    • the ITD
  • CiviCRM version: 3.4.7
  • CMS version: 1.15.26
  • MySQL version: 5.1.66
  • PHP version: 5.3
Re: CiviReportMail.php - send with PDF/CSV attachment
September 06, 2010, 09:33:59 am
Anybody got any ideas?

I thought I might be missing something obvious, but if the functionality isn't there, I'm happy to look into writing a patch.
Too err is human, to really foul things up needs a computer.

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: CiviReportMail.php - send with PDF/CSV attachment
September 06, 2010, 09:43:16 am

took a brief look at the code and i dont think that functionality is there

Please write and submit the needed patch. The relevant code is at: CRM/Report/Form.php Check the function endPostProcess

lobo

 
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

davej

  • Ask me questions
  • ****
  • Posts: 404
  • Karma: 21
Re: CiviReportMail.php - send with PDF/CSV attachment
April 15, 2011, 10:29:55 am
Did anything come of this? I had a look at CRM/Report/Form.php function endPostProcess but I haven't so far made sense of the execution path whereby this gets called via CiviReportMail.php & therefore where to intervene to set _outputMode in the CRM_Core_Form subclass instance, if that's what we need to do. Any pointers welcome!

Thanks,

Dave J

davej

  • Ask me questions
  • ****
  • Posts: 404
  • Karma: 21
Re: CiviReportMail.php - send with PDF/CSV attachment
April 15, 2011, 11:18:12 am
Ah, looks as though CRM/Report/Form.php function processReportMode checks for request parameter 'output' which may be 'csv'. Haven't got as far as testing this though, as CiviReportMail.php is erroring out, just with what I believe are the basic parameters:

my.domain/sites/all/modules/civicrm/bin/CiviReportMail.php?name=blah&pass=blah&key=blah&instanceId=23&reset=1&sendmail=0

(where 23 is taken from my.domain/civicrm/report/instance/23&reset=1)

Smarty error: unable to read resource: "CRM/Form/.tpl" in .../sites/all/modules/civicrm/packages/Smarty/Smarty.class.php on line 1093.

This is in Civi 3.3.5 .

[Edit: now resolved. I thought sendmail=1 meant sendmail as opposed to SMTP, so I had sendmail = 0. It seems sendmail has to be 1 / true for the script to work.]

Thanks,

Dave
« Last Edit: April 19, 2011, 10:49:14 am by davej »

theitd

  • I’m new here
  • *
  • Posts: 22
  • Karma: 1
    • the ITD
  • CiviCRM version: 3.4.7
  • CMS version: 1.15.26
  • MySQL version: 5.1.66
  • PHP version: 5.3
Re: CiviReportMail.php - send with PDF/CSV attachment
April 17, 2011, 11:41:04 pm
Hi davej,

I did look into this - and again yesterday after seeing your post. I'm afraid it's a case of not being good enough at PHP for me. I got stuck on trying to find the best place to interrupt the request too. I even tried a workaround involving simulating the PDF button and attaching the output to an email - but I couldn't get this to work. It's going to take a much better-skilled developer than me. Sorry!
Too err is human, to really foul things up needs a computer.

davej

  • Ask me questions
  • ****
  • Posts: 404
  • Karma: 21
Re: CiviReportMail.php - send with PDF/CSV attachment
April 19, 2011, 10:53:50 am
Hi,

I've made some progress with this, code needs more checking and cleaning up but basically working for CSV. I'll contribute a patch. Guess it makes sense if I create a feature request issue for this and attach the patch to that. I'll update this thread.

[Edit] Created issue http://issues.civicrm.org/jira/browse/CRM-7940 with patch.

Dave J
« Last Edit: April 20, 2011, 05:04:22 am by davej »

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviReport (Moderator: Dave Greenberg) »
  • CiviReportMail.php - send with PDF/CSV attachment

This forum was archived on 2017-11-26.