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