Skip to content

Commit

Permalink
Add timezone offset to MySQL
Browse files Browse the repository at this point in the history
  • Loading branch information
gogdzl committed Oct 25, 2024
1 parent e92a96f commit 7d0721a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions projects/plugins/crm/admin/dashboard/dashboard.ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ function jetpackcrm_dash_refresh() {
);
}

$tz_offset = jpcrm_get_wp_timezone_offset();
$wpdb->query( 'SET time_zone = "' . $tz_offset . '";' );

Check failure on line 73 in projects/plugins/crm/admin/dashboard/dashboard.ajax.php

View workflow job for this annotation

GitHub Actions / Static analysis

TypeError PhanTypeSuspiciousStringExpression Suspicious type \str of a variable or expression $tz_offset used to build a string. (Expected type to be able to cast to a string)

// 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 );
Expand Down

0 comments on commit 7d0721a

Please sign in to comment.