dolibarr 23.0.3
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-2025 MDW <mdeweerd@users.noreply.github.com>
8 * Copyright (C) 2025 Frédéric France <frederic.france@free.fr>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program. If not, see <https://www.gnu.org/licenses/>.
22 * or see https://www.gnu.org/
23 */
24
38{
39 global $langs, $conf, $user;
40 if (isModEnabled("shipping")) {
41 $langs->load("sendings");
42 }
43 $langs->load("orders");
44
45 $h = 0;
46 $head = array();
47
48 $head[$h][0] = dolBuildUrl(DOL_URL_ROOT."/admin/confexped.php");
49 $head[$h][1] = $langs->trans("Setup");
50 $head[$h][2] = '';
51 $h++;
52
53 $head[$h][0] = dolBuildUrl(DOL_URL_ROOT."/admin/expedition.php");
54 $head[$h][1] = $langs->trans("Shipment");
55 $head[$h][2] = '';
56 $hselected = $h;
57 $h++;
58
59 if (getDolGlobalInt('MAIN_SUBMODULE_DELIVERY')) {
60 $head[$h][0] = dolBuildUrl(DOL_URL_ROOT."/admin/delivery.php");
61 $head[$h][1] = $langs->trans("Receivings");
62 $head[$h][2] = '';
63 $h++;
64 }
65
66 complete_head_from_modules($conf, $langs, $object, $head, $h, 'order');
67
68 complete_head_from_modules($conf, $langs, $object, $head, $h, 'order', 'remove');
69
70 return $head;
71}
72
79{
80 global $langs, $conf, $user, $db;
81 $langs->load("sendings");
82
83 $extrafields = new ExtraFields($db);
84
85 $h = 0;
86 $head = array();
87
88 /*
89 $head[$h][0] = DOL_URL_ROOT."/admin/confexped.php";
90 $head[$h][1] = $langs->trans("Setup");
91 $head[$h][2] = 'general';
92 $h++;
93 */
94
95 if (getDolGlobalString('MAIN_SUBMODULE_EXPEDITION')) {
96 $extrafields->fetch_name_optionals_label('expedition');
97 $extrafields->fetch_name_optionals_label('expeditiondet');
98
99 $head[$h][0] = dolBuildUrl(DOL_URL_ROOT."/admin/expedition.php");
100 $head[$h][1] = $langs->trans("Shipment");
101 $head[$h][2] = 'shipment';
102 $h++;
103
104 $head[$h][0] = dolBuildUrl(DOL_URL_ROOT.'/admin/expedition_extrafields.php');
105 $head[$h][1] = $langs->trans("ExtraFields");
106 $nbExtrafields = $extrafields->attributes['expedition']['count'];
107 if ($nbExtrafields > 0) {
108 $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
109 }
110 $head[$h][2] = 'attributes_shipment';
111 $h++;
112
113 $head[$h][0] = dolBuildUrl(DOL_URL_ROOT.'/admin/expeditiondet_extrafields.php');
114 $head[$h][1] = $langs->trans("ExtraFieldsLines");
115 $nbExtrafields = $extrafields->attributes['expeditiondet']['count'];
116 if ($nbExtrafields > 0) {
117 $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
118 }
119 $head[$h][2] = 'attributeslines_shipment';
120 $h++;
121 }
122
123 $head[$h][0] = dolBuildUrl(DOL_URL_ROOT."/admin/delivery.php");
124 $head[$h][1] = $langs->trans("Receivings");
125 $head[$h][2] = 'receivings';
126 $h++;
127
128 if (getDolGlobalInt('MAIN_SUBMODULE_DELIVERY')) {
129 $extrafields->fetch_name_optionals_label('delivery');
130 $extrafields->fetch_name_optionals_label('deliverydet');
131
132 $head[$h][0] = dolBuildUrl(DOL_URL_ROOT.'/admin/delivery_extrafields.php');
133 $head[$h][1] = $langs->trans("ExtraFields");
134 $nbExtrafields = $extrafields->attributes['delivery']['count'];
135 if ($nbExtrafields > 0) {
136 $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
137 }
138 $head[$h][2] = 'attributes_receivings';
139 $h++;
140
141 $head[$h][0] = dolBuildUrl(DOL_URL_ROOT.'/admin/deliverydet_extrafields.php');
142 $head[$h][1] = $langs->trans("ExtraFieldsLines");
143 $nbExtrafields = $extrafields->attributes['deliverydet']['count'];
144 if ($nbExtrafields > 0) {
145 $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
146 }
147 $head[$h][2] = 'attributeslines_receivings';
148 $h++;
149 }
150
151 complete_head_from_modules($conf, $langs, null, $head, $h, 'expedition_admin');
152
153 complete_head_from_modules($conf, $langs, null, $head, $h, 'expedition_admin', 'remove');
154
155 return $head;
156}
if(! $sortfield) if(! $sortorder) $object
Definition account.php:100
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.
dolBuildUrl($url, $params=[], $addtoken=false)
Return path of url.
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 a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.