dolibarr 24.0.0-beta
product_attribute_extrafields.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3 * Copyright (C) 2024-2026 Frédéric France <frederic.france@free.fr>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <https://www.gnu.org/licenses/>.
17 */
18
25// Load Dolibarr environment
26require '../../main.inc.php';
35require_once DOL_DOCUMENT_ROOT.'/variants/lib/variants.lib.php';
36require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
37
38if (!$user->admin) {
40}
41
42// Load translation files required by the page
43$langs->loadLangs(array('admin', 'other', 'product'));
44
45$form = new Form($db);
46
47// List of supported format
48$tmptype2label = ExtraFields::$type2label;
49$type2label = array('');
50foreach ($tmptype2label as $key => $val) {
51 $type2label[$key] = $langs->transnoentitiesnoconv($val);
52}
53
54$action = GETPOST('action', 'aZ09');
55$attrname = GETPOST('attrname', 'alpha');
56$elementtype = 'product_attribute'; //Must be the $table_element of the class that manage extrafield
57
58
59/*
60 * Actions
61 */
62
63require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';
64
65
66
67/*
68 * View
69 */
70
71$title = $langs->trans("ProductAttributeExtrafieldsSetup");
72llxHeader('', $title);
73
74$linkback = '<a href="'.dolBuildUrl(DOL_URL_ROOT.'/admin/modules.php', ['restore_lastsearch_values' => 1]).'">'.img_picto($langs->trans("BackToModuleList"), 'back', 'class="pictofixedwidth"').'<span class="hideonsmartphone">'.$langs->trans("BackToModuleList").'</span></a>';
75print load_fiche_titre($title, $linkback, 'title_setup');
76
78
79print dol_get_fiche_head($head, 'product_attribute', $title, -1, 'product');
80
81require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';
82
83print dol_get_fiche_end();
84
85
86// Creation of an optional field
87if ($action == 'create') {
88 print '<br><div id="newattrib"></div>';
89 print load_fiche_titre($langs->trans('NewAttribute'));
90
91 require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
92}
93
94// Edition of an optional field
95if ($action == 'edit' && !empty($attrname)) {
96 print "<br>";
97 print load_fiche_titre($langs->trans("FieldEdition", $attrname));
98
99 require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php';
100}
101
102// End of page
103llxFooter();
104$db->close();
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
Definition wrapper.php:91
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Definition wrapper.php:73
Class to manage generation of HTML components Only common components must be here.
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $db
API class for accounts.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.
adminProductAttributePrepareHead()
Prepare array with list of tabs.