dolibarr 21.0.0-beta
variants.lib.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2022 Open-Dsi <support@open-dsi.fr>
3 * Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
4 * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
34{
35 global $langs, $conf;
36 $langs->load("products");
37
38 $h = 0;
39 $head = array();
40
41 $head[$h][0] = DOL_URL_ROOT.'/variants/card.php?id='.$object->id;
42 $head[$h][1] = $langs->trans("ProductAttribute");
43 $head[$h][2] = 'card';
44 $h++;
45
46 // Show more tabs from modules
47 // Entries must be declared in modules descriptor with line
48 // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
49 // $this->tabs = array('entity:-tabname); to remove a tab
50 complete_head_from_modules($conf, $langs, $object, $head, $h, 'product_attribute');
51
52 complete_head_from_modules($conf, $langs, $object, $head, $h, 'product_attribute', 'remove');
53
54 return $head;
55}
56
63{
64 global $langs, $conf, $db;
65
66 $extrafields = new ExtraFields($db);
67 $extrafields->fetch_name_optionals_label('product_attribute');
68 $extrafields->fetch_name_optionals_label('product_attribute_value');
69
70 $langs->load("products");
71
72 $h = 0;
73 $head = array();
74
75 $head[$h][0] = DOL_URL_ROOT.'/variants/admin/admin.php';
76 $head[$h][1] = $langs->trans("ProductAttribute");
77 $head[$h][2] = 'admin';
78 $h++;
79
80 $head[$h][0] = DOL_URL_ROOT.'/variants/admin/product_attribute_extrafields.php';
81 $head[$h][1] = $langs->trans("ProductAttributeExtrafields");
82 $nbExtrafields = $extrafields->attributes['product_attribute']['count'];
83 if ($nbExtrafields > 0) {
84 $head[$h][1] .= '<span class="badge marginleftonlyshort">' . $nbExtrafields . '</span>';
85 }
86 $head[$h][2] = 'product_attribute';
87 $h++;
88
89 $head[$h][0] = DOL_URL_ROOT.'/variants/admin/product_attribute_value_extrafields.php';
90 $head[$h][1] = $langs->trans("ProductAttributeValueExtrafields");
91 $nbExtrafields = $extrafields->attributes['product_attribute_value']['count'];
92 if ($nbExtrafields > 0) {
93 $head[$h][1] .= '<span class="badge marginleftonlyshort">' . $nbExtrafields . '</span>';
94 }
95 $head[$h][2] = 'product_attribute_value';
96 $h++;
97
98 // Show more tabs from modules
99 // Entries must be declared in modules descriptor with line
100 // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
101 // $this->tabs = array('entity:-tabname); to remove a tab
102 complete_head_from_modules($conf, $langs, null, $head, $h, 'admin_product_attribute');
103
104 complete_head_from_modules($conf, $langs, null, $head, $h, 'admin_product_attribute', 'remove');
105
106 return $head;
107}
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition card.php:66
Class to manage standard extra fields.
complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type, $mode='add', $filterorigmodule='')
Complete or removed entries into a head array (used to build tabs).
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
Definition member.php:79
adminProductAttributePrepareHead()
Prepare array with list of tabs.
productAttributePrepareHead($object)
Prepare array with list of tabs.