/** * Used to set the ForeignKeyField * * @param $input datas used to add the item * * @return the modified $input array **/ function prepareInputForAdd($input) { $input[$this->getForeignKeyField()] = $this->getNewAncestor(); // We call the parent to manage tree return parent::prepareInputForAdd($input); }
/** * @see CommonDBTM::prepareInputForAdd() */ function prepareInputForAdd($input) { global $LANG; // Check for mandatory fields $mandatory_ok = true; if (!isset($input["plugin_customfields_dropdowns_id"]) || empty($input["plugin_customfields_dropdowns_id"])) { Session::addMessageAfterRedirect($LANG['plugin_customfields']['error'][1], false, ERROR); $mandatory_ok = false; } if (!$mandatory_ok) { return false; } return parent::prepareInputForAdd($input); }
/** * @since version 0.84 (before in entitydata.class) **/ function prepareInputForAdd($input) { global $DB; $input = parent::prepareInputForAdd($input); $query = "SELECT MAX(`id`)+1 AS newID\n FROM `glpi_entities`"; if ($result = $DB->query($query)) { $input['id'] = $DB->result($result, 0, 0); } else { return false; } $input['max_closedate'] = $_SESSION["glpi_currenttime"]; return $this->checkRightDatas($input); }
/** * @since version 0.85 * * @see CommonTreeDropdown::prepareInputForAdd() **/ function prepareInputForAdd($input) { $input = parent::prepareInputForAdd($input); $state = new self(); // Get visibility information from parent if not set if (isset($input['states_id']) && $state->getFromDB($input['states_id'])) { foreach ($this->visibility_fields as $type => $field) { if (!isset($input[$field]) && isset($state->fields[$field])) { $input[$field] = $state->fields[$field]; } } } return $input; }