From 4bc88aa0ccb6c3754ece44576f019265e7e7f3cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 11 Aug 2026 20:07:16 +0200 Subject: [PATCH] NEW: Migrate partnership extrafields admin page to the unified page --- htdocs/core/lib/admin_extrafields.lib.php | 11 ++ .../admin/partnership_extrafields.php | 116 ------------------ htdocs/partnership/lib/partnership.lib.php | 2 +- 3 files changed, 12 insertions(+), 117 deletions(-) delete mode 100644 htdocs/partnership/admin/partnership_extrafields.php diff --git a/htdocs/core/lib/admin_extrafields.lib.php b/htdocs/core/lib/admin_extrafields.lib.php index 38105250f4a..32effd39fe5 100644 --- a/htdocs/core/lib/admin_extrafields.lib.php +++ b/htdocs/core/lib/admin_extrafields.lib.php @@ -789,5 +789,16 @@ function getExtrafieldsAdminMap() 'helpurl' => '', 'langs' => array('hrm', 'admin'), ), + 'partnership' => array( + 'headfunction' => 'partnershipAdminPrepareHead', + 'headfile' => 'partnership/lib/partnership.lib.php', + 'tabid' => 'partnership_extrafields', + 'headlabel' => 'PartnershipSetup', + 'textobject' => 'Partnership', + 'headpicto' => 'partnership', + 'title' => 'PartnershipSetup', + 'helpurl' => '', + 'langs' => array('partnership', 'admin'), + ), ); } diff --git a/htdocs/partnership/admin/partnership_extrafields.php b/htdocs/partnership/admin/partnership_extrafields.php deleted file mode 100644 index 2a9fc27d60a..00000000000 --- a/htdocs/partnership/admin/partnership_extrafields.php +++ /dev/null @@ -1,116 +0,0 @@ - - * Copyright (C) 2003 Jean-Louis Bergamo - * Copyright (C) 2004-2011 Laurent Destailleur - * Copyright (C) 2012 Regis Houssin - * Copyright (C) 2014 Florian Henry - * Copyright (C) 2015 Jean-François Ferry - * Copyright (C) 2024 Frédéric France - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** - * \file admin/partnership_extrafields.php - * \ingroup partnership - * \brief Page to setup extra fields of partnership - */ - -// Load Dolibarr environment -require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; -require_once '../lib/partnership.lib.php'; - -/** - * @var Conf $conf - * @var DoliDB $db - * @var HookManager $hookmanager - * @var Translate $langs - * @var User $user - */ - -// Load translation files required by the page -$langs->loadLangs(array('partnership', 'admin')); - -$extrafields = new ExtraFields($db); -$form = new Form($db); - -// List of supported format -$type2label = ExtraFields::getListOfTypesLabels(); - -$action = GETPOST('action', 'aZ09'); -$attrname = GETPOST('attrname', 'alpha'); -$elementtype = 'partnership'; //Must be the $table_element of the class that manage extrafield - -if (!$user->admin) { - accessforbidden(); -} - - -/* - * Actions - */ - -require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php'; - - - -/* - * View - */ - -$textobject = $langs->transnoentitiesnoconv("Partnership"); - -$help_url = ''; -$title = $langs->trans("PartnershipSetup"); - -llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-partnership page-admin-extrafields'); - - -$linkback = ''.img_picto($langs->trans("BackToModuleList"), 'back', 'class="pictofixedwidth"').''.$langs->trans("BackToModuleList").''; -print load_fiche_titre($langs->trans("PartnershipSetup"), $linkback, 'title_setup'); - - -$head = partnershipAdminPrepareHead(); - -print dol_get_fiche_head($head, 'partnership_extrafields', $title, -1, 'partnership'); - -require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; - -print dol_get_fiche_end(); - - -/* - * Creation of an optional field - */ -if ($action == 'create') { - print '
'; - print load_fiche_titre($langs->trans('NewAttribute')); - - require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; -} - -/* - * Edition of an optional field - */ -if ($action == 'edit' && !empty($attrname)) { - print "
"; - print load_fiche_titre($langs->trans("FieldEdition", $attrname)); - - require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; -} - -// End of page -llxFooter(); -$db->close(); diff --git a/htdocs/partnership/lib/partnership.lib.php b/htdocs/partnership/lib/partnership.lib.php index 5518962c17a..b0817425ec5 100644 --- a/htdocs/partnership/lib/partnership.lib.php +++ b/htdocs/partnership/lib/partnership.lib.php @@ -45,7 +45,7 @@ function partnershipAdminPrepareHead() $h++; - $head[$h][0] = DOL_URL_ROOT . '/partnership/admin/partnership_extrafields.php'; + $head[$h][0] = dolBuildUrl(DOL_URL_ROOT.'/admin/extrafields.php', array('elementtype' => 'partnership')); $head[$h][1] = $langs->trans("ExtraFields"); $nbExtrafields = $extrafields->attributes['partnership']['count']; if ($nbExtrafields > 0) {