dolibarr  13.0.2
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  {
44  $head[$h][0] = DOL_URL_ROOT.'/product/stock/movement_list.php?id='.$object->id;
45  $head[$h][1] = $langs->trans("StockMovements");
46  $head[$h][2] = 'movements';
47  $h++;
48  }
49 
50  /*
51  $head[$h][0] = DOL_URL_ROOT.'/product/stock/fiche-valo.php?id='.$object->id;
52  $head[$h][1] = $langs->trans("EnhancedValue");
53  $head[$h][2] = 'value';
54  $h++;
55  */
56 
57  /* Disabled because will never be implemented. Table always empty.
58  if (! empty($conf->global->STOCK_USE_WAREHOUSE_BY_USER))
59  {
60  // Should not be enabled by defaut because does not work yet correctly because
61  // personnal stocks are not tagged into table llx_entrepot
62  $head[$h][0] = DOL_URL_ROOT.'/product/stock/user.php?id='.$object->id;
63  $head[$h][1] = $langs->trans("Users");
64  $head[$h][2] = 'user';
65  $h++;
66  }
67  */
68 
69  // Show more tabs from modules
70  // Entries must be declared in modules descriptor with line
71  // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
72  // $this->tabs = array('entity:-tabname); to remove a tab
73  complete_head_from_modules($conf, $langs, $object, $head, $h, 'stock');
74 
75  $head[$h][0] = DOL_URL_ROOT.'/product/stock/info.php?id='.$object->id;
76  $head[$h][1] = $langs->trans("Info");
77  $head[$h][2] = 'info';
78  $h++;
79 
80  complete_head_from_modules($conf, $langs, $object, $head, $h, 'stock', 'remove');
81 
82  return $head;
83 }
84 
91 {
92  global $langs, $conf, $user;
93 
94  $h = 0;
95  $head = array();
96 
97  $head[$h][0] = DOL_URL_ROOT.'/admin/stock.php';
98  $head[$h][1] = $langs->trans("Miscellaneous");
99  $head[$h][2] = 'general';
100  $h++;
101 
102  // Show more tabs from modules
103  // Entries must be declared in modules descriptor with line
104  // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
105  // $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab
106  complete_head_from_modules($conf, $langs, null, $head, $h, 'stock_admin');
107 
108  $head[$h][0] = DOL_URL_ROOT.'/product/admin/stock_extrafields.php';
109  $head[$h][1] = $langs->trans("ExtraFields");
110  $head[$h][2] = 'attributes';
111  $h++;
112 
113  complete_head_from_modules($conf, $langs, null, $head, $h, 'stock_admin', 'remove');
114 
115  return $head;
116 }
stock_admin_prepare_head()
Return array head with list of tabs to view object informations.
Definition: stock.lib.php:90
stock_prepare_head($object)
Prepare array with list of tabs.
Definition: stock.lib.php:30
complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type, $mode= 'add')
Complete or removed entries into a head array (used to build tabs).