From 0538051c784efd1e1dba41d7c9ba998eed3f0f90 Mon Sep 17 00:00:00 2001 From: Geert De Deckere Date: Mon, 11 Jun 2012 17:03:56 +0200 Subject: [PATCH] Made first year retrieval more robust --- admin/woocommerce-admin-reports.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/woocommerce-admin-reports.php b/admin/woocommerce-admin-reports.php index c98647120ae..0b90d19ebde 100644 --- a/admin/woocommerce-admin-reports.php +++ b/admin/woocommerce-admin-reports.php @@ -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'));