dolibarr  16.0.5
eldy.lib.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2010-2022 Laurent Destailleur <eldy@users.sourceforge.net>
3  * Copyright (C) 2010 Regis Houssin <regis.houssin@inodbox.com>
4  * Copyright (C) 2012-2015 Juanjo Menent <jmenent@2byte.es>
5  * Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
6  * Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
7  * Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
8  * Copyright (C) 2018-2022 Frédéric France <frederic.france@netlogic.fr>
9  * Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
10  *
11  * This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 3 of the License, or
14  * (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program. If not, see <https://www.gnu.org/licenses/>.
23  * or see https://www.gnu.org/
24  */
25 
30 require_once DOL_DOCUMENT_ROOT.'/core/class/menubase.class.php';
31 
32 
45 function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = 0, $mode = '')
46 {
47  global $user, $conf, $langs, $mysoc;
48  global $dolibarr_main_db_name;
49 
50  $mainmenu = (empty($_SESSION["mainmenu"]) ? '' : $_SESSION["mainmenu"]);
51  $leftmenu = (empty($_SESSION["leftmenu"]) ? '' : $_SESSION["leftmenu"]);
52 
53  $id = 'mainmenu';
54  $listofmodulesforexternal = explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL);
55 
56  $substitarray = getCommonSubstitutionArray($langs, 0, null, null);
57 
58  if (empty($noout)) {
60  }
61 
62  global $usemenuhider;
63  $usemenuhider = 1;
64 
65  // Show/Hide vertical menu. The hamburger icon for .menuhider action.
66  if ($mode != 'jmobile' && $mode != 'topnb' && $usemenuhider && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
67  $showmode = 1;
68  $classname = 'class="tmenu menuhider nohover"';
69  $idsel = 'menu';
70 
71  $menu->add('#', (getDolGlobalInt('THEME_TOPMENU_DISABLE_IMAGE') == 1 ? '<span class="fa fa-bars"></span>' : ''), 0, $showmode, $atarget, "xxx", '', 0, $id, $idsel, $classname);
72  }
73 
74  $menu_arr = array();
75 
76  // Home
77  $menu_arr[] = array(
78  'name' => 'Home',
79  'link' => '/index.php?mainmenu=home&amp;leftmenu=home',
80  'title' => "Home",
81  'level' => 0,
82  'enabled' => $showmode = 1,
83  'target' => $atarget,
84  'mainmenu' => "home",
85  'leftmenu' => '',
86  'position' => 10,
87  'id' => $id,
88  'idsel' => 'home',
89  'classname' => $classname = (!empty($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "home") ? 'class="tmenusel"' : 'class="tmenu"',
90  'prefix' => '<span class="fa fa-home fa-fw paddingright"></span>',
91  'session' => ((!empty($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "home") ? 0 : 1),
92  'loadLangs' => array(),
93  'submenus' => array(),
94  );
95 
96  // Members
97  $tmpentry = array(
98  'enabled' => (isModEnabled('adherent')),
99  'perms' => (!empty($user->rights->adherent->lire)),
100  'module' => 'adherent'
101  );
102  $menu_arr[] = array(
103  'name' => 'Members',
104  'link' => '/adherents/index.php?mainmenu=members&amp;leftmenu=',
105  'title' => "MenuMembers",
106  'level' => 0,
107  'enabled' => $showmode = isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal),
108  'target' => $atarget,
109  'mainmenu' => "members",
110  'leftmenu' => '',
111  'position' => 18,
112  'id' => $id,
113  'idsel' => 'members',
114  'classname' => $classname = (!empty($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "members") ? 'class="tmenusel"' : 'class="tmenu"',
115  'prefix' => img_picto('', 'member', 'class="fa-fw paddingright pictofixedwidth"'),
116  'session' => ((!empty($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "members") ? 0 : 1),
117  'loadLangs' => array(),
118  'submenus' => array(),
119  );
120 
121  // Third parties
122  $tmpentry = array(
123  'enabled'=> ((isModEnabled('societe') &&
124  (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS))
125  )
126  || ((isModEnabled('fournisseur') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled('supplier_order') || isModEnabled('supplier_invoice'))
127  ),
128  'perms'=> (!empty($user->rights->societe->lire) || !empty($user->rights->fournisseur->lire) || !empty($user->rights->supplier_order->lire) || !empty($user->rights->supplier_invoice->lire) || !empty($user->rights->supplier_proposal->lire)),
129  'module'=>'societe|fournisseur'
130  );
131  $menu_arr[] = array(
132  'name' => 'Companies',
133  'link' => '/societe/index.php?mainmenu=companies&amp;leftmenu=',
134  'title' => "ThirdParties",
135  'level' => 0,
136  'enabled' => $showmode = isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal),
137  'target' => $atarget,
138  'mainmenu' => "companies",
139  'leftmenu' => '',
140  'position' => 20,
141  'id' => $id,
142  'idsel' => 'companies',
143  'classname' => $classname = (!empty($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "companies") ? 'class="tmenusel"' : 'class="tmenu"',
144  'prefix' => img_picto('', 'company', 'class="fa-fw paddingright pictofixedwidth"'),
145  'session' => ((!empty($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "companies") ? 0 : 1),
146  'loadLangs' => array("companies", "suppliers"),
147  'submenus' => array(),
148  );
149 
150  // Products-Services
151  $tmpentry = array(
152  'enabled'=> (isModEnabled('product') || isModEnabled('service') || isModEnabled('expedition')),
153  'perms'=> (!empty($user->rights->produit->lire) || !empty($user->rights->service->lire) || !empty($user->rights->expedition->lire)),
154  'module'=>'product|service'
155  );
156  $menu_arr[] = array(
157  'name' => 'Products',
158  'link' => '/product/index.php?mainmenu=products&amp;leftmenu=',
159  'title' => (isModEnabled('product') && isModEnabled('service'))
160  ? (array("TMenuProducts", " | ", "TMenuServices"))
161  : (isModEnabled('product') ? "TMenuProducts" : "TMenuServices"),
162  'level' => 0,
163  'enabled' => $showmode = isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal),
164  'target' => $atarget,
165  'mainmenu' => "products",
166  'leftmenu' => '',
167  'position' => 30,
168  'id' => $id,
169  'idsel' => 'products',
170  'classname' => $classname = (!empty($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "products") ? 'class="tmenusel"' : 'class="tmenu"',
171  'prefix' => img_picto('', 'product', 'class="fa-fw paddingright pictofixedwidth"'),
172  'session' => ((!empty($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "products") ? 0 : 1),
173  'loadLangs' => array("products"),
174  'submenus' => array(),
175  );
176 
177  // MRP - GPAO
178  $tmpentry = array(
179  'enabled'=>(isModEnabled('bom') || isModEnabled('mrp')),
180  'perms'=>(!empty($user->rights->bom->read) || !empty($user->rights->mrp->read)),
181  'module'=>'bom|mrp'
182  );
183  $menu_arr[] = array(
184  'name' => 'TMenuMRP',
185  'link' => '/mrp/index.php?mainmenu=mrp&amp;leftmenu=',
186  'title' => "TMenuMRP",
187  'level' => 0,
188  'enabled' => $showmode = isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal),
189  'target' => $atarget,
190  'mainmenu' => "mrp",
191  'leftmenu' => '',
192  'position' => 31,
193  'id' => $id,
194  'idsel' => 'mrp',
195  'classname' => $classname = (!empty($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "mrp") ? 'class="tmenusel"' : 'class="tmenu"',
196  'prefix' => img_picto('', 'mrp', 'class="fa-fw paddingright pictofixedwidth"'),
197  'session' => ((!empty($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "mrp") ? 0 : 1),
198  'loadLangs' => array("mrp"),
199  'submenus' => array(),
200  );
201 
202  // Projects
203  $tmpentry = array(
204  'enabled'=> (isModEnabled('projet') ? 1 : 0),
205  'perms'=> (!empty($user->rights->projet->lire) ? 1 : 0),
206  'module'=>'projet'
207  );
208  $menu_arr[] = array(
209  'name' => 'Projet',
210  'link' => '/projet/index.php?mainmenu=project&amp;leftmenu=',
211  'title' => (! empty($conf->global->PROJECT_USE_OPPORTUNITIES) && $conf->global->PROJECT_USE_OPPORTUNITIES == 2 ? "Leads" : "Projects"),
212  'level' => 0,
213  'enabled' => $showmode = isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal),
214  'target' => $atarget,
215  'mainmenu' => "project",
216  'leftmenu' => '',
217  'position' => 35,
218  'id' => $id,
219  'idsel' => 'project',
220  'classname' => $classname = (!empty($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "project") ? 'class="tmenusel"' : 'class="tmenu"',
221  'prefix' => img_picto('', 'project', 'class="fa-fw paddingright pictofixedwidth"'),
222  'session' => ((!empty($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "project") ? 0 : 1),
223  'loadLangs' => array("projects"),
224  'submenus' => array(),
225  );
226 
227  // Commercial (propal, commande, supplier_proposal, supplier_order, contrat, ficheinter)
228  $tmpentry = array(
229  'enabled'=>(isModEnabled('propal')
230  || isModEnabled('commande')
231  || isModEnabled('fournisseur')
232  || isModEnabled('supplier_proposal')
233  || isModEnabled('supplier_order')
234  || isModEnabled('contrat')
235  || isModEnabled('ficheinter')
236  ) ? 1 : 0,
237  'perms'=>(!empty($user->rights->propal->lire)
238  || !empty($user->rights->commande->lire)
239  || !empty($user->rights->supplier_proposal->lire)
240  || !empty($user->rights->fournisseur->lire)
241  || !empty($user->rights->fournisseur->commande->lire)
242  || !empty($user->rights->supplier_order->lire)
243  || !empty($user->rights->contrat->lire)
244  || !empty($user->rights->ficheinter->lire)
245  ),
246  'module'=>'propal|commande|supplier_proposal|supplier_order|contrat|ficheinter'
247  );
248 
249  $onlysupplierorder = !empty($user->rights->fournisseur->commande->lire) &&
250  empty($user->rights->propal->lire) &&
251  empty($user->rights->commande->lire) &&
252  empty($user->rights->supplier_order->lire) &&
253  empty($user->rights->supplier_proposal->lire) &&
254  empty($user->rights->contrat->lire) &&
255  empty($user->rights->ficheinter->lire);
256 
257  $menu_arr[] = array(
258  'name' => 'Commercial',
259  'link' => ($onlysupplierorder ? '/fourn/commande/index.php?mainmenu=commercial&amp;leftmenu=' : '/comm/index.php?mainmenu=commercial&amp;leftmenu='),
260  'title' => "Commercial",
261  'level' => 0,
262  'enabled' => $showmode = isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal),
263  'target' => $atarget,
264  'mainmenu' => "commercial",
265  'leftmenu' => '',
266  'position' => 40,
267  'id' => $id,
268  'idsel' => 'commercial',
269  'classname' => $classname = (!empty($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "commercial") ? 'class="tmenusel"' : 'class="tmenu"',
270  'prefix' => img_picto('', 'contract', 'class="fa-fw paddingright pictofixedwidth"'),
271  'session' => ((!empty($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "commercial") ? 0 : 1),
272  'loadLangs' => array("commercial"),
273  'submenus' => array(),
274  );
275 
276  // Billing - Financial
277  $tmpentry = array(
278  'enabled'=>(isModEnabled('facture') ||
279  isModEnabled('don') ||
280  isModEnabled('tax') ||
281  isModEnabled('salaries') ||
282  isModEnabled('supplier_invoice') ||
283  isModEnabled('loan') ||
284  isModEnabled('margins')
285  ) ? 1 : 0,
286  'perms'=>(!empty($user->rights->facture->lire) || !empty($user->rights->don->contact->lire)
287  || !empty($user->rights->tax->charges->lire) || !empty($user->rights->salaries->read)
288  || !empty($user->rights->fournisseur->facture->lire) || !empty($user->rights->loan->read) || !empty($user->rights->margins->liretous)),
289  'module'=>'facture|supplier_invoice|don|tax|salaries|loan'
290  );
291  $menu_arr[] = array(
292  'name' => 'Compta',
293  'link' => '/compta/index.php?mainmenu=billing&amp;leftmenu=',
294  'title' => "MenuFinancial",
295  'level' => 0,
296  'enabled' => $showmode = isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal),
297  'target' => $atarget,
298  'mainmenu' => "billing",
299  'leftmenu' => '',
300  'position' => 50,
301  'id' => $id,
302  'idsel' => 'billing',
303  'classname' => $classname = (!empty($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "billing") ? 'class="tmenusel"' : 'class="tmenu"',
304  'prefix' => img_picto('', 'bill', 'class="fa-fw paddingright pictofixedwidth"'),
305  'session' => ((!empty($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "billing") ? 0 : 1),
306  'loadLangs' => array("compta"),
307  'submenus' => array(),
308  );
309 
310  // Bank
311  $tmpentry = array(
312  'enabled'=>(isModEnabled('banque') || isModEnabled('prelevement')),
313  'perms'=>(!empty($user->rights->banque->lire) || !empty($user->rights->prelevement->lire) || !empty($user->rights->paymentbybanktransfer->read)),
314  'module'=>'banque|prelevement|paymentbybanktransfer'
315  );
316  $menu_arr[] = array(
317  'name' => 'Bank',
318  'link' => '/compta/bank/list.php?mainmenu=bank&amp;leftmenu=',
319  'title' => "MenuBankCash",
320  'level' => 0,
321  'enabled' => $showmode = isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal),
322  'target' => $atarget,
323  'mainmenu' => "bank",
324  'leftmenu' => '',
325  'position' => 52,
326  'id' => $id,
327  'idsel' => 'bank',
328  'classname' => $classname = (!empty($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "bank") ? 'class="tmenusel"' : 'class="tmenu"',
329  'prefix' => img_picto('', 'bank_account', 'class="fa-fw paddingright pictofixedwidth"'),
330  'session' => ((!empty($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "bank") ? 0 : 1),
331  'loadLangs' => array("compta", "banks"),
332  'submenus' => array(),
333  );
334 
335  // Accounting
336  $tmpentry = array(
337  'enabled'=>(isModEnabled('comptabilite') || isModEnabled('accounting') || isModEnabled('asset') || isModEnabled('intracommreport')),
338  'perms'=>(!empty($user->rights->compta->resultat->lire) || !empty($user->rights->accounting->comptarapport->lire) || !empty($user->rights->accounting->mouvements->lire) || !empty($user->rights->asset->read) || !empty($user->rights->intracommreport->read)),
339  'module'=>'comptabilite|accounting|asset|intracommreport'
340  );
341  $menu_arr[] = array(
342  'name' => 'Accounting',
343  'link' => '/accountancy/index.php?mainmenu=accountancy&amp;leftmenu=',
344  'title' => "MenuAccountancy",
345  'level' => 0,
346  'enabled' => $showmode = isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal),
347  'target' => $atarget,
348  'mainmenu' => "accountancy",
349  'leftmenu' => '',
350  'position' => 54,
351  'id' => $id,
352  'idsel' => 'accountancy',
353  'classname' => $classname = (!empty($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "accountancy") ? 'class="tmenusel"' : 'class="tmenu"',
354  'prefix' => img_picto('', 'accountancy', 'class="fa-fw paddingright pictofixedwidth"'),
355  'session' => ((!empty($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "accountancy") ? 0 : 1),
356  'loadLangs' => array("compta", "accountancy", "assets", "intracommreport"),
357  'submenus' => array(),
358  );
359 
360  // HRM
361  $tmpentry = array(
362  'enabled'=>(isModEnabled('hrm') || (isModEnabled('holiday')) || isModEnabled('deplacement') || isModEnabled('expensereport') || isModEnabled('recruitment')),
363  'perms'=>(!empty($user->rights->user->user->lire) || !empty($user->rights->holiday->read) || !empty($user->rights->deplacement->lire) || !empty($user->rights->expensereport->lire) || !empty($user->rights->recruitment->recruitmentjobposition->read)),
364  'module'=>'hrm|holiday|deplacement|expensereport|recruitment'
365  );
366 
367  $menu_arr[] = array(
368  'name' => 'HRM',
369  'link' => '/hrm/index.php?mainmenu=hrm&amp;leftmenu=',
370  'title' => "HRM",
371  'level' => 0,
372  'enabled' => $showmode = isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal),
373  'target' => $atarget,
374  'mainmenu' => "hrm",
375  'leftmenu' => '',
376  'position' => 80,
377  'id' => $id,
378  'idsel' => 'hrm',
379  'classname' => $classname = (!empty($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "hrm") ? 'class="tmenusel"' : 'class="tmenu"',
380  'prefix' => img_picto('', 'hrm', 'class="fa-fw paddingright pictofixedwidth"'),
381  'session' => ((!empty($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "hrm") ? 0 : 1),
382  'loadLangs' => array("holiday"),
383  'submenus' => array(),
384  );
385 
386  // Tickets and knowledge base
387  $tmpentry = array(
388  'enabled'=>(isModEnabled('ticket') || isModEnabled('knowledgemanagement')),
389  'perms'=>(!empty($user->rights->ticket->read) || !empty($user->rights->knowledgemanagement->knowledgerecord->read)),
390  'module'=>'ticket|knowledgemanagement'
391  );
392  $link = '';
393  if (isModEnabled('ticket')) {
394  $link = '/ticket/index.php?mainmenu=ticket&amp;leftmenu=';
395  } else {
396  $link = '/knowledgemanagement/knowledgerecord_list.php?mainmenu=ticket&amp;leftmenu=';
397  }
398  $menu_arr[] = array(
399  'name' => 'Ticket',
400  'link' => '/ticket/index.php?mainmenu=ticket&amp;leftmenu=',
401  'title' => "Tickets",
402  'level' => 0,
403  'enabled' => $showmode = isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal),
404  'target' => $atarget,
405  'mainmenu' => "ticket",
406  'leftmenu' => '',
407  'position' => 88,
408  'id' => $id,
409  'idsel' => 'ticket',
410  'classname' => $classname = (!empty($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "ticket") ? 'class="tmenusel"' : 'class="tmenu"',
411  'prefix' => img_picto('', 'ticket', 'class="fa-fw paddingright pictofixedwidth"'),
412  'session' => ((!empty($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "ticket") ? 0 : 1),
413  'loadLangs' => array("other"),
414  'submenus' => array(),
415  );
416 
417  // Tools
418  $tmpentry = array(
419  'enabled'=>1,
420  'perms'=>1,
421  'module'=>''
422  );
423  $menu_arr[] = array(
424  'name' => 'Tools',
425  'link' => '/core/tools.php?mainmenu=tools&amp;leftmenu=',
426  'title' => "Tools",
427  'level' => 0,
428  'enabled' => $showmode = isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal),
429  'target' => $atarget,
430  'mainmenu' => "tools",
431  'leftmenu' => '',
432  'position' => 90,
433  'id' => $id,
434  'idsel' => 'tools',
435  'classname' => $classname = (!empty($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "tools") ? 'class="tmenusel"' : 'class="tmenu"',
436  'prefix' => img_picto('', 'tools', 'class="fa-fw paddingright pictofixedwidth"'),
437  'session' => ((!empty($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "tools") ? 0 : 1),
438  'loadLangs' => array("other"),
439  'submenus' => array(),
440  );
441 
442  // Add menus
443  foreach ($menu_arr as $key => $smenu) {
444  $smenu = (object) $smenu;
445 
446  if ($smenu->enabled) {
447  if ($smenu->session) {
448  $_SESSION['idmenu'] = '';
449  }
450 
451  // Load Langue
452  if (!empty($smenu->loadLangs)) {
453  $langs->loadLangs($smenu->loadLangs);
454  }
455 
456  // Trans title
457  $mtitle = '';
458  if (is_array($smenu->title)) {
459  foreach ($smenu->title as $item) {
460  $mtitle .= $langs->trans($item);
461  }
462  } else {
463  $mtitle = $langs->trans($smenu->title);
464  }
465  // Add item
466  $menu->add($smenu->link, $mtitle, $smenu->level, $smenu->enabled, $smenu->target, $smenu->mainmenu, $smenu->leftmenu, $smenu->position, $smenu->id, $smenu->idsel, $smenu->classname, $smenu->prefix);
467  }
468  }
469 
470  // Show personalized menus
471  $menuArbo = new Menubase($db, 'eldy');
472 
473  $newTabMenu = $menuArbo->menuTopCharger('', '', $type_user, 'eldy', $tabMenu); // Return tabMenu with only top entries
474 
475  $num = count($newTabMenu);
476  for ($i = 0; $i < $num; $i++) {
477  //var_dump($type_user.' '.$newTabMenu[$i]['url'].' '.$showmode.' '.$newTabMenu[$i]['perms']);
478  $idsel = (empty($newTabMenu[$i]['mainmenu']) ? 'none' : $newTabMenu[$i]['mainmenu']);
479 
480  $newTabMenu[$i]['url'] = make_substitutions($newTabMenu[$i]['url'], $substitarray);
481 
482  // url = url from host, shorturl = relative path into dolibarr sources
483  $url = $shorturl = $newTabMenu[$i]['url'];
484  if (!preg_match("/^(http:\/\/|https:\/\/)/i", $newTabMenu[$i]['url'])) { // Do not change url content for external links
485  $tmp = explode('?', $newTabMenu[$i]['url'], 2);
486  $url = $shorturl = $tmp[0];
487  $param = (isset($tmp[1]) ? $tmp[1] : '');
488 
489  if ((!preg_match('/mainmenu/i', $param)) || !preg_match('/leftmenu/i', $param)) {
490  $param .= ($param ? '&' : '').'mainmenu='.$newTabMenu[$i]['mainmenu'].'&leftmenu=';
491  }
492  //$url.="idmenu=".$newTabMenu[$i]['rowid']; // Already done by menuLoad
493  $url = dol_buildpath($url, 1).($param ? '?'.$param : '');
494  //$shorturl = $shorturl.($param?'?'.$param:'');
495  $shorturl = $url;
496  if (DOL_URL_ROOT) {
497  $shorturl = preg_replace('/^'.preg_quote(DOL_URL_ROOT, '/').'/', '', $shorturl);
498  }
499  }
500 
501  $showmode = isVisibleToUserType($type_user, $newTabMenu[$i], $listofmodulesforexternal);
502  if ($showmode == 1) {
503  // Define the class (top menu selected or not)
504  if (!empty($_SESSION['idmenu']) && $newTabMenu[$i]['rowid'] == $_SESSION['idmenu']) {
505  $classname = 'class="tmenusel"';
506  } elseif (!empty($_SESSION["mainmenu"]) && $newTabMenu[$i]['mainmenu'] == $_SESSION["mainmenu"]) {
507  $classname = 'class="tmenusel"';
508  } else {
509  $classname = 'class="tmenu"';
510  }
511  } elseif ($showmode == 2) {
512  $classname = 'class="tmenu"';
513  }
514 
515  $menu->add(
516  $shorturl,
517  $newTabMenu[$i]['titre'],
518  0,
519  $showmode,
520  ($newTabMenu[$i]['target'] ? $newTabMenu[$i]['target'] : $atarget),
521  ($newTabMenu[$i]['mainmenu'] ? $newTabMenu[$i]['mainmenu'] : $newTabMenu[$i]['rowid']),
522  ($newTabMenu[$i]['leftmenu'] ? $newTabMenu[$i]['leftmenu'] : ''),
523  $newTabMenu[$i]['position'],
524  $id,
525  $idsel,
526  $classname,
527  $newTabMenu[$i]['prefix']
528  );
529  }
530 
531  // Sort on position
532  $menu->liste = dol_sort_array($menu->liste, 'position');
533 
534  // Output menu entries
535  // Show logo company
536  if (empty($conf->global->MAIN_MENU_INVERT) && empty($noout) && !empty($conf->global->MAIN_SHOW_LOGO) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
537  //$mysoc->logo_mini=(empty($conf->global->MAIN_INFO_SOCIETE_LOGO_MINI)?'':$conf->global->MAIN_INFO_SOCIETE_LOGO_MINI);
538  $mysoc->logo_squarred_mini = (empty($conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED_MINI) ? '' : $conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED_MINI);
539 
540  $logoContainerAdditionalClass = 'backgroundforcompanylogo';
541  if (!empty($conf->global->MAIN_INFO_SOCIETE_LOGO_NO_BACKGROUND)) {
542  $logoContainerAdditionalClass = '';
543  }
544 
545  if (!empty($mysoc->logo_squarred_mini) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_squarred_mini)) {
546  $urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&amp;modulepart=mycompany&amp;file='.urlencode('logos/thumbs/'.$mysoc->logo_squarred_mini);
547  /*} elseif (! empty($mysoc->logo_mini) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini))
548  {
549  $urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&amp;modulepart=mycompany&amp;file='.urlencode('logos/thumbs/'.$mysoc->logo_mini);
550  }*/
551  } else {
552  $urllogo = DOL_URL_ROOT.'/theme/dolibarr_512x512_white.png';
553  $logoContainerAdditionalClass = '';
554  }
555  $title = $langs->trans("GoIntoSetupToChangeLogo");
556 
557  print "\n".'<!-- Show logo on menu -->'."\n";
558  print_start_menu_entry('companylogo', 'class="tmenu tmenucompanylogo nohover"', 1);
559 
560  print '<div class="center '.$logoContainerAdditionalClass.' menulogocontainer"><img class="mycompany" title="'.dol_escape_htmltag($title).'" alt="" src="'.$urllogo.'" style="max-width: 100px"></div>'."\n";
561 
563  }
564 
565  if (empty($noout)) {
566  foreach ($menu->liste as $menuval) {
567  print_start_menu_entry($menuval['idsel'], $menuval['classname'], $menuval['enabled']);
568  print_text_menu_entry($menuval['titre'], $menuval['enabled'], (($menuval['url'] != '#' && !preg_match('/^(http:\/\/|https:\/\/)/i', $menuval['url'])) ? DOL_URL_ROOT:'').$menuval['url'], $menuval['id'], $menuval['idsel'], $menuval['classname'], ($menuval['target'] ? $menuval['target'] : $atarget));
569  print_end_menu_entry($menuval['enabled']);
570  }
571  }
572 
573  $showmode = 1;
574  if (empty($noout)) {
575  print_start_menu_entry('', 'class="tmenuend"', $showmode);
576  print_end_menu_entry($showmode);
578  }
579 
580  return 0;
581 }
582 
583 
590 {
591  global $conf;
592 
593  print '<div class="tmenudiv">';
594  print '<ul role="navigation" class="tmenu"'.(empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '' : ' title="Top menu"').'>';
595 }
596 
605 function print_start_menu_entry($idsel, $classname, $showmode)
606 {
607  if ($showmode) {
608  print '<li '.$classname.' id="mainmenutd_'.$idsel.'">';
609  //print '<div class="tmenuleft tmenusep"></div>';
610  print '<div class="tmenucenter">';
611  }
612 }
613 
626 function print_text_menu_entry($text, $showmode, $url, $id, $idsel, $classname, $atarget)
627 {
628  global $conf, $langs;
629 
630  $classnameimg = str_replace('class="', 'class="tmenuimage ', $classname);
631  $classnametxt = str_replace('class="', 'class="tmenulabel ', $classname);
632 
633  //$conf->global->THEME_TOPMENU_DISABLE_TEXT=1;
634  if ($showmode == 1) {
635  print '<a '.$classnameimg.' tabindex="-1" href="'.$url.'"'.($atarget ? ' target="'.$atarget.'"' : '').' title="'.dol_escape_htmltag($text).'">';
636  print '<div class="'.$id.' '.$idsel.' topmenuimage"><span class="'.$id.' tmenuimageforpng" id="mainmenuspan_'.$idsel.'"></span></div>';
637  print '</a>';
638  if (empty($conf->global->THEME_TOPMENU_DISABLE_TEXT)) {
639  print '<a '.$classnametxt.' id="mainmenua_'.$idsel.'" href="'.$url.'"'.($atarget ? ' target="'.$atarget.'"' : '').' title="'.dol_escape_htmltag($text).'">';
640  print '<span class="mainmenuaspan">';
641  print $text;
642  print '</span>';
643  print '</a>';
644  }
645  } elseif ($showmode == 2) {
646  print '<div '.$classnameimg.' title="'.dol_escape_htmltag($text.' - '.$langs->trans("NotAllowed")).'">';
647  print '<div class="'.$id.' '.$idsel.' topmenuimage tmenudisabled"><span class="'.$id.' tmenuimageforpng tmenudisabled" id="mainmenuspan_'.$idsel.'"></span></div>';
648  print '</div>';
649  if (empty($conf->global->THEME_TOPMENU_DISABLE_TEXT)) {
650  print '<span '.$classnametxt.' id="mainmenua_'.$idsel.'" href="#" title="'.dol_escape_htmltag($text.' - '.$langs->trans("NotAllowed")).'">';
651  print '<span class="mainmenuaspan tmenudisabled">';
652  print $text;
653  print '</span>';
654  print '</span>';
655  }
656  }
657 }
658 
665 function print_end_menu_entry($showmode)
666 {
667  if ($showmode) {
668  print '</div></li>';
669  }
670  print "\n";
671 }
672 
679 {
680  print '</ul>';
681  print '</div>';
682  print "\n";
683 }
684 
701 function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabMenu, &$menu, $noout = 0, $forcemainmenu = '', $forceleftmenu = '', $moredata = null, $type_user = 0)
702 {
703 
704  global $user, $conf, $langs, $hookmanager;
705 
706  //var_dump($tabMenu);
707 
708  $newmenu = $menu;
709 
710  $mainmenu = ($forcemainmenu ? $forcemainmenu : $_SESSION["mainmenu"]);
711  $leftmenu = ($forceleftmenu ? '' : (empty($_SESSION["leftmenu"]) ? 'none' : $_SESSION["leftmenu"]));
712 
713  global $usemenuhider;
714  $usemenuhider = 0;
715 
716  if (is_array($moredata) && !empty($moredata['searchform'])) { // searchform can contains select2 code or link to show old search form or link to switch on search page
717  print "\n";
718  print "<!-- Begin SearchForm -->\n";
719  print '<div id="blockvmenusearch" class="blockvmenusearch">'."\n";
720  print $moredata['searchform'];
721  print '</div>'."\n";
722  print "<!-- End SearchForm -->\n";
723  }
724 
725  if (is_array($moredata) && !empty($moredata['bookmarks'])) {
726  print "\n";
727  print "<!-- Begin Bookmarks -->\n";
728  print '<div id="blockvmenubookmarks" class="blockvmenubookmarks">'."\n";
729  print $moredata['bookmarks'];
730  print '</div>'."\n";
731  print "<!-- End Bookmarks -->\n";
732  }
733 
734  $substitarray = getCommonSubstitutionArray($langs, 0, null, null);
735 
736  $listofmodulesforexternal = explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL);
737 
742  if ($mainmenu) { // If this is empty, loading hard coded menu and loading personalised menu will fail
743  /*
744  * Menu HOME
745  */
746  if ($mainmenu == 'home') {
747  get_left_menu_home($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user);
748  }
749 
750  /*
751  * Menu THIRDPARTIES
752  */
753  if ($mainmenu == 'companies') {
754  get_left_menu_thridparties($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user);
755  }
756 
757  /*
758  * Menu COMMERCIAL (propal, commande, supplier_proposal, supplier_order, contrat, ficheinter)
759  */
760  if ($mainmenu == 'commercial') {
761  get_left_menu_commercial($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user);
762  }
763 
764  /*
765  * Menu COMPTA-FINANCIAL
766  */
767  if ($mainmenu == 'billing') {
768  get_left_menu_billing($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user);
769  }
770 
771  /*
772  * Menu COMPTA-FINANCIAL
773  */
774  if ($mainmenu == 'accountancy') {
775  get_left_menu_accountancy($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user);
776  }
777 
778  /*
779  * Menu BANK
780  */
781  if ($mainmenu == 'bank') {
782  get_left_menu_bank($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user);
783  }
784 
785  /*
786  * Menu PRODUCTS-SERVICES
787  */
788  if ($mainmenu == 'products') {
789  get_left_menu_products($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user);
790  }
791 
792  /*
793  * Menu PRODUCTS-SERVICES MRP - GPAO
794  */
795  if ($mainmenu == 'mrp') {
796  get_left_menu_mrp($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user);
797  }
798 
799  /*
800  * Menu PROJECTS
801  */
802  if ($mainmenu == 'project') {
803  get_left_menu_projects($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user);
804  }
805 
806  /*
807  * Menu HRM
808  */
809  if ($mainmenu == 'hrm') {
810  get_left_menu_hrm($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user);
811  }
812  /*
813  * Menu TOOLS
814  */
815  if ($mainmenu == 'tools') {
816  get_left_menu_tools($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user);
817  }
818 
819  /*
820  * Menu MEMBERS
821  */
822  if ($mainmenu == 'members') {
823  get_left_menu_members($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user);
824  }
825 
826  // Add personalized menus and modules menus
827  //var_dump($newmenu->liste); //
828  $menuArbo = new Menubase($db, 'eldy');
829  $newmenu = $menuArbo->menuLeftCharger($newmenu, $mainmenu, $leftmenu, (empty($user->socid) ? 0 : 1), 'eldy', $tabMenu);
830  //var_dump($newmenu->liste); //
831 
832  if (isModEnabled('ftp') && $mainmenu == 'ftp') { // Entry for FTP
833  $MAXFTP = 20;
834  $i = 1;
835  while ($i <= $MAXFTP) {
836  $paramkey = 'FTP_NAME_'.$i;
837  //print $paramkey;
838  if (!empty($conf->global->$paramkey)) {
839  $link = "/ftp/index.php?idmenu=".$_SESSION["idmenu"]."&numero_ftp=".$i;
840  $newmenu->add($link, dol_trunc($conf->global->$paramkey, 24));
841  }
842  $i++;
843  }
844  }
845  }
846 
847  //var_dump($tabMenu);
848  //var_dump($newmenu->liste);
849 
850  // Build final $menu_array = $menu_array_before +$newmenu->liste + $menu_array_after
851  //var_dump($menu_array_before);exit;
852  //var_dump($menu_array_after);exit;
853  $menu_array = $newmenu->liste;
854  if (is_array($menu_array_before)) {
855  $menu_array = array_merge($menu_array_before, $menu_array);
856  }
857  if (is_array($menu_array_after)) {
858  $menu_array = array_merge($menu_array, $menu_array_after);
859  }
860  //var_dump($menu_array);exit;
861  if (!is_array($menu_array)) {
862  return 0;
863  }
864 
865  // Allow the $menu_array of the menu to be manipulated by modules
866  $parameters = array(
867  'mainmenu' => $mainmenu,
868  );
869  $hook_items = $menu_array;
870  $reshook = $hookmanager->executeHooks('menuLeftMenuItems', $parameters, $hook_items); // Note that $action and $object may have been modified by some hooks
871 
872  if (is_numeric($reshook)) {
873  if ($reshook == 0 && !empty($hookmanager->results)) {
874  $menu_array[] = $hookmanager->results; // add
875  } elseif ($reshook == 1) {
876  $menu_array = $hookmanager->results; // replace
877  }
878 
879  // @todo Sort menu items by 'position' value
880  // $position = array();
881  // foreach ($menu_array as $key => $row) {
882  // $position[$key] = $row['position'];
883  // }
884  // $array1_sort_order = SORT_ASC;
885  // array_multisort($position, $array1_sort_order, $menu_array);
886  }
887 
888  // TODO Use the position property in menu_array to reorder the $menu_array
889  //var_dump($menu_array);
890  /*$new_menu_array = array();
891  $level=0; $cusor=0; $position=0;
892  $nbentry = count($menu_array);
893  while (findNextEntryForLevel($menu_array, $cursor, $position, $level))
894  {
895 
896  $cursor++;
897  }*/
898 
899  // Show menu
900  $invert = empty($conf->global->MAIN_MENU_INVERT) ? "" : "invert";
901  if (empty($noout)) {
902  $altok = 0;
903  $blockvmenuopened = false;
904  $lastlevel0 = '';
905  $num = count($menu_array);
906  for ($i = 0; $i < $num; $i++) { // Loop on each menu entry
907  $showmenu = true;
908  if (!empty($conf->global->MAIN_MENU_HIDE_UNAUTHORIZED) && empty($menu_array[$i]['enabled'])) {
909  $showmenu = false;
910  }
911 
912  // Begin of new left menu block
913  if (empty($menu_array[$i]['level']) && $showmenu) {
914  $altok++;
915  $blockvmenuopened = true;
916  $lastopened = true;
917  for ($j = ($i + 1); $j < $num; $j++) {
918  if (empty($menu_array[$j]['level'])) {
919  $lastopened = false;
920  }
921  }
922  if ($altok % 2 == 0) {
923  print '<div class="blockvmenu blockvmenuimpair'.$invert.($lastopened ? ' blockvmenulast' : '').($altok == 1 ? ' blockvmenufirst' : '').'">'."\n";
924  } else {
925  print '<div class="blockvmenu blockvmenupair'.$invert.($lastopened ? ' blockvmenulast' : '').($altok == 1 ? ' blockvmenufirst' : '').'">'."\n";
926  }
927  }
928 
929  // Add tabulation
930  $tabstring = '';
931  $tabul = ($menu_array[$i]['level'] - 1);
932  if ($tabul > 0) {
933  for ($j = 0; $j < $tabul; $j++) {
934  $tabstring .= '&nbsp;&nbsp;&nbsp;';
935  }
936  }
937 
938  // $menu_array[$i]['url'] can be a relative url, a full external url. We try substitution
939 
940  $menu_array[$i]['url'] = make_substitutions($menu_array[$i]['url'], $substitarray);
941 
942  $url = $shorturl = $shorturlwithoutparam = $menu_array[$i]['url'];
943  if (!preg_match("/^(http:\/\/|https:\/\/)/i", $menu_array[$i]['url'])) {
944  $tmp = explode('?', $menu_array[$i]['url'], 2);
945  $url = $shorturl = $tmp[0];
946  $param = (isset($tmp[1]) ? $tmp[1] : ''); // params in url of the menu link
947 
948  // Complete param to force leftmenu to '' to close open menu when we click on a link with no leftmenu defined.
949  if ((!preg_match('/mainmenu/i', $param)) && (!preg_match('/leftmenu/i', $param)) && !empty($menu_array[$i]['mainmenu'])) {
950  $param .= ($param ? '&' : '').'mainmenu='.$menu_array[$i]['mainmenu'].'&leftmenu=';
951  }
952  if ((!preg_match('/mainmenu/i', $param)) && (!preg_match('/leftmenu/i', $param)) && empty($menu_array[$i]['mainmenu'])) {
953  $param .= ($param ? '&' : '').'leftmenu=';
954  }
955  //$url.="idmenu=".$menu_array[$i]['rowid']; // Already done by menuLoad
956  $url = dol_buildpath($url, 1).($param ? '?'.$param : '');
957  $shorturlwithoutparam = $shorturl;
958  $shorturl = $shorturl.($param ? '?'.$param : '');
959  }
960 
961 
962  print '<!-- Process menu entry with mainmenu='.$menu_array[$i]['mainmenu'].', leftmenu='.$menu_array[$i]['leftmenu'].', level='.$menu_array[$i]['level'].' enabled='.$menu_array[$i]['enabled'].', position='.$menu_array[$i]['position'].' -->'."\n";
963 
964  // Menu level 0
965  if ($menu_array[$i]['level'] == 0) {
966  if ($menu_array[$i]['enabled']) { // Enabled so visible
967  print '<div class="menu_titre">'.$tabstring;
968  if ($shorturlwithoutparam) {
969  print '<a class="vmenu" title="'.dol_escape_htmltag(dol_string_nohtmltag($menu_array[$i]['titre'])).'" href="'.$url.'"'.($menu_array[$i]['target'] ? ' target="'.$menu_array[$i]['target'].'"' : '').'>';
970  } else {
971  print '<span class="vmenu">';
972  }
973  print ($menu_array[$i]['prefix'] ? $menu_array[$i]['prefix'] : '').$menu_array[$i]['titre'];
974  if ($shorturlwithoutparam) {
975  print '</a>';
976  } else {
977  print '</span>';
978  }
979  print '</div>'."\n";
980  $lastlevel0 = 'enabled';
981  } elseif ($showmenu) { // Not enabled but visible (so greyed)
982  print '<div class="menu_titre">'.$tabstring;
983  print '<span class="vmenudisabled">';
984  print ($menu_array[$i]['prefix'] ? $menu_array[$i]['prefix'] : '').$menu_array[$i]['titre'];
985  print '</span>';
986  print '</div>'."\n";
987  $lastlevel0 = 'greyed';
988  } else {
989  $lastlevel0 = 'hidden';
990  }
991  if ($showmenu) {
992  print '<div class="menu_top"></div>'."\n";
993  }
994  }
995 
996  // Menu level > 0
997  if ($menu_array[$i]['level'] > 0) {
998  $cssmenu = '';
999  if ($menu_array[$i]['url']) {
1000  $cssmenu = ' menu_contenu'.dol_string_nospecial(preg_replace('/\.php.*$/', '', $menu_array[$i]['url']));
1001  }
1002 
1003  if ($menu_array[$i]['enabled'] && $lastlevel0 == 'enabled') {
1004  // Enabled so visible, except if parent was not enabled.
1005  print '<div class="menu_contenu'.$cssmenu.'">';
1006  print $tabstring;
1007  if ($shorturlwithoutparam) {
1008  print '<a class="vsmenu" title="'.dol_escape_htmltag(dol_string_nohtmltag($menu_array[$i]['titre'])).'" href="'.$url.'"'.($menu_array[$i]['target'] ? ' target="'.$menu_array[$i]['target'].'"' : '').'>';
1009  } else {
1010  print '<span class="vsmenu" title="'.dol_escape_htmltag($menu_array[$i]['titre']).'">';
1011  }
1012  print $menu_array[$i]['titre'];
1013  if ($shorturlwithoutparam) {
1014  print '</a>';
1015  } else {
1016  print '</span>';
1017  }
1018  // If title is not pure text and contains a table, no carriage return added
1019  if (!strstr($menu_array[$i]['titre'], '<table')) {
1020  print '<br>';
1021  }
1022  print '</div>'."\n";
1023  } elseif ($showmenu && $lastlevel0 == 'enabled') {
1024  // Not enabled but visible (so greyed), except if parent was not enabled.
1025  print '<div class="menu_contenu'.$cssmenu.'">';
1026  print $tabstring;
1027  print '<span class="vsmenudisabled vsmenudisabledmargin">'.$menu_array[$i]['titre'].'</span><br>';
1028  print '</div>'."\n";
1029  }
1030  }
1031 
1032  // If next is a new block or if there is nothing after
1033  if (empty($menu_array[$i + 1]['level'])) { // End menu block
1034  if ($showmenu) {
1035  print '<div class="menu_end"></div>'."\n";
1036  }
1037  if ($blockvmenuopened) {
1038  print '</div>'."\n";
1039  $blockvmenuopened = false;
1040  }
1041  }
1042  }
1043 
1044  if ($altok) {
1045  print '<div class="blockvmenuend"></div>'; // End menu block
1046  }
1047  }
1048 
1049  return count($menu_array);
1050 }
1051 
1052 
1063 function get_left_menu_home($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = 'none', $type_user = 0)
1064 {
1065  global $user, $conf, $langs;
1066 
1067  if ($mainmenu == 'home') {
1068  $langs->load("users");
1069 
1070  // Home - dashboard
1071  $newmenu->add("/index.php?mainmenu=home&amp;leftmenu=home", $langs->trans("MyDashboard"), 0, 1, '', $mainmenu, 'home', 0, '', '', '', '<i class="fa fa-bar-chart fa-fw paddingright pictofixedwidth"></i>');
1072 
1073  // Setup
1074  $newmenu->add("/admin/index.php?mainmenu=home&amp;leftmenu=setup", $langs->trans("Setup"), 0, $user->admin, '', $mainmenu, 'setup', 0, '', '', '', '<i class="fa fa-tools fa-fw paddingright pictofixedwidth"></i>');
1075 
1076  if ($usemenuhider || empty($leftmenu) || $leftmenu == "setup") {
1077  // Load translation files required by the page
1078  $langs->loadLangs(array("admin", "help"));
1079 
1080  $warnpicto = '';
1081  if (empty($conf->global->MAIN_INFO_SOCIETE_NOM) || empty($conf->global->MAIN_INFO_SOCIETE_COUNTRY)) {
1082  $langs->load("errors");
1083  $warnpicto = img_warning($langs->trans("WarningMandatorySetupNotComplete"));
1084  }
1085  $newmenu->add("/admin/company.php?mainmenu=home", $langs->trans("MenuCompanySetup").$warnpicto, 1);
1086 
1087  $warnpicto = '';
1088  if (count($conf->modules) <= (empty($conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING) ? 1 : $conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING)) { // If only user module enabled
1089  $langs->load("errors");
1090  $warnpicto = img_warning($langs->trans("WarningMandatorySetupNotComplete"));
1091  }
1092  $newmenu->add("/admin/modules.php?mainmenu=home", $langs->trans("Modules").$warnpicto, 1);
1093  $newmenu->add("/admin/ihm.php?mainmenu=home", $langs->trans("GUISetup"), 1);
1094  $newmenu->add("/admin/menus.php?mainmenu=home", $langs->trans("Menus"), 1);
1095 
1096  $newmenu->add("/admin/translation.php?mainmenu=home", $langs->trans("Translation"), 1);
1097  $newmenu->add("/admin/defaultvalues.php?mainmenu=home", $langs->trans("DefaultValues"), 1);
1098  $newmenu->add("/admin/boxes.php?mainmenu=home", $langs->trans("Boxes"), 1);
1099  $newmenu->add("/admin/delais.php?mainmenu=home", $langs->trans("MenuWarnings"), 1);
1100  $newmenu->add("/admin/security_other.php?mainmenu=home", $langs->trans("Security"), 1);
1101  $newmenu->add("/admin/limits.php?mainmenu=home", $langs->trans("MenuLimits"), 1);
1102  $newmenu->add("/admin/pdf.php?mainmenu=home", $langs->trans("PDF"), 1);
1103 
1104  $warnpicto = '';
1105  if (!empty($conf->global->MAIN_MAIL_SENDMODE) && $conf->global->MAIN_MAIL_SENDMODE == 'mail' && empty($conf->global->MAIN_HIDE_WARNING_TO_ENCOURAGE_SMTP_SETUP)) {
1106  $langs->load("errors");
1107  $warnpicto = img_warning($langs->trans("WarningPHPMailD"));
1108  }
1109  if (!empty($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmail')) && empty($conf->global->MAIN_MAIL_SMTP_SERVER)) {
1110  $langs->load("errors");
1111  $warnpicto = img_warning($langs->trans("ErrorSetupOfEmailsNotComplete"));
1112  }
1113 
1114  $newmenu->add("/admin/mails.php?mainmenu=home", $langs->trans("Emails").$warnpicto, 1);
1115  $newmenu->add("/admin/sms.php?mainmenu=home", $langs->trans("SMS"), 1);
1116  $newmenu->add("/admin/dict.php?mainmenu=home", $langs->trans("Dictionary"), 1);
1117  $newmenu->add("/admin/const.php?mainmenu=home", $langs->trans("OtherSetup"), 1);
1118  }
1119 
1120  // System tools
1121  $newmenu->add("/admin/tools/index.php?mainmenu=home&amp;leftmenu=admintools", $langs->trans("AdminTools"), 0, $user->admin, '', $mainmenu, 'admintools', 0, '', '', '', '<i class="fa fa-server fa-fw paddingright pictofixedwidth"></i>');
1122  if ($usemenuhider || empty($leftmenu) || preg_match('/^admintools/', $leftmenu)) {
1123  // Load translation files required by the page
1124  $langs->loadLangs(array('admin', 'help'));
1125 
1126  $newmenu->add('/admin/system/dolibarr.php?mainmenu=home&amp;leftmenu=admintools_info', $langs->trans('InfoDolibarr'), 1);
1127  if ($usemenuhider || empty($leftmenu) || $leftmenu == 'admintools_info') {
1128  $newmenu->add('/admin/system/modules.php?mainmenu=home&amp;leftmenu=admintools_info', $langs->trans('Modules'), 2);
1129  $newmenu->add('/admin/triggers.php?mainmenu=home&amp;leftmenu=admintools_info', $langs->trans('Triggers'), 2);
1130  $newmenu->add('/admin/system/filecheck.php?mainmenu=home&amp;leftmenu=admintools_info', $langs->trans('FileCheck'), 2);
1131  }
1132  $newmenu->add('/admin/system/browser.php?mainmenu=home&amp;leftmenu=admintools', $langs->trans('InfoBrowser'), 1);
1133  $newmenu->add('/admin/system/os.php?mainmenu=home&amp;leftmenu=admintools', $langs->trans('InfoOS'), 1);
1134  $newmenu->add('/admin/system/web.php?mainmenu=home&amp;leftmenu=admintools', $langs->trans('InfoWebServer'), 1);
1135  $newmenu->add('/admin/system/phpinfo.php?mainmenu=home&amp;leftmenu=admintools', $langs->trans('InfoPHP'), 1);
1136  $newmenu->add('/admin/system/database.php?mainmenu=home&amp;leftmenu=admintools', $langs->trans('InfoDatabase'), 1);
1137  $newmenu->add("/admin/system/perf.php?mainmenu=home&amp;leftmenu=admintools", $langs->trans("InfoPerf"), 1);
1138  $newmenu->add("/admin/system/security.php?mainmenu=home&amp;leftmenu=admintools", $langs->trans("InfoSecurity"), 1);
1139  $newmenu->add("/admin/tools/dolibarr_export.php?mainmenu=home&amp;leftmenu=admintools", $langs->trans("Backup"), 1);
1140  $newmenu->add("/admin/tools/dolibarr_import.php?mainmenu=home&amp;leftmenu=admintools", $langs->trans("Restore"), 1);
1141  $newmenu->add("/admin/tools/update.php?mainmenu=home&amp;leftmenu=admintools", $langs->trans("MenuUpgrade"), 1);
1142  $newmenu->add("/admin/tools/purge.php?mainmenu=home&amp;leftmenu=admintools", $langs->trans("Purge"), 1);
1143  $newmenu->add("/admin/tools/listevents.php?mainmenu=home&amp;leftmenu=admintools", $langs->trans("Audit"), 1);
1144  $newmenu->add("/admin/tools/listsessions.php?mainmenu=home&amp;leftmenu=admintools", $langs->trans("Sessions"), 1);
1145  $newmenu->add('/admin/system/about.php?mainmenu=home&amp;leftmenu=admintools', $langs->trans('ExternalResources'), 1);
1146 
1147  if (isModEnabled('product') || isModEnabled('service')) {
1148  $langs->load("products");
1149  $newmenu->add("/product/admin/product_tools.php?mainmenu=home&amp;leftmenu=admintools", $langs->trans("ProductVatMassChange"), 1, $user->admin);
1150  }
1151  }
1152 
1153  $newmenu->add("/user/home.php?leftmenu=users", $langs->trans("MenuUsersAndGroups"), 0, $user->rights->user->user->lire, '', $mainmenu, 'users', 0, '', '', '', img_picto('', 'user', 'class="paddingright pictofixedwidth"'));
1154  if ($user->rights->user->user->lire) {
1155  if ($usemenuhider || empty($leftmenu) || $leftmenu == "users") {
1156  $newmenu->add("", $langs->trans("Users"), 1, $user->rights->user->user->lire || $user->admin);
1157  $newmenu->add("/user/card.php?leftmenu=users&action=create", $langs->trans("NewUser"), 2, ($user->rights->user->user->creer || $user->admin) && !(isModEnabled('multicompany') && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE), '', 'home');
1158  $newmenu->add("/user/list.php?leftmenu=users", $langs->trans("ListOfUsers"), 2, $user->rights->user->user->lire || $user->admin);
1159  $newmenu->add("/user/hierarchy.php?leftmenu=users", $langs->trans("HierarchicView"), 2, $user->rights->user->user->lire || $user->admin);
1160  if (isModEnabled('categorie')) {
1161  $langs->load("categories");
1162  $newmenu->add("/categories/index.php?leftmenu=users&type=7", $langs->trans("UsersCategoriesShort"), 2, $user->rights->categorie->lire, '', $mainmenu, 'cat');
1163  }
1164  $newmenu->add("", $langs->trans("Groups"), 1, ($user->rights->user->user->lire || $user->admin) && !(isModEnabled('multicompany') && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE));
1165  $newmenu->add("/user/group/card.php?leftmenu=users&action=create", $langs->trans("NewGroup"), 2, ((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) ? $user->rights->user->group_advance->write : $user->rights->user->user->creer) || $user->admin) && !(isModEnabled('multicompany') && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE));
1166  $newmenu->add("/user/group/list.php?leftmenu=users", $langs->trans("ListOfGroups"), 2, ((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) ? $user->rights->user->group_advance->read : $user->rights->user->user->lire) || $user->admin) && !(isModEnabled('multicompany') && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE));
1167  }
1168  }
1169  }
1170 }
1171 
1182 function get_left_menu_thridparties($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = 'none', $type_user = 0)
1183 {
1184  global $user, $conf, $langs;
1185 
1186  if ($mainmenu == 'companies') {
1187  // Societes
1188  if (isModEnabled('societe')) {
1189  $langs->load("companies");
1190  $newmenu->add("/societe/index.php?leftmenu=thirdparties", $langs->trans("ThirdParty"), 0, $user->rights->societe->lire, '', $mainmenu, 'thirdparties', 0, '', '', '', img_picto('', 'company', 'class="paddingright pictofixedwidth"'));
1191 
1192  if ($user->rights->societe->creer) {
1193  $newmenu->add("/societe/card.php?action=create", $langs->trans("MenuNewThirdParty"), 1);
1194  if (!$conf->use_javascript_ajax) {
1195  $newmenu->add("/societe/card.php?action=create&amp;private=1", $langs->trans("MenuNewPrivateIndividual"), 1);
1196  }
1197  }
1198  }
1199 
1200  $newmenu->add("/societe/list.php?leftmenu=thirdparties", $langs->trans("List"), 1);
1201 
1202  // Prospects
1203  if (isModEnabled('societe') && empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) {
1204  $langs->load("commercial");
1205  $newmenu->add("/societe/list.php?type=p&amp;leftmenu=prospects", $langs->trans("ListProspectsShort"), 2, $user->rights->societe->lire, '', $mainmenu, 'prospects');
1206  /* no more required, there is a filter that can do more
1207  if ($usemenuhider || empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/societe/list.php?type=p&amp;sortfield=s.datec&amp;sortorder=desc&amp;begin=&amp;search_stcomm=-1", $langs->trans("LastProspectDoNotContact"), 2, $user->rights->societe->lire);
1208  if ($usemenuhider || empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/societe/list.php?type=p&amp;sortfield=s.datec&amp;sortorder=desc&amp;begin=&amp;search_stcomm=0", $langs->trans("LastProspectNeverContacted"), 2, $user->rights->societe->lire);
1209  if ($usemenuhider || empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/societe/list.php?type=p&amp;sortfield=s.datec&amp;sortorder=desc&amp;begin=&amp;search_stcomm=1", $langs->trans("LastProspectToContact"), 2, $user->rights->societe->lire);
1210  if ($usemenuhider || empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/societe/list.php?type=p&amp;sortfield=s.datec&amp;sortorder=desc&amp;begin=&amp;search_stcomm=2", $langs->trans("LastProspectContactInProcess"), 2, $user->rights->societe->lire);
1211  if ($usemenuhider || empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/societe/list.php?type=p&amp;sortfield=s.datec&amp;sortorder=desc&amp;begin=&amp;search_stcomm=3", $langs->trans("LastProspectContactDone"), 2, $user->rights->societe->lire);
1212  */
1213  $newmenu->add("/societe/card.php?leftmenu=prospects&amp;action=create&amp;type=p", $langs->trans("MenuNewProspect"), 3, $user->rights->societe->creer);
1214  }
1215 
1216  // Customers/Prospects
1217  if (isModEnabled('societe') && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) {
1218  $langs->load("commercial");
1219  $newmenu->add("/societe/list.php?type=c&amp;leftmenu=customers", $langs->trans("ListCustomersShort"), 2, $user->rights->societe->lire, '', $mainmenu, 'customers');
1220 
1221  $newmenu->add("/societe/card.php?leftmenu=customers&amp;action=create&amp;type=c", $langs->trans("MenuNewCustomer"), 3, $user->rights->societe->creer);
1222  }
1223 
1224  // Suppliers
1225  if (isModEnabled('societe') && (((isModEnabled('fournisseur') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled('supplier_order') || isModEnabled('supplier_invoice')) || isModEnabled('supplier_proposal'))) {
1226  $langs->load("suppliers");
1227  $newmenu->add("/societe/list.php?type=f&amp;leftmenu=suppliers", $langs->trans("ListSuppliersShort"), 2, ($user->rights->fournisseur->lire || $user->rights->supplier_order->lire || $user->rights->supplier_invoice->lire || $user->rights->supplier_proposal->lire), '', $mainmenu, 'suppliers');
1228  $newmenu->add("/societe/card.php?leftmenu=suppliers&amp;action=create&amp;type=f", $langs->trans("MenuNewSupplier"), 3, $user->rights->societe->creer && ($user->rights->fournisseur->lire || $user->rights->supplier_order->lire || $user->rights->supplier_invoice->lire || $user->rights->supplier_proposal->lire));
1229  }
1230 
1231  // Categories
1232  if (isModEnabled('categorie')) {
1233  $langs->load("categories");
1234  if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) {
1235  // Categories prospects/customers
1236  $menutoshow = $langs->trans("CustomersProspectsCategoriesShort");
1237  if (!empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) {
1238  $menutoshow = $langs->trans("CustomersCategoriesShort");
1239  }
1240  if (!empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) {
1241  $menutoshow = $langs->trans("ProspectsCategoriesShort");
1242  }
1243  $newmenu->add("/categories/index.php?leftmenu=cat&amp;type=2", $menutoshow, 1, $user->rights->categorie->lire, '', $mainmenu, 'cat');
1244  }
1245  // Categories suppliers
1246  if ((isModEnabled('fournisseur') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled('supplier_order') || isModEnabled('supplier_invoice')) {
1247  $newmenu->add("/categories/index.php?leftmenu=catfournish&amp;type=1", $langs->trans("SuppliersCategoriesShort"), 1, $user->rights->categorie->lire);
1248  }
1249  }
1250 
1251  // Contacts
1252  $newmenu->add("/societe/index.php?leftmenu=thirdparties", (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses")), 0, $user->rights->societe->contact->lire, '', $mainmenu, 'contacts', 0, '', '', '', img_picto('', 'contact', 'class="paddingright pictofixedwidth"'));
1253 
1254  $newmenu->add("/contact/card.php?leftmenu=contacts&amp;action=create", (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("NewContact") : $langs->trans("NewContactAddress")), 1, $user->rights->societe->contact->creer);
1255  $newmenu->add("/contact/list.php?leftmenu=contacts", $langs->trans("List"), 1, $user->rights->societe->contact->lire);
1256  if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) {
1257  $newmenu->add("/contact/list.php?leftmenu=contacts&type=p", $langs->trans("Prospects"), 2, $user->rights->societe->contact->lire);
1258  }
1259  if (empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) {
1260  $newmenu->add("/contact/list.php?leftmenu=contacts&type=c", $langs->trans("Customers"), 2, $user->rights->societe->contact->lire);
1261  }
1262  if ((isModEnabled('fournisseur') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled('supplier_order') || isModEnabled('supplier_invoice')) {
1263  $newmenu->add("/contact/list.php?leftmenu=contacts&type=f", $langs->trans("Suppliers"), 2, $user->rights->societe->contact->lire);
1264  }
1265  $newmenu->add("/contact/list.php?leftmenu=contacts&type=o", $langs->trans("ContactOthers"), 2, $user->rights->societe->contact->lire);
1266  //$newmenu->add("/contact/list.php?userid=$user->id", $langs->trans("MyContacts"), 1, $user->rights->societe->contact->lire);
1267 
1268  // Categories
1269  if (isModEnabled('categorie')) {
1270  $langs->load("categories");
1271  // Categories Contact
1272  $newmenu->add("/categories/index.php?leftmenu=catcontact&amp;type=4", $langs->trans("ContactCategoriesShort"), 1, $user->rights->categorie->lire, '', $mainmenu, 'cat');
1273  }
1274  }
1275 }
1276 
1287 function get_left_menu_commercial($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = 'none', $type_user = 0)
1288 {
1289  global $user, $conf, $langs;
1290 
1291  if ($mainmenu == 'commercial') {
1292  $langs->load("companies");
1293 
1294  // Customer proposal
1295  if (isModEnabled('propal')) {
1296  $langs->load("propal");
1297  $newmenu->add("/comm/propal/index.php?leftmenu=propals", $langs->trans("Proposals"), 0, $user->rights->propale->lire, '', $mainmenu, 'propals', 100, '', '', '', img_picto('', 'propal', 'class="paddingright pictofixedwidth"'));
1298  $newmenu->add("/comm/propal/card.php?action=create&amp;leftmenu=propals", $langs->trans("NewPropal"), 1, $user->rights->propale->creer);
1299  $newmenu->add("/comm/propal/list.php?leftmenu=propals", $langs->trans("List"), 1, $user->rights->propale->lire);
1300  if ($usemenuhider || empty($leftmenu) || $leftmenu == "propals") {
1301  $newmenu->add("/comm/propal/list.php?leftmenu=propals&search_status=0", $langs->trans("PropalsDraft"), 2, $user->rights->propale->lire);
1302  $newmenu->add("/comm/propal/list.php?leftmenu=propals&search_status=1", $langs->trans("PropalsOpened"), 2, $user->rights->propale->lire);
1303  $newmenu->add("/comm/propal/list.php?leftmenu=propals&search_status=2", $langs->trans("PropalStatusSigned"), 2, $user->rights->propale->lire);
1304  $newmenu->add("/comm/propal/list.php?leftmenu=propals&search_status=3", $langs->trans("PropalStatusNotSigned"), 2, $user->rights->propale->lire);
1305  $newmenu->add("/comm/propal/list.php?leftmenu=propals&search_status=4", $langs->trans("PropalStatusBilled"), 2, $user->rights->propale->lire);
1306  //$newmenu->add("/comm/propal/list.php?leftmenu=propals&search_status=2,3,4", $langs->trans("PropalStatusClosedShort"), 2, $user->rights->propale->lire);
1307  }
1308  $newmenu->add("/comm/propal/stats/index.php?leftmenu=propals", $langs->trans("Statistics"), 1, $user->rights->propale->lire);
1309  }
1310 
1311  // Customers orders
1312  if (isModEnabled('commande')) {
1313  $langs->load("orders");
1314  $newmenu->add("/commande/index.php?leftmenu=orders", $langs->trans("CustomersOrders"), 0, $user->rights->commande->lire, '', $mainmenu, 'orders', 200, '', '', '', img_picto('', 'order', 'class="paddingright pictofixedwidth"'));
1315  $newmenu->add("/commande/card.php?action=create&amp;leftmenu=orders", $langs->trans("NewOrder"), 1, $user->rights->commande->creer);
1316  $newmenu->add("/commande/list.php?leftmenu=orders", $langs->trans("List"), 1, $user->rights->commande->lire);
1317  if ($usemenuhider || empty($leftmenu) || $leftmenu == "orders") {
1318  $newmenu->add("/commande/list.php?leftmenu=orders&search_status=0", $langs->trans("StatusOrderDraftShort"), 2, $user->rights->commande->lire);
1319  $newmenu->add("/commande/list.php?leftmenu=orders&search_status=1", $langs->trans("StatusOrderValidated"), 2, $user->rights->commande->lire);
1320  if (isModEnabled('expedition')) {
1321  $newmenu->add("/commande/list.php?leftmenu=orders&search_status=2", $langs->trans("StatusOrderSentShort"), 2, $user->rights->commande->lire);
1322  }
1323  $newmenu->add("/commande/list.php?leftmenu=orders&search_status=3", $langs->trans("StatusOrderDelivered"), 2, $user->rights->commande->lire);
1324  //$newmenu->add("/commande/list.php?leftmenu=orders&search_status=4", $langs->trans("StatusOrderProcessed"), 2, $user->rights->commande->lire);
1325  $newmenu->add("/commande/list.php?leftmenu=orders&search_status=-1", $langs->trans("StatusOrderCanceledShort"), 2, $user->rights->commande->lire);
1326  }
1327  $newmenu->add("/commande/stats/index.php?leftmenu=orders", $langs->trans("Statistics"), 1, $user->rights->commande->lire);
1328  }
1329 
1330  // Supplier proposal
1331  if (isModEnabled('supplier_proposal')) {
1332  $langs->load("supplier_proposal");
1333  $newmenu->add("/supplier_proposal/index.php?leftmenu=propals_supplier", $langs->trans("SupplierProposalsShort"), 0, $user->rights->supplier_proposal->lire, '', $mainmenu, 'propals_supplier', 300, '', '', '', img_picto('', 'supplier_proposal', 'class="paddingright pictofixedwidth"'));
1334  $newmenu->add("/supplier_proposal/card.php?action=create&amp;leftmenu=supplier_proposals", $langs->trans("SupplierProposalNew"), 1, $user->rights->supplier_proposal->creer);
1335  $newmenu->add("/supplier_proposal/list.php?leftmenu=supplier_proposals", $langs->trans("List"), 1, $user->rights->supplier_proposal->lire);
1336  $newmenu->add("/comm/propal/stats/index.php?leftmenu=supplier_proposals&amp;mode=supplier", $langs->trans("Statistics"), 1, $user->rights->supplier_proposal->lire);
1337  }
1338 
1339  // Suppliers orders
1340  if (isModEnabled('supplier_order')) {
1341  $langs->load("orders");
1342  $newmenu->add("/fourn/commande/index.php?leftmenu=orders_suppliers", $langs->trans("SuppliersOrders"), 0, $user->rights->fournisseur->commande->lire, '', $mainmenu, 'orders_suppliers', 400, '', '', '', img_picto('', 'supplier_order', 'class="paddingright pictofixedwidth"'));
1343  $newmenu->add("/fourn/commande/card.php?action=create&amp;leftmenu=orders_suppliers", $langs->trans("NewSupplierOrderShort"), 1, $user->rights->fournisseur->commande->creer);
1344  $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers", $langs->trans("List"), 1, $user->rights->fournisseur->commande->lire);
1345 
1346  if ($usemenuhider || empty($leftmenu) || $leftmenu == "orders_suppliers") {
1347  $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=0", $langs->trans("StatusSupplierOrderDraftShort"), 2, $user->rights->fournisseur->commande->lire);
1348  if (empty($conf->global->SUPPLIER_ORDER_HIDE_VALIDATED)) {
1349  $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=1", $langs->trans("StatusSupplierOrderValidated"), 2, $user->rights->fournisseur->commande->lire);
1350  }
1351  $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=2", $langs->trans("StatusSupplierOrderApprovedShort"), 2, $user->rights->fournisseur->commande->lire);
1352  $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=3", $langs->trans("StatusSupplierOrderOnProcessShort"), 2, $user->rights->fournisseur->commande->lire);
1353  $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=4", $langs->trans("StatusSupplierOrderReceivedPartiallyShort"), 2, $user->rights->fournisseur->commande->lire);
1354  $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=5", $langs->trans("StatusSupplierOrderReceivedAll"), 2, $user->rights->fournisseur->commande->lire);
1355  $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=6,7", $langs->trans("StatusSupplierOrderCanceled"), 2, $user->rights->fournisseur->commande->lire);
1356  $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=9", $langs->trans("StatusSupplierOrderRefused"), 2, $user->rights->fournisseur->commande->lire);
1357  }
1358  // Billed is another field. We should add instead a dedicated filter on list. if ($usemenuhider || empty($leftmenu) || $leftmenu=="orders_suppliers") $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&billed=1", $langs->trans("Billed"), 2, $user->rights->fournisseur->commande->lire);
1359 
1360 
1361  $newmenu->add("/commande/stats/index.php?leftmenu=orders_suppliers&amp;mode=supplier", $langs->trans("Statistics"), 1, $user->rights->fournisseur->commande->lire);
1362  }
1363 
1364  // Contrat
1365  if (isModEnabled('contrat')) {
1366  $langs->load("contracts");
1367  $newmenu->add("/contrat/index.php?leftmenu=contracts", $langs->trans("ContractsSubscriptions"), 0, $user->rights->contrat->lire, '', $mainmenu, 'contracts', 2000, '', '', '', img_picto('', 'contract', 'class="paddingright pictofixedwidth"'));
1368  $newmenu->add("/contrat/card.php?action=create&amp;leftmenu=contracts", $langs->trans("NewContractSubscription"), 1, $user->rights->contrat->creer);
1369  $newmenu->add("/contrat/list.php?leftmenu=contracts", $langs->trans("List"), 1, $user->rights->contrat->lire);
1370  $newmenu->add("/contrat/services_list.php?leftmenu=contracts", $langs->trans("MenuServices"), 1, $user->rights->contrat->lire);
1371  if ($usemenuhider || empty($leftmenu) || $leftmenu == "contracts") {
1372  $newmenu->add("/contrat/services_list.php?leftmenu=contracts&amp;mode=0", $langs->trans("MenuInactiveServices"), 2, $user->rights->contrat->lire);
1373  $newmenu->add("/contrat/services_list.php?leftmenu=contracts&amp;mode=4", $langs->trans("MenuRunningServices"), 2, $user->rights->contrat->lire);
1374  $newmenu->add("/contrat/services_list.php?leftmenu=contracts&amp;mode=4&amp;filter=expired", $langs->trans("MenuExpiredServices"), 2, $user->rights->contrat->lire);
1375  $newmenu->add("/contrat/services_list.php?leftmenu=contracts&amp;mode=5", $langs->trans("MenuClosedServices"), 2, $user->rights->contrat->lire);
1376  }
1377  }
1378 
1379  // Interventions
1380  if (isModEnabled('ficheinter')) {
1381  $langs->load("interventions");
1382  $newmenu->add("/fichinter/index.php?leftmenu=ficheinter", $langs->trans("Interventions"), 0, $user->rights->ficheinter->lire, '', $mainmenu, 'ficheinter', 2200, '', '', '', img_picto('', 'intervention', 'class="paddingright pictofixedwidth"'));
1383  $newmenu->add("/fichinter/card.php?action=create&amp;leftmenu=ficheinter", $langs->trans("NewIntervention"), 1, $user->rights->ficheinter->creer, '', '', '', 201);
1384  $newmenu->add("/fichinter/list.php?leftmenu=ficheinter", $langs->trans("List"), 1, $user->rights->ficheinter->lire, '', '', '', 202);
1385  if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
1386  $newmenu->add("/fichinter/card-rec.php?leftmenu=ficheinter", $langs->trans("ListOfTemplates"), 1, $user->rights->ficheinter->lire, '', '', '', 203);
1387  }
1388  $newmenu->add("/fichinter/stats/index.php?leftmenu=ficheinter", $langs->trans("Statistics"), 1, $user->rights->ficheinter->lire);
1389  }
1390  }
1391 }
1392 
1403 function get_left_menu_billing($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = 'none', $type_user = 0)
1404 {
1405  global $user, $conf, $langs;
1406 
1407  if ($mainmenu == 'billing') {
1408  $langs->load("companies");
1409 
1410  // Customers invoices
1411  if (isModEnabled('facture')) {
1412  $langs->load("bills");
1413  $newmenu->add("/compta/facture/index.php?leftmenu=customers_bills", $langs->trans("BillsCustomers"), 0, $user->rights->facture->lire, '', $mainmenu, 'customers_bills', 0, '', '', '', img_picto('', 'bill', 'class="paddingright pictofixedwidth"'));
1414  $newmenu->add("/compta/facture/card.php?action=create", $langs->trans("NewBill"), 1, $user->rights->facture->creer);
1415  $newmenu->add("/compta/facture/list.php?leftmenu=customers_bills", $langs->trans("List"), 1, $user->rights->facture->lire, '', $mainmenu, 'customers_bills_list');
1416 
1417  if ($usemenuhider || empty($leftmenu) || preg_match('/customers_bills(|_draft|_notpaid|_paid|_canceled)$/', $leftmenu)) {
1418  $newmenu->add("/compta/facture/list.php?leftmenu=customers_bills_draft&amp;search_status=0", $langs->trans("BillShortStatusDraft"), 2, $user->rights->facture->lire);
1419  $newmenu->add("/compta/facture/list.php?leftmenu=customers_bills_notpaid&amp;search_status=1", $langs->trans("BillShortStatusNotPaid"), 2, $user->rights->facture->lire);
1420  $newmenu->add("/compta/facture/list.php?leftmenu=customers_bills_paid&amp;search_status=2", $langs->trans("BillShortStatusPaid"), 2, $user->rights->facture->lire);
1421  $newmenu->add("/compta/facture/list.php?leftmenu=customers_bills_canceled&amp;search_status=3", $langs->trans("BillShortStatusCanceled"), 2, $user->rights->facture->lire);
1422  }
1423  $newmenu->add("/compta/facture/invoicetemplate_list.php?leftmenu=customers_bills_templates", $langs->trans("ListOfTemplates"), 1, $user->rights->facture->creer, '', $mainmenu, 'customers_bills_templates'); // No need to see recurring invoices, if user has no permission to create invoice.
1424 
1425  $newmenu->add("/compta/paiement/list.php?leftmenu=customers_bills_payment", $langs->trans("Payments"), 1, $user->rights->facture->lire, '', $mainmenu, 'customers_bills_payment');
1426 
1427  if (!empty($conf->global->BILL_ADD_PAYMENT_VALIDATION)) {
1428  $newmenu->add("/compta/paiement/tovalidate.php?leftmenu=customers_bills_tovalid", $langs->trans("MenuToValid"), 2, $user->rights->facture->lire, '', $mainmenu, 'customer_bills_tovalid');
1429  }
1430  if ($usemenuhider || empty($leftmenu) || preg_match('/customers_bills/', $leftmenu)) {
1431  $newmenu->add("/compta/paiement/rapport.php?leftmenu=customers_bills_payment_report", $langs->trans("Reportings"), 2, $user->rights->facture->lire, '', $mainmenu, 'customers_bills_payment_report');
1432  }
1433 
1434  $newmenu->add("/compta/facture/stats/index.php?leftmenu=customers_bills_stats", $langs->trans("Statistics"), 1, $user->rights->facture->lire, '', $mainmenu, 'customers_bills_stats');
1435  }
1436 
1437  // Suppliers invoices
1438  if (isModEnabled('societe') && isModEnabled('supplier_invoice')) {
1439  $langs->load("bills");
1440  $newmenu->add("/fourn/facture/index.php?leftmenu=suppliers_bills", $langs->trans("BillsSuppliers"), 0, $user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills', 0, '', '', '', img_picto('', 'supplier_invoice', 'class="paddingright pictofixedwidth"'));
1441  $newmenu->add("/fourn/facture/card.php?leftmenu=suppliers_bills&amp;action=create", $langs->trans("NewBill"), 1, ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer), '', $mainmenu, 'suppliers_bills_create');
1442  $newmenu->add("/fourn/facture/list.php?leftmenu=suppliers_bills", $langs->trans("List"), 1, $user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills_list');
1443 
1444  if ($usemenuhider || empty($leftmenu) || preg_match('/suppliers_bills/', $leftmenu)) {
1445  $newmenu->add("/fourn/facture/list.php?leftmenu=suppliers_bills_draft&amp;search_status=0", $langs->trans("BillShortStatusDraft"), 2, $user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills_draft');
1446  $newmenu->add("/fourn/facture/list.php?leftmenu=suppliers_bills_notpaid&amp;search_status=1", $langs->trans("BillShortStatusNotPaid"), 2, $user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills_notpaid');
1447  $newmenu->add("/fourn/facture/list.php?leftmenu=suppliers_bills_paid&amp;search_status=2", $langs->trans("BillShortStatusPaid"), 2, $user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills_paid');
1448  }
1449 
1450  $newmenu->add("/fourn/facture/list-rec.php?leftmenu=supplierinvoicestemplate_list", $langs->trans("ListOfTemplates"), 1, $user->rights->fournisseur->facture->lire, '', $mainmenu, 'supplierinvoicestemplate_list');
1451 
1452  $newmenu->add("/fourn/paiement/list.php?leftmenu=suppliers_bills_payment", $langs->trans("Payments"), 1, $user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills_payment');
1453 
1454  if ($usemenuhider || empty($leftmenu) || preg_match('/suppliers_bills/', $leftmenu)) {
1455  $newmenu->add("/fourn/facture/rapport.php?leftmenu=suppliers_bills_payment_report", $langs->trans("Reportings"), 2, $user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills_payment_report');
1456  }
1457 
1458  $newmenu->add("/compta/facture/stats/index.php?mode=supplier&amp;leftmenu=suppliers_bills_stats", $langs->trans("Statistics"), 1, $user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills_stats');
1459  }
1460 
1461  // Orders
1462  if (isModEnabled('commande')) {
1463  $langs->load("orders");
1464  if (isModEnabled('facture')) {
1465  $newmenu->add("/commande/list.php?leftmenu=orders&amp;search_status=-3&amp;billed=0&amp;contextpage=billableorders", $langs->trans("MenuOrdersToBill2"), 0, $user->rights->commande->lire, '', $mainmenu, 'orders', 0, '', '', '', img_picto('', 'order', 'class="paddingright pictofixedwidth"'));
1466  }
1467  //if ($usemenuhider || empty($leftmenu) || $leftmenu=="orders") $newmenu->add("/commande/", $langs->trans("StatusOrderToBill"), 1, $user->rights->commande->lire);
1468  }
1469 
1470  // Supplier Orders to bill
1471  if (isModEnabled('supplier_invoice')) {
1472  if (!empty($conf->global->SUPPLIER_MENU_ORDER_RECEIVED_INTO_INVOICE)) {
1473  $langs->load("supplier");
1474  $newmenu->add("/fourn/commande/list.php?leftmenu=orders&amp;search_status=5&amp;billed=0", $langs->trans("MenuOrdersSupplierToBill"), 0, $user->rights->commande->lire, '', $mainmenu, 'orders', 0, '', '', '', img_picto('', 'supplier_order', 'class="paddingright pictofixedwidth"'));
1475  //if ($usemenuhider || empty($leftmenu) || $leftmenu=="orders") $newmenu->add("/commande/", $langs->trans("StatusOrderToBill"), 1, $user->rights->commande->lire);
1476  }
1477  }
1478 
1479 
1480  // Donations
1481  if (isModEnabled('don')) {
1482  $langs->load("donations");
1483  $newmenu->add("/don/index.php?leftmenu=donations&amp;mainmenu=billing", $langs->trans("Donations"), 0, $user->rights->don->lire, '', $mainmenu, 'donations', 0, '', '', '', img_picto('', 'donation', 'class="paddingright pictofixedwidth"'));
1484  if ($usemenuhider || empty($leftmenu) || $leftmenu == "donations") {
1485  $newmenu->add("/don/card.php?leftmenu=donations&amp;action=create", $langs->trans("NewDonation"), 1, $user->rights->don->creer);
1486  $newmenu->add("/don/list.php?leftmenu=donations", $langs->trans("List"), 1, $user->rights->don->lire);
1487  }
1488  // if ($leftmenu=="donations") $newmenu->add("/don/stats/index.php",$langs->trans("Statistics"), 1, $user->rights->don->lire);
1489  }
1490 
1491  // Taxes and social contributions
1492  if (isModEnabled('tax')) {
1493  $newmenu->add("/compta/charges/index.php?leftmenu=tax&amp;mainmenu=billing", $langs->trans("MenuTaxesAndSpecialExpenses"), 0, $user->rights->tax->charges->lire, '', $mainmenu, 'tax', 0, '', '', '', img_picto('', 'payment', 'class="paddingright pictofixedwidth"'));
1494 
1495  $newmenu->add("/compta/sociales/list.php?leftmenu=tax_social", $langs->trans("MenuSocialContributions"), 1, $user->rights->tax->charges->lire);
1496  if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_social/i', $leftmenu)) {
1497  $newmenu->add("/compta/sociales/card.php?leftmenu=tax_social&action=create", $langs->trans("MenuNewSocialContribution"), 2, $user->rights->tax->charges->creer);
1498  $newmenu->add("/compta/sociales/list.php?leftmenu=tax_social", $langs->trans("List"), 2, $user->rights->tax->charges->lire);
1499  $newmenu->add("/compta/sociales/payments.php?leftmenu=tax_social&amp;mainmenu=billing", $langs->trans("Payments"), 2, $user->rights->tax->charges->lire);
1500  }
1501  // VAT
1502  if (empty($conf->global->TAX_DISABLE_VAT_MENUS)) {
1503  global $mysoc;
1504 
1505  $newmenu->add("/compta/tva/list.php?leftmenu=tax_vat&amp;mainmenu=billing", $langs->transcountry("VAT", $mysoc->country_code), 1, $user->rights->tax->charges->lire, '', $mainmenu, 'tax_vat');
1506  if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_vat/i', $leftmenu)) {
1507  $newmenu->add("/compta/tva/card.php?leftmenu=tax_vat&action=create", $langs->trans("New"), 2, $user->rights->tax->charges->creer);
1508  $newmenu->add("/compta/tva/list.php?leftmenu=tax_vat", $langs->trans("List"), 2, $user->rights->tax->charges->lire);
1509  $newmenu->add("/compta/tva/payments.php?mode=tvaonly&amp;leftmenu=tax_vat", $langs->trans("Payments"), 2, $user->rights->tax->charges->lire);
1510  $newmenu->add("/compta/tva/index.php?leftmenu=tax_vat", $langs->trans("ReportByMonth"), 2, $user->rights->tax->charges->lire);
1511  $newmenu->add("/compta/tva/clients.php?leftmenu=tax_vat", $langs->trans("ReportByThirdparties"), 2, $user->rights->tax->charges->lire);
1512  $newmenu->add("/compta/tva/quadri_detail.php?leftmenu=tax_vat", $langs->trans("ReportByQuarter"), 2, $user->rights->tax->charges->lire);
1513  }
1514 
1515  //Local Taxes 1
1516  if ($mysoc->useLocalTax(1) && (isset($mysoc->localtax1_assuj) && $mysoc->localtax1_assuj == "1")) {
1517  $newmenu->add("/compta/localtax/list.php?leftmenu=tax_1_vat&amp;mainmenu=billing&amp;localTaxType=1", $langs->transcountry("LT1", $mysoc->country_code), 1, $user->rights->tax->charges->lire);
1518  if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_1_vat/i', $leftmenu)) {
1519  $newmenu->add("/compta/localtax/card.php?leftmenu=tax_1_vat&action=create&amp;localTaxType=1", $langs->trans("New"), 2, $user->rights->tax->charges->creer);
1520  $newmenu->add("/compta/localtax/list.php?leftmenu=tax_1_vat&amp;localTaxType=1", $langs->trans("List"), 2, $user->rights->tax->charges->lire);
1521  $newmenu->add("/compta/localtax/index.php?leftmenu=tax_1_vat&amp;localTaxType=1", $langs->trans("ReportByMonth"), 2, $user->rights->tax->charges->lire);
1522  $newmenu->add("/compta/localtax/clients.php?leftmenu=tax_1_vat&amp;localTaxType=1", $langs->trans("ReportByThirdparties"), 2, $user->rights->tax->charges->lire);
1523  $newmenu->add("/compta/localtax/quadri_detail.php?leftmenu=tax_1_vat&amp;localTaxType=1", $langs->trans("ReportByQuarter"), 2, $user->rights->tax->charges->lire);
1524  }
1525  }
1526  //Local Taxes 2
1527  if ($mysoc->useLocalTax(2) && (isset($mysoc->localtax2_assuj) && $mysoc->localtax2_assuj == "1")) {
1528  $newmenu->add("/compta/localtax/list.php?leftmenu=tax_2_vat&amp;mainmenu=billing&amp;localTaxType=2", $langs->transcountry("LT2", $mysoc->country_code), 1, $user->rights->tax->charges->lire);
1529  if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_2_vat/i', $leftmenu)) {
1530  $newmenu->add("/compta/localtax/card.php?leftmenu=tax_2_vat&action=create&amp;localTaxType=2", $langs->trans("New"), 2, $user->rights->tax->charges->creer);
1531  $newmenu->add("/compta/localtax/list.php?leftmenu=tax_2_vat&amp;localTaxType=2", $langs->trans("List"), 2, $user->rights->tax->charges->lire);
1532  $newmenu->add("/compta/localtax/index.php?leftmenu=tax_2_vat&amp;localTaxType=2", $langs->trans("ReportByMonth"), 2, $user->rights->tax->charges->lire);
1533  $newmenu->add("/compta/localtax/clients.php?leftmenu=tax_2_vat&amp;localTaxType=2", $langs->trans("ReportByThirdparties"), 2, $user->rights->tax->charges->lire);
1534  $newmenu->add("/compta/localtax/quadri_detail.php?leftmenu=tax_2_vat&amp;localTaxType=2", $langs->trans("ReportByQuarter"), 2, $user->rights->tax->charges->lire);
1535  }
1536  }
1537  }
1538  }
1539 
1540  // Salaries
1541  if (isModEnabled('salaries')) {
1542  $langs->load("salaries");
1543  $newmenu->add("/salaries/list.php?leftmenu=tax_salary&amp;mainmenu=billing", $langs->trans("Salaries"), 0, $user->rights->salaries->read, '', $mainmenu, 'tax_salary', 0, '', '', '', img_picto('', 'salary', 'class="paddingright pictofixedwidth"'));
1544  if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_salary/i', $leftmenu)) {
1545  $newmenu->add("/salaries/card.php?leftmenu=tax_salary&action=create", $langs->trans("New"), 1, $user->rights->salaries->write);
1546  $newmenu->add("/salaries/list.php?leftmenu=tax_salary", $langs->trans("List"), 1, $user->rights->salaries->read);
1547  $newmenu->add("/salaries/payments.php?leftmenu=tax_salary", $langs->trans("Payments"), 1, $user->rights->salaries->read);
1548  $newmenu->add("/salaries/stats/index.php?leftmenu=tax_salary", $langs->trans("Statistics"), 1, $user->rights->salaries->read);
1549  }
1550  }
1551 
1552  // Loan
1553  if (isModEnabled('loan')) {
1554  $langs->load("loan");
1555  $newmenu->add("/loan/list.php?leftmenu=tax_loan&amp;mainmenu=billing", $langs->trans("Loans"), 0, $user->rights->loan->read, '', $mainmenu, 'tax_loan', 0, '', '', '', img_picto('', 'loan', 'class="paddingright pictofixedwidth"'));
1556  if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_loan/i', $leftmenu)) {
1557  $newmenu->add("/loan/card.php?leftmenu=tax_loan&action=create", $langs->trans("NewLoan"), 1, $user->rights->loan->write);
1558  //$newmenu->add("/loan/payment/list.php?leftmenu=tax_loan",$langs->trans("Payments"),2,$user->rights->loan->read);
1559  }
1560  }
1561 
1562  // Various payment
1563  if (isModEnabled('banque') && empty($conf->global->BANK_USE_OLD_VARIOUS_PAYMENT)) {
1564  $langs->load("banks");
1565  $newmenu->add("/compta/bank/various_payment/list.php?leftmenu=tax_various&amp;mainmenu=billing", $langs->trans("MenuVariousPayment"), 0, $user->rights->banque->lire, '', $mainmenu, 'tax_various', 0, '', '', '', img_picto('', 'payment', 'class="paddingright pictofixedwidth"'));
1566  if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_various/i', $leftmenu)) {
1567  $newmenu->add("/compta/bank/various_payment/card.php?leftmenu=tax_various&action=create", $langs->trans("New"), 1, $user->rights->banque->modifier);
1568  $newmenu->add("/compta/bank/various_payment/list.php?leftmenu=tax_various", $langs->trans("List"), 1, $user->rights->banque->lire);
1569  }
1570  }
1571  }
1572 }
1573 
1584 function get_left_menu_accountancy($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = 'none', $type_user = 0)
1585 {
1586  global $user, $conf, $langs;
1587  global $db;
1588 
1589  if ($mainmenu == 'accountancy') {
1590  $langs->load("companies");
1591 
1592  // Accounting (Double entries)
1593  if (isModEnabled('accounting')) {
1594  //$permtoshowmenu = (isModEnabled('accounting') || $user->rights->accounting->bind->write || $user->rights->compta->resultat->lire);
1595  //$newmenu->add("/accountancy/index.php?leftmenu=accountancy", $langs->trans("MenuAccountancy"), 0, $permtoshowmenu, '', $mainmenu, 'accountancy');
1596 
1597  // Configuration
1598  $newmenu->add("/accountancy/index.php?leftmenu=accountancy_admin", $langs->trans("Setup"), 0, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin', 1, '', '', '', img_picto('', 'technic', 'class="paddingright pictofixedwidth"'));
1599  if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/', $leftmenu)) {
1600  global $mysoc;
1601  $newmenu->add("/accountancy/admin/index.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("General"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_general', 10);
1602 
1603  // Fiscal year - Not really yet used. In a future will lock some periods.
1604  if ($conf->global->MAIN_FEATURES_LEVEL > 1) {
1605  $newmenu->add("/accountancy/admin/fiscalyear.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("FiscalPeriod"), 1, $user->rights->accounting->fiscalyear->write, '', $mainmenu, 'fiscalyear', 20);
1606  }
1607 
1608  $newmenu->add("/accountancy/admin/journals_list.php?id=35&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("AccountingJournals"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_journal', 30);
1609  $newmenu->add("/accountancy/admin/accountmodel.php?id=31&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("Pcg_version"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_chartmodel', 40);
1610  $newmenu->add("/accountancy/admin/account.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("Chartofaccounts"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_chart', 41);
1611  $newmenu->add("/accountancy/admin/subaccount.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("ChartOfSubaccounts"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_chart', 41);
1612  $newmenu->add("/accountancy/admin/categories_list.php?id=32&search_country_id=".$mysoc->country_id."&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("AccountingCategory"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_chart', 50);
1613  $newmenu->add("/accountancy/admin/defaultaccounts.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuDefaultAccounts"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_default', 60);
1614  if (isModEnabled('banque')) {
1615  $newmenu->add("/compta/bank/list.php?mainmenu=accountancy&leftmenu=accountancy_admin&search_status=-1", $langs->trans("MenuBankAccounts"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_bank', 70);
1616  }
1617  if (isModEnabled('facture') || ((isModEnabled('fournisseur') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled('supplier_invoice'))) {
1618  $newmenu->add("/admin/dict.php?id=10&from=accountancy&search_country_id=".$mysoc->country_id."&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuVatAccounts"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_default', 80);
1619  }
1620  if (isModEnabled('tax')) {
1621  $newmenu->add("/admin/dict.php?id=7&from=accountancy&search_country_id=".$mysoc->country_id."&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuTaxAccounts"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_default', 90);
1622  }
1623  if (isModEnabled('expensereport')) {
1624  $newmenu->add("/admin/dict.php?id=17&from=accountancy&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuExpenseReportAccounts"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_default', 100);
1625  }
1626  $newmenu->add("/accountancy/admin/productaccount.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuProductsAccounts"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_product', 110);
1627  if ($conf->global->MAIN_FEATURES_LEVEL > 1) {
1628  $newmenu->add("/accountancy/admin/closure.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuClosureAccounts"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_closure', 120);
1629  }
1630  $newmenu->add("/accountancy/admin/export.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("ExportOptions"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_export', 130);
1631  }
1632 
1633  // Transfer in accounting
1634  $newmenu->add("/accountancy/index.php?leftmenu=accountancy_transfer", $langs->trans("TransferInAccounting"), 0, $user->rights->accounting->bind->write, '', $mainmenu, 'transfer', 1, '', '', '', img_picto('', 'long-arrow-alt-right', 'class="paddingright pictofixedwidth"'));
1635 
1636  // Binding
1637  // $newmenu->add("", $langs->trans("Binding"), 0, $user->rights->accounting->bind->write, '', $mainmenu, 'dispatch');
1638  if (isModEnabled('facture') && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_SALES)) {
1639  $newmenu->add("/accountancy/customer/index.php?leftmenu=accountancy_dispatch_customer&amp;mainmenu=accountancy", $langs->trans("CustomersVentilation"), 1, $user->rights->accounting->bind->write, '', $mainmenu, 'dispatch_customer');
1640  if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_dispatch_customer/', $leftmenu)) {
1641  $newmenu->add("/accountancy/customer/list.php?mainmenu=accountancy&amp;leftmenu=accountancy_dispatch_customer", $langs->trans("ToBind"), 2, $user->rights->accounting->bind->write);
1642  $newmenu->add("/accountancy/customer/lines.php?mainmenu=accountancy&amp;leftmenu=accountancy_dispatch_customer", $langs->trans("Binded"), 2, $user->rights->accounting->bind->write);
1643  }
1644  }
1645  if (isModEnabled('supplier_invoice') && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_PURCHASES)) {
1646  $newmenu->add("/accountancy/supplier/index.php?leftmenu=accountancy_dispatch_supplier&amp;mainmenu=accountancy", $langs->trans("SuppliersVentilation"), 1, $user->rights->accounting->bind->write, '', $mainmenu, 'dispatch_supplier');
1647  if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_dispatch_supplier/', $leftmenu)) {
1648  $newmenu->add("/accountancy/supplier/list.php?mainmenu=accountancy&amp;leftmenu=accountancy_dispatch_supplier", $langs->trans("ToBind"), 2, $user->rights->accounting->bind->write);
1649  $newmenu->add("/accountancy/supplier/lines.php?mainmenu=accountancy&amp;leftmenu=accountancy_dispatch_supplier", $langs->trans("Binded"), 2, $user->rights->accounting->bind->write);
1650  }
1651  }
1652  if (isModEnabled('expensereport') && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS)) {
1653  $newmenu->add("/accountancy/expensereport/index.php?leftmenu=accountancy_dispatch_expensereport&amp;mainmenu=accountancy", $langs->trans("ExpenseReportsVentilation"), 1, $user->rights->accounting->bind->write, '', $mainmenu, 'dispatch_expensereport');
1654  if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_dispatch_expensereport/', $leftmenu)) {
1655  $newmenu->add("/accountancy/expensereport/list.php?mainmenu=accountancy&amp;leftmenu=accountancy_dispatch_expensereport", $langs->trans("ToBind"), 2, $user->rights->accounting->bind->write);
1656  $newmenu->add("/accountancy/expensereport/lines.php?mainmenu=accountancy&amp;leftmenu=accountancy_dispatch_expensereport", $langs->trans("Binded"), 2, $user->rights->accounting->bind->write);
1657  }
1658  }
1659 
1660  // Journals
1661  if (isModEnabled('accounting') && !empty($user->rights->accounting->comptarapport->lire) && $mainmenu == 'accountancy') {
1662  $newmenu->add('', $langs->trans("RegistrationInAccounting"), 1, $user->rights->accounting->comptarapport->lire, '', $mainmenu, 'accountancy_journal');
1663 
1664  // Multi journal
1665  $sql = "SELECT rowid, code, label, nature";
1666  $sql .= " FROM ".MAIN_DB_PREFIX."accounting_journal";
1667  $sql .= " WHERE entity = ".$conf->entity;
1668  $sql .= " AND active = 1";
1669  $sql .= " ORDER BY nature ASC, label DESC";
1670 
1671  $resql = $db->query($sql);
1672  if ($resql) {
1673  $numr = $db->num_rows($resql);
1674  $i = 0;
1675 
1676  if ($numr > 0) {
1677  while ($i < $numr) {
1678  $objp = $db->fetch_object($resql);
1679 
1680  $nature = '';
1681 
1682  // Must match array $sourceList defined into journals_list.php
1683  if ($objp->nature == 2 && isModEnabled('facture') && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_SALES)) {
1684  $nature = "sells";
1685  }
1686  if ($objp->nature == 3
1687  && ((isModEnabled('fournisseur') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled('supplier_invoice'))
1688  && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_PURCHASES)) {
1689  $nature = "purchases";
1690  }
1691  if ($objp->nature == 4 && isModEnabled('banque')) {
1692  $nature = "bank";
1693  }
1694  if ($objp->nature == 5 && isModEnabled('expensereport') && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS)) {
1695  $nature = "expensereports";
1696  }
1697  if ($objp->nature == 1 && isModEnabled('asset')) {
1698  $nature = "various"; // Warning: The page /accountancy/journal/variousjournal.php is bugged. It read tables that does not exists.
1699  }
1700  if ($objp->nature == 8) {
1701  $nature = "inventory";
1702  }
1703  if ($objp->nature == 9) {
1704  $nature = "hasnew";
1705  }
1706 
1707  // To enable when page exists
1708  if (empty($conf->global->ACCOUNTANCY_SHOW_DEVELOP_JOURNAL)) {
1709  if ($nature == 'hasnew' || $nature == 'inventory') {
1710  $nature = '';
1711  }
1712  }
1713 
1714  if ($nature) {
1715  $langs->load('accountancy');
1716  $journallabel = $langs->transnoentities($objp->label); // Labels in this table are set by loading llx_accounting_abc.sql. Label can be 'ACCOUNTING_SELL_JOURNAL', 'InventoryJournal', ...
1717  $newmenu->add('/accountancy/journal/'.$nature.'journal.php?mainmenu=accountancy&leftmenu=accountancy_journal&id_journal='.$objp->rowid, $journallabel, 2, $user->rights->accounting->comptarapport->lire);
1718  }
1719  $i++;
1720  }
1721  } else {
1722  // Should not happend. Entries are added
1723  $newmenu->add('', $langs->trans("NoJournalDefined"), 2, $user->rights->accounting->comptarapport->lire);
1724  }
1725  } else {
1726  dol_print_error($db);
1727  }
1728  $db->free($resql);
1729  }
1730 
1731  // Files
1732  if (empty($conf->global->ACCOUNTANCY_HIDE_EXPORT_FILES_MENU)) {
1733  $newmenu->add("/compta/accounting-files.php?mainmenu=accountancy&amp;leftmenu=accountancy_files", $langs->trans("AccountantFiles"), 1, $user->rights->accounting->mouvements->lire);
1734  }
1735 
1736 
1737  // Accounting
1738  $newmenu->add("/accountancy/index.php?leftmenu=accountancy_accountancy", $langs->trans("MenuAccountancy"), 0, $user->rights->accounting->mouvements->lire || $user->rights->accounting->comptarapport->lire, '', $mainmenu, 'accountancy', 1, '', '', '', img_picto('', 'accountancy', 'class="paddingright pictofixedwidth"'));
1739 
1740  // General Ledger
1741  $newmenu->add("/accountancy/bookkeeping/listbyaccount.php?mainmenu=accountancy&amp;leftmenu=accountancy_accountancy", $langs->trans("Bookkeeping"), 1, $user->rights->accounting->mouvements->lire);
1742 
1743  // Journals
1744  $newmenu->add("/accountancy/bookkeeping/list.php?mainmenu=accountancy&amp;leftmenu=accountancy_accountancy", $langs->trans("Journals"), 1, $user->rights->accounting->mouvements->lire);
1745 
1746  // Account Balance
1747  $newmenu->add("/accountancy/bookkeeping/balance.php?mainmenu=accountancy&amp;leftmenu=accountancy_accountancy", $langs->trans("AccountBalance"), 1, $user->rights->accounting->mouvements->lire);
1748 
1749  // Closure
1750  $newmenu->add("/accountancy/closure/index.php?mainmenu=accountancy&amp;leftmenu=accountancy_closure", $langs->trans("MenuAccountancyClosure"), 1, $user->rights->accounting->fiscalyear->write, '', $mainmenu, 'closure');
1751 
1752  // Reports
1753  $newmenu->add("/accountancy/index.php?leftmenu=accountancy_report", $langs->trans("Reportings"), 1, $user->rights->accounting->comptarapport->lire, '', $mainmenu, 'ca');
1754 
1755  if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/', $leftmenu)) {
1756  $newmenu->add("/compta/resultat/index.php?leftmenu=accountancy_report", $langs->trans("MenuReportInOut"), 2, $user->rights->accounting->comptarapport->lire);
1757  $newmenu->add("/compta/resultat/clientfourn.php?leftmenu=accountancy_report", $langs->trans("ByPredefinedAccountGroups"), 3, $user->rights->accounting->comptarapport->lire);
1758  $newmenu->add("/compta/resultat/result.php?leftmenu=accountancy_report", $langs->trans("ByPersonalizedAccountGroups"), 3, $user->rights->accounting->comptarapport->lire);
1759  }
1760 
1761  $modecompta = 'CREANCES-DETTES';
1762  if (isModEnabled('accounting') && !empty($user->rights->accounting->comptarapport->lire) && $mainmenu == 'accountancy') {
1763  $modecompta = 'BOOKKEEPING'; // Not yet implemented. Should be BOOKKEEPINGCOLLECTED
1764  }
1765  if ($modecompta) {
1766  if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/', $leftmenu)) {
1767  $newmenu->add("/compta/stats/index.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ReportTurnover"), 2, $user->rights->accounting->comptarapport->lire);
1768  $newmenu->add("/compta/stats/casoc.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 3, $user->rights->accounting->comptarapport->lire);
1769  $newmenu->add("/compta/stats/cabyuser.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByUsers"), 3, $user->rights->accounting->comptarapport->lire);
1770  $newmenu->add("/compta/stats/cabyprodserv.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByProductsAndServices"), 3, $user->rights->accounting->comptarapport->lire);
1771  $newmenu->add("/compta/stats/byratecountry.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByVatRate"), 3, $user->rights->accounting->comptarapport->lire);
1772  }
1773  }
1774 
1775  $modecompta = 'RECETTES-DEPENSES';
1776  //if (isModEnabled('accounting') && ! empty($user->rights->accounting->comptarapport->lire) && $mainmenu == 'accountancy') $modecompta=''; // Not yet implemented. Should be BOOKKEEPINGCOLLECTED
1777  if ($modecompta) {
1778  if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/', $leftmenu)) {
1779  $newmenu->add("/compta/stats/index.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ReportTurnoverCollected"), 2, $user->rights->accounting->comptarapport->lire);
1780  $newmenu->add("/compta/stats/casoc.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 3, $user->rights->accounting->comptarapport->lire);
1781  $newmenu->add("/compta/stats/cabyuser.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByUsers"), 3, $user->rights->accounting->comptarapport->lire);
1782  //$newmenu->add("/compta/stats/cabyprodserv.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByProductsAndServices"),3,$user->rights->accounting->comptarapport->lire);
1783  //$newmenu->add("/compta/stats/byratecountry.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByVatRate"),3,$user->rights->accounting->comptarapport->lire);
1784  }
1785  }
1786 
1787  $modecompta = 'CREANCES-DETTES';
1788  if (isModEnabled('accounting') && !empty($user->rights->accounting->comptarapport->lire) && $mainmenu == 'accountancy') {
1789  $modecompta = 'BOOKKEEPING'; // Not yet implemented.
1790  }
1791  if ($modecompta && ((isModEnabled('fournisseur') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled('supplier_invoice'))) {
1792  if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/', $leftmenu)) {
1793  $newmenu->add("/compta/stats/supplier_turnover.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ReportPurchaseTurnover"), 2, $user->rights->accounting->comptarapport->lire);
1794  $newmenu->add("/compta/stats/supplier_turnover_by_thirdparty.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 3, $user->rights->accounting->comptarapport->lire);
1795  $newmenu->add("/compta/stats/supplier_turnover_by_prodserv.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByProductsAndServices"), 3, $user->rights->accounting->comptarapport->lire);
1796  }
1797  }
1798 
1799  $modecompta = 'RECETTES-DEPENSES';
1800  if (isModEnabled('accounting') && !empty($user->rights->accounting->comptarapport->lire) && $mainmenu == 'accountancy') {
1801  $modecompta = 'BOOKKEEPINGCOLLECTED'; // Not yet implemented.
1802  }
1803  if ($modecompta && ((isModEnabled('fournisseur') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled('supplier_invoice'))) {
1804  if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/', $leftmenu)) {
1805  $newmenu->add("/compta/stats/supplier_turnover.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ReportPurchaseTurnoverCollected"), 2, $user->rights->accounting->comptarapport->lire);
1806  $newmenu->add("/compta/stats/supplier_turnover_by_thirdparty.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 3, $user->rights->accounting->comptarapport->lire);
1807  }
1808  }
1809  }
1810 
1811  // Accountancy (simple)
1812  if (isModEnabled('comptabilite')) {
1813  // Files
1814  if (empty($conf->global->ACCOUNTANCY_HIDE_EXPORT_FILES_MENU)) {
1815  $newmenu->add("/compta/accounting-files.php?mainmenu=accountancy&leftmenu=accountancy_files", $langs->trans("AccountantFiles"), 0, $user->rights->compta->resultat->lire, '', $mainmenu, 'files', 0, '', '', '', img_picto('', 'accountancy', 'class="paddingright pictofixedwidth"'));
1816  }
1817 
1818  // Bilan, resultats
1819  $newmenu->add("/compta/resultat/index.php?leftmenu=report&mainmenu=accountancy", $langs->trans("Reportings"), 0, $user->rights->compta->resultat->lire, '', $mainmenu, 'ca', 0, '', '', '', img_picto('', 'accountancy', 'class="paddingright pictofixedwidth"'));
1820 
1821  if ($usemenuhider || empty($leftmenu) || preg_match('/report/', $leftmenu)) {
1822  $newmenu->add("/compta/resultat/index.php?leftmenu=report", $langs->trans("MenuReportInOut"), 1, $user->rights->compta->resultat->lire);
1823  $newmenu->add("/compta/resultat/clientfourn.php?leftmenu=report", $langs->trans("ByCompanies"), 2, $user->rights->compta->resultat->lire);
1824  /* On verra ca avec module compabilite expert
1825  $newmenu->add("/compta/resultat/compteres.php?leftmenu=report","Compte de resultat",2,$user->rights->compta->resultat->lire);
1826  $newmenu->add("/compta/resultat/bilan.php?leftmenu=report","Bilan",2,$user->rights->compta->resultat->lire);
1827  */
1828 
1829  /*
1830  $newmenu->add("/compta/stats/cumul.php?leftmenu=report","Cumule",2,$user->rights->compta->resultat->lire);
1831  if (isModEnabled('propal')) {
1832  $newmenu->add("/compta/stats/prev.php?leftmenu=report","Previsionnel",2,$user->rights->compta->resultat->lire);
1833  $newmenu->add("/compta/stats/comp.php?leftmenu=report","Transforme",2,$user->rights->compta->resultat->lire);
1834  }
1835  */
1836 
1837  $modecompta = 'CREANCES-DETTES';
1838  $newmenu->add("/compta/stats/index.php?leftmenu=report&modecompta=".$modecompta, $langs->trans("ReportTurnover"), 1, $user->rights->compta->resultat->lire);
1839  $newmenu->add("/compta/stats/casoc.php?leftmenu=report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 2, $user->rights->compta->resultat->lire);
1840  $newmenu->add("/compta/stats/cabyuser.php?leftmenu=report&modecompta=".$modecompta, $langs->trans("ByUsers"), 2, $user->rights->compta->resultat->lire);
1841  $newmenu->add("/compta/stats/cabyprodserv.php?leftmenu=report&modecompta=".$modecompta, $langs->trans("ByProductsAndServices"), 2, $user->rights->compta->resultat->lire);
1842  $newmenu->add("/compta/stats/byratecountry.php?leftmenu=report&modecompta=".$modecompta, $langs->trans("ByVatRate"), 2, $user->rights->compta->resultat->lire);
1843 
1844  $modecompta = 'RECETTES-DEPENSES';
1845  $newmenu->add("/compta/stats/index.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ReportTurnoverCollected"), 1, $user->rights->compta->resultat->lire);
1846  $newmenu->add("/compta/stats/casoc.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 2, $user->rights->compta->resultat->lire);
1847  $newmenu->add("/compta/stats/cabyuser.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByUsers"), 2, $user->rights->compta->resultat->lire);
1848 
1849  //Achats
1850  $modecompta = 'CREANCES-DETTES';
1851  $newmenu->add("/compta/stats/supplier_turnover.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ReportPurchaseTurnover"), 1, $user->rights->compta->resultat->lire);
1852  $newmenu->add("/compta/stats/supplier_turnover_by_thirdparty.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 2, $user->rights->compta->resultat->lire);
1853  $newmenu->add("/compta/stats/supplier_turnover_by_prodserv.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByProductsAndServices"), 2, $user->rights->compta->resultat->lire);
1854 
1855  /*
1856  $modecompta = 'RECETTES-DEPENSES';
1857  $newmenu->add("/compta/stats/index.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ReportPurchaseTurnoverCollected"), 1, $user->rights->compta->resultat->lire);
1858  $newmenu->add("/compta/stats/casoc.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 2, $user->rights->compta->resultat->lire);
1859  $newmenu->add("/compta/stats/cabyuser.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByUsers"), 2, $user->rights->compta->resultat->lire);
1860  */
1861 
1862  // Journals
1863  $newmenu->add("/compta/journal/sellsjournal.php?leftmenu=report", $langs->trans("SellsJournal"), 1, $user->rights->compta->resultat->lire, '', '', '', 50);
1864  $newmenu->add("/compta/journal/purchasesjournal.php?leftmenu=report", $langs->trans("PurchasesJournal"), 1, $user->rights->compta->resultat->lire, '', '', '', 51);
1865  }
1866  //if ($leftmenu=="ca") $newmenu->add("/compta/journaux/index.php?leftmenu=ca",$langs->trans("Journals"),1,$user->rights->compta->resultat->lire||$user->rights->accounting->comptarapport->lire);
1867  }
1868 
1869  // Intracomm report
1870  if (isModEnabled('intracommreport')) {
1871  $newmenu->add("/intracommreport/list.php?leftmenu=intracommreport", $langs->trans("MenuIntracommReport"), 0, $user->rights->intracommreport->read, '', $mainmenu, 'intracommreport', 60, '', '', '', img_picto('', 'intracommreport', 'class="paddingright pictofixedwidth"'));
1872  if ($usemenuhider || empty($leftmenu) || preg_match('/intracommreport/', $leftmenu)) {
1873  // DEB / DES
1874  $newmenu->add("/intracommreport/card.php?action=create&leftmenu=intracommreport", $langs->trans("MenuIntracommReportNew"), 1, $user->rights->intracommreport->write, '', $mainmenu, 'intracommreport', 1);
1875  $newmenu->add("/intracommreport/list.php?leftmenu=intracommreport", $langs->trans("MenuIntracommReportList"), 1, $user->rights->intracommreport->read, '', $mainmenu, 'intracommreport', 1);
1876  }
1877  }
1878 
1879  // Assets
1880  if (isModEnabled('asset')) {
1881  $newmenu->add("/asset/list.php?leftmenu=asset&amp;mainmenu=accountancy", $langs->trans("MenuAssets"), 0, $user->rights->asset->read, '', $mainmenu, 'asset', 100, '', '', '', img_picto('', 'payment', 'class="paddingright pictofixedwidth"'));
1882  $newmenu->add("/asset/card.php?leftmenu=asset&amp;action=create", $langs->trans("MenuNewAsset"), 1, $user->rights->asset->write);
1883  $newmenu->add("/asset/list.php?leftmenu=asset&amp;mainmenu=accountancy", $langs->trans("MenuListAssets"), 1, $user->rights->asset->read);
1884  $newmenu->add("/asset/model/list.php?leftmenu=asset_model", $langs->trans("MenuAssetModels"), 1, (empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->read) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->read)), '', $mainmenu, 'asset_model');
1885  if ($usemenuhider || empty($leftmenu) || preg_match('/asset_model/', $leftmenu)) {
1886  $newmenu->add("/asset/model/card.php?leftmenu=asset_model&amp;action=create", $langs->trans("MenuNewAssetModel"), 2, (empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->write) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->write)));
1887  $newmenu->add("/asset/model/list.php?leftmenu=asset_model", $langs->trans("MenuListAssetModels"), 2, (empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->read) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->read)));
1888  }
1889  }
1890  }
1891 }
1892 
1903 function get_left_menu_bank($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = 'none', $type_user = 0)
1904 {
1905  global $user, $conf, $langs;
1906 
1907  if ($mainmenu == 'bank') {
1908  // Load translation files required by the page
1909  $langs->loadLangs(array("withdrawals", "banks", "bills", "categories"));
1910 
1911  // Bank-Cash account
1912  if (isModEnabled('banque')) {
1913  $newmenu->add("/compta/bank/list.php?leftmenu=bank&amp;mainmenu=bank", $langs->trans("MenuBankCash"), 0, $user->rights->banque->lire, '', $mainmenu, 'bank', 0, '', '', '', img_picto('', 'bank_account', 'class="paddingright pictofixedwidth"'));
1914 
1915  $newmenu->add("/compta/bank/card.php?action=create", $langs->trans("MenuNewFinancialAccount"), 1, $user->rights->banque->configurer);
1916  $newmenu->add("/compta/bank/list.php?leftmenu=bank&amp;mainmenu=bank", $langs->trans("List"), 1, $user->rights->banque->lire, '', $mainmenu, 'bank');
1917  $newmenu->add("/compta/bank/bankentries_list.php", $langs->trans("ListTransactions"), 1, $user->rights->banque->lire);
1918  $newmenu->add("/compta/bank/budget.php", $langs->trans("ListTransactionsByCategory"), 1, $user->rights->banque->lire);
1919 
1920  $newmenu->add("/compta/bank/transfer.php", $langs->trans("MenuBankInternalTransfer"), 1, $user->rights->banque->transfer);
1921  }
1922 
1923  if (isModEnabled('categorie')) {
1924  $langs->load("categories");
1925  $newmenu->add("/categories/index.php?type=5", $langs->trans("Rubriques"), 1, $user->rights->categorie->creer, '', $mainmenu, 'tags');
1926  $newmenu->add("/compta/bank/categ.php", $langs->trans("RubriquesTransactions"), 1, $user->rights->banque->configurer, '', $mainmenu, 'tags');
1927  }
1928 
1929  // Direct debit order
1930  if (isModEnabled('prelevement')) {
1931  $newmenu->add("/compta/prelevement/index.php?leftmenu=withdraw&amp;mainmenu=bank", $langs->trans("PaymentByDirectDebit"), 0, $user->rights->prelevement->bons->lire, '', $mainmenu, 'withdraw', 0, '', '', '', img_picto('', 'payment', 'class="paddingright pictofixedwidth"'));
1932 
1933  if ($usemenuhider || empty($leftmenu) || $leftmenu == "withdraw") {
1934  $newmenu->add("/compta/prelevement/create.php?mainmenu=bank", $langs->trans("NewStandingOrder"), 1, $user->rights->prelevement->bons->creer);
1935 
1936  $newmenu->add("/compta/prelevement/orders_list.php?mainmenu=bank", $langs->trans("WithdrawalsReceipts"), 1, $user->rights->prelevement->bons->lire);
1937  $newmenu->add("/compta/prelevement/list.php?mainmenu=bank", $langs->trans("WithdrawalsLines"), 1, $user->rights->prelevement->bons->lire);
1938  $newmenu->add("/compta/prelevement/rejets.php?mainmenu=bank", $langs->trans("Rejects"), 1, $user->rights->prelevement->bons->lire);
1939  $newmenu->add("/compta/prelevement/stats.php?mainmenu=bank", $langs->trans("Statistics"), 1, $user->rights->prelevement->bons->lire);
1940  }
1941  }
1942 
1943  // Bank transfer order
1944  if (isModEnabled('paymentbybanktransfer')) {
1945  $newmenu->add("/compta/paymentbybanktransfer/index.php?leftmenu=banktransfer&amp;mainmenu=bank", $langs->trans("PaymentByBankTransfer"), 0, $user->rights->paymentbybanktransfer->read, '', $mainmenu, 'banktransfer', 0, '', '', '', img_picto('', 'payment', 'class="paddingright pictofixedwidth"'));
1946 
1947  if ($usemenuhider || empty($leftmenu) || $leftmenu == "banktransfer") {
1948  $newmenu->add("/compta/prelevement/create.php?type=bank-transfer&mainmenu=bank", $langs->trans("NewPaymentByBankTransfer"), 1, $user->rights->paymentbybanktransfer->create);
1949 
1950  $newmenu->add("/compta/prelevement/orders_list.php?type=bank-transfer&mainmenu=bank", $langs->trans("PaymentByBankTransferReceipts"), 1, $user->rights->paymentbybanktransfer->read);
1951  $newmenu->add("/compta/prelevement/list.php?type=bank-transfer&mainmenu=bank", $langs->trans("PaymentByBankTransferLines"), 1, $user->rights->paymentbybanktransfer->read);
1952  $newmenu->add("/compta/prelevement/rejets.php?type=bank-transfer&mainmenu=bank", $langs->trans("Rejects"), 1, $user->rights->paymentbybanktransfer->read);
1953  $newmenu->add("/compta/prelevement/stats.php?type=bank-transfer&mainmenu=bank", $langs->trans("Statistics"), 1, $user->rights->paymentbybanktransfer->read);
1954  }
1955  }
1956 
1957  // Management of checks
1958  if (empty($conf->global->BANK_DISABLE_CHECK_DEPOSIT) && isModEnabled('banque') && (isModEnabled('facture') || !empty($conf->global->MAIN_MENU_CHEQUE_DEPOSIT_ON))) {
1959  $newmenu->add("/compta/paiement/cheque/index.php?leftmenu=checks&amp;mainmenu=bank", $langs->trans("MenuChequeDeposits"), 0, $user->rights->banque->cheque, '', $mainmenu, 'checks', 0, '', '', '', img_picto('', 'payment', 'class="paddingright pictofixedwidth"'));
1960  if (preg_match('/checks/', $leftmenu)) {
1961  $newmenu->add("/compta/paiement/cheque/card.php?leftmenu=checks_bis&amp;action=new&amp;mainmenu=bank", $langs->trans("NewChequeDeposit"), 1, $user->rights->banque->cheque);
1962  $newmenu->add("/compta/paiement/cheque/list.php?leftmenu=checks_bis&amp;mainmenu=bank", $langs->trans("List"), 1, $user->rights->banque->cheque);
1963  }
1964  }
1965 
1966  // Cash Control
1967  if (isModEnabled('takepos') || isModEnabled('cashdesk')) {
1968  $permtomakecashfence = ($user->hasRight('cashdesk', 'run')|| $user->hasRight('takepos', 'run'));
1969  $newmenu->add("/compta/cashcontrol/cashcontrol_list.php?action=list", $langs->trans("POS"), 0, $permtomakecashfence, '', $mainmenu, 'cashcontrol', 0, '', '', '', img_picto('', 'pos', 'class="pictofixedwidth"'));
1970  $newmenu->add("/compta/cashcontrol/cashcontrol_card.php?action=create", $langs->trans("NewCashFence"), 1, $permtomakecashfence);
1971  $newmenu->add("/compta/cashcontrol/cashcontrol_list.php?action=list", $langs->trans("List"), 1, $permtomakecashfence);
1972  }
1973  }
1974 }
1975 
1986 function get_left_menu_products($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = 'none', $type_user = 0)
1987 {
1988  global $user, $conf, $langs;
1989 
1990  if ($mainmenu == 'products') {
1991  // Products
1992  if (isModEnabled('product')) {
1993  $newmenu->add("/product/index.php?leftmenu=product&amp;type=0", $langs->trans("Products"), 0, $user->rights->produit->lire, '', $mainmenu, 'product', 0, '', '', '', img_picto('', 'product', 'class="pictofixedwidth"'));
1994  $newmenu->add("/product/card.php?leftmenu=product&amp;action=create&amp;type=0", $langs->trans("NewProduct"), 1, $user->rights->produit->creer);
1995  $newmenu->add("/product/list.php?leftmenu=product&amp;type=0", $langs->trans("List"), 1, $user->rights->produit->lire);
1996  if (isModEnabled('stock')) {
1997  $newmenu->add("/product/reassort.php?type=0", $langs->trans("MenuStocks"), 1, $user->rights->produit->lire && $user->rights->stock->lire);
1998  }
1999  if (isModEnabled('productbatch')) {
2000  $langs->load("stocks");
2001  $newmenu->add("/product/reassortlot.php?type=0", $langs->trans("StocksByLotSerial"), 1, $user->rights->produit->lire && $user->rights->stock->lire);
2002  $newmenu->add("/product/stock/productlot_list.php", $langs->trans("LotSerial"), 1, $user->rights->produit->lire && $user->rights->stock->lire);
2003  }
2004  if (isModEnabled('variants')) {
2005  $newmenu->add("/variants/list.php", $langs->trans("VariantAttributes"), 1, $user->rights->produit->lire);
2006  }
2007  if (isModEnabled('propal') || (isModEnabled('commande') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled('facture') || isModEnabled('fournisseur') || isModEnabled('supplier_proposal') || isModEnabled('supplier_order') || isModEnabled('supplier_invoice')) {
2008  $newmenu->add("/product/stats/card.php?id=all&leftmenu=stats&type=0", $langs->trans("Statistics"), 1, $user->rights->produit->lire);
2009  }
2010 
2011  // Categories
2012  if (isModEnabled('categorie')) {
2013  $langs->load("categories");
2014  $newmenu->add("/categories/index.php?leftmenu=cat&amp;type=0", $langs->trans("Categories"), 1, $user->rights->categorie->lire, '', $mainmenu, 'cat');
2015  //if ($usemenuhider || empty($leftmenu) || $leftmenu=="cat") $newmenu->add("/categories/list.php", $langs->trans("List"), 1, $user->rights->categorie->lire);
2016  }
2017  }
2018 
2019  // Services
2020  if (isModEnabled('service')) {
2021  $newmenu->add("/product/index.php?leftmenu=service&amp;type=1", $langs->trans("Services"), 0, $user->rights->service->lire, '', $mainmenu, 'service', 0, '', '', '', img_picto('', 'service', 'class="pictofixedwidth"'));
2022  $newmenu->add("/product/card.php?leftmenu=service&amp;action=create&amp;type=1", $langs->trans("NewService"), 1, $user->rights->service->creer);
2023  $newmenu->add("/product/list.php?leftmenu=service&amp;type=1", $langs->trans("List"), 1, $user->rights->service->lire);
2024  if (isModEnabled('propal') || isModEnabled('commande') || isModEnabled('facture') || (isModEnabled('fournisseur') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled('supplier_proposal') || isModEnabled('supplier_order') || isModEnabled('supplier_invoice')) {
2025  $newmenu->add("/product/stats/card.php?id=all&leftmenu=stats&type=1", $langs->trans("Statistics"), 1, $user->rights->service->lire);
2026  }
2027  // Categories
2028  if (isModEnabled('categorie')) {
2029  $langs->load("categories");
2030  $newmenu->add("/categories/index.php?leftmenu=cat&amp;type=0", $langs->trans("Categories"), 1, $user->rights->categorie->lire, '', $mainmenu, 'cat');
2031  //if ($usemenuhider || empty($leftmenu) || $leftmenu=="cat") $newmenu->add("/categories/list.php", $langs->trans("List"), 1, $user->rights->categorie->lire);
2032  }
2033  }
2034 
2035  // Warehouse
2036  if (isModEnabled('stock')) {
2037  $langs->load("stocks");
2038  $newmenu->add("/product/stock/index.php?leftmenu=stock", $langs->trans("Warehouses"), 0, $user->rights->stock->lire, '', $mainmenu, 'stock', 0, '', '', '', img_picto('', 'stock', 'class="pictofixedwidth"'));
2039  $newmenu->add("/product/stock/card.php?action=create", $langs->trans("MenuNewWarehouse"), 1, $user->rights->stock->creer);
2040  $newmenu->add("/product/stock/list.php", $langs->trans("List"), 1, $user->rights->stock->lire);
2041  $newmenu->add("/product/stock/movement_list.php", $langs->trans("Movements"), 1, $user->rights->stock->mouvement->lire);
2042 
2043  $newmenu->add("/product/stock/massstockmove.php", $langs->trans("MassStockTransferShort"), 1, $user->rights->stock->mouvement->creer);
2044  if (isModEnabled('supplier_order')) {
2045  $newmenu->add("/product/stock/replenish.php", $langs->trans("Replenishment"), 1, $user->rights->stock->mouvement->creer && $user->rights->fournisseur->lire);
2046  }
2047  $newmenu->add("/product/stock/stockatdate.php", $langs->trans("StockAtDate"), 1, $user->rights->produit->lire && $user->rights->stock->lire);
2048 
2049  // Categories for warehouses
2050  if (isModEnabled('categorie')) {
2051  $newmenu->add("/categories/index.php?leftmenu=stock&amp;type=9", $langs->trans("Categories"), 1, $user->rights->categorie->lire, '', $mainmenu, 'cat');
2052  }
2053  }
2054 
2055  if (isModEnabled('stocktransfer')) {
2056  $newmenu->add('/product/stock/stocktransfer/stocktransfer_list.php', $langs->trans("ModuleStockTransferName"), 0, $user->rights->stocktransfer->stocktransfer->read, '', $mainmenu, 'stocktransfer', 0, '', '', '', img_picto('', 'stock', 'class="pictofixedwidth"'));
2057  $newmenu->add('/product/stock/stocktransfer/stocktransfer_card.php?action=create', $langs->trans('StockTransferNew'), 1, $user->rights->stocktransfer->stocktransfer->write);
2058  $newmenu->add('/product/stock/stocktransfer/stocktransfer_list.php', $langs->trans('List'), 1, $user->rights->stocktransfer->stocktransfer->read);
2059  }
2060 
2061  // Inventory
2062  if (isModEnabled('stock')) {
2063  $langs->load("stocks");
2064  if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) {
2065  $newmenu->add("/product/inventory/list.php?leftmenu=stock_inventories", $langs->trans("Inventories"), 0, $user->rights->stock->lire, '', $mainmenu, 'stock', 0, '', '', '', img_picto('', 'inventory', 'class="pictofixedwidth"'));
2066  if ($usemenuhider || empty($leftmenu) || $leftmenu == "stock_inventories") {
2067  $newmenu->add("/product/inventory/card.php?action=create&leftmenu=stock_inventories", $langs->trans("NewInventory"), 1, $user->rights->stock->creer);
2068  $newmenu->add("/product/inventory/list.php?leftmenu=stock_inventories", $langs->trans("List"), 1, $user->rights->stock->lire);
2069  }
2070  } else {
2071  $newmenu->add("/product/inventory/list.php?leftmenu=stock_inventories", $langs->trans("Inventories"), 0, $user->rights->stock->inventory_advance->read, '', $mainmenu, 'stock', 0, '', '', '', img_picto('', 'inventory', 'class="pictofixedwidth"'));
2072  if ($usemenuhider || empty($leftmenu) || $leftmenu == "stock_inventories") {
2073  $newmenu->add("/product/inventory/card.php?action=create&leftmenu=stock_inventories", $langs->trans("NewInventory"), 1, $user->rights->stock->inventory_advance->write);
2074  $newmenu->add("/product/inventory/list.php?leftmenu=stock_inventories", $langs->trans("List"), 1, $user->rights->stock->inventory_advance->read);
2075  }
2076  }
2077  }
2078 
2079  // Shipments
2080  if (isModEnabled('expedition')) {
2081  $langs->load("sendings");
2082  $newmenu->add("/expedition/index.php?leftmenu=sendings", $langs->trans("Shipments"), 0, $user->rights->expedition->lire, '', $mainmenu, 'sendings', 0, '', '', '', img_picto('', 'shipment', 'class="pictofixedwidth"'));
2083  $newmenu->add("/expedition/card.php?action=create2&amp;leftmenu=sendings", $langs->trans("NewSending"), 1, $user->rights->expedition->creer);
2084  $newmenu->add("/expedition/list.php?leftmenu=sendings", $langs->trans("List"), 1, $user->rights->expedition->lire);
2085  if ($usemenuhider || empty($leftmenu) || $leftmenu == "sendings") {
2086  $newmenu->add("/expedition/list.php?leftmenu=sendings&search_status=0", $langs->trans("StatusSendingDraftShort"), 2, $user->rights->expedition->lire);
2087  $newmenu->add("/expedition/list.php?leftmenu=sendings&search_status=1", $langs->trans("StatusSendingValidatedShort"), 2, $user->rights->expedition->lire);
2088  $newmenu->add("/expedition/list.php?leftmenu=sendings&search_status=2", $langs->trans("StatusSendingProcessedShort"), 2, $user->rights->expedition->lire);
2089  }
2090  $newmenu->add("/expedition/stats/index.php?leftmenu=sendings", $langs->trans("Statistics"), 1, $user->rights->expedition->lire);
2091  }
2092 
2093  // Receptions
2094  if (isModEnabled('reception')) {
2095  $langs->load("receptions");
2096  $newmenu->add("/reception/index.php?leftmenu=receptions", $langs->trans("Receptions"), 0, $user->rights->reception->lire, '', $mainmenu, 'receptions', 0, '', '', '', img_picto('', 'dollyrevert', 'class="pictofixedwidth"'));
2097  $newmenu->add("/reception/card.php?action=create2&amp;leftmenu=receptions", $langs->trans("NewReception"), 1, $user->rights->reception->creer);
2098  $newmenu->add("/reception/list.php?leftmenu=receptions", $langs->trans("List"), 1, $user->rights->reception->lire);
2099  if ($usemenuhider || empty($leftmenu) || $leftmenu == "receptions") {
2100  $newmenu->add("/reception/list.php?leftmenu=receptions&search_status=0", $langs->trans("StatusReceptionDraftShort"), 2, $user->rights->reception->lire);
2101  }
2102  if ($usemenuhider || empty($leftmenu) || $leftmenu == "receptions") {
2103  $newmenu->add("/reception/list.php?leftmenu=receptions&search_status=1", $langs->trans("StatusReceptionValidatedShort"), 2, $user->rights->reception->lire);
2104  }
2105  if ($usemenuhider || empty($leftmenu) || $leftmenu == "receptions") {
2106  $newmenu->add("/reception/list.php?leftmenu=receptions&search_status=2", $langs->trans("StatusReceptionProcessedShort"), 2, $user->rights->reception->lire);
2107  }
2108  $newmenu->add("/reception/stats/index.php?leftmenu=receptions", $langs->trans("Statistics"), 1, $user->rights->reception->lire);
2109  }
2110  }
2111 }
2112 
2123 function get_left_menu_mrp($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = 'none', $type_user = 0)
2124 {
2125  global $user, $conf, $langs;
2126 
2127  if ($mainmenu == 'mrp') {
2128  // BOM
2129  if (isModEnabled('bom') || isModEnabled('mrp')) {
2130  $langs->load("mrp");
2131 
2132  $newmenu->add("", $langs->trans("MenuBOM"), 0, $user->rights->bom->read, '', $mainmenu, 'bom', 0, '', '', '', img_picto('', 'bom', 'class="paddingright pictofixedwidth"'));
2133  $newmenu->add("/bom/bom_card.php?leftmenu=bom&amp;action=create", $langs->trans("NewBOM"), 1, $user->rights->bom->write, '', $mainmenu, 'bom');
2134  $newmenu->add("/bom/bom_list.php?leftmenu=bom", $langs->trans("List"), 1, $user->rights->bom->read, '', $mainmenu, 'bom');
2135  }
2136 
2137  if (isModEnabled('mrp')) {
2138  $langs->load("mrp");
2139 
2140  $newmenu->add("", $langs->trans("MenuMRP"), 0, $user->rights->mrp->read, '', $mainmenu, 'mo', 0, '', '', '', img_picto('', 'mrp', 'class="paddingright pictofixedwidth"'));
2141  $newmenu->add("/mrp/mo_card.php?leftmenu=mo&amp;action=create", $langs->trans("NewMO"), 1, $user->rights->mrp->write, '', $mainmenu, 'mo');
2142  $newmenu->add("/mrp/mo_list.php?leftmenu=mo", $langs->trans("List"), 1, $user->rights->mrp->read, '', $mainmenu, 'mo');
2143  }
2144  }
2145 }
2146 
2157 function get_left_menu_projects($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = 'none', $type_user = 0)
2158 {
2159  global $user, $conf, $langs;
2160 
2161  if ($mainmenu == 'project') {
2162  if (isModEnabled('projet')) {
2163  $langs->load("projects");
2164 
2165  $search_project_user = GETPOST('search_project_user', 'int');
2166 
2167  $tmpentry = array(
2168  'enabled'=>(isModEnabled('projet')),
2169  'perms'=>(!empty($user->rights->projet->lire)),
2170  'module'=>'projet'
2171  );
2172  $listofmodulesforexternal = explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL);
2173  $showmode = isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal);
2174 
2175  $titleboth = $langs->trans("LeadsOrProjects");
2176  $titlenew = $langs->trans("NewLeadOrProject"); // Leads and opportunities by default
2177  if (empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
2178  $titleboth = $langs->trans("Projects");
2179  $titlenew = $langs->trans("NewProject");
2180  }
2181  if (isset($conf->global->PROJECT_USE_OPPORTUNITIES) && $conf->global->PROJECT_USE_OPPORTUNITIES == 2) { // 2 = leads only
2182  $titleboth = $langs->trans("Leads");
2183  $titlenew = $langs->trans("NewLead");
2184  }
2185 
2186  // Project assigned to user
2187  $newmenu->add("/projet/index.php?leftmenu=projects".($search_project_user ? '&search_project_user='.$search_project_user : ''), $titleboth, 0, $user->rights->projet->lire, '', $mainmenu, 'projects', 0, '', '', '', img_picto('', 'project', 'class="paddingright pictofixedwidth"'));
2188  $newmenu->add("/projet/card.php?leftmenu=projects&action=create".($search_project_user ? '&search_project_user='.$search_project_user : ''), $titlenew, 1, $user->rights->projet->creer);
2189 
2190  if (empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
2191  $newmenu->add("/projet/list.php?leftmenu=projets".($search_project_user ? '&search_project_user='.$search_project_user : '').'&search_status=99', $langs->trans("List"), 1, $showmode, '', 'project', 'list');
2192  } elseif (isset($conf->global->PROJECT_USE_OPPORTUNITIES) && $conf->global->PROJECT_USE_OPPORTUNITIES == 1) {
2193  $newmenu->add("/projet/list.php?leftmenu=projets".($search_project_user ? '&search_project_user='.$search_project_user : ''), $langs->trans("List"), 1, $showmode, '', 'project', 'list');
2194  $newmenu->add('/projet/list.php?mainmenu=project&amp;leftmenu=list&search_usage_opportunity=1&search_status=99&search_opp_status=openedopp&contextpage=lead', $langs->trans("ListOpenLeads"), 2, $showmode);
2195  $newmenu->add('/projet/list.php?mainmenu=project&amp;leftmenu=list&search_opp_status=notopenedopp&search_status=99&contextpage=project', $langs->trans("ListOpenProjects"), 2, $showmode);
2196  } elseif (isset($conf->global->PROJECT_USE_OPPORTUNITIES) && $conf->global->PROJECT_USE_OPPORTUNITIES == 2) { // 2 = leads only
2197  $newmenu->add('/projet/list.php?mainmenu=project&amp;leftmenu=list&search_usage_opportunity=1&search_status=99', $langs->trans("List"), 2, $showmode);
2198  }
2199 
2200  $newmenu->add("/projet/stats/index.php?leftmenu=projects", $langs->trans("Statistics"), 1, $user->rights->projet->lire);
2201 
2202  // Categories
2203  if (isModEnabled('categorie')) {
2204  $langs->load("categories");
2205  $newmenu->add("/categories/index.php?leftmenu=cat&amp;type=6", $langs->trans("Categories"), 1, $user->rights->categorie->lire, '', $mainmenu, 'cat');
2206  }
2207 
2208  if (empty($conf->global->PROJECT_HIDE_TASKS)) {
2209  // Project affected to user
2210  $newmenu->add("/projet/activity/index.php?leftmenu=tasks".($search_project_user ? '&search_project_user='.$search_project_user : ''), $langs->trans("Activities"), 0, $user->rights->projet->lire, '', 'project', 'tasks', 0, '', '', '', img_picto('', 'projecttask', 'class="paddingright pictofixedwidth"'));
2211  $newmenu->add("/projet/tasks.php?leftmenu=tasks&action=create", $langs->trans("NewTask"), 1, $user->rights->projet->creer);
2212  $newmenu->add("/projet/tasks/list.php?leftmenu=tasks".($search_project_user ? '&search_project_user='.$search_project_user : ''), $langs->trans("List"), 1, $user->rights->projet->lire);
2213  $newmenu->add("/projet/tasks/stats/index.php?leftmenu=projects", $langs->trans("Statistics"), 1, $user->rights->projet->lire);
2214 
2215  $newmenu->add("/projet/activity/perweek.php?leftmenu=tasks".($search_project_user ? '&search_project_user='.$search_project_user : ''), $langs->trans("NewTimeSpent"), 0, $user->rights->projet->lire, '', 'project', 'timespent', 0, '', '', '', img_picto('', 'timespent', 'class="paddingright pictofixedwidth"'));
2216  $newmenu->add("/projet/tasks/time.php?leftmenu=tasks".($search_project_user ? '&search_project_user='.$search_project_user : ''), $langs->trans("List"), 1, $user->rights->projet->lire);
2217  }
2218  }
2219  }
2220 }
2221 
2232 function get_left_menu_hrm($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = 'none', $type_user = 0)
2233 {
2234  global $user, $conf, $langs;
2235 
2236  if ($mainmenu == 'hrm') {
2237  // HRM module
2238  if (isModEnabled('hrm')) {
2239  $langs->load("hrm");
2240 
2241  $newmenu->add("/user/list.php?mainmenu=hrm&leftmenu=hrm&mode=employee", $langs->trans("Employees"), 0, $user->rights->user->user->lire, '', $mainmenu, 'hrm', 0, '', '', '', img_picto('', 'user', 'class="paddingright pictofixedwidth"'));
2242  $newmenu->add("/user/card.php?mainmenu=hrm&leftmenu=hrm&action=create&employee=1", $langs->trans("NewEmployee"), 1, $user->rights->user->user->creer);
2243  $newmenu->add("/user/list.php?mainmenu=hrm&leftmenu=hrm&mode=employee&contextpage=employeelist", $langs->trans("List"), 1, $user->rights->user->user->lire);
2244 
2245  $newmenu->add("/hrm/skill_list.php?mainmenu=hrm&leftmenu=hrm_sm", $langs->trans("SkillsManagement"), 0, $user->rights->hrm->all->read, '', $mainmenu, 'hrm_sm', 0, '', '', '', img_picto('', 'shapes', 'class="paddingright pictofixedwidth"'));
2246 
2247  // Skills
2248  $newmenu->add("/hrm/skill_list.php?mainmenu=hrm&leftmenu=hrm_sm", $langs->trans("Skills"), 1, $user->rights->hrm->all->read, '', $mainmenu, 'hrm_sm', 0, '', '', '', img_picto('', 'shapes', 'class="paddingright pictofixedwidth"'));
2249  //$newmenu->add("/hrm/skill_card.php?mainmenu=hrm&leftmenu=hrm_sm&action=create", $langs->trans("NewSkill"), 1, $user->rights->hrm->all->write);
2250  //$newmenu->add("/hrm/skill_list.php?mainmenu=hrm&leftmenu=hrm_sm", $langs->trans("List"), 1, $user->rights->hrm->all->read);
2251 
2252  // Job (Description of work to do and skills required)
2253  $newmenu->add("/hrm/job_list.php?mainmenu=hrm&leftmenu=hrm_sm", $langs->trans("JobsPosition"), 1, $user->rights->hrm->all->read, '', $mainmenu, 'hrm_sm', 0, '', '', '', img_picto('', 'technic', 'class="paddingright pictofixedwidth"'));
2254  //$newmenu->add("/hrm/job_card.php?mainmenu=hrm&leftmenu=hrm_sm&action=create", $langs->transnoentities("NewObject", $langs->trans("Job")), 1, $user->rights->hrm->all->write);
2255  //$newmenu->add("/hrm/job_list.php?mainmenu=hrm&leftmenu=hrm_sm", $langs->trans("List"), 1, $user->rights->hrm->all->read);
2256 
2257  // Position = Link job - user
2258  $newmenu->add("/hrm/position_list.php?mainmenu=hrm&leftmenu=hrm_sm", $langs->trans("EmployeePositions"), 1, $user->rights->hrm->all->read, '', $mainmenu, 'hrm_sm', 0, '', '', '', img_picto('', 'user-cog', 'class="paddingright pictofixedwidth"'));
2259  //$newmenu->add("/hrm/position.php?mainmenu=hrm&leftmenu=hrm_sm&action=create", $langs->transnoentities("NewObject", $langs->trans("Position")), 1, $user->rights->hrm->all->write);
2260  //$newmenu->add("/hrm/position_list.php?mainmenu=hrm&leftmenu=hrm_sm", $langs->trans("List"), 1, $user->rights->hrm->all->read);
2261 
2262  // Evaluation
2263  $newmenu->add("/hrm/evaluation_list.php?mainmenu=hrm&leftmenu=hrm_sm", $langs->trans("Evals"), 1, $user->rights->hrm->evaluation->read, '', $mainmenu, 'hrm_sm', 0, '', '', '', img_picto('', 'user', 'class="paddingright pictofixedwidth"'));
2264  //$newmenu->add("/hrm/evaluation_card.php?mainmenu=hrm&leftmenu=hrm_sm&action=create", $langs->trans("NewEval"), 1, $user->rights->hrm->evaluation->write);
2265  //$newmenu->add("/hrm/evaluation_list.php?mainmenu=hrm&leftmenu=hrm_sm", $langs->trans("List"), 1, $user->rights->hrm->evaluation->read);
2266  $newmenu->add("/hrm/compare.php?mainmenu=hrm&leftmenu=hrm_sm", $langs->trans("SkillComparison"), 1, $user->rights->hrm->evaluation->read || $user->rights->hrm->compare_advance->read);
2267  }
2268 
2269  // Leave/Holiday/Vacation module
2270  if (isModEnabled('holiday')) {
2271  // Load translation files required by the page
2272  $langs->loadLangs(array("holiday", "trips"));
2273 
2274  $newmenu->add("/holiday/list.php?mainmenu=hrm&leftmenu=holiday", $langs->trans("CPTitreMenu"), 0, $user->rights->holiday->read, '', $mainmenu, 'holiday', 0, '', '', '', img_picto('', 'holiday', 'class="paddingright pictofixedwidth"'));
2275  $newmenu->add("/holiday/card.php?mainmenu=hrm&leftmenu=holiday&action=create", $langs->trans("New"), 1, $user->rights->holiday->write, '', $mainmenu);
2276  $newmenu->add("/holiday/list.php?mainmenu=hrm&leftmenu=holiday", $langs->trans("List"), 1, $user->rights->holiday->read, '', $mainmenu);
2277  if ($usemenuhider || empty($leftmenu) || $leftmenu == "holiday") {
2278  $newmenu->add("/holiday/list.php?search_status=1&mainmenu=hrm&leftmenu=holiday", $langs->trans("DraftCP"), 2, $user->rights->holiday->read, '', $mainmenu, 'holiday_sm');
2279  $newmenu->add("/holiday/list.php?search_status=2&mainmenu=hrm&leftmenu=holiday", $langs->trans("ToReviewCP"), 2, $user->rights->holiday->read, '', $mainmenu, 'holiday_sm');
2280  $newmenu->add("/holiday/list.php?search_status=3&mainmenu=hrm&leftmenu=holiday", $langs->trans("ApprovedCP"), 2, $user->rights->holiday->read, '', $mainmenu, 'holiday_sm');
2281  $newmenu->add("/holiday/list.php?search_status=4&mainmenu=hrm&leftmenu=holiday", $langs->trans("CancelCP"), 2, $user->rights->holiday->read, '', $mainmenu, 'holiday_sm');
2282  $newmenu->add("/holiday/list.php?search_status=5&mainmenu=hrm&leftmenu=holiday", $langs->trans("RefuseCP"), 2, $user->rights->holiday->read, '', $mainmenu, 'holiday_sm');
2283  }
2284  $newmenu->add("/holiday/define_holiday.php?mainmenu=hrm&action=request", $langs->trans("MenuConfCP"), 1, $user->rights->holiday->read, '', $mainmenu, 'holiday_sm');
2285  $newmenu->add("/holiday/month_report.php?mainmenu=hrm&leftmenu=holiday", $langs->trans("MenuReportMonth"), 1, $user->rights->holiday->readall, '', $mainmenu, 'holiday_sm');
2286  $newmenu->add("/holiday/view_log.php?mainmenu=hrm&leftmenu=holiday&action=request", $langs->trans("MenuLogCP"), 1, $user->rights->holiday->define_holiday, '', $mainmenu, 'holiday_sm');
2287  }
2288 
2289  // Trips and expenses (old module)
2290  if (isModEnabled('deplacement')) {
2291  $langs->load("trips");
2292  $newmenu->add("/compta/deplacement/index.php?leftmenu=tripsandexpenses&amp;mainmenu=hrm", $langs->trans("TripsAndExpenses"), 0, $user->rights->deplacement->lire, '', $mainmenu, 'tripsandexpenses', 0, '', '', '', img_picto('', 'trip', 'class="paddingright pictofixedwidth"'));
2293  $newmenu->add("/compta/deplacement/card.php?action=create&amp;leftmenu=tripsandexpenses&amp;mainmenu=hrm", $langs->trans("New"), 1, $user->rights->deplacement->creer);
2294  $newmenu->add("/compta/deplacement/list.php?leftmenu=tripsandexpenses&amp;mainmenu=hrm", $langs->trans("List"), 1, $user->rights->deplacement->lire);
2295  $newmenu->add("/compta/deplacement/stats/index.php?leftmenu=tripsandexpenses&amp;mainmenu=hrm", $langs->trans("Statistics"), 1, $user->rights->deplacement->lire);
2296  }
2297 
2298  // Expense report
2299  if (isModEnabled('expensereport')) {
2300  $langs->loadLangs(array("trips", "bills"));
2301  $newmenu->add("/expensereport/index.php?leftmenu=expensereport&amp;mainmenu=hrm", $langs->trans("TripsAndExpenses"), 0, $user->rights->expensereport->lire, '', $mainmenu, 'expensereport', 0, '', '', '', img_picto('', 'trip', 'class="paddingright pictofixedwidth"'));
2302  $newmenu->add("/expensereport/card.php?action=create&amp;leftmenu=expensereport&amp;mainmenu=hrm", $langs->trans("New"), 1, $user->rights->expensereport->creer);
2303  $newmenu->add("/expensereport/list.php?leftmenu=expensereport&amp;mainmenu=hrm", $langs->trans("List"), 1, $user->rights->expensereport->lire);
2304  if ($usemenuhider || empty($leftmenu) || $leftmenu == "expensereport") {
2305  $newmenu->add("/expensereport/list.php?search_status=0&amp;leftmenu=expensereport&amp;mainmenu=hrm", $langs->trans("Draft"), 2, $user->rights->expensereport->lire);
2306  $newmenu->add("/expensereport/list.php?search_status=2&amp;leftmenu=expensereport&amp;mainmenu=hrm", $langs->trans("Validated"), 2, $user->rights->expensereport->lire);
2307  $newmenu->add("/expensereport/list.php?search_status=5&amp;leftmenu=expensereport&amp;mainmenu=hrm", $langs->trans("Approved"), 2, $user->rights->expensereport->lire);
2308  $newmenu->add("/expensereport/list.php?search_status=6&amp;leftmenu=expensereport&amp;mainmenu=hrm", $langs->trans("Paid"), 2, $user->rights->expensereport->lire);
2309  $newmenu->add("/expensereport/list.php?search_status=4&amp;leftmenu=expensereport&amp;mainmenu=hrm", $langs->trans("Canceled"), 2, $user->rights->expensereport->lire);
2310  $newmenu->add("/expensereport/list.php?search_status=99&amp;leftmenu=expensereport&amp;mainmenu=hrm", $langs->trans("Refused"), 2, $user->rights->expensereport->lire);
2311  }
2312  $newmenu->add("/expensereport/payment/list.php?leftmenu=expensereport_payments&amp;mainmenu=hrm", $langs->trans("Payments"), 1, $user->rights->expensereport->lire);
2313  $newmenu->add("/expensereport/stats/index.php?leftmenu=expensereport&amp;mainmenu=hrm", $langs->trans("Statistics"), 1, $user->rights->expensereport->lire);
2314  }
2315 
2316  if (isModEnabled('projet')) {
2317  if (empty($conf->global->PROJECT_HIDE_TASKS)) {
2318  $langs->load("projects");
2319 
2320  $search_project_user = GETPOST('search_project_user', 'int');
2321 
2322  $newmenu->add("/projet/activity/perweek.php?leftmenu=tasks".($search_project_user ? '&search_project_user='.$search_project_user : ''), $langs->trans("NewTimeSpent"), 0, $user->rights->projet->lire, '', $mainmenu, 'timespent', 0, '', '', '', img_picto('', 'timespent', 'class="paddingright pictofixedwidth"'));
2323  }
2324  }
2325  }
2326 }
2327 
2328 
2339 function get_left_menu_tools($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = 'none', $type_user = 0)
2340 {
2341  global $user, $conf, $langs;
2342 
2343  if ($mainmenu == 'tools') {
2344  if (empty($user->socid)) { // limit to internal users
2345  $langs->load("mails");
2346  $newmenu->add("/admin/mails_templates.php?leftmenu=email_templates", $langs->trans("EMailTemplates"), 0, 1, '', $mainmenu, 'email_templates', 0, '', '', '', img_picto('', 'email', 'class="paddingright pictofixedwidth"'));
2347  }
2348 
2349  if (isModEnabled('mailing')) {
2350  $newmenu->add("/comm/mailing/index.php?leftmenu=mailing", $langs->trans("EMailings"), 0, $user->rights->mailing->lire, '', $mainmenu, 'mailing', 0, '', '', '', img_picto('', 'email', 'class="paddingright pictofixedwidth"'));
2351  $newmenu->add("/comm/mailing/card.php?leftmenu=mailing&amp;action=create", $langs->trans("NewMailing"), 1, $user->rights->mailing->creer);
2352  $newmenu->add("/comm/mailing/list.php?leftmenu=mailing", $langs->trans("List"), 1, $user->rights->mailing->lire);
2353  }
2354 
2355  if (isModEnabled('export')) {
2356  $langs->load("exports");
2357  $newmenu->add("/exports/index.php?leftmenu=export", $langs->trans("FormatedExport"), 0, $user->rights->export->lire, '', $mainmenu, 'export', 0, '', '', '', img_picto('', 'technic', 'class="paddingright pictofixedwidth"'));
2358  $newmenu->add("/exports/export.php?leftmenu=export", $langs->trans("NewExport"), 1, $user->rights->export->creer);
2359  //$newmenu->add("/exports/export.php?leftmenu=export",$langs->trans("List"),1, $user->rights->export->lire);
2360  }
2361 
2362  if (isModEnabled('import')) {
2363  $langs->load("exports");
2364  $newmenu->add("/imports/index.php?leftmenu=import", $langs->trans("FormatedImport"), 0, $user->rights->import->run, '', $mainmenu, 'import', 0, '', '', '', img_picto('', 'technic', 'class="paddingright pictofixedwidth"'));
2365  $newmenu->add("/imports/import.php?leftmenu=import", $langs->trans("NewImport"), 1, $user->rights->import->run);
2366  }
2367  }
2368 }
2369 
2380 function get_left_menu_members($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = 'none', $type_user = 0)
2381 {
2382  global $user, $conf, $langs;
2383 
2384  if ($mainmenu == 'members') {
2385  if (isModEnabled('adherent')) {
2386  // Load translation files required by the page
2387  $langs->loadLangs(array("members", "compta"));
2388 
2389  $newmenu->add("/adherents/index.php?leftmenu=members&amp;mainmenu=members", $langs->trans("Members"), 0, $user->rights->adherent->lire, '', $mainmenu, 'members', 0, '', '', '', img_picto('', 'member', 'class="paddingright pictofixedwidth"'));
2390  $newmenu->add("/adherents/card.php?leftmenu=members&amp;action=create", $langs->trans("NewMember"), 1, $user->rights->adherent->creer);
2391  $newmenu->add("/adherents/list.php?leftmenu=members", $langs->trans("List"), 1, $user->rights->adherent->lire);
2392  $newmenu->add("/adherents/list.php?leftmenu=members&amp;statut=-1", $langs->trans("MenuMembersToValidate"), 2, $user->rights->adherent->lire);
2393  $newmenu->add("/adherents/list.php?leftmenu=members&amp;statut=1", $langs->trans("MenuMembersValidated"), 2, $user->rights->adherent->lire);
2394  $newmenu->add("/adherents/list.php?leftmenu=members&amp;statut=1&amp;filter=withoutsubscription", $langs->trans("WithoutSubscription"), 3, $user->rights->adherent->lire);
2395  $newmenu->add("/adherents/list.php?leftmenu=members&amp;statut=1&amp;filter=uptodate", $langs->trans("UpToDate"), 3, $user->rights->adherent->lire);
2396  $newmenu->add("/adherents/list.php?leftmenu=members&amp;statut=1&amp;filter=outofdate", $langs->trans("OutOfDate"), 3, $user->rights->adherent->lire);
2397  $newmenu->add("/adherents/list.php?leftmenu=members&amp;statut=0", $langs->trans("MenuMembersResiliated"), 2, $user->rights->adherent->lire);
2398  $newmenu->add("/adherents/stats/index.php?leftmenu=members", $langs->trans("MenuMembersStats"), 1, $user->rights->adherent->lire);
2399 
2400  $newmenu->add("/adherents/cartes/carte.php?leftmenu=export", $langs->trans("MembersCards"), 1, $user->rights->adherent->export);
2401  if (!empty($conf->global->MEMBER_LINK_TO_HTPASSWDFILE) && ($usemenuhider || empty($leftmenu) || $leftmenu == 'none' || $leftmenu == "members" || $leftmenu == "export")) {
2402  $newmenu->add("/adherents/htpasswd.php?leftmenu=export", $langs->trans("Filehtpasswd"), 1, $user->rights->adherent->export);
2403  }
2404 
2405  if (isModEnabled('categorie')) {
2406  $langs->load("categories");
2407  $newmenu->add("/categories/index.php?leftmenu=cat&amp;type=3", $langs->trans("Categories"), 1, $user->rights->categorie->lire, '', $mainmenu, 'cat');
2408  }
2409 
2410  $newmenu->add("/adherents/index.php?leftmenu=members&amp;mainmenu=members", $langs->trans("Subscriptions"), 0, $user->rights->adherent->cotisation->lire, '', $mainmenu, 'members', 0, '', '', '', img_picto('', 'payment', 'class="paddingright pictofixedwidth"'));
2411  $newmenu->add("/adherents/list.php?leftmenu=members&amp;statut=-1,1&amp;mainmenu=members", $langs->trans("NewSubscription"), 1, $user->rights->adherent->cotisation->creer);
2412  $newmenu->add("/adherents/subscription/list.php?leftmenu=members", $langs->trans("List"), 1, $user->rights->adherent->cotisation->lire);
2413  $newmenu->add("/adherents/stats/index.php?leftmenu=members", $langs->trans("MenuMembersStats"), 1, $user->rights->adherent->lire);
2414 
2415  //$newmenu->add("/adherents/index.php?leftmenu=export&amp;mainmenu=members",$langs->trans("Tools"),0,$user->rights->adherent->export, '', $mainmenu, 'export');
2416  //if (isModEnabled('export') && ($usemenuhider || empty($leftmenu) || $leftmenu=="export")) $newmenu->add("/exports/index.php?leftmenu=export",$langs->trans("Datas"),1,$user->rights->adherent->export);
2417 
2418  // Type
2419  $newmenu->add("/adherents/type.php?leftmenu=setup&amp;mainmenu=members", $langs->trans("MembersTypes"), 0, $user->rights->adherent->configurer, '', $mainmenu, 'setup', 0, '', '', '', img_picto('', 'members', 'class="paddingright pictofixedwidth"'));
2420  $newmenu->add("/adherents/type.php?leftmenu=setup&amp;mainmenu=members&amp;action=create", $langs->trans("New"), 1, $user->rights->adherent->configurer);
2421  $newmenu->add("/adherents/type.php?leftmenu=setup&amp;mainmenu=members", $langs->trans("List"), 1, $user->rights->adherent->configurer);
2422  }
2423  }
2424 }
make_substitutions
make_substitutions($text, $substitutionarray, $outputlangs=null, $converttextinhtmlifnecessary=0)
Make substitution into a text string, replacing keys with vals from $substitutionarray (oldval=>newva...
Definition: functions.lib.php:7839
dol_escape_htmltag
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields.
Definition: functions.lib.php:1468
dol_trunc
dol_trunc($string, $size=40, $trunc='right', $stringencoding='UTF-8', $nodot=0, $display=0)
Truncate a string to a particular length adding '…' if string larger than length.
Definition: functions.lib.php:3805
get_left_menu_products
get_left_menu_products($mainmenu, &$newmenu, $usemenuhider=1, $leftmenu='none', $type_user=0)
Get left Menu PRODUCTS-SERVICES.
Definition: eldy.lib.php:1986
print_left_eldy_menu
print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabMenu, &$menu, $noout=0, $forcemainmenu='', $forceleftmenu='', $moredata=null, $type_user=0)
Core function to output left menu eldy Fill &$menu (example with $forcemainmenu='home' $forceleftmenu...
Definition: eldy.lib.php:701
print_start_menu_entry
print_start_menu_entry($idsel, $classname, $showmode)
Output start menu entry.
Definition: eldy.lib.php:605
GETPOST
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
Definition: functions.lib.php:484
print_end_menu_array
print_end_menu_array()
Output menu array.
Definition: eldy.lib.php:678
dol_print_error
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
Definition: functions.lib.php:4844
dol_sort_array
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by second index function, which produces ascending (default) or descending output...
Definition: functions.lib.php:8385
dol_buildpath
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
Definition: functions.lib.php:1062
img_warning
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
Definition: functions.lib.php:4521
get_left_menu_accountancy
get_left_menu_accountancy($mainmenu, &$newmenu, $usemenuhider=1, $leftmenu='none', $type_user=0)
Get left COMPTA-FINANCIAL (accountancy)
Definition: eldy.lib.php:1584
print_text_menu_entry
print_text_menu_entry($text, $showmode, $url, $id, $idsel, $classname, $atarget)
Output menu entry.
Definition: eldy.lib.php:626
Menubase
Class to manage menu entries.
Definition: menubase.class.php:30
isVisibleToUserType
isVisibleToUserType($type_user, &$menuentry, &$listofmodulesforexternal)
Function to test if an entry is enabled or not.
Definition: functions.lib.php:10217
get_left_menu_commercial
get_left_menu_commercial($mainmenu, &$newmenu, $usemenuhider=1, $leftmenu='none', $type_user=0)
Get left Menu COMMERCIAL (propal, commande, supplier_proposal, supplier_order, contrat,...
Definition: eldy.lib.php:1287
get_left_menu_tools
get_left_menu_tools($mainmenu, &$newmenu, $usemenuhider=1, $leftmenu='none', $type_user=0)
Get left Menu TOOLS.
Definition: eldy.lib.php:2339
print_eldy_menu
print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout=0, $mode='')
Core function to output top menu eldy.
Definition: eldy.lib.php:45
img_picto
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
Definition: functions.lib.php:3880
get_left_menu_thridparties
get_left_menu_thridparties($mainmenu, &$newmenu, $usemenuhider=1, $leftmenu='none', $type_user=0)
Get left Menu THIRDPARTIES.
Definition: eldy.lib.php:1182
get_left_menu_home
get_left_menu_home($mainmenu, &$newmenu, $usemenuhider=1, $leftmenu='none', $type_user=0)
Get left Menu HOME.
Definition: eldy.lib.php:1063
get_left_menu_hrm
get_left_menu_hrm($mainmenu, &$newmenu, $usemenuhider=1, $leftmenu='none', $type_user=0)
Get left Menu HRM.
Definition: eldy.lib.php:2232
get_left_menu_billing
get_left_menu_billing($mainmenu, &$newmenu, $usemenuhider=1, $leftmenu='none', $type_user=0)
Get left COMPTA-FINANCIAL.
Definition: eldy.lib.php:1403
getCommonSubstitutionArray
getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $object=null)
Return array of possible common substitutions.
Definition: functions.lib.php:7275
dol_string_nohtmltag
dol_string_nohtmltag($stringtoclean, $removelinefeed=1, $pagecodeto='UTF-8', $strip_tags=0, $removedoublespaces=1)
Clean a string from all HTML tags and entities.
Definition: functions.lib.php:6694
get_left_menu_projects
get_left_menu_projects($mainmenu, &$newmenu, $usemenuhider=1, $leftmenu='none', $type_user=0)
Get left Menu PROJECTS.
Definition: eldy.lib.php:2157
print_end_menu_entry
print_end_menu_entry($showmode)
Output end menu entry.
Definition: eldy.lib.php:665
isModEnabled
isModEnabled($module)
Is Dolibarr module enabled.
Definition: functions.lib.php:105
print_start_menu_array
print_start_menu_array()
Output start menu array.
Definition: eldy.lib.php:589
get_left_menu_mrp
get_left_menu_mrp($mainmenu, &$newmenu, $usemenuhider=1, $leftmenu='none', $type_user=0)
Get left Menu PRODUCTS-SERVICES MRP - GPAO.
Definition: eldy.lib.php:2123
get_left_menu_bank
get_left_menu_bank($mainmenu, &$newmenu, $usemenuhider=1, $leftmenu='none', $type_user=0)
Get left Menu BANK.
Definition: eldy.lib.php:1903
get_left_menu_members
get_left_menu_members($mainmenu, &$newmenu, $usemenuhider=1, $leftmenu='none', $type_user=0)
Get left Menu MEMBERS.
Definition: eldy.lib.php:2380
$resql
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->rights->fournisseur->facture->lire)||(isModEnabled('supplier_invoice') && $user->rights->supplier_invoice->lire)) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
Definition: index.php:742
getDolGlobalInt
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
Definition: functions.lib.php:93