function computeDate($start_date, $additional_delay = 0)
{
if (isset($this->fields['id'])) {
$delay = $this->getSLTTime();
// Based on a calendar
if ($this->fields['calendars_id'] > 0) {
$cal = new Calendar();
$work_in_days = $this->fields['definition_time'] == 'day';
if ($cal->getFromDB($this->fields['calendars_id'])) {
return $cal->computeEndDate($start_date, $delay, $additional_delay, $work_in_days, $this->fields['end_of_working_day']);
}
}
// No calendar defined or invalid calendar
if ($this->fields['number_time'] >= 0) {
$starttime = strtotime($start_date);
$endtime = $starttime + $delay + $additional_delay;
return date('Y-m-d H:i:s', $endtime);
}
}
return NULL;
}