From 123df7cc2d0013272b9e5fe178212d44721cc9a5 Mon Sep 17 00:00:00 2001 From: Stanislas Kita Date: Mon, 6 Oct 2025 14:22:32 +0200 Subject: [PATCH] Fix(build): clean front files --- front/commondropdown.form.php | 37 ----------------------------- front/commondropdown.php | 37 ----------------------------- templates/container.class.tpl | 6 +++-- templates/dropdown.class.tpl | 44 ++--------------------------------- templates/dropdown.form.tpl | 7 ------ templates/dropdown.tpl | 6 ----- 6 files changed, 6 insertions(+), 131 deletions(-) delete mode 100644 front/commondropdown.form.php delete mode 100644 front/commondropdown.php delete mode 100644 templates/dropdown.form.tpl delete mode 100644 templates/dropdown.tpl diff --git a/front/commondropdown.form.php b/front/commondropdown.form.php deleted file mode 100644 index 9801c46d..00000000 --- a/front/commondropdown.form.php +++ /dev/null @@ -1,37 +0,0 @@ -. - * ------------------------------------------------------------------------- - * @copyright Copyright (C) 2013-2023 by Fields plugin team. - * @license GPLv2 https://www.gnu.org/licenses/gpl-2.0.html - * @link https://github.com/pluginsGLPI/fields - * ------------------------------------------------------------------------- - */ - -include '../../../inc/includes.php'; -Session::checkLoginUser(); -if (preg_match('/[a-z]/i', $_REQUEST['ddtype']) !== 1) { - throw new \RuntimeException(sprintf('Invalid itemtype "%1$s"', $_REQUEST['ddtype'])); -} -$path = PLUGINFIELDS_FRONT_PATH . '/' . $_REQUEST['ddtype'] . '.form.php'; -require_once $path; diff --git a/front/commondropdown.php b/front/commondropdown.php deleted file mode 100644 index a9009efe..00000000 --- a/front/commondropdown.php +++ /dev/null @@ -1,37 +0,0 @@ -. - * ------------------------------------------------------------------------- - * @copyright Copyright (C) 2013-2023 by Fields plugin team. - * @license GPLv2 https://www.gnu.org/licenses/gpl-2.0.html - * @link https://github.com/pluginsGLPI/fields - * ------------------------------------------------------------------------- - */ - -include '../../../inc/includes.php'; -Session::checkLoginUser(); -if (preg_match('/[a-z]/i', $_REQUEST['ddtype']) !== 1) { - throw new \RuntimeException(sprintf('Invalid itemtype "%1$s"', $_REQUEST['ddtype'])); -} -$path = PLUGINFIELDS_FRONT_PATH . '/' . $_REQUEST['ddtype'] . '.php'; -require_once $path; diff --git a/templates/container.class.tpl b/templates/container.class.tpl index 5fb10fd2..805f80a7 100644 --- a/templates/container.class.tpl +++ b/templates/container.class.tpl @@ -1,5 +1,7 @@ isEntityAssign() && !$DB->fieldExists($table, 'entities_id')) { + if (getItemForItemtype(%%ITEMTYPE%%::class)->isEntityAssign() && !$DB->fieldExists($table, 'entities_id')) { $migration->addField($table, 'entities_id', 'fkey', ['after' => 'plugin_fields_containers_id']); $migration->addKey($table, 'entities_id'); $migration->executeMigration(); @@ -107,7 +109,7 @@ class %%CLASSNAME%% extends PluginFieldsAbstractContainerInstance * associated item type requires recursive assignment */ if ( - getItemForItemtype('%%ITEMTYPE%%')->maybeRecursive() + getItemForItemtype(%%ITEMTYPE%%::class)->maybeRecursive() && !$DB->fieldExists($table, 'is_recursive') && $DB->fieldExists($table, 'entities_id')) { $migration->addField($table, 'is_recursive', 'bool', ['after' => 'entities_id']); diff --git a/templates/dropdown.class.tpl b/templates/dropdown.class.tpl index 93a23171..33eddc02 100644 --- a/templates/dropdown.class.tpl +++ b/templates/dropdown.class.tpl @@ -59,9 +59,7 @@ class %%CLASSNAME%% extends CommonTreeDropdown { * @param $full path or relative one (true by default) **/ static function getTabsURL($full=true) { - $url = Toolbox::getItemTypeTabsURL('PluginFieldsCommonDropdown', $full); - $plug = isPluginItemType(get_called_class()); - $url .= '?ddtype=' . strtolower($plug['class']); + $url = Toolbox::getItemTypeTabsURL(get_called_class(), $full); return $url; } @@ -71,45 +69,7 @@ class %%CLASSNAME%% extends CommonTreeDropdown { * @param $full path or relative one (true by default) **/ static function getSearchURL($full=true) { - $url = Toolbox::getItemTypeSearchURL('PluginFieldsCommonDropdown', $full); - $plug = isPluginItemType(get_called_class()); - $url .= '?ddtype=' . strtolower($plug['class']); + $url = Toolbox::getItemTypeSearchURL(get_called_class(), $full); return $url; } - - /** - * Get the form page URL for the current class - * - * @param $full path or relative one (true by default) - **/ - static function getFormURL($full=true) { - $url = Toolbox::getItemTypeFormURL('PluginFieldsCommonDropdown', $full); - $plug = isPluginItemType(get_called_class()); - $url .= '?ddtype=' . strtolower($plug['class']); - return $url; - } - - /** - * Get the form page URL for the current class and point to a specific ID - * - * @param $id (default 0) - * @param $full path or relative one (true by default) - * - * @since version 0.90 - **/ - static function getFormURLWithID($id=0, $full=true) { - - $link = self::getFormURL($full); - $link .= '&id=' . $id; - return $link; - } - - /** - * Get default values to search engine to override - **/ - static function getDefaultSearchRequest() { - $plug = isPluginItemType(get_called_class()); - $search = ['addhidden' => ['ddtype' => strtolower($plug['class'])]]; - return $search; - } } diff --git a/templates/dropdown.form.tpl b/templates/dropdown.form.tpl deleted file mode 100644 index 70519f79..00000000 --- a/templates/dropdown.form.tpl +++ /dev/null @@ -1,7 +0,0 @@ - $_GET['ddtype'] -]; -include GLPI_ROOT . "/front/dropdown.common.form.php"; diff --git a/templates/dropdown.tpl b/templates/dropdown.tpl deleted file mode 100644 index 08ff79e9..00000000 --- a/templates/dropdown.tpl +++ /dev/null @@ -1,6 +0,0 @@ -