diff --git a/htdocs/admin/order_extrafields.php b/htdocs/admin/order_extrafields.php deleted file mode 100644 index f1e34cd0da3..00000000000 --- a/htdocs/admin/order_extrafields.php +++ /dev/null @@ -1,108 +0,0 @@ - - * Copyright (C) 2003 Jean-Louis Bergamo - * Copyright (C) 2004-2013 Laurent Destailleur - * Copyright (C) 2012 Regis Houssin - * Copyright (C) 2012 Florian Henry - * Copyright (C) 2013 Philippe Grand - * Copyright (C) 2024-2026 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 htdocs/admin/order_extrafields.php - * \ingroup order - * \brief Page to setup extra fields of order - */ - -// Load Dolibarr environment -require '../main.inc.php'; -/** - * @var Conf $conf - * @var DoliDB $db - * @var ExtraFields $extrafields - * @var HookManager $hookmanager - * @var Translate $langs - * @var User $user - */ - -require_once DOL_DOCUMENT_ROOT.'/core/lib/order.lib.php'; - -if (!$user->admin) { - accessforbidden(); -} - -// Load translation files required by the page -$langs->loadLangs(array('admin', 'other', 'orders')); - -$form = new Form($db); - -// List of supported format -$type2label = ExtraFields::getListOfTypesLabels(); - -$action = GETPOST('action', 'aZ09'); -$attrname = GETPOST('attrname', 'alpha'); -$elementtype = 'commande'; //Must be the $table_element of the class that manage extrafield - - - -/* - * Actions - */ - -require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php'; - - - -/* - * View - */ - -$textobject = $langs->transnoentitiesnoconv("Orders"); - -llxHeader('', $langs->trans("OrdersSetup"), '', '', 0, 0, '', '', '', 'mod-admin page-order_extrafields'); - -$linkback = ''.img_picto($langs->trans("BackToModuleList"), 'back', 'class="pictofixedwidth"').''.$langs->trans("BackToModuleList").''; - -print load_fiche_titre($langs->trans("OrdersSetup"), $linkback, 'title_setup'); - -$head = order_admin_prepare_head(); - -print dol_get_fiche_head($head, 'attributes', $langs->trans("Orders"), -1, 'order'); - -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/admin/orderdet_extrafields.php b/htdocs/admin/orderdet_extrafields.php deleted file mode 100644 index f6a3a676f5e..00000000000 --- a/htdocs/admin/orderdet_extrafields.php +++ /dev/null @@ -1,108 +0,0 @@ - - * Copyright (C) 2003 Jean-Louis Bergamo - * Copyright (C) 2004-2013 Laurent Destailleur - * Copyright (C) 2012 Regis Houssin - * Copyright (C) 2012 Florian Henry - * Copyright (C) 2013 Philippe Grand - * Copyright (C) 2013 Florian Henry - * Copyright (C) 2024-2026 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 htdocs/admin/orderdet_extrafields.php - * \ingroup order - * \brief Page to setup extra fields of order - */ - -// Load Dolibarr environment -require '../main.inc.php'; -/** - * @var Conf $conf - * @var DoliDB $db - * @var ExtraFields $extrafields - * @var HookManager $hookmanager - * @var Translate $langs - * @var User $user - */ - -require_once DOL_DOCUMENT_ROOT.'/core/lib/order.lib.php'; - -if (!$user->admin) { - accessforbidden(); -} - -// Load translation files required by the page -$langs->loadlangs(array('admin', 'other', 'orders')); - -$form = new Form($db); - -// List of supported format -$type2label = ExtraFields::getListOfTypesLabels(); - -$action = GETPOST('action', 'aZ09'); -$attrname = GETPOST('attrname', 'alpha'); -$elementtype = 'commandedet'; //Must be the $table_element of the class that manage extrafield - - -/* - * Actions - */ - -require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php'; - - - -/* - * View - */ - -$textobject = $langs->transnoentitiesnoconv("Orders"); - -llxHeader('', $langs->trans("OrdersSetup"), '', '', 0, 0, '', '', '', 'mod-admin page-orderdet_extrafields'); - -$linkback = ''.img_picto($langs->trans("BackToModuleList"), 'back', 'class="pictofixedwidth"').''.$langs->trans("BackToModuleList").''; - -print load_fiche_titre($langs->trans("OrdersSetup"), $linkback, 'title_setup'); - -$head = order_admin_prepare_head(); - -print dol_get_fiche_head($head, 'attributeslines', $langs->trans("Orders"), -1, 'order'); - -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/core/lib/admin_extrafields.lib.php b/htdocs/core/lib/admin_extrafields.lib.php index f7a2bf46071..29985d70ff6 100644 --- a/htdocs/core/lib/admin_extrafields.lib.php +++ b/htdocs/core/lib/admin_extrafields.lib.php @@ -473,5 +473,58 @@ function getExtrafieldsAdminMap() 'helpurl' => '', 'langs' => array('mrp', 'admin'), ), + 'commande' => array( + 'headfunction' => 'order_admin_prepare_head', + 'headfile' => 'core/lib/order.lib.php', + 'tabid' => 'attributes', + 'headlabel' => 'Orders', + 'textobject' => 'Orders', + 'headpicto' => 'order', + 'title' => 'OrdersSetup', + 'helpurl' => '', + 'langs' => array('admin', 'other', 'orders'), + ), + 'commandedet' => array( + 'headfunction' => 'order_admin_prepare_head', + 'headfile' => 'core/lib/order.lib.php', + 'tabid' => 'attributeslines', + 'headlabel' => 'Orders', + 'textobject' => 'Orders', + 'headpicto' => 'order', + 'title' => 'OrdersSetup', + 'helpurl' => '', + 'langs' => array('admin', 'other', 'orders'), + ), + // The supplier order module is mid-transition between the legacy 'fournisseur' + // module (core/lib/fourn.lib.php, function supplierorder_admin_prepare_head()) + // and the new split 'supplier_order' module (core/lib/supplier_order.lib.php, + // function supplier_order_admin_prepare_head()), selected at runtime by the + // MAIN_USE_NEW_SUPPLIERMOD conf option — this mirrors the exact conditional + // the original (now-deleted) per-object supplier order extrafields admin wrapper + // files used to pick which lib file to require and which head function + // to call. Both functions build a $head array containing the same 'supplierorder' + // / 'supplierorderdet' tab id, so only headfunction/headfile need to vary. + 'commande_fournisseur' => array( + 'headfunction' => getDolGlobalString('MAIN_USE_NEW_SUPPLIERMOD') ? 'supplier_order_admin_prepare_head' : 'supplierorder_admin_prepare_head', + 'headfile' => getDolGlobalString('MAIN_USE_NEW_SUPPLIERMOD') ? 'core/lib/supplier_order.lib.php' : 'core/lib/fourn.lib.php', + 'tabid' => 'supplierorder', + 'headlabel' => 'Suppliers', + 'textobject' => 'SuppliersOrders', + 'headpicto' => 'company', + 'title' => 'SuppliersSetup', + 'helpurl' => '', + 'langs' => array('admin', 'other', 'orders'), + ), + 'commande_fournisseurdet' => array( + 'headfunction' => getDolGlobalString('MAIN_USE_NEW_SUPPLIERMOD') ? 'supplier_order_admin_prepare_head' : 'supplierorder_admin_prepare_head', + 'headfile' => getDolGlobalString('MAIN_USE_NEW_SUPPLIERMOD') ? 'core/lib/supplier_order.lib.php' : 'core/lib/fourn.lib.php', + 'tabid' => 'supplierorderdet', + 'headlabel' => 'Suppliers', + 'textobject' => 'SuppliersOrders', + 'headpicto' => 'company', + 'title' => 'SuppliersSetup', + 'helpurl' => '', + 'langs' => array('admin', 'other', 'orders'), + ), ); } diff --git a/htdocs/core/lib/fourn.lib.php b/htdocs/core/lib/fourn.lib.php index a85b4490566..a5aaea42b32 100644 --- a/htdocs/core/lib/fourn.lib.php +++ b/htdocs/core/lib/fourn.lib.php @@ -342,7 +342,7 @@ function supplierorder_admin_prepare_head() complete_head_from_modules($conf, $langs, null, $head, $h, 'supplierorder_admin'); - $head[$h][0] = dolBuildUrl(DOL_URL_ROOT.'/supplier_order/admin/supplierorder_extrafields.php'); + $head[$h][0] = dolBuildUrl(DOL_URL_ROOT.'/admin/extrafields.php', array('elementtype' => 'commande_fournisseur')); $head[$h][1] = $langs->trans("ExtraFieldsSupplierOrders"); $nbExtrafields = $extrafields->attributes['commande_fournisseur']['count']; if ($nbExtrafields > 0) { @@ -351,7 +351,7 @@ function supplierorder_admin_prepare_head() $head[$h][2] = 'supplierorder'; $h++; - $head[$h][0] = dolBuildUrl(DOL_URL_ROOT.'/supplier_order/admin/supplierorderdet_extrafields.php'); + $head[$h][0] = dolBuildUrl(DOL_URL_ROOT.'/admin/extrafields.php', array('elementtype' => 'commande_fournisseurdet')); $head[$h][1] = $langs->trans("ExtraFieldsSupplierOrdersLines"); $nbExtrafields = $extrafields->attributes['commande_fournisseurdet']['count']; if ($nbExtrafields > 0) { diff --git a/htdocs/core/lib/order.lib.php b/htdocs/core/lib/order.lib.php index 1008f62f47b..3a9b0b51944 100644 --- a/htdocs/core/lib/order.lib.php +++ b/htdocs/core/lib/order.lib.php @@ -195,7 +195,7 @@ function order_admin_prepare_head() complete_head_from_modules($conf, $langs, null, $head, $h, 'order_admin'); - $head[$h][0] = dolBuildUrl(DOL_URL_ROOT . '/admin/order_extrafields.php'); + $head[$h][0] = dolBuildUrl(DOL_URL_ROOT.'/admin/extrafields.php', array('elementtype' => 'commande')); $head[$h][1] = $langs->trans("ExtraFields"); $nbExtrafields = $extrafields->attributes['commande']['count']; if ($nbExtrafields > 0) { @@ -204,7 +204,7 @@ function order_admin_prepare_head() $head[$h][2] = 'attributes'; $h++; - $head[$h][0] = dolBuildUrl(DOL_URL_ROOT . '/admin/orderdet_extrafields.php'); + $head[$h][0] = dolBuildUrl(DOL_URL_ROOT.'/admin/extrafields.php', array('elementtype' => 'commandedet')); $head[$h][1] = $langs->trans("ExtraFieldsLines"); $nbExtrafields = $extrafields->attributes['commandedet']['count']; if ($nbExtrafields > 0) { diff --git a/htdocs/core/lib/supplier_order.lib.php b/htdocs/core/lib/supplier_order.lib.php index 384c099bd37..f2c52739218 100644 --- a/htdocs/core/lib/supplier_order.lib.php +++ b/htdocs/core/lib/supplier_order.lib.php @@ -192,7 +192,7 @@ function supplier_order_admin_prepare_head() complete_head_from_modules($conf, $langs, null, $head, $h, 'supplierorder_admin'); - $head[$h][0] = dolBuildUrl(DOL_URL_ROOT.'/supplier_order/admin/supplierorder_extrafields.php'); + $head[$h][0] = dolBuildUrl(DOL_URL_ROOT.'/admin/extrafields.php', array('elementtype' => 'commande_fournisseur')); $head[$h][1] = $langs->trans("ExtraFieldsSupplierOrders"); $nbExtrafields = $extrafields->attributes['commande_fournisseur']['count']; if ($nbExtrafields > 0) { @@ -201,7 +201,7 @@ function supplier_order_admin_prepare_head() $head[$h][2] = 'supplierorder'; $h++; - $head[$h][0] = dolBuildUrl(DOL_URL_ROOT.'/supplier_order/admin/supplierorderdet_extrafields.php'); + $head[$h][0] = dolBuildUrl(DOL_URL_ROOT.'/admin/extrafields.php', array('elementtype' => 'commande_fournisseurdet')); $head[$h][1] = $langs->trans("ExtraFieldsSupplierOrdersLines"); $nbExtrafields = $extrafields->attributes['commande_fournisseurdet']['count']; if ($nbExtrafields > 0) { diff --git a/htdocs/supplier_order/admin/supplierorder_extrafields.php b/htdocs/supplier_order/admin/supplierorder_extrafields.php deleted file mode 100644 index c541c3f730a..00000000000 --- a/htdocs/supplier_order/admin/supplierorder_extrafields.php +++ /dev/null @@ -1,120 +0,0 @@ - - * Copyright (C) 2003 Jean-Louis Bergamo - * Copyright (C) 2004-2013 Laurent Destailleur - * Copyright (C) 2012 Regis Houssin - * Copyright (C) 2012 Florian Henry - * Copyright (C) 2013 Philippe Grand - * Copyright (C) 2024-2025 Frédéric France - * Copyright (C) 2026 Alexandre Spangaro - * - * 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 htdocs/supplier_order/admin/supplierorder_extrafields.php - * \ingroup fourn - * \brief Page to setup extra fields of supplierorder - */ - -// Load Dolibarr environment -require '../../main.inc.php'; - -/** - * @var Conf $conf - * @var DoliDB $db - * @var HookManager $hookmanager - * @var Translate $langs - * @var User $user - */ - -if (getDolGlobalString('MAIN_USE_NEW_SUPPLIERMOD')) { - require_once DOL_DOCUMENT_ROOT . '/core/lib/supplier_order.lib.php'; -} else { - require_once DOL_DOCUMENT_ROOT . '/core/lib/fourn.lib.php'; -} -require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; - -if (!$user->admin) { - accessforbidden(); -} - - // Load translation files required by the page -$langs->loadLangs(array('admin', 'other', 'orders')); - -$extrafields = new ExtraFields($db); -$form = new Form($db); - -// List of supported format -$type2label = ExtraFields::getListOfTypesLabels(); - -$action = GETPOST('action', 'aZ09'); -$attrname = GETPOST('attrname', 'alpha'); -$elementtype = 'commande_fournisseur'; //Must be the $table_element of the class that manage extrafield - - - -/* - * Actions - */ - -require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php'; - - - -/* - * View - */ - -$textobject = $langs->transnoentitiesnoconv("SuppliersOrders"); - -llxHeader('', $langs->trans("SuppliersSetup"), '', '', 0, 0, '', '', '', 'mod-admin page-supplierorder_extrafields'); - -$linkback = ''.img_picto($langs->trans("BackToModuleList"), 'back', 'class="pictofixedwidth"').''.$langs->trans("BackToModuleList").''; - -print load_fiche_titre($langs->trans("SuppliersSetup"), $linkback, 'title_setup'); -print "
\n"; - -if (getDolGlobalString('MAIN_USE_NEW_SUPPLIERMOD')) { - $head = supplier_order_admin_prepare_head(); -} else { - $head = supplierorder_admin_prepare_head(); -} - -print dol_get_fiche_head($head, 'supplierorder', $langs->trans("Suppliers"), -1, 'company'); - -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/supplier_order/admin/supplierorderdet_extrafields.php b/htdocs/supplier_order/admin/supplierorderdet_extrafields.php deleted file mode 100644 index fa4112ffec3..00000000000 --- a/htdocs/supplier_order/admin/supplierorderdet_extrafields.php +++ /dev/null @@ -1,120 +0,0 @@ - - * Copyright (C) 2003 Jean-Louis Bergamo - * Copyright (C) 2004-2013 Laurent Destailleur - * Copyright (C) 2012 Regis Houssin - * Copyright (C) 2012 Florian Henry - * Copyright (C) 2013 Philippe Grand - * Copyright (C) 2015 Claudio Aschieri - * Copyright (C) 2024-2025 Frédéric France - * Copyright (C) 2026 Alexandre Spangaro - * - * 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 htdocs/supplier_order/admin/supplierorder_extrafields.php - * \ingroup fourn - * \brief Page to setup extra fields of supplierorder line - */ - -// Load Dolibarr environment -require '../../main.inc.php'; - -/** - * @var Conf $conf - * @var DoliDB $db - * @var HookManager $hookmanager - * @var Translate $langs - * @var User $user - */ - -if (getDolGlobalString('MAIN_USE_NEW_SUPPLIERMOD')) { - require_once DOL_DOCUMENT_ROOT . '/core/lib/supplier_order.lib.php'; -} else { - require_once DOL_DOCUMENT_ROOT . '/core/lib/fourn.lib.php'; -} -require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; - -if (!$user->admin) { - accessforbidden(); -} - -// Load translation files required by the page -$langs->loadLangs(array('admin', 'other', 'orders')); - -$extrafields = new ExtraFields($db); -$form = new Form($db); - -// List of supported format -$type2label = ExtraFields::getListOfTypesLabels(); - -$action = GETPOST('action', 'aZ09'); -$attrname = GETPOST('attrname', 'alpha'); -$elementtype = 'commande_fournisseurdet'; //Must be the $table_element of the class that manage extrafield - - -/* - * Actions - */ - -require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php'; - - - -/* - * View - */ - -$textobject = $langs->transnoentitiesnoconv("SuppliersOrders"); - -llxHeader('', $langs->trans("SuppliersSetup"), '', '', 0, 0, '', '', '', 'mod-admin page-supplierorderdet_extrafields'); - -$linkback = ''.img_picto($langs->trans("BackToModuleList"), 'back', 'class="pictofixedwidth"').''.$langs->trans("BackToModuleList").''; - -print load_fiche_titre($langs->trans("SuppliersSetup"), $linkback, 'title_setup'); -print "
\n"; - -if (getDolGlobalString('MAIN_USE_NEW_SUPPLIERMOD')) { - $head = supplier_order_admin_prepare_head(); -} else { - $head = supplierorder_admin_prepare_head(); -} - -print dol_get_fiche_head($head, 'supplierorderdet', $langs->trans("Suppliers"), -1, 'company'); - -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();