From 7d0721aa3318b97dc6d2156542a4c40c9485ddcb Mon Sep 17 00:00:00 2001 From: gogdzl Date: Fri, 25 Oct 2024 16:54:15 -0300 Subject: [PATCH] Add timezone offset to MySQL --- projects/plugins/crm/admin/dashboard/dashboard.ajax.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/projects/plugins/crm/admin/dashboard/dashboard.ajax.php b/projects/plugins/crm/admin/dashboard/dashboard.ajax.php index 1eed1c4433ab9..f59311bba1641 100644 --- a/projects/plugins/crm/admin/dashboard/dashboard.ajax.php +++ b/projects/plugins/crm/admin/dashboard/dashboard.ajax.php @@ -69,6 +69,9 @@ function jetpackcrm_dash_refresh() { ); } + $tz_offset = jpcrm_get_wp_timezone_offset(); + $wpdb->query( 'SET time_zone = "' . $tz_offset . '";' ); + // next we want the contact chart which is total contacts between the dates grouped by day, week, month, year $sql = $wpdb->prepare( 'SELECT count(ID) as count, YEAR(FROM_UNIXTIME(zbsc_created)) as year FROM ' . $ZBSCRM_t['contacts'] . ' WHERE zbsc_created > %d AND zbsc_created < %d GROUP BY year ORDER BY year', $start_date, $end_date ); // phpcs:ignore WordPress.NamingConventions.ValidVariableName.VariableNotSnakeCase $yearly = $wpdb->get_results( $sql );