function prepareInputForAdd($input)
{
Toolbox::manageBeginAndEndPlanDates($input['plan']);
$input["name"] = trim($input["name"]);
if (empty($input["name"])) {
$input["name"] = __('Without title');
}
$input["begin"] = $input["end"] = "NULL";
if (isset($input['plan'])) {
if (!empty($input['plan']["begin"]) && !empty($input['plan']["end"]) && $input['plan']["begin"] < $input['plan']["end"]) {
$input['_plan'] = $input['plan'];
unset($input['plan']);
$input['is_planned'] = 1;
$input["begin"] = $input['_plan']["begin"];
$input["end"] = $input['_plan']["end"];
} else {
Session::addMessageAfterRedirect(__('Error in entering dates. The starting date is later than the ending date'), false, ERROR);
}
}
// set new date.
$input["date"] = $_SESSION["glpi_currenttime"];
return $input;
}