dolibarr  20.0.0-beta
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  * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 3 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program. If not, see <https://www.gnu.org/licenses/>.
21  * or see https://www.gnu.org/
22  */
23 
37 {
38  global $langs, $conf, $user;
39  if (isModEnabled("shipping")) {
40  $langs->load("sendings");
41  }
42  $langs->load("orders");
43 
44  $h = 0;
45  $head = array();
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 (getDolGlobalInt('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 (getDolGlobalString('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 (getDolGlobalInt('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 }
if($user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition: card.php:58
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 information.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
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).
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.