From 9d12aeee49fccd683981f2c833e445a81e7472f7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 18 Feb 2021 15:41:52 +0100 Subject: [PATCH] Fix timezone problem with drag and drop --- htdocs/comm/action/card.php | 8 +++++--- htdocs/comm/action/index.php | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 6f1e83103d5..b3cb6d60a23 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -730,8 +730,8 @@ if (empty($reshook) && GETPOST('actionmove', 'alpha') == 'mupdate') { $error = 0; - $shour = dol_print_date($object->datep, "%H"); - $smin = dol_print_date($object->datep, "%M"); + $shour = dol_print_date($object->datep, "%H", 'tzuserrel'); // We take the date visible by user $newdate is also date visible by user. + $smin = dol_print_date($object->datep, "%M", 'tzuserrel'); $newdate = GETPOST('newdate', 'alpha'); if (empty($newdate) || strpos($newdate, 'dayevent_') != 0) @@ -740,7 +740,9 @@ if (empty($reshook) && GETPOST('actionmove', 'alpha') == 'mupdate') exit; } - $datep = dol_mktime($shour, $smin, 0, substr($newdate, 13, 2), substr($newdate, 15, 2), substr($newdate, 9, 4)); + $datep = dol_mktime($shour, $smin, 0, substr($newdate, 13, 2), substr($newdate, 15, 2), substr($newdate, 9, 4), 'tzuserrel'); + //print dol_print_date($datep, 'dayhour');exit; + if ($datep != $object->datep) { if (!empty($object->datef)) diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 602b12d8548..cd0b98c8f90 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -1630,7 +1630,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa $tmpyearend = date('Y', $event->date_end_in_calendar); $tmpmonthend = date('m', $event->date_end_in_calendar); $tmpdayend = date('d', $event->date_end_in_calendar); - if ($tmpyearend == $annee && $tmpmonthend == $mois && $tmpdayend == $jour) + if ($tmpyearend != $annee || $tmpmonthend != $mois || $tmpdayend != $jour) { $cssclass .= " unmovable"; }