@license GPLv2+ http://www.gnu.org/licenses/gpl.txt @link https://forge.indepnet.net/projects/genericobject @link http://www.glpi-project.org/ @since 2009 ---------------------------------------------------------------------- */ include "../../../inc/includes.php"; if (isset($_POST["delete"])) { $type = new PluginGenericobjectType(); $type->getFromDB($_POST["id"]); $itemtype = $type->fields['itemtype']; PluginGenericobjectType::registerOneType($itemtype); foreach ($_POST["fields"] as $field => $value) { if ($type->can($_POST["id"], PURGE) && $value == 1 && PluginGenericobjectField::checkNecessaryFieldsDelete($itemtype, $field)) { PluginGenericobjectField::deleteField(getTableForItemType($itemtype), $field); Session::addMessageAfterRedirect(__("Field(s) deleted successfully", "genericobject"), true, INFO); } } } elseif (isset($_POST["add_field"])) { $type = new PluginGenericobjectType(); if ($_POST["new_field"] && $type->can($_POST["id"], UPDATE)) { $itemtype = $type->fields['itemtype']; PluginGenericobjectType::registerOneType($itemtype); PluginGenericobjectField::addNewField(getTableForItemType($itemtype), $_POST["new_field"]); Session::addMessageAfterRedirect(__("Field added successfully", "genericobject")); } } elseif (isset($_POST['action'])) { //Move field PluginGenericobjectField::changeFieldOrder($_POST); } Html::back();
@license GPLv2+ http://www.gnu.org/licenses/gpl.txt @link https://forge.indepnet.net/projects/genericobject @link http://www.glpi-project.org/ @since 2009 ---------------------------------------------------------------------- */ include "../../../inc/includes.php"; if (isset($_POST["delete"])) { $type = new PluginGenericobjectType(); $type->getFromDB($_POST["id"]); $itemtype = $type->fields['itemtype']; PluginGenericobjectType::registerOneType($itemtype); foreach ($_POST["fields"] as $field => $value) { if ($type->can($_POST["id"], "w") && $value == 1 && PluginGenericobjectField::checkNecessaryFieldsDelete($itemtype, $field)) { PluginGenericobjectField::deleteField(getTableForItemType($itemtype), $field); Session::addMessageAfterRedirect(__("Field(s) deleted successfully", "genericobject"), true, INFO); } } } elseif (isset($_POST["add_field"])) { $type = new PluginGenericobjectType(); if ($_POST["new_field"] && $type->can($_POST["id"], "w")) { $itemtype = $type->fields['itemtype']; PluginGenericobjectType::registerOneType($itemtype); PluginGenericobjectField::addNewField(getTableForItemType($itemtype), $_POST["new_field"]); Session::addMessageAfterRedirect(__("Field added successfully", "genericobject")); } } elseif (isset($_POST['action'])) { //Move field PluginGenericobjectField::changeFieldOrder($_POST); } Html::back();