function prepareInputForUpdate($input) { global $CFG_GLPI; Toolbox::manageBeginAndEndPlanDates($input['plan']); if (isset($input["hour"]) && isset($input["minute"])) { $input["actiontime"] = $input["hour"] * HOUR_TIMESTAMP + $input["minute"] * MINUTE_TIMESTAMP; unset($input["hour"]); unset($input["minute"]); } if (isset($input["plan"])) { $input["_plan"] = $input["plan"]; unset($input["plan"]); } if (isset($input['plugin_projet_taskstates_id']) && !empty($input['plugin_projet_taskstates_id'])) { $archived = " `for_dependency` = '1' "; $states = getAllDatasFromTable("glpi_plugin_projet_taskstates", $archived); $tab = array(); if (!empty($states)) { foreach ($states as $state) { $tab[] = $state['id']; } } if (!empty($tab) && in_array($input['plugin_projet_taskstates_id'], $tab)) { $input['advance'] = '100'; } } if (isset($input['_link'])) { $task_task = new PluginProjetTask_Task(); if (!empty($input['_link']['plugin_projet_tasks_id_2'])) { if ($task_task->can(-1, 'w', $input['_link'])) { $task_task->add($input['_link']); } else { Session::addMessageAfterRedirect(__('Unknown project task', 'projet'), false, ERROR); } } } $this->getFromDB($input["id"]); $input["_old_name"] = $this->fields["name"]; $input["_old_users_id"] = $this->fields["users_id"]; $input["_old_groups_id"] = $this->fields["groups_id"]; $input["_old_contacts_id"] = $this->fields["contacts_id"]; $input["_old_plugin_projet_tasktypes_id"] = $this->fields["plugin_projet_tasktypes_id"]; $input["_old_plugin_projet_taskstates_id"] = $this->fields["plugin_projet_taskstates_id"]; $input["_old_actiontime"] = $this->fields["actiontime"]; $input["_old_advance"] = $this->fields["advance"]; $input["_old_priority"] = $this->fields["priority"]; $input["_old_comment"] = $this->fields["comment"]; $input["_old_sub"] = $this->fields["sub"]; $input["_old_others"] = $this->fields["others"]; $input["_old_affect"] = $this->fields["affect"]; $input["_old_plugin_projet_projets_id"] = $this->fields["plugin_projet_projets_id"]; $input["_old_depends"] = $this->fields["depends"]; $input["_old_show_gantt"] = $this->fields["show_gantt"]; $input["_old_locations_id"] = $this->fields["locations_id"]; return $input; }