2
0
forked from Wavyzz/dolibarr

Merge branch 'develop' into new/check_update_for_module

This commit is contained in:
Laurent Destailleur
2021-04-19 21:26:01 +02:00
committed by GitHub
53 changed files with 620 additions and 217 deletions

View File

@@ -2290,7 +2290,7 @@ function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs =
dol_print_error("Functions.lib::dol_print_date function called with a bad value from page ".$_SERVER["PHP_SELF"]);
return '';
} elseif (preg_match('/^([0-9]+)\-([0-9]+)\-([0-9]+) ?([0-9]+)?:?([0-9]+)?:?([0-9]+)?/i', $time, $reg)) { // Still available to solve problems in extrafields of type date
// This part of code should not be used.
// This part of code should not be used anymore.
dol_syslog("Functions.lib::dol_print_date function called with a bad value from page ".$_SERVER["PHP_SELF"], LOG_WARNING);
//if (function_exists('debug_print_backtrace')) debug_print_backtrace();
// Date has format 'YYYY-MM-DD' or 'YYYY-MM-DD HH:MM:SS'
@@ -2318,7 +2318,7 @@ function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs =
$timetouse = $time + $offsettz + $offsetdst; // TODO Replace this with function Date PHP. We also should not use anymore offsettz and offsetdst but only offsettzstring.
// Here ret is string in PHP setup language (strftime was used). Now we convert to $outputlangs.
$month = adodb_strftime('%m', $timetouse);
$month = adodb_strftime('%m', $timetouse, true);
$month = sprintf("%02d", $month); // $month may be return with format '06' on some installation and '6' on other, so we force it to '06'.
if ($encodetooutput) {
$monthtext = $outputlangs->transnoentities('Month'.$month);
@@ -2336,7 +2336,7 @@ function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs =
if (preg_match('/__a__/i', $format)) {
$timetouse = $time + $offsettz + $offsetdst; // TODO Replace this with function Date PHP. We also should not use anymore offsettz and offsetdst but only offsettzstring.
$w = adodb_strftime('%w', $timetouse); // TODO Replace this with function Date PHP. We also should not use anymore offsettz and offsetdst but only offsettzstring.
$w = adodb_strftime('%w', $timetouse, true); // TODO Replace this with function Date PHP. We also should not use anymore offsettz and offsetdst but only offsettzstring.
$dayweek = $outputlangs->transnoentitiesnoconv('Day'.$w);
$ret = str_replace('__A__', $dayweek, $ret);
$ret = str_replace('__a__', dol_substr($dayweek, 0, 3), $ret);
@@ -2353,7 +2353,7 @@ function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs =
*
* @param int $timestamp Timestamp
* @param boolean $fast Fast mode. deprecated.
* @param string $forcetimezone '' to use the PHP server timezone. Or use a form like 'Europe/Paris' or '+0200' to force timezone.
* @param string $forcetimezone '' to use the PHP server timezone. Or use a form like 'gmt', 'Europe/Paris' or '+0200' to force timezone.
* @return array Array of informations
* 'seconds' => $secs,
* 'minutes' => $min,
@@ -2375,7 +2375,7 @@ function dol_getdate($timestamp, $fast = false, $forcetimezone = '')
$datetimeobj = new DateTime();
$datetimeobj->setTimestamp($timestamp); // Use local PHP server timezone
if ($forcetimezone) {
$datetimeobj->setTimezone(new DateTimeZone($forcetimezone)); // (add timezone relative to the date entered)
$datetimeobj->setTimezone(new DateTimeZone($forcetimezone == 'gmt' ? 'UTC' : $forcetimezone)); // (add timezone relative to the date entered)
}
$arrayinfo = array(
'year'=>((int) date_format($datetimeobj, 'Y')),