Merge pull request #12147 from homer8173/patch-5

Fix user time instead of server time
This commit is contained in:
Laurent Destailleur 2019-10-16 13:12:37 +02:00 committed by GitHub
commit ea2986037f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5607,10 +5607,10 @@ class Form
$reset_scripts = "";
// Generate the date part, depending on the use or not of the javascript calendar
$reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date(dol_now(), 'day').'\');';
$reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date(dol_now(), '%d').'\');';
$reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date(dol_now(), '%m').'\');';
$reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date(dol_now(), '%Y').'\');';
$reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date(dol_now(), 'day', 'tzuser').'\');';
$reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date(dol_now(), '%d', 'tzuser').'\');';
$reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date(dol_now(), '%m', 'tzuser').'\');';
$reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date(dol_now(), '%Y', 'tzuser').'\');';
/*if ($usecalendar == "eldy")
{
$base=DOL_URL_ROOT.'/core/';
@ -5627,7 +5627,7 @@ class Form
{
if ($fullday) $reset_scripts .= " if (jQuery('#fullday:checked').val() == null) {";
//$reset_scripts .= 'this.form.elements[\''.$prefix.'hour\'].value=formatDate(new Date(), \'HH\'); ';
$reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(\''.dol_print_date(dol_now(), '%H').'\');';
$reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(\''.dol_print_date(dol_now(), '%H', 'tzuser').'\');';
if ($fullday) $reset_scripts .= ' } ';
}
// Update the minute part
@ -5635,7 +5635,7 @@ class Form
{
if ($fullday) $reset_scripts .= " if (jQuery('#fullday:checked').val() == null) {";
//$reset_scripts .= 'this.form.elements[\''.$prefix.'min\'].value=formatDate(new Date(), \'mm\'); ';
$reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(\''.dol_print_date(dol_now(), '%M').'\');';
$reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(\''.dol_print_date(dol_now(), '%M', 'tzuser').'\');';
if ($fullday) $reset_scripts .= ' } ';
}
// If reset_scripts is not empty, print the link with the reset_scripts in the onClick