dolibarr  16.0.5
stock.lib.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2009 Laurent Destailleur <eldy@users.sourceforge.net>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  * or see https://www.gnu.org/
17  */
18 
30 function stock_prepare_head($object)
31 {
32  global $langs, $conf, $user;
33 
34  $h = 0;
35  $head = array();
36 
37  $head[$h][0] = DOL_URL_ROOT.'/product/stock/card.php?id='.$object->id;
38  $head[$h][1] = $langs->trans("Warehouse");
39  $head[$h][2] = 'card';
40  $h++;
41 
42  if (!empty($user->rights->stock->mouvement->lire)) {
43  $head[$h][0] = DOL_URL_ROOT.'/product/stock/movement_list.php?id='.$object->id;
44  $head[$h][1] = $langs->trans("StockMovements");
45  $head[$h][2] = 'movements';
46  $h++;
47  }
48 
49  /*
50  $head[$h][0] = DOL_URL_ROOT.'/product/stock/fiche-valo.php?id='.$object->id;
51  $head[$h][1] = $langs->trans("EnhancedValue");
52  $head[$h][2] = 'value';
53  $h++;
54  */
55 
56  /* Disabled because will never be implemented. Table always empty.
57  if (! empty($conf->global->STOCK_USE_WAREHOUSE_BY_USER))
58  {
59  // Should not be enabled by defaut because does not work yet correctly because
60  // personnal stocks are not tagged into table llx_entrepot
61  $head[$h][0] = DOL_URL_ROOT.'/product/stock/user.php?id='.$object->id;
62  $head[$h][1] = $langs->trans("Users");
63  $head[$h][2] = 'user';
64  $h++;
65  }
66  */
67 
68  // Show more tabs from modules
69  // Entries must be declared in modules descriptor with line
70  // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
71  // $this->tabs = array('entity:-tabname); to remove a tab
72  complete_head_from_modules($conf, $langs, $object, $head, $h, 'stock');
73 
74  $head[$h][0] = DOL_URL_ROOT.'/product/stock/info.php?id='.$object->id;
75  $head[$h][1] = $langs->trans("Info");
76  $head[$h][2] = 'info';
77  $h++;
78 
79  complete_head_from_modules($conf, $langs, $object, $head, $h, 'stock', 'remove');
80 
81  return $head;
82 }
83 
90 {
91  global $langs, $conf, $user;
92 
93  $h = 0;
94  $head = array();
95 
96  $head[$h][0] = DOL_URL_ROOT.'/admin/stock.php';
97  $head[$h][1] = $langs->trans("Miscellaneous");
98  $head[$h][2] = 'general';
99  $h++;
100 
101  // Show more tabs from modules
102  // Entries must be declared in modules descriptor with line
103  // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
104  // $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab
105  complete_head_from_modules($conf, $langs, null, $head, $h, 'stock_admin');
106 
107  $head[$h][0] = DOL_URL_ROOT.'/product/admin/stock_extrafields.php';
108  $head[$h][1] = $langs->trans("ExtraFields");
109  $head[$h][2] = 'attributes';
110  $h++;
111 
112  $head[$h][0] = DOL_URL_ROOT.'/product/admin/stock_mouvement_extrafields.php';
113  $head[$h][1] = $langs->trans("StockMouvementExtraFields");
114  $head[$h][2] = 'stockMouvementAttributes';
115  $h++;
116 
117  $head[$h][0] = DOL_URL_ROOT.'/product/admin/inventory_extrafields.php';
118  $head[$h][1] = $langs->trans("InventoryExtraFields");
119  $head[$h][2] = 'inventoryAttributes';
120  $h++;
121 
122  complete_head_from_modules($conf, $langs, null, $head, $h, 'stock_admin', 'remove');
123 
124  return $head;
125 }
complete_head_from_modules
complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type, $mode='add')
Complete or removed entries into a head array (used to build tabs).
Definition: functions.lib.php:9038
stock_admin_prepare_head
stock_admin_prepare_head()
Return array head with list of tabs to view object informations.
Definition: stock.lib.php:89
stock_prepare_head
stock_prepare_head($object)
Prepare array with list of tabs.
Definition: stock.lib.php:30