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
23/**
24 *  \file       htdocs/core/lib/expedition.lib.php
25 *  \brief      Function for expedition module
26 *  \ingroup    expedition
27 */
28
29/**
30 * Prepare array with list of tabs
31 *
32 * @param   Expedition	$object		Object related to tabs
33 * @return  array				Array of tabs to show
34 */
35function expedition_prepare_head(Expedition $object)
36{
37	global $langs, $conf, $user;
38	if (!empty($conf->expedition->enabled)) {
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
69/**
70 *  Return array head with list of tabs to view object informations.
71 *
72 *  @return	array   	    		    head array with tabs
73 */
74function expedition_admin_prepare_head()
75{
76	global $langs, $conf, $user;
77	$langs->load("sendings");
78
79	$h = 0;
80	$head = array();
81
82	$head[$h][0] = DOL_URL_ROOT."/admin/confexped.php";
83	$head[$h][1] = $langs->trans("Setup");
84	$head[$h][2] = 'general';
85	$h++;
86
87
88	if (!empty($conf->global->MAIN_SUBMODULE_EXPEDITION)) {
89		$head[$h][0] = DOL_URL_ROOT."/admin/expedition.php";
90		$head[$h][1] = $langs->trans("Shipment");
91		$head[$h][2] = 'shipment';
92		$h++;
93	}
94
95
96	if (!empty($conf->global->MAIN_SUBMODULE_EXPEDITION)) {
97		$head[$h][0] = DOL_URL_ROOT.'/admin/expedition_extrafields.php';
98		$head[$h][1] = $langs->trans("ExtraFields");
99		$head[$h][2] = 'attributes_shipment';
100		$h++;
101	}
102
103	if (!empty($conf->global->MAIN_SUBMODULE_EXPEDITION)) {
104		$head[$h][0] = DOL_URL_ROOT.'/admin/expeditiondet_extrafields.php';
105		$head[$h][1] = $langs->trans("ExtraFieldsLines");
106		$head[$h][2] = 'attributeslines_shipment';
107		$h++;
108	}
109
110	if (!empty($conf->global->MAIN_SUBMODULE_DELIVERY)) {
111		$head[$h][0] = DOL_URL_ROOT."/admin/delivery.php";
112		$head[$h][1] = $langs->trans("Receivings");
113		$head[$h][2] = 'receivings';
114		$h++;
115	}
116
117	if (!empty($conf->global->MAIN_SUBMODULE_DELIVERY)) {
118		$head[$h][0] = DOL_URL_ROOT.'/admin/delivery_extrafields.php';
119		$head[$h][1] = $langs->trans("ExtraFields");
120		$head[$h][2] = 'attributes_receivings';
121		$h++;
122	}
123
124	if (!empty($conf->global->MAIN_SUBMODULE_DELIVERY)) {
125		$head[$h][0] = DOL_URL_ROOT.'/admin/deliverydet_extrafields.php';
126		$head[$h][1] = $langs->trans("ExtraFieldsLines");
127		$head[$h][2] = 'attributeslines_receivings';
128		$h++;
129	}
130
131	complete_head_from_modules($conf, $langs, null, $head, $h, 'expedition_admin');
132
133	complete_head_from_modules($conf, $langs, null, $head, $h, 'expedition_admin', 'remove');
134
135	return $head;
136}
137