dolibarr  13.0.2
reception.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@capnetworks.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 $db, $langs, $conf, $user;
38 
39  $langs->load("sendings");
40  $langs->load("deliveries");
41 
42  $h = 0;
43  $head = array();
44 
45  $head[$h][0] = DOL_URL_ROOT."/reception/card.php?id=".$object->id;
46  $head[$h][1] = $langs->trans("ReceptionCard");
47  $head[$h][2] = 'reception';
48  $h++;
49 
50  if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
51  {
52  $objectsrc = $object;
53  if ($object->origin == 'commande' && $object->origin_id > 0)
54  {
55  $objectsrc = new Commande($db);
56  $objectsrc->fetch($object->origin_id);
57  }
58  $nbContact = count($objectsrc->liste_contact(-1, 'internal')) + count($objectsrc->liste_contact(-1, 'external'));
59  $head[$h][0] = DOL_URL_ROOT."/reception/contact.php?id=".$object->id;
60  $head[$h][1] = $langs->trans("ContactsAddresses");
61  if ($nbContact > 0) $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbContact.'</span>';
62  $head[$h][2] = 'contact';
63  $h++;
64  }
65 
66  // Show more tabs from modules
67  // Entries must be declared in modules descriptor with line
68  // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
69  // $this->tabs = array('entity:-tabname); to remove a tab
70  complete_head_from_modules($conf, $langs, $object, $head, $h, 'reception');
71 
72  $nbNote = 0;
73  if (!empty($object->note_private)) $nbNote++;
74  if (!empty($object->note_public)) $nbNote++;
75  $head[$h][0] = DOL_URL_ROOT."/reception/note.php?id=".$object->id;
76  $head[$h][1] = $langs->trans("Notes");
77  if ($nbNote > 0) $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbNote.'</span>';
78  $head[$h][2] = 'note';
79  $h++;
80 
81  complete_head_from_modules($conf, $langs, $object, $head, $h, 'reception', 'remove');
82 
83  return $head;
84 }
85 
92 {
93  global $langs, $conf, $user;
94  $langs->load("receptions");
95 
96  $h = 0;
97  $head = array();
98 
99  $head[$h][0] = DOL_URL_ROOT."/admin/reception_setup.php";
100  $head[$h][1] = $langs->trans("Reception");
101  $head[$h][2] = 'reception';
102  $h++;
103 
104  complete_head_from_modules($conf, $langs, null, $head, $h, 'reception_admin');
105 
106  if (!empty($conf->global->MAIN_SUBMODULE_RECEPTION))
107  {
108  $head[$h][0] = DOL_URL_ROOT.'/admin/reception_extrafields.php';
109  $head[$h][1] = $langs->trans("ExtraFields");
110  $head[$h][2] = 'attributes_reception';
111  $h++;
112  }
113 
114  if (!empty($conf->global->MAIN_SUBMODULE_RECEPTION))
115  {
116  $head[$h][0] = DOL_URL_ROOT.'/admin/commande_fournisseur_dispatch_extrafields.php';
117  $head[$h][1] = $langs->trans("ExtraFieldsLines");
118  $head[$h][2] = 'attributeslines_reception';
119  $h++;
120  }
121 
122  complete_head_from_modules($conf, $langs, null, $head, $h, 'reception_admin', 'remove');
123 
124  return $head;
125 }
Class to manage receptions.
Class to manage customers orders.
reception_admin_prepare_head()
Return array head with list of tabs to view object informations.
reception_prepare_head(Reception $object)
Prepare array with list of tabs.
complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type, $mode= 'add')
Complete or removed entries into a head array (used to build tabs).