Sales Reports Page - Incorrect URL for "Yesterday" link

Project: 
product-report
Category: 
bug report
Version: 
Ubercart 1.0 RC
Priority: 
critical
Assigned: 
Unassigned
Status: 
fixed

This is in RC4.

Fix is very simple:

in sites/all/modules/ubercart/uc_reports/uc_reports.module

change line 377

from:

<?php
l
(t('Yesterday, !date', array('!date' => format_date($today_start - 86400, 'custom', $format))), 'admin/store/orders/search/results/0/0/0/0/0/0/'. $today_start - 86400 .'/'. $today_end - 86400),
?>

to:

<?php
l
(t('Yesterday, !date', array('!date' => format_date($today_start - 86400, 'custom', $format))), 'admin/store/orders/search/results/0/0/0/0/0/0/'. ($today_start - 86400) .'/'. ($today_end - 86400)),
?>

(added parenthesis around the subtraction operations)

Re: Sales Reports Page - Incorrect URL for "Yesterday" link

Good call. Fixed and committed.

Re: Sales Reports Page - Incorrect URL for "Yesterday" link

It is a bit nitpickish, but I always cringe when I see date/time calculations using the number of seconds in a day/week/month/year. Instead of

$today_start - 86400

I like seeing
strtotime('-1 day', $today_start)

I think it is easier to read and it also handles the rare case with daylight savings time days containing more or less than 86400 seconds. At 11:30PM on a day where the clock was moved back in the morning, -86400 seconds would still be the current day instead of yesterday.

Re: Re: Sales Reports Page - Incorrect URL for "Yesterday" link

Hmm...I see you are having some strtotime() issues ( http://www.ubercart.org/forum/development/4334/making_sure_reports_10_re... ), so I guess you are trying to stay away from that function. Not sure what the problem is there...