dolibarr  17.0.4
expedition.lib.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2006-2012 Laurent Destailleur <eldy@users.sourceforge.net>
3  * Copyright (C) 2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
4  * Copyright (C) 2010-2012 Regis Houssin <regis.houssin@inodbox.com>
5  * Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
6  * Copyright (C) 2015 Claudio Aschieri <c.aschieri@19.coop>
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <https://www.gnu.org/licenses/>.
20  * or see https://www.gnu.org/
21  */
22 
36 {
37  global $langs, $conf, $user;
38  if (isModEnabled("expedition")) {
39  $langs->load("sendings");
40  }
41  $langs->load("orders");
42 
43  $h = 0;
44  $head = array();
45  $h = 0;
46 
47  $head[$h][0] = DOL_URL_ROOT."/admin/confexped.php";
48  $head[$h][1] = $langs->trans("Setup");
49  $h++;
50 
51  $head[$h][0] = DOL_URL_ROOT."/admin/expedition.php";
52  $head[$h][1] = $langs->trans("Shipment");
53  $hselected = $h;
54  $h++;
55 
56  if (!empty($conf->global->MAIN_SUBMODULE_DELIVERY)) {
57  $head[$h][0] = DOL_URL_ROOT."/admin/delivery.php";
58  $head[$h][1] = $langs->trans("Receivings");
59  $h++;
60  }
61 
62  complete_head_from_modules($conf, $langs, $object, $head, $h, 'order');
63 
64  complete_head_from_modules($conf, $langs, $object, $head, $h, 'order', 'remove');
65 
66  return $head;
67 }
68 
75 {
76  global $langs, $conf, $user, $db;
77  $langs->load("sendings");
78 
79  $extrafields = new ExtraFields($db);
80 
81  $h = 0;
82  $head = array();
83 
84  /*
85  $head[$h][0] = DOL_URL_ROOT."/admin/confexped.php";
86  $head[$h][1] = $langs->trans("Setup");
87  $head[$h][2] = 'general';
88  $h++;
89  */
90 
91  if (!empty($conf->global->MAIN_SUBMODULE_EXPEDITION)) {
92  $extrafields->fetch_name_optionals_label('expedition');
93  $extrafields->fetch_name_optionals_label('expeditiondet');
94 
95  $head[$h][0] = DOL_URL_ROOT."/admin/expedition.php";
96  $head[$h][1] = $langs->trans("Shipment");
97  $head[$h][2] = 'shipment';
98  $h++;
99 
100  $head[$h][0] = DOL_URL_ROOT.'/admin/expedition_extrafields.php';
101  $head[$h][1] = $langs->trans("ExtraFields");
102  $nbExtrafields = $extrafields->attributes['expedition']['count'];
103  if ($nbExtrafields > 0) {
104  $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
105  }
106  $head[$h][2] = 'attributes_shipment';
107  $h++;
108 
109  $head[$h][0] = DOL_URL_ROOT.'/admin/expeditiondet_extrafields.php';
110  $head[$h][1] = $langs->trans("ExtraFieldsLines");
111  $nbExtrafields = $extrafields->attributes['expeditiondet']['count'];
112  if ($nbExtrafields > 0) {
113  $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
114  }
115  $head[$h][2] = 'attributeslines_shipment';
116  $h++;
117  }
118 
119  $head[$h][0] = DOL_URL_ROOT."/admin/delivery.php";
120  $head[$h][1] = $langs->trans("Receivings");
121  $head[$h][2] = 'receivings';
122  $h++;
123 
124  if (!empty($conf->global->MAIN_SUBMODULE_DELIVERY)) {
125  $extrafields->fetch_name_optionals_label('delivery');
126  $extrafields->fetch_name_optionals_label('deliverydet');
127 
128  $head[$h][0] = DOL_URL_ROOT.'/admin/delivery_extrafields.php';
129  $head[$h][1] = $langs->trans("ExtraFields");
130  $nbExtrafields = $extrafields->attributes['delivery']['count'];
131  if ($nbExtrafields > 0) {
132  $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
133  }
134  $head[$h][2] = 'attributes_receivings';
135  $h++;
136 
137  $head[$h][0] = DOL_URL_ROOT.'/admin/deliverydet_extrafields.php';
138  $head[$h][1] = $langs->trans("ExtraFieldsLines");
139  $nbExtrafields = $extrafields->attributes['deliverydet']['count'];
140  if ($nbExtrafields > 0) {
141  $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
142  }
143  $head[$h][2] = 'attributeslines_receivings';
144  $h++;
145  }
146 
147  complete_head_from_modules($conf, $langs, null, $head, $h, 'expedition_admin');
148 
149  complete_head_from_modules($conf, $langs, null, $head, $h, 'expedition_admin', 'remove');
150 
151  return $head;
152 }
Class to manage shipments.
Class to manage standard extra fields.
expedition_prepare_head(Expedition $object)
Prepare array with list of tabs.
expedition_admin_prepare_head()
Return array head with list of tabs to view object informations.
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).
isModEnabled($module)
Is Dolibarr module enabled.