Merge pull request #1144 from GeertDD/year_dropdown

Made first year retrieval more robust
This commit is contained in:
Mike Jolley 2012-06-11 08:27:24 -07:00
commit 1464ba7a94
1 changed files with 1 additions and 1 deletions

View File

@ -678,7 +678,7 @@ function woocommerce_monthly_sales() {
global $start_date, $end_date, $woocommerce, $wpdb;
$first_year = $wpdb->get_var("SELECT post_date FROM $wpdb->posts ORDER BY post_date ASC LIMIT 1;");
$first_year = $wpdb->get_var("SELECT post_date FROM $wpdb->posts WHERE post_date != 0 ORDER BY post_date ASC LIMIT 1;");
if ($first_year) $first_year = date('Y', strtotime($first_year)); else $first_year = date('Y');
$current_year = (isset($_POST['show_year'])) ? $_POST['show_year'] : date('Y', current_time('timestamp'));