From e5cff0ede117553c11b269a2a529fbac41eee8fb Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 22 Sep 2021 16:07:36 +0000 Subject: [PATCH] Fixing style errors. --- htdocs/core/lib/date.lib.php | 46 +++++++++++++++++------------------- 1 file changed, 22 insertions(+), 24 deletions(-) diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php index 21a8835a229..cff6d22518f 100644 --- a/htdocs/core/lib/date.lib.php +++ b/htdocs/core/lib/date.lib.php @@ -168,30 +168,28 @@ function dol_time_plus_duree($time, $duration_value, $duration_unit) } //Change the behavior of PHP over data-interval when the result of this function is Feb 29 (non-leap years), 30 or Feb 31 (php returns March 1, 2 or 3 respectively) if ($conf->global->MAIN_DATE_CHANGE_PHP_DATEINTERVAL_RESULT_FEBRUARY && $duration_unit == 'm') { - - $timeyear = dol_print_date($time, '%Y'); - $timemonth = dol_print_date($time, '%m'); - $timetotalmonths = (($timeyear * 12) + $timemonth); - - $monthsexpected = ($timetotalmonths + $duration_value); - - $newtime = $date->getTimestamp(); - - $newtimeyear = dol_print_date($newtime, '%Y'); - $newtimemonth = dol_print_date($newtime, '%m'); - $newtimetotalmonths = (($newtimeyear * 12) + $newtimemonth); - - if ($monthsexpected < $newtimetotalmonths) { - - $newtimehours = dol_print_date($newtime, '%m'); - $newtimemins = dol_print_date($newtime, '%m'); - $newtimesecs = dol_print_date($newtime, '%m'); - - $datelim = dol_mktime($newtimehours, $newtimemins, $newtimesecs, $newtimemonth, 1, $newtimeyear); - $datelim -= (3600 * 24); - - $date->setTimestamp($datelim); - } + $timeyear = dol_print_date($time, '%Y'); + $timemonth = dol_print_date($time, '%m'); + $timetotalmonths = (($timeyear * 12) + $timemonth); + + $monthsexpected = ($timetotalmonths + $duration_value); + + $newtime = $date->getTimestamp(); + + $newtimeyear = dol_print_date($newtime, '%Y'); + $newtimemonth = dol_print_date($newtime, '%m'); + $newtimetotalmonths = (($newtimeyear * 12) + $newtimemonth); + + if ($monthsexpected < $newtimetotalmonths) { + $newtimehours = dol_print_date($newtime, '%m'); + $newtimemins = dol_print_date($newtime, '%m'); + $newtimesecs = dol_print_date($newtime, '%m'); + + $datelim = dol_mktime($newtimehours, $newtimemins, $newtimesecs, $newtimemonth, 1, $newtimeyear); + $datelim -= (3600 * 24); + + $date->setTimestamp($datelim); + } } return $date->getTimestamp(); }