function prepareInputForUpdate($input)
{
Toolbox::manageBeginAndEndPlanDates($input['plan']);
if (isset($input['_planningrecall'])) {
PlanningRecall::manageDatas($input['_planningrecall']);
}
if (isset($input["name"])) {
$input["name"] = trim($input["name"]);
if (empty($input["name"])) {
$input["name"] = __('Without title');
}
}
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);
}
}
return $input;
}