fix halfday period, fix php8 compatibility

This commit is contained in:
Jean-Christian Denis 2021-10-23 23:36:35 +02:00
parent d07ae07ad0
commit d9329a3f5e
Signed by: JcDenis
GPG key ID: 1B5B8C5B90B6C951

View file

@ -219,7 +219,7 @@ class periodical
if (!empty($params['periodical_id'])) { if (!empty($params['periodical_id'])) {
if (is_array($params['periodical_id'])) { if (is_array($params['periodical_id'])) {
array_walk($params['periodical_id'], create_function('&$v,$k', 'if($v!==null){$v=(integer)$v;}')); array_walk($params['periodical_id'], function ($v) { if ($v !== null) { $v = (integer) $v; } });
} else { } else {
$params['periodical_id'] = [(integer) $params['periodical_id']]; $params['periodical_id'] = [(integer) $params['periodical_id']];
} }
@ -332,23 +332,23 @@ class periodical
switch($period) switch($period)
{ {
case 'hour': case 'hour':
$new_ts = mktime($e[0] + 1,$e[1],$e[2],$e[3],$e[4],$e[5]); $new_ts = mktime($e[0] + 1, $e[1], $e[2], $e[3], $e[4], $e[5]);
break; break;
case 'halfday': case 'halfday':
$new_ts = mktime($e[0],$e[1] + 12,$e[2],$e[3],$e[4],$e[5]); $new_ts = mktime($e[0] + 12, $e[1], $e[2], $e[3], $e[4], $e[5]);
break; break;
case 'day': case 'day':
$new_ts = mktime($e[0],$e[1],$e[2],$e[3],$e[4] + 1,$e[5]); $new_ts = mktime($e[0], $e[1] ,$e[2], $e[3], $e[4] + 1, $e[5]);
break; break;
case 'week': case 'week':
$new_ts = mktime($e[0],$e[1],$e[2],$e[3],$e[4] + 7,$e[5]); $new_ts = mktime($e[0], $e[1], $e[2], $e[3], $e[4] + 7, $e[5]);
break; break;
case 'month': case 'month':
$new_ts = mktime($e[0],$e[1],$e[2],$e[3] + 1,$e[4],$e[5]); $new_ts = mktime($e[0], $e[1], $e[2], $e[3] + 1, $e[4], $e[5]);
break; break;
default: default: