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)) $langs->load("sendings");
39	$langs->load("orders");
40
41	$h = 0;
42	$head = array();
43	$h = 0;
44
45	$head[$h][0] = DOL_URL_ROOT."/admin/confexped.php";
46	$head[$h][1] = $langs->trans("Setup");
47	$h++;
48
49	$head[$h][0] = DOL_URL_ROOT."/admin/expedition.php";
50	$head[$h][1] = $langs->trans("Shipment");
51	$hselected = $h;
52	$h++;
53
54	if (!empty($conf->global->MAIN_SUBMODULE_DELIVERY))
55	{
56		$head[$h][0] = DOL_URL_ROOT."/admin/delivery.php";
57		$head[$h][1] = $langs->trans("Receivings");
58		$h++;
59	}
60
61	complete_head_from_modules($conf, $langs, $object, $head, $h, 'order');
62
63	complete_head_from_modules($conf, $langs, $object, $head, $h, 'order', 'remove');
64
65	return $head;
66}
67
68/**
69 *  Return array head with list of tabs to view object informations.
70 *
71 *  @return	array   	    		    head array with tabs
72 */
73function expedition_admin_prepare_head()
74{
75	global $langs, $conf, $user;
76	$langs->load("sendings");
77
78	$h = 0;
79	$head = array();
80
81	$head[$h][0] = DOL_URL_ROOT."/admin/confexped.php";
82	$head[$h][1] = $langs->trans("Setup");
83	$head[$h][2] = 'general';
84	$h++;
85
86
87	if (!empty($conf->global->MAIN_SUBMODULE_EXPEDITION))
88	{
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	{
98		$head[$h][0] = DOL_URL_ROOT.'/admin/expedition_extrafields.php';
99		$head[$h][1] = $langs->trans("ExtraFields");
100		$head[$h][2] = 'attributes_shipment';
101		$h++;
102	}
103
104	if (!empty($conf->global->MAIN_SUBMODULE_EXPEDITION))
105	{
106		$head[$h][0] = DOL_URL_ROOT.'/admin/expeditiondet_extrafields.php';
107		$head[$h][1] = $langs->trans("ExtraFieldsLines");
108		$head[$h][2] = 'attributeslines_shipment';
109		$h++;
110	}
111
112	if (!empty($conf->global->MAIN_SUBMODULE_DELIVERY))
113	{
114		$head[$h][0] = DOL_URL_ROOT."/admin/delivery.php";
115		$head[$h][1] = $langs->trans("Receivings");
116		$head[$h][2] = 'receivings';
117		$h++;
118	}
119
120	if (!empty($conf->global->MAIN_SUBMODULE_DELIVERY))
121	{
122		$head[$h][0] = DOL_URL_ROOT.'/admin/delivery_extrafields.php';
123		$head[$h][1] = $langs->trans("ExtraFields");
124		$head[$h][2] = 'attributes_receivings';
125		$h++;
126	}
127
128	if (!empty($conf->global->MAIN_SUBMODULE_DELIVERY))
129	{
130		$head[$h][0] = DOL_URL_ROOT.'/admin/deliverydet_extrafields.php';
131		$head[$h][1] = $langs->trans("ExtraFieldsLines");
132		$head[$h][2] = 'attributeslines_receivings';
133		$h++;
134	}
135
136	complete_head_from_modules($conf, $langs, null, $head, $h, 'expedition_admin');
137
138	complete_head_from_modules($conf, $langs, null, $head, $h, 'expedition_admin', 'remove');
139
140	return $head;
141}
142