Fixing style errors.
This commit is contained in:
parent
e74043d48e
commit
e5cff0ede1
@ -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();
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user