Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PDFReports: Send Report Now not working, Error: Object of class Piwik_Date could not be converted to int #1783

Closed
anonymous-matomo-user opened this issue Oct 27, 2010 · 5 comments
Labels
Bug For errors / faults / flaws / inconsistencies etc.
Milestone

Comments

@anonymous-matomo-user
Copy link

HI, there:

The mail function on the server seems fine, if I do recover password I can get the email. However, the Email Report is not working, everytime I tried "Send Report Now", I got the following error in application log:

Piwik_ErrorHandler(8, Object of class Piwik_Date could not be converted to int, /var/www/html/core/Date.php, 59, Array ([=> Piwik_Date Object ( => 1287591505,[=> UTC),timezone => )) called at [/var/www/html/core/Date.php:59]<br />

any idea what is causing this and how can I fix it?
thank you very much!
sincerely
Steve

@robocoder
Copy link
Contributor

I couldn't reproduce the problem on trunk (i.e., no error).

On 1.0, using FF3.6, I can't get the 'Send Report Now' button to even trigger.

Steve: can you email us a stack trace? (if you opt to attach it here, you should filter the contents)

@anonymous-matomo-user
Copy link
Author

here is the trace in error log:

<div style='word-wrap: break-word; border: 3px solid red; padding:4px; width:70%; background-color:#FFFF96;'><b>Notice:</b> <i>Object of class Piwik_Date could not be converted to int</i> in <b>/var/www/html/core/Date.php</b> on line <b>59</b>
<br /><br />Backtrace --&gt;<div style="font-family:Courier;font-size:10pt">#0  Piwik_ErrorHandler(8, Object of class Piwik_Date could not be converted to int, /var/www/html/core/Date.php, 59, Array ([dateString] =&gt; Piwik_Date Object ([] =&gt; 1287683565,[] =&gt; UTC),[timezone] =&gt; )) called at [/var/www/html/core/Date.php:59]<br />
#1  Piwik_Date::factory(Piwik_Date Object ([] =&gt; 1287683565,[] =&gt; UTC)) called at [/var/www/html/plugins/PDFReports/API.php:245]<br />
#2  Piwik_PDFReports_API-&gt;generateReport(6, Piwik_Date Object ([] =&gt; 1287683565,[] =&gt; UTC), 3, 2) called at [/var/www/html/plugins/PDFReports/API.php:315]<br />
#3  Piwik_PDFReports_API-&gt;sendEmailReport(6, 3)<br />
#4  call_user_func_array(Array ([0] =&gt; Piwik_PDFReports_API Object ([] =&gt; Array ()),[1] =&gt; sendEmailReport), Array ([0] =&gt; 6,[1] =&gt; 3)) called at [/var/www/html/core/API/Proxy.php:151]<br />
#5  Piwik_API_Proxy-&gt;call(Piwik_PDFReports_API, sendEmailReport, Array ([token_auth] =&gt; XXXXXXXXXX,[idSite] =&gt; 3,[module] =&gt; API,[method] =&gt; PDFReports.sendEmailReport,[format] =&gt; json,[idReport] =&gt; 6,[filter_limit] =&gt; 50)) called at [/var/www/html/core/API/Request.php:117]<br />
#6  Piwik_API_Request-&gt;process() called at [/var/www/html/plugins/API/Controller.php:27]<br />
#7  Piwik_API_Controller-&gt;index()<br />
#8  call_user_func_array(Array ([0] =&gt; Piwik_API_Controller Object ([] =&gt; API,[] =&gt; ,[] =&gt; ,[] =&gt; 3,[] =&gt; ),[1] =&gt; index), Array ()) called at [/var/www/html/core/FrontController.php:126]<br />
#9  Piwik_FrontController-&gt;dispatch() called at [/var/www/html/index.php:60]<br />
</div><br /><br />
</pre></div><br />

@robocoder
Copy link
Contributor

I don't know why line 59 of Date.php is triggering an error, but can you try the following change?

In plugins/PDFReports/API.php's sendEmailReport() function, change:

Piwik_PDFReports_API::getInstance()->generateReport(
    $idReport,
    Piwik_Date::now()->subPeriod(1, $report['period']),
    $idSite,
    $outputType = Piwik_PDFReports_API::OUTPUT_PDF_SAVE_ON_DISK
);

to:

Piwik_PDFReports_API::getInstance()->generateReport(
    $idReport,
    Piwik_Date::now()->subPeriod(1, $report['period'])->toString(),
    $idSite,
    $outputType = Piwik_PDFReports_API::OUTPUT_PDF_SAVE_ON_DISK
);

@anonymous-matomo-user
Copy link
Author

yes! that fixed it. The PDFReports works fine after applying that change.
thank you very much!

@robocoder
Copy link
Contributor

(In [3273]) fixes #1783

@anonymous-matomo-user anonymous-matomo-user added this to the Piwik 1.1 milestone Jul 8, 2014
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For errors / faults / flaws / inconsistencies etc.
Projects
None yet
Development

No branches or pull requests

2 participants