aschroder / Magento-SMTP-Pro-Email-Extension

Full SMTP and Gmail/Google Apps Email support for Magento
aschroder.com
333 stars 209 forks source link

Time difference in SMTP Pro E-Mail-Log Grid and Detail view #265

Open FelixKonVis opened 5 years ago

FelixKonVis commented 5 years ago

There seems to be a problem with the smtppro_email_log table entries and their log_at column.

From what I found in the code:

  1. The SMTP Pro E-Mail Log Grid uses the Magento Datetime renderer which takes into account the timezone.

  2. The SMTP Pro E-Mail Log Detail view displays the plain value of log_at.

  3. The smtpro_email_log table uses CURRENT_TIMESTAMP to update the log_at column This happens to be local time (GMT+2) for us.

In our case the shop is running in GMT+2 (GMT+1 + DST) and we are seeing the correct time in the E-Mail details but another +2h rendered in the Grid.

Am I missing anything? This seems to be a bug since the log entries store the local time in log_at but the Grid expects the datetime in GMT.

One possible fix might be to change the Grid column from type datetime to text so both Grid and Detail view display the same time.

Originally posted by @FelixKonVis in https://github.com/aschroder/Magento-SMTP-Pro-Email-Extension/issues/263#issuecomment-486187466

MartinKonVis commented 5 years ago

Hello aschroder-Team,

I would like to ask if there is allready a update regarding this issue? The extension is great and our client loves it. The mail log is great for quick check if there was a problem with the store or the client need to check spam filter etc.

But the time difference makes it hard for not IT-Persons to get the right timestamp. Would be great if you can double check the mentioned points. We can fix it but than we might get problems if you provide a update version etc.

Unfortunatly we got little bit under time pressure. We can fix it and provide you the code if it helps? Thanks in advance.

dbachmann commented 3 months ago

It's a bit late, I know :)

The time of the mail that has already been saved, is sent again in the grid view through the datetime renderer. So the specified time zone is applied again and this is why there are different times in the grid view and in the detail view.

I will make the bug fix available as a commit when I get the time, although it is actually really simple. Open app/code/local/Aschroder/SMTPPro/Block/Log/Grid.php and add 'use_timezone' => 0 to the array of column ID 'sent' at the end. That's all.

When you're done, it should look like this

$this->addColumn('sent', array( 'header' => Mage::helper('adminhtml')->__('Sent'), 'width' => '60px', 'index' => 'log_at', 'type' => 'datetime', 'use_timezone' => 0 ));

Have fun.