dolibarr 24.0.0-beta
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-2026 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 if ((!preg_match('/mainmenu/i', $param)) || !preg_match('/leftmenu/i', $param)) {
517 // @phan-suppress-next-line PhanTypeSuspiciousStringExpression
518 $param .= ($param ? '&' : '').'mainmenu='.$newTabMenu[$i]['mainmenu'].'&leftmenu=';
519 }
520 //$url.="idmenu=".$newTabMenu[$i]['rowid']; // Already done by menuLoad
521 $url = dol_buildpath($url, 1).($param ? '?'.$param : '');
522 //$shorturl = $shorturl.($param?'?'.$param:'');
523 $shorturl = $url;
524 if (DOL_URL_ROOT) {
525 $shorturl = preg_replace('/^'.preg_quote(DOL_URL_ROOT, '/').'/', '', $shorturl);
526 }
527 }
528
529 // Modify URL for the case we are using the option showtopmenuinframe
530 if ($newTabMenu[$i]['showtopmenuinframe']) {
531 if (preg_match("/^(http:\/\/|https:\/\/)/i", $newTabMenu[$i]['url'])) {
532 $url = $shorturl = '/core/frames.php?idmenu='.$newTabMenu[$i]['rowid'];
533 }
534 }
535
536 $showmode = isVisibleToUserType($type_user, $newTabMenu[$i], $listofmodulesforexternal);
537 if ($showmode == 1) {
538 // Define the class (top menu selected or not)
539 if (!empty($_SESSION['idmenu']) && $newTabMenu[$i]['rowid'] == $_SESSION['idmenu']) {
540 $classname = 'class="tmenusel"';
541 } elseif (!empty($_SESSION["mainmenu"]) && $newTabMenu[$i]['mainmenu'] == $_SESSION["mainmenu"]) {
542 $classname = 'class="tmenusel"';
543 } else {
544 $classname = 'class="tmenu"';
545 }
546 } elseif ($showmode == 2) {
547 $classname = 'class="tmenu"';
548 }
549
550 $menu->add(
551 $shorturl,
552 $newTabMenu[$i]['titre'],
553 0,
554 $showmode,
555 ($newTabMenu[$i]['target'] ? $newTabMenu[$i]['target'] : $atarget),
556 ($newTabMenu[$i]['mainmenu'] ? $newTabMenu[$i]['mainmenu'] : $newTabMenu[$i]['rowid']),
557 ($newTabMenu[$i]['leftmenu'] ? $newTabMenu[$i]['leftmenu'] : ''),
558 $newTabMenu[$i]['position'],
559 $id,
560 $idsel,
561 $classname,
562 $newTabMenu[$i]['prefix']
563 );
564 }
565
566 // Sort the top menu on position
567 $menu->liste = dol_sort_array($menu->liste, 'position');
568
569 // If noout is on (for jmobile div menu for example)
570 if ($noout) {
571 return 0;
572 }
573
574 // Output menu entries
575
577
578 // Show logo company
579 if (!getDolGlobalString('MAIN_MENU_INVERT') && getDolGlobalString('MAIN_SHOW_LOGO') && !getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
580 //$mysoc->logo_mini=(empty($conf->global->MAIN_INFO_SOCIETE_LOGO_MINI)?'':$conf->global->MAIN_INFO_SOCIETE_LOGO_MINI);
581 $mysoc->logo_squarred_mini = getDolGlobalString('MAIN_INFO_SOCIETE_LOGO_SQUARRED_MINI');
582
583 $logoContainerAdditionalClass = 'backgroundforcompanylogo';
584 if (getDolGlobalString('MAIN_INFO_SOCIETE_LOGO_NO_BACKGROUND')) {
585 $logoContainerAdditionalClass = '';
586 }
587
588 if (!empty($mysoc->logo_squarred_mini) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_squarred_mini)) {
589 $urllogo = dolBuildUrl(DOL_URL_ROOT.'/viewimage.php', ['cache' => 1, 'modulepart' => 'mycompany', 'file' => 'logos/thumbs/'.$mysoc->logo_squarred_mini]);
590 /*} elseif (!empty($mysoc->logo_mini) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini))
591 {
592 $urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&amp;modulepart=mycompany&amp;file='.urlencode('logos/thumbs/'.$mysoc->logo_mini);
593 }*/
594 } else {
595 $urllogo = dolBuildUrl(DOL_URL_ROOT.'/theme/dolibarr_512x512_white.png');
596 $logoContainerAdditionalClass = '';
597 }
598 $title = $langs->trans("GoIntoSetupToChangeLogo");
599
600 print "\n".'<!-- Show logo on menu -->'."\n";
601 print_start_menu_entry('companylogo', 'class="tmenu tmenucompanylogo nohover"', 1);
602
603 print '<div class="center '.$logoContainerAdditionalClass.' menulogocontainer"><img class="mycompany" title="'.dol_escape_htmltag($title).'" alt="" src="'.$urllogo.'" style="max-width: 100px"></div>'."\n";
604
606 }
607
608 //var_dump($menu->liste);
609 foreach ($menu->liste as $menuval) {
610 print_start_menu_entry($menuval['idsel'], $menuval['classname'], $menuval['enabled']);
611 // @phpstan-ignore-next-line
612 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);
613 print_end_menu_entry($menuval['enabled']);
614 }
615
616 if (!getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
617 $showmode = 1;
618 print_start_menu_entry('', 'class="tmenuend"', $showmode);
619 print_end_menu_entry($showmode);
621 }
622
623 return 0;
624}
625
626
633{
634 print '<div class="tmenudiv">';
635 print '<ul role="navigation" class="tmenu"'.(getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER') ? ' title="Top menu"' : '').'>';
636}
637
646function print_start_menu_entry($idsel, $classname, $showmode)
647{
648 if ($showmode) {
649 print '<li '.$classname.' id="mainmenutd_'.$idsel.'">';
650 //print '<div class="tmenuleft tmenusep"></div>';
651 print '<div class="tmenucenter">';
652 }
653}
654
668function print_text_menu_entry($text, $showmode, $url, $id, $idsel, $classname, $atarget, $menuval = array())
669{
670 global $langs;
671
672 $classnameimg = str_replace('class="', 'class="tmenuimage ', $classname);
673 $classnametxt = str_replace('class="', 'class="tmenulabel ', $classname);
674
675 //$conf->global->THEME_TOPMENU_DISABLE_IMAGE=1;
676 if ($showmode == 1) {
677 print '<a '.$classnameimg.' tabindex="-1" href="'.$url.'"'.($atarget ? ' target="'.$atarget.'"' : '').' title="'.dol_escape_htmltag($text).'">';
678 print '<div class="'.$id.' '.$idsel.' topmenuimage">';
679 $reg = array();
680 if (!empty($menuval['prefix']) && strpos($menuval['prefix'], '<span') === 0) {
681 print $menuval['prefix'];
682 } elseif (!empty($menuval['prefix']) && preg_match('/^(fa[rsb]? )?fa-/', $menuval['prefix'], $reg)) {
683 print '<span class="'.$id.' '.(empty($reg[1]) ? 'fa ' : '').$menuval['prefix'].'" id="mainmenuspan_'.$idsel.'"></span>';
684 } else {
685 print '<span class="'.$id.' tmenuimageforpng" id="mainmenuspan_'.$idsel.'"></span>';
686 }
687 print '</div>';
688 print '</a>';
689 if (!getDolGlobalString('THEME_TOPMENU_DISABLE_TEXT')) {
690 print '<a '.$classnametxt.' id="mainmenua_'.$idsel.'" href="'.$url.'"'.($atarget ? ' target="'.$atarget.'"' : '').' title="'.dol_escape_htmltag($text).'">';
691 print '<span class="mainmenuaspan">';
692 print $text;
693 print '</span>';
694 print '</a>';
695 }
696 } elseif ($showmode == 2) {
697 print '<div '.$classnameimg.' title="'.dol_escape_htmltag($text.' - '.$langs->trans("NotAllowed")).'">';
698 print '<div class="'.$id.' '.$idsel.' topmenuimage tmenudisabled">';
699 if (!empty($menuval['prefix']) && strpos($menuval['prefix'], '<span') === 0) {
700 print $menuval['prefix'];
701 } else {
702 print '<span class="'.$id.' tmenuimageforpng tmenudisabled" id="mainmenuspan_'.$idsel.'"></span>';
703 }
704 print '</div>';
705 print '</div>';
706 if (!getDolGlobalString('THEME_TOPMENU_DISABLE_TEXT')) {
707 print '<span '.$classnametxt.' id="mainmenua_'.$idsel.'" href="#" title="'.dol_escape_htmltag($text.' - '.$langs->trans("NotAllowed")).'">';
708 print '<span class="mainmenuaspan tmenudisabled">';
709 print $text;
710 print '</span>';
711 print '</span>';
712 }
713 }
714}
715
722function print_end_menu_entry($showmode)
723{
724 if ($showmode) {
725 print '</div></li>';
726 }
727 print "\n";
728}
729
736{
737 print '</ul>';
738 print '</div>';
739 print "\n";
740}
741
758function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabMenu, &$menu, $noout = 0, $forcemainmenu = '', $forceleftmenu = '', $moredata = null, $type_user = 0)
759{
760 global $user, $conf, $langs, $hookmanager;
761
762 //var_dump($tabMenu);
763
764 $newmenu = $menu;
765
766 $mainmenu = ($forcemainmenu ? $forcemainmenu : $_SESSION["mainmenu"] ?? '');
767 $leftmenu = ($forceleftmenu ? '' : (empty($_SESSION["leftmenu"]) ? 'none' : $_SESSION["leftmenu"] ?? ''));
768
769 if (empty($mainmenu)) {
770 $mainmenu = 'home';
771 }
772
773 global $usemenuhider;
774 $usemenuhider = 0;
775
776 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
777 print "\n";
778 print "<!-- Begin SearchForm -->\n";
779 print '<div id="blockvmenusearch" class="blockvmenusearch">'."\n";
780 print $moredata['searchform'];
781 print '</div>'."\n";
782 print "<!-- End SearchForm -->\n";
783 }
784
785 if (is_array($moredata) && !empty($moredata['bookmarks'])) {
786 print "\n";
787 print "<!-- Begin Bookmarks -->\n";
788 print '<div id="blockvmenubookmarks" class="blockvmenubookmarks">'."\n";
789 print $moredata['bookmarks'];
790 print '</div>'."\n";
791 print "<!-- End Bookmarks -->\n";
792 }
793
794 $substitarray = getCommonSubstitutionArray($langs, 0, null, null, array('system', 'mycompany', 'date', 'user'));
795
796 $listofmodulesforexternal = explode(',', getDolGlobalString('MAIN_MODULES_FOR_EXTERNAL'));
797
802 if ($mainmenu) { // If this is empty, loading hard coded menu and loading personalised menu will fail
803 /*
804 * Menu HOME
805 */
806 if ($mainmenu == 'home') {
807 get_left_menu_home($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user);
808 }
809
810 /*
811 * Menu THIRDPARTIES
812 */
813 if ($mainmenu == 'companies') {
814 get_left_menu_thridparties($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user);
815 }
816
817 /*
818 * Menu COMMERCIAL (propal, commande, supplier_proposal, supplier_order, contrat, ficheinter)
819 */
820 if ($mainmenu == 'commercial') {
821 get_left_menu_commercial($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user);
822 }
823
824 /*
825 * Menu COMPTA-FINANCIAL
826 */
827 if ($mainmenu == 'billing') {
828 get_left_menu_billing($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user);
829 }
830
831 /*
832 * Menu COMPTA-FINANCIAL
833 */
834 if ($mainmenu == 'accountancy') {
835 get_left_menu_accountancy($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user);
836 }
837
838 /*
839 * Menu BANK
840 */
841 if ($mainmenu == 'bank') {
842 get_left_menu_bank($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user);
843 }
844
845 /*
846 * Menu PRODUCTS-SERVICES
847 */
848 if ($mainmenu == 'products') {
849 get_left_menu_products($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user);
850 }
851
852 /*
853 * Menu PRODUCTS-SERVICES MRP - GPAO
854 */
855 if ($mainmenu == 'mrp') {
856 get_left_menu_mrp($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user);
857 }
858
859 /*
860 * Menu PROJECTS
861 */
862 if ($mainmenu == 'project') {
863 get_left_menu_projects($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user);
864 }
865
866 /*
867 * Menu HRM
868 */
869 if ($mainmenu == 'hrm') {
870 get_left_menu_hrm($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user);
871 }
872 /*
873 * Menu TOOLS
874 */
875 if ($mainmenu == 'tools') {
876 get_left_menu_tools($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user);
877 }
878
879 /*
880 * Menu MEMBERS
881 */
882 if ($mainmenu == 'members') {
883 get_left_menu_members($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user);
884 }
885
886 // Add personalized menus and modules menus
887 //var_dump($newmenu->liste); //
888 $menuArbo = new Menubase($db, 'eldy');
889 $newmenu = $menuArbo->menuLeftCharger($newmenu, $mainmenu, $leftmenu, (empty($user->socid) ? 0 : 1), 'eldy', $tabMenu);
890 //var_dump($newmenu->liste); //
891
892 if (isModEnabled('ftp') && $mainmenu == 'ftp') { // Entry for FTP
893 $MAXFTP = 20;
894 $i = 1;
895 while ($i <= $MAXFTP) {
896 $paramkey = 'FTP_NAME_'.$i;
897 //print $paramkey;
898 if (getDolGlobalString($paramkey)) {
899 $link = "/ftp/index.php?idmenu=".$_SESSION["idmenu"]."&numero_ftp=".$i;
900 $newmenu->add($link, dol_trunc($conf->global->$paramkey, 24));
901 }
902 $i++;
903 }
904 }
905 }
906
907 //var_dump($tabMenu);
908 //var_dump($newmenu->liste);
909
910 // Build final $menu_array = $menu_array_before +$newmenu->liste + $menu_array_after
911 //var_dump($menu_array_before);exit;
912 //var_dump($menu_array_after);exit;
913 $menu_array = $newmenu->liste;
914 if (is_array($menu_array_before)) {
915 $menu_array = array_merge($menu_array_before, $menu_array);
916 }
917 if (is_array($menu_array_after)) {
918 $menu_array = array_merge($menu_array, $menu_array_after);
919 }
920 //var_dump($menu_array);exit;
921 if (!is_array($menu_array)) {
922 return 0;
923 }
924
925 // Allow the $menu_array of the menu to be manipulated by modules
926 $parameters = array(
927 'mainmenu' => $mainmenu,
928 );
929 $hook_items = $menu_array;
930 $reshook = $hookmanager->executeHooks('menuLeftMenuItems', $parameters, $hook_items); // Note that $action and $object may have been modified by some hooks @phan-suppress-current-line PhanTypeMismatchArgument
931
932 if (is_numeric($reshook)) {
933 if ($reshook == 0 && !empty($hookmanager->resArray)) {
934 $menu_array[] = $hookmanager->resArray; // add
935 } elseif ($reshook == 1) {
936 $menu_array = $hookmanager->resArray; // replace
937 }
938 }
939
940 // Set a field positionfull to allow to sort tree entry without breaking the hierarchy.
941 $counter = 0;
942 $currentpositionlevel = 0;
943 $currentpositionpath = '';
944 foreach ($menu_array as $key => $val) {
945 $counter++;
946 //print 'key='.$key.' level='.$menu_array[$key]['level'].' currentpositionlevel='.$currentpositionlevel.' <br>'."\n";
947 if ($menu_array[$key]['level'] <= $currentpositionlevel) { // We found a break we are now on a lower level
948 $tmparray = explode('_', $currentpositionpath);
949 $currentpositionpath = '';
950 for ($i = 0; $i < $menu_array[$key]['level']; $i++) {
951 $currentpositionpath .= $tmparray[$i].'_';
952 }
953 $currentpositionpath .= $menu_array[$key]['position'].'.'.$counter;
954 $menu_array[$key]['positionfull'] = $currentpositionpath;
955 //print '$currentpositionpath='.$currentpositionpath.'<br>'."\n";
956 } else {
957 $currentpositionpath .= '_'.$menu_array[$key]['position'].'.'.$counter;
958 $menu_array[$key]['positionfull'] = $currentpositionpath;
959 //print '$currentpositionpath='.$currentpositionpath.'<br>'."\n";
960 }
961 $currentpositionlevel = $menu_array[$key]['level'];
962 }
963
964 //var_dump($menu_array);exit;
965 $menu_array = dol_sort_array($menu_array, 'positionfull', 'asc', 1, 0, 1);
966
967 // Force the typing at this point to get useful analysis below:
968 '@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';
972 // Show menu
973 $invert = !getDolGlobalString('MAIN_MENU_INVERT') ? "" : "invert";
974 if (empty($noout)) {
975 $altok = 0;
976 $blockvmenuopened = false;
977 $lastlevel0 = '';
978 $num = count($menu_array);
979 foreach (array_keys($menu_array) as $i) { // Loop on each menu entry (got better static analysis)
980 $showmenu = true;
981 if (getDolGlobalString('MAIN_MENU_HIDE_UNAUTHORIZED') && empty($menu_array[$i]['enabled'])) {
982 $showmenu = false;
983 }
984
985 // Begin of new left menu block
986 if (empty($menu_array[$i]['level']) && $showmenu) {
987 $altok++;
988 $blockvmenuopened = true;
989 $lastopened = true;
990 for ($j = ($i + 1); $j < $num; $j++) {
991 if (empty($menu_array[$j]['level'])) {
992 $lastopened = false;
993 }
994 }
995 if ($altok % 2 == 0) {
996 print '<div class="blockvmenu blockvmenuimpair'.$invert.($lastopened ? ' blockvmenulast' : '').($altok == 1 ? ' blockvmenufirst' : '').'">'."\n";
997 } else {
998 print '<div class="blockvmenu blockvmenupair'.$invert.($lastopened ? ' blockvmenulast' : '').($altok == 1 ? ' blockvmenufirst' : '').'">'."\n";
999 }
1000 }
1001
1002 // Add tabulation
1003 $tabstring = '';
1004 $tabul = ($menu_array[$i]['level'] - 1);
1005 if ($tabul > 0) {
1006 for ($j = 0; $j < $tabul; $j++) {
1007 $tabstring .= '&nbsp;&nbsp;&nbsp;';
1008 }
1009 }
1010
1011 // $menu_array[$i]['url'] can be a relative url, a full external url. We try substitution
1012
1013 $menu_array[$i]['url'] = make_substitutions($menu_array[$i]['url'], $substitarray);
1014
1015 $url = $shorturl = $shorturlwithoutparam = $menu_array[$i]['url'];
1016 if (!preg_match("/^(http:\/\/|https:\/\/)/i", $menu_array[$i]['url'])) {
1017 $tmp = explode('?', $menu_array[$i]['url'], 2);
1018 $url = $shorturl = $tmp[0];
1019 $param = (isset($tmp[1]) ? $tmp[1] : ''); // params in url of the menu link
1020
1021 // Complete param to force leftmenu to '' to close open menu when we click on a link with no leftmenu defined.
1022 if ((!preg_match('/mainmenu/i', $param)) && (!preg_match('/leftmenu/i', $param)) && !empty($menu_array[$i]['mainmenu'])) {
1023 $param .= ($param ? '&' : '').'mainmenu='.$menu_array[$i]['mainmenu'].'&leftmenu=';
1024 }
1025 if ((!preg_match('/mainmenu/i', $param)) && (!preg_match('/leftmenu/i', $param)) && empty($menu_array[$i]['mainmenu'])) {
1026 $param .= ($param ? '&' : '').'leftmenu=';
1027 }
1028 //$url.="idmenu=".$menu_array[$i]['rowid']; // Already done by menuLoad
1029 $url = dol_buildpath($url, 1).($param ? '?'.$param : '');
1030 $shorturlwithoutparam = $shorturl;
1031 $shorturl .= ($param ? '?'.$param : '');
1032 }
1033
1034
1035 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";
1036
1037 // Menu level 0
1038 if ($menu_array[$i]['level'] == 0) {
1039 if ($menu_array[$i]['enabled']) { // Enabled so visible
1040 print '<div class="menu_titre">'.$tabstring;
1041 if ($shorturlwithoutparam) {
1042 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'].'"' : '').'>';
1043 } else {
1044 print '<span class="vmenu">';
1045 }
1046 if (!empty($menu_array[$i]['prefix'])) {
1047 $reg = array();
1048 if (preg_match('/^(fa[rsb]? )?fa-/', $menu_array[$i]['prefix'], $reg)) {
1049 print '<span class="'.(empty($reg[1]) ? 'fa ' : '').$menu_array[$i]['prefix'].' paddingright pictofixedwidth"></span>';
1050 } else {
1051 print $menu_array[$i]['prefix'];
1052 }
1053 }
1054 print ucfirst($menu_array[$i]['titre']);
1055 if ($shorturlwithoutparam) {
1056 print '</a>';
1057 } else {
1058 print '</span>';
1059 }
1060 print '</div>'."\n";
1061 $lastlevel0 = 'enabled';
1062 } elseif ($showmenu) { // Not enabled but visible (so greyed)
1063 print '<div class="menu_titre">'.$tabstring;
1064 print '<span class="vmenudisabled" title="'.dolPrintHTMLForAttribute($menu_array[$i]['titre']).'">';
1065 if (!empty($menu_array[$i]['prefix'])) {
1066 print $menu_array[$i]['prefix'];
1067 }
1068 print ucfirst($menu_array[$i]['titre']);
1069 print '</span>';
1070 print '</div>'."\n";
1071 $lastlevel0 = 'greyed';
1072 } else {
1073 $lastlevel0 = 'hidden';
1074 }
1075 if ($showmenu) {
1076 print '<div class="menu_top"></div>'."\n";
1077 }
1078 }
1079
1080 // Menu level > 0
1081 if ($menu_array[$i]['level'] > 0) {
1082 $cssmenu = '';
1083 if ($menu_array[$i]['url']) {
1084 $cssmenu = ' menu_contenu'.dol_string_nospecial(preg_replace('/\.php.*$/', '', $menu_array[$i]['url']));
1085 }
1086
1087 if ($menu_array[$i]['enabled'] && $lastlevel0 == 'enabled') {
1088 // Enabled so visible, except if parent was not enabled.
1089 print '<div class="menu_contenu'.$cssmenu.'">';
1090 print $tabstring;
1091 if ($shorturlwithoutparam) {
1092 print '<a class="vsmenu" title="'.dolPrintHTMLForAttribute($menu_array[$i]['titre']).'" href="'.$url.'"'.($menu_array[$i]['target'] ? ' target="'.$menu_array[$i]['target'].'"' : '').'>';
1093 } else {
1094 print '<span class="vsmenu" title="'.dolPrintHTMLForAttribute($menu_array[$i]['titre']).'">';
1095 }
1096 print ucfirst($menu_array[$i]['titre']);
1097 if ($shorturlwithoutparam) {
1098 print '</a>';
1099 } else {
1100 print '</span>';
1101 }
1102 // If title is not pure text and contains a table, no carriage return added
1103 if (!strstr($menu_array[$i]['titre'], '<table')) {
1104 print '<br>';
1105 }
1106 print '</div>'."\n";
1107 } elseif ($showmenu && $lastlevel0 == 'enabled') {
1108 // Not enabled but visible (so greyed), except if parent was not enabled.
1109 print '<div class="menu_contenu'.$cssmenu.'">';
1110 print $tabstring;
1111 print '<span class="vsmenudisabled vsmenudisabledmargin" title="'.dolPrintHTMLForAttribute($menu_array[$i]['titre']).'">'.$menu_array[$i]['titre'].'</span><br>';
1112 print '</div>'."\n";
1113 }
1114 }
1115
1116 // If next is a new block or if there is nothing after
1117 if (empty($menu_array[$i + 1]['level'])) { // End menu block
1118 if ($showmenu) {
1119 print '<div class="menu_end"></div>'."\n";
1120 }
1121 if ($blockvmenuopened) {
1122 print '</div>'."\n";
1123 $blockvmenuopened = false;
1124 }
1125 }
1126 }
1127
1128 if ($altok) {
1129 print '<div class="blockvmenuend"></div>'; // End menu block
1130 }
1131 }
1132
1133 return count($menu_array);
1134}
1135
1136
1147function get_left_menu_home($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = 'none', $type_user = 0)
1148{
1149 global $user, $conf, $langs;
1150
1151 if ($mainmenu == 'home') {
1152 $langs->load("users");
1153
1154 // Home - dashboard
1155 $landingpage = getDolUserString('MAIN_LANDING_PAGE', getDolGlobalString('MAIN_LANDING_PAGE'));
1156 if (!empty($landingpage)) {
1157 $landingpage = dol_buildpath($landingpage, 1);
1158 } else {
1159 $landingpage = dolBuildUrl('/index.php', ['mainmenu' => 'home', 'leftmenu' => 'home']);
1160 }
1161 $newmenu->add($landingpage, $langs->trans("MyDashboard"), 0, 1, '', $mainmenu, 'home', 0, '', '', '', '<i class="fas fa-chart-bar fa-fw paddingright pictofixedwidth"></i>');
1162
1163 // Setup
1164 $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>');
1165
1166 if ($usemenuhider || empty($leftmenu) || $leftmenu == "setup") {
1167 // Define $nbmodulesnotautoenabled - TODO This code is at different places
1168 $nbmodulesnotautoenabled = count($conf->modules);
1169 $listofmodulesautoenabled = array('user', 'agenda', 'fckeditor', 'export', 'import');
1170 foreach ($listofmodulesautoenabled as $moduleautoenable) {
1171 if (in_array($moduleautoenable, $conf->modules)) {
1172 $nbmodulesnotautoenabled--;
1173 }
1174 }
1175
1176 // Load translation files required by the page
1177 $langs->loadLangs(array("admin", "help"));
1178 $warnpicto = '';
1179 if (!getDolGlobalString('MAIN_INFO_SOCIETE_NOM') || !getDolGlobalString('MAIN_INFO_SOCIETE_COUNTRY') || getDolGlobalString('MAIN_INFO_SOCIETE_SETUP_TODO_WARNING')) {
1180 $langs->load("errors");
1181 $warnpicto = img_warning($langs->trans("WarningMandatorySetupNotComplete"));
1182 }
1183 $newmenu->add(dolBuildUrl("/admin/company.php", ['mainmenu' => 'home']), $langs->trans("MenuCompanySetup").$warnpicto, 1);
1184 $warnpicto = '';
1185 if ($nbmodulesnotautoenabled < getDolGlobalInt('MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING', 1)) { // If only minimal initial modules enabled)
1186 $langs->load("errors");
1187 $warnpicto = img_warning($langs->trans("WarningMandatorySetupNotComplete"));
1188 }
1189 $newmenu->add(dolBuildUrl("/admin/modules.php", ['mainmenu' => 'home']), $langs->trans("Modules").$warnpicto, 1);
1190 $newmenu->add(dolBuildUrl("/admin/ihm.php", ['mainmenu' => 'home']), $langs->trans("GUISetup"), 1);
1191 $newmenu->add(dolBuildUrl("/admin/menus.php", ['mainmenu' => 'home']), $langs->trans("Menus"), 1);
1192
1193 $newmenu->add(dolBuildUrl("/admin/translation.php", ['mainmenu' => 'home']), $langs->trans("Translation"), 1);
1194 $newmenu->add(dolBuildUrl("/admin/defaultvalues.php", ['mainmenu' => 'home']), $langs->trans("DefaultValues"), 1);
1195 $newmenu->add(dolBuildUrl("/admin/boxes.php", ['mainmenu' => 'home']), $langs->trans("Boxes"), 1);
1196 $newmenu->add(dolBuildUrl("/admin/delais.php", ['mainmenu' => 'home']), $langs->trans("MenuWarnings"), 1);
1197 $newmenu->add(dolBuildUrl("/admin/security_other.php", ['mainmenu' => 'home']), $langs->trans("Security"), 1);
1198 $newmenu->add(dolBuildUrl("/admin/limits.php", ['mainmenu' => 'home']), $langs->trans("MenuLimits"), 1);
1199 $newmenu->add(dolBuildUrl("/admin/pdf.php", ['mainmenu' => 'home']), $langs->trans("PDF"), 1);
1200
1201 $warnpicto = '';
1202 /* No warning into menu entry, the message in Email setup page is enough
1203 A warning will be important if a DMARC record exists and SPF is not aligned.
1204 if (getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail') == 'mail' && !getDolGlobalString('MAIN_HIDE_WARNING_TO_ENCOURAGE_SMTP_SETUP')) {
1205 $langs->load("errors");
1206 $warnpicto = img_warning($langs->trans("WarningPHPMailD"));
1207 }
1208 */
1209 if (getDolGlobalString('MAIN_MAIL_SENDMODE') && in_array(getDolGlobalString('MAIN_MAIL_SENDMODE'), array('smtps', 'swiftmail')) && !getDolGlobalString('MAIN_MAIL_SMTP_SERVER')) {
1210 $langs->load("errors");
1211 $warnpicto = img_warning($langs->trans("ErrorSetupOfEmailsNotComplete"));
1212 }
1213
1214 $newmenu->add(dolBuildUrl("/admin/mails.php", ['mainmenu' => 'home']), $langs->trans("Emails").$warnpicto, 1);
1215 $newmenu->add(dolBuildUrl("/admin/sms.php", ['mainmenu' => 'home']), $langs->trans("SMS"), 1);
1216 $newmenu->add(dolBuildUrl("/admin/dict.php", ['mainmenu' => 'home']), $langs->trans("Dictionary"), 1);
1217 $newmenu->add(dolBuildUrl("/admin/const.php", ['mainmenu' => 'home']), $langs->trans("OtherSetup"), 1);
1218 }
1219
1220 // System tools
1221 $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>');
1222 if ($usemenuhider || empty($leftmenu) || preg_match('/^admintools/', $leftmenu)) {
1223 // Load translation files required by the page
1224 $langs->loadLangs(array('admin', 'help'));
1225
1226 $newmenu->add(dolBuildUrl('/admin/system/dolibarr.php', ['mainmenu' => 'home', 'leftmenu' => 'admintools_info']), $langs->trans('InfoDolibarr'), 1);
1227 if ($usemenuhider || empty($leftmenu) || $leftmenu == 'admintools_info') {
1228 $newmenu->add(dolBuildUrl('/admin/system/modules.php', ['mainmenu' => 'home', 'leftmenu' => 'admintools_info']), $langs->trans('Modules'), 2);
1229 $newmenu->add(dolBuildUrl('/admin/triggers.php', ['mainmenu' => 'home', 'leftmenu' => 'admintools_info']), $langs->trans('Triggers'), 2);
1230 $newmenu->add(dolBuildUrl('/blockedlog/admin/filecheck.php', ['mainmenu' => 'home', 'leftmenu' => 'admintools_info']), $langs->trans('FileCheck'), 2);
1231 $newmenu->add(dolBuildUrl('/admin/system/about.php', ['mainmenu' => 'home', 'leftmenu' => 'admintools_info']), $langs->trans('ExternalResources'), 2);
1232 }
1233 $newmenu->add(dolBuildUrl('/admin/system/browser.php', ['mainmenu' => 'home', 'leftmenu' => 'admintools']), $langs->trans('InfoBrowser'), 1);
1234 $newmenu->add(dolBuildUrl('/admin/system/os.php', ['mainmenu' => 'home', 'leftmenu' => 'admintools']), $langs->trans('InfoOS'), 1);
1235 $newmenu->add(dolBuildUrl('/admin/system/web.php', ['mainmenu' => 'home', 'leftmenu' => 'admintools']), $langs->trans('InfoWebServer'), 1);
1236 $newmenu->add(dolBuildUrl('/admin/system/phpinfo.php', ['mainmenu' => 'home', 'leftmenu' => 'admintools']), $langs->trans('InfoPHP'), 1);
1237 $newmenu->add(dolBuildUrl('/admin/system/database.php', ['mainmenu' => 'home', 'leftmenu' => 'admintools']), $langs->trans('InfoDatabase'), 1);
1238 $newmenu->add(dolBuildUrl('/admin/system/perf.php', ['mainmenu' => 'home', 'leftmenu' => 'admintools']), $langs->trans("InfoPerf"), 1);
1239 $newmenu->add(dolBuildUrl('/admin/system/security.php', ['mainmenu' => 'home', 'leftmenu' => 'admintools']), $langs->trans("InfoSecurity"), 1);
1240 $newmenu->add(dolBuildUrl('/admin/tools/listevents.php', ['mainmenu' => 'home', 'leftmenu' => 'admintools']), $langs->trans("Audit"), 1);
1241 $newmenu->add(dolBuildUrl('/admin/tools/listsessions.php', ['mainmenu' => 'home', 'leftmenu' => 'admintools']), $langs->trans("Sessions"), 1);
1242 $newmenu->add(dolBuildUrl('/admin/tools/dolibarr_export.php', ['mainmenu' => 'home', 'leftmenu' => 'admintools']), $langs->trans("Backup"), 1);
1243 $newmenu->add(dolBuildUrl('/admin/tools/dolibarr_import.php', ['mainmenu' => 'home', 'leftmenu' => 'admintools']), $langs->trans("Restore"), 1);
1244 $newmenu->add(dolBuildUrl('/admin/tools/update.php', ['mainmenu' => 'home', 'leftmenu' => 'admintools']), $langs->trans("MenuUpgrade"), 1);
1245 $newmenu->add(dolBuildUrl('/admin/tools/purge.php', ['mainmenu' => 'home', 'leftmenu' => 'admintools']), $langs->trans("Purge"), 1);
1246
1247 /* Already into menu Tools
1248 if (isModEnabled('blockedlog')) {
1249 $langs->load("blockedlog");
1250 $newmenu->add(dolBuildUrl('/blockedlog/admin/blockedlog_list.php', ['mainmenu' => 'home', 'leftmenu' => 'admintools']), $langs->trans("BrowseBlockedLog"), 1, $user->admin);
1251 }
1252 */
1253
1254 if (isModEnabled('product') || isModEnabled('service')) {
1255 $langs->load("products");
1256 $newmenu->add(dolBuildUrl('/product/admin/product_tools.php', ['mainmenu' => 'home', 'leftmenu' => 'admintools']), $langs->trans("ProductVatMassChange"), 1, $user->admin);
1257 }
1258 }
1259
1260 $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"'));
1261 if ($user->hasRight('user', 'user', 'read')) {
1262 if ($usemenuhider || empty($leftmenu) || $leftmenu == "users") {
1263 $newmenu->add("", $langs->trans("Users"), 1, (int) ($user->hasRight('user', 'user', 'read') || $user->admin));
1264 $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');
1265 $newmenu->add(dolBuildUrl('/user/list.php', ['leftmenu' => 'users']), $langs->trans("ListOfUsers"), 2, (int) ($user->hasRight('user', 'user', 'read') || $user->admin));
1266 //$newmenu->add(dolBuildUrl('/user/hierarchy.php', ['leftmenu' => 'users']), $langs->trans("HierarchicView"), 2, (int) ($user->hasRight('user', 'user', 'read') || $user->admin));
1267 if (isModEnabled('category') && getDolGlobalString('CATEGORY_EDIT_IN_MENU_NOT_IN_POPUP')) {
1268 $langs->load("categories");
1269 $newmenu->add(dolBuildUrl('/categories/categorie_list.php', ['leftmenu' => 'users', 'type' => 7]), $langs->trans("UsersCategoriesShort"), 2, $user->hasRight('categorie', 'read'), '', $mainmenu, 'cat');
1270 }
1271 $newmenu->add("", $langs->trans("Groups"), 1, (int) (($user->hasRight('user', 'user', 'read') || $user->admin) && !(isModEnabled('multicompany') && !empty($user->entity) && getDolGlobalString('MULTICOMPANY_TRANSVERSE_MODE'))));
1272 $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'))));
1273 $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));
1274 }
1275 }
1276 }
1277}
1278
1289function get_left_menu_thridparties($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = 'none', $type_user = 0)
1290{
1291 global $user, $conf, $langs;
1292
1293 if ($mainmenu == 'companies') {
1294 // Societes
1295 if (isModEnabled('societe')) {
1296 $langs->load("companies");
1297 $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"'));
1298
1299 if ($user->hasRight('societe', 'creer')) {
1300 $newmenu->add(dolBuildUrl('/societe/card.php', ['action' => 'create']), $langs->trans("MenuNewThirdParty"), 1);
1301 if (!$conf->use_javascript_ajax) {
1302 $newmenu->add(dolBuildUrl('/societe/card.php', ['action' => 'create', 'private' => 1]), $langs->trans("MenuNewPrivateIndividual"), 1);
1303 }
1304 }
1305 }
1306
1307 $newmenu->add(dolBuildUrl('/societe/list.php', ['leftmenu' => 'thirdparties']), $langs->trans("List"), 1, $user->hasRight('societe', 'lire'), '', $mainmenu, 'thirdparties_list', 2);
1308
1309 // Prospects
1310 if (isModEnabled('societe') && !getDolGlobalString('SOCIETE_DISABLE_PROSPECTS')) {
1311 $langs->load("commercial");
1312 $newmenu->add(dolBuildUrl('/societe/list.php', ['type' => 'p', 'leftmenu' => 'prospects']), $langs->trans("Prospects"), 2, $user->hasRight('societe', 'lire'), '', $mainmenu, 'prospects', 5);
1313
1314 $newmenu->add(dolBuildUrl('/societe/card.php', ['leftmenu' => 'prospects', 'action' => 'create', 'type' => 'p']), $langs->trans("MenuNewProspect"), 3, $user->hasRight('societe', 'creer'));
1315 }
1316
1317 // Customers/Prospects
1318 if (isModEnabled('societe') && !getDolGlobalString('SOCIETE_DISABLE_CUSTOMERS')) {
1319 $langs->load("commercial");
1320 $newmenu->add("/societe/list.php?type=c&amp;leftmenu=customers", $langs->trans("Customers"), 2, $user->hasRight('societe', 'lire'), '', $mainmenu, 'customers', 10);
1321
1322 $newmenu->add("/societe/card.php?leftmenu=customers&action=create&type=c", $langs->trans("MenuNewCustomer"), 3, $user->hasRight('societe', 'creer'));
1323 }
1324
1325 // Suppliers
1326 if (isModEnabled('societe') && (isModEnabled('supplier_order') || isModEnabled('supplier_invoice') || isModEnabled('supplier_proposal'))) {
1327 $langs->load("suppliers");
1328 $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);
1329
1330 $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'))));
1331 }
1332
1333 // Categories
1334 if (isModEnabled('category')) {
1335 $langs->load("categories");
1336 if (!getDolGlobalString('SOCIETE_DISABLE_PROSPECTS') || !getDolGlobalString('SOCIETE_DISABLE_CUSTOMERS')) {
1337 // Categories prospects/customers
1338 $menutoshow = $langs->trans("CustomersProspectsCategoriesShort");
1339 if (getDolGlobalString('SOCIETE_DISABLE_PROSPECTS')) {
1340 $menutoshow = $langs->trans("CustomersCategoriesShort");
1341 }
1342 if (getDolGlobalString('SOCIETE_DISABLE_CUSTOMERS')) {
1343 $menutoshow = $langs->trans("ProspectsCategoriesShort");
1344 }
1345 if (getDolGlobalString('CATEGORY_EDIT_IN_MENU_NOT_IN_POPUP')) {
1346 $langs->load("categories");
1347 $newmenu->add("/categories/categorie_list.php?leftmenu=cat&type=2", $menutoshow, 1, $user->hasRight('categorie', 'lire'), '', $mainmenu, 'cat', 3);
1348 }
1349 }
1350 // Categories suppliers
1351 if (isModEnabled('supplier_proposal') || isModEnabled('supplier_order') || isModEnabled('supplier_invoice')) {
1352 if (getDolGlobalString('CATEGORY_EDIT_IN_MENU_NOT_IN_POPUP')) {
1353 $langs->load("categories");
1354 $newmenu->add("/categories/categorie_list.php?leftmenu=catfournish&type=1", $langs->trans("SuppliersCategoriesShort"), 1, $user->hasRight('categorie', 'lire'), '', $mainmenu, 'catsupplier', 4);
1355 }
1356 }
1357 }
1358
1359 // Contacts
1360 $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"'));
1361
1362 $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'));
1363 $newmenu->add("/contact/list.php?leftmenu=contacts", $langs->trans("List"), 1, $user->hasRight('societe', 'contact', 'lire'));
1364 if (!getDolGlobalString('SOCIETE_DISABLE_PROSPECTS')) {
1365 $newmenu->add("/contact/list.php?leftmenu=contacts&type=p", $langs->trans("Prospects"), 2, $user->hasRight('societe', 'contact', 'lire'));
1366 }
1367 if (!getDolGlobalString('SOCIETE_DISABLE_CUSTOMERS')) {
1368 $newmenu->add("/contact/list.php?leftmenu=contacts&type=c", $langs->trans("Customers"), 2, $user->hasRight('societe', 'contact', 'lire'));
1369 }
1370 if (isModEnabled('supplier_proposal') || isModEnabled('supplier_order') || isModEnabled('supplier_invoice')) {
1371 $newmenu->add("/contact/list.php?leftmenu=contacts&type=f", $langs->trans("Suppliers"), 2, $user->hasRight('fournisseur', 'lire'));
1372 }
1373 $newmenu->add("/contact/list.php?leftmenu=contacts&type=o", $langs->trans("ContactOthers"), 2, $user->hasRight('societe', 'contact', 'lire'));
1374 //$newmenu->add("/contact/list.php?userid=$user->id", $langs->trans("MyContacts"), 1, $user->hasRight('societe', 'contact', 'lire'));
1375
1376 // Categories
1377 if (isModEnabled('category') && getDolGlobalString('CATEGORY_EDIT_IN_MENU_NOT_IN_POPUP')) {
1378 $langs->load("categories");
1379 // Categories Contact
1380 $newmenu->add("/categories/categorie_list.php?leftmenu=catcontact&type=4", $langs->trans("ContactCategoriesShort"), 1, $user->hasRight('categorie', 'lire'), '', $mainmenu, 'cat');
1381 }
1382 }
1383}
1384
1395function get_left_menu_commercial($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = 'none', $type_user = 0)
1396{
1397 global $user, $langs;
1398
1399 if ($mainmenu == 'commercial') {
1400 $langs->load("companies");
1401
1402 // Customer proposal
1403 if (isModEnabled('propal')) {
1404 $langs->load("propal");
1405 $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"'));
1406 $newmenu->add("/comm/propal/card.php?action=create&amp;leftmenu=propals", $langs->trans("NewPropal"), 1, $user->hasRight('propal', 'write'));
1407 $newmenu->add("/comm/propal/list.php?leftmenu=propals", $langs->trans("List"), 1, $user->hasRight('propal', 'read'));
1408 if ($usemenuhider || empty($leftmenu) || $leftmenu == "propals") {
1409 $newmenu->add("/comm/propal/list.php?leftmenu=propals&search_status=0", $langs->trans("PropalsDraft"), 2, $user->hasRight('propal', 'read'));
1410 $newmenu->add("/comm/propal/list.php?leftmenu=propals&search_status=1", $langs->trans("PropalsOpened"), 2, $user->hasRight('propal', 'read'));
1411 $newmenu->add("/comm/propal/list.php?leftmenu=propals&search_status=2", $langs->trans("PropalStatusSigned"), 2, $user->hasRight('propal', 'read'));
1412 $newmenu->add("/comm/propal/list.php?leftmenu=propals&search_status=3", $langs->trans("PropalStatusNotSigned"), 2, $user->hasRight('propal', 'read'));
1413 $newmenu->add("/comm/propal/list.php?leftmenu=propals&search_status=4", $langs->trans("PropalStatusBilled"), 2, $user->hasRight('propal', 'read'));
1414 //$newmenu->add("/comm/propal/list.php?leftmenu=propals&search_status=2,3,4", $langs->trans("PropalStatusClosedShort"), 2, $user->hasRight('propal', 'read'));
1415 }
1416 if (getDolGlobalString('MAIN_STATISTICS_IN_MENU')) {
1417 $newmenu->add("/comm/propal/stats/index.php?leftmenu=propals", $langs->trans("Statistics"), 1, $user->hasRight('propal', 'read'));
1418 }
1419 }
1420
1421 // Customers orders
1422 if (isModEnabled('order')) {
1423 $langs->load("orders");
1424 $newmenu->add("/commande/index.php?leftmenu=orders", $langs->trans("CustomersOrders"), 0, $user->hasRight('commande', 'lire'), '', $mainmenu, 'orders', 200, '', '', '', img_picto('', 'order', 'class="paddingright pictofixedwidth"'));
1425 $newmenu->add("/commande/card.php?action=create&amp;leftmenu=orders", $langs->trans("NewOrder"), 1, $user->hasRight('commande', 'creer'));
1426 $newmenu->add("/commande/list.php?leftmenu=orders", $langs->trans("List"), 1, $user->hasRight('commande', 'lire'));
1427 if ($usemenuhider || empty($leftmenu) || $leftmenu == "orders") {
1428 $newmenu->add("/commande/list.php?leftmenu=orders&search_status=0", $langs->trans("StatusOrderDraftShort"), 2, $user->hasRight('commande', 'lire'));
1429 $newmenu->add("/commande/list.php?leftmenu=orders&search_status=1", $langs->trans("StatusOrderValidated"), 2, $user->hasRight('commande', 'lire'));
1430 if (isModEnabled('shipping')) {
1431 $newmenu->add("/commande/list.php?leftmenu=orders&search_status=2", $langs->trans("StatusOrderSentShort"), 2, $user->hasRight('commande', 'lire'));
1432 }
1433 $newmenu->add("/commande/list.php?leftmenu=orders&search_status=3", $langs->trans("StatusOrderDelivered"), 2, $user->hasRight('commande', 'lire'));
1434 //$newmenu->add("/commande/list.php?leftmenu=orders&search_status=4", $langs->trans("StatusOrderProcessed"), 2, $user->hasRight('commande', 'lire'));
1435 $newmenu->add("/commande/list.php?leftmenu=orders&search_status=-1", $langs->trans("StatusOrderCanceledShort"), 2, $user->hasRight('commande', 'lire'));
1436 }
1437 if (empty($user->socid)) {
1438 $newmenu->add("/commande/list_det.php?leftmenu=orders", $langs->trans("ListOrderLigne"), 1, $user->hasRight('commande', 'lire'));
1439 }
1440 if (getDolGlobalString('MAIN_STATISTICS_IN_MENU')) {
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
1448 // Categories
1449 if (isModEnabled('category') && getDolGlobalString('CATEGORY_EDIT_IN_MENU_NOT_IN_POPUP')) {
1450 $langs->load("categories");
1451 $newmenu->add("/categories/categorie_list.php?leftmenu=cat&type=16", $langs->trans("Categories"), 1, $user->hasRight('categorie', 'lire'), '', $mainmenu, 'cat');
1452 }
1453 }
1454
1455 // Supplier proposal
1456 if (isModEnabled('supplier_proposal')) {
1457 $langs->load("supplier_proposal");
1458 $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"'));
1459 $newmenu->add("/supplier_proposal/card.php?action=create&amp;leftmenu=supplier_proposals", $langs->trans("SupplierProposalNew"), 1, $user->hasRight('supplier_proposal', 'creer'));
1460 $newmenu->add("/supplier_proposal/list.php?leftmenu=supplier_proposals", $langs->trans("List"), 1, $user->hasRight('supplier_proposal', 'lire'));
1461 if (getDolGlobalString('MAIN_STATISTICS_IN_MENU')) {
1462 $newmenu->add("/comm/propal/stats/index.php?leftmenu=supplier_proposals&amp;mode=supplier", $langs->trans("Statistics"), 1, $user->hasRight('supplier_proposal', 'lire'));
1463 }
1464 }
1465
1466 // Suppliers orders
1467 if (isModEnabled('supplier_order')) {
1468 $langs->load("orders");
1469
1470 $permOrderRightRead = (int) ($user->hasRight('fournisseur', 'commande', 'lire') || $user->hasRight('supplier_order', 'lire'));
1471 $permOrderRightCreate = (int) ($user->hasRight('fournisseur', 'commande', 'creer') || $user->hasRight('supplier_order', 'creer'));
1472 $permOrderRightExport = (int) ($user->hasRight('fournisseur', 'commande', 'export') || $user->hasRight('supplier_order', 'export'));
1473
1474 $newmenu->add("/fourn/commande/index.php?leftmenu=orders_suppliers", $langs->trans("SuppliersOrders"), 0, $permOrderRightRead, '', $mainmenu, 'orders_suppliers', 400, '', '', '', img_picto('', 'supplier_order', 'class="paddingright pictofixedwidth"'));
1475 $newmenu->add("/fourn/commande/card.php?action=create&amp;leftmenu=orders_suppliers", $langs->trans("NewSupplierOrderShort"), 1, $permOrderRightCreate);
1476 $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers", $langs->trans("List"), 1, $permOrderRightRead);
1477
1478 if ($usemenuhider || empty($leftmenu) || $leftmenu == "orders_suppliers") {
1479 $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=0", $langs->trans("StatusSupplierOrderDraftShort"), 2, $permOrderRightRead);
1480 if (!getDolGlobalString('SUPPLIER_ORDER_HIDE_VALIDATED')) {
1481 $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=1", $langs->trans("StatusSupplierOrderValidated"), 2, $permOrderRightRead);
1482 }
1483 $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=2", $langs->trans("StatusSupplierOrderApprovedShort"), 2, $permOrderRightRead);
1484 $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=3", $langs->trans("StatusSupplierOrderOnProcessShort"), 2, $permOrderRightRead);
1485 $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=4", $langs->trans("StatusSupplierOrderReceivedPartiallyShort"), 2, $permOrderRightRead);
1486 $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=5", $langs->trans("StatusSupplierOrderReceivedAll"), 2, $permOrderRightRead);
1487 $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=6,7", $langs->trans("StatusSupplierOrderCanceled"), 2, $permOrderRightRead);
1488 $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=9", $langs->trans("StatusSupplierOrderRefused"), 2, $permOrderRightRead);
1489 }
1490 // 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'));
1491
1492 if (getDolGlobalString('MAIN_STATISTICS_IN_MENU')) {
1493 if (getDolGlobalInt('MAIN_NEED_EXPORT_PERMISSION_TO_READ_STATISTICS')) {
1494 $newmenu->add("/commande/stats/index.php?leftmenu=orders_suppliers&amp;mode=supplier", $langs->trans("Statistics"), 1, $permOrderRightExport);
1495 } else {
1496 $newmenu->add("/commande/stats/index.php?leftmenu=orders_suppliers&amp;mode=supplier", $langs->trans("Statistics"), 1, $permOrderRightRead);
1497 }
1498 }
1499
1500 // Categories
1501 if (isModEnabled('category') && getDolGlobalString('CATEGORY_EDIT_IN_MENU_NOT_IN_POPUP')) {
1502 $langs->load("categories");
1503 $newmenu->add("/categories/categorie_list.php?leftmenu=cat&type=20", $langs->trans("Categories"), 1, $user->hasRight('categorie', 'lire'), '', $mainmenu, 'cat');
1504 }
1505 }
1506
1507 // Contrat
1508 if (isModEnabled('contract')) {
1509 $langs->load("contracts");
1510 $newmenu->add("/contrat/index.php?leftmenu=contracts", $langs->trans("ContractsSubscriptions"), 0, $user->hasRight('contrat', 'lire'), '', $mainmenu, 'contracts', 2000, '', '', '', img_picto('', 'contract', 'class="paddingright pictofixedwidth"'));
1511 $newmenu->add("/contrat/card.php?action=create&amp;leftmenu=contracts", $langs->trans("NewContractSubscription"), 1, $user->hasRight('contrat', 'creer'));
1512 $newmenu->add("/contrat/list.php?leftmenu=contracts", $langs->trans("List"), 1, $user->hasRight('contrat', 'lire'));
1513 $newmenu->add("/contrat/services_list.php?leftmenu=contracts", $langs->trans("MenuServices"), 1, $user->hasRight('contrat', 'lire'));
1514 if ($usemenuhider || empty($leftmenu) || $leftmenu == "contracts") {
1515 $newmenu->add("/contrat/services_list.php?leftmenu=contracts&amp;search_status=0", $langs->trans("MenuInactiveServices"), 2, $user->hasRight('contrat', 'lire'));
1516 $newmenu->add("/contrat/services_list.php?leftmenu=contracts&amp;search_status=4", $langs->trans("MenuRunningServices"), 2, $user->hasRight('contrat', 'lire'));
1517 $newmenu->add("/contrat/services_list.php?leftmenu=contracts&amp;search_status=4%26filter=expired", $langs->trans("MenuExpiredServices"), 2, $user->hasRight('contrat', 'lire'));
1518 $newmenu->add("/contrat/services_list.php?leftmenu=contracts&amp;search_status=5", $langs->trans("MenuClosedServices"), 2, $user->hasRight('contrat', 'lire'));
1519 }
1520 if (getDolGlobalString('MAIN_STATISTICS_IN_MENU')) {
1521 $newmenu->add("/contrat/stats/index.php", $langs->trans("Statistics"), 1, $user->hasRight('contrat', 'lire'));
1522 }
1523 }
1524
1525 // Interventions
1526 if (isModEnabled('intervention')) {
1527 $langs->load("interventions");
1528 $newmenu->add("/fichinter/index.php?leftmenu=ficheinter", $langs->trans("Interventions"), 0, $user->hasRight('ficheinter', 'lire'), '', $mainmenu, 'ficheinter', 2200, '', '', '', img_picto('', 'intervention', 'class="paddingright pictofixedwidth"'));
1529 $newmenu->add("/fichinter/card.php?action=create&amp;leftmenu=ficheinter", $langs->trans("NewIntervention"), 1, $user->hasRight('ficheinter', 'creer'), '', '', '', 201);
1530 $newmenu->add("/fichinter/list.php?leftmenu=ficheinter", $langs->trans("List"), 1, $user->hasRight('ficheinter', 'lire'), '', '', '', 202);
1531 $newmenu->add("/fichinter/card-rec.php?leftmenu=ficheinter", $langs->trans("ListOfTemplates"), 1, $user->hasRight('ficheinter', 'lire'), '', '', '', 203);
1532 if (getDolGlobalString('MAIN_STATISTICS_IN_MENU')) {
1533 $newmenu->add("/fichinter/stats/index.php?leftmenu=ficheinter", $langs->trans("Statistics"), 1, $user->hasRight('ficheinter', 'lire'), '', '', '', 204);
1534 }
1535 }
1536 }
1537}
1538
1549function get_left_menu_billing($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = 'none', $type_user = 0)
1550{
1551 global $user, $langs;
1552
1553 if ($mainmenu == 'billing') {
1554 $langs->load("companies");
1555
1556 // Customers invoices
1557 if (isModEnabled('invoice')) {
1558 $langs->load("bills");
1559 $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"'));
1560 $newmenu->add("/compta/facture/card.php?action=create", $langs->trans("NewBill"), 1, $user->hasRight('facture', 'creer'));
1561 $newmenu->add("/compta/facture/list.php?leftmenu=customers_bills", $langs->trans("List"), 1, $user->hasRight('facture', 'lire'), '', $mainmenu, 'customers_bills_list');
1562
1563 if ($usemenuhider || empty($leftmenu) || preg_match('/customers_bills(|_draft|_notpaid|_paid|_canceled)$/', $leftmenu)) {
1564 $newmenu->add("/compta/facture/list.php?leftmenu=customers_bills_draft&amp;search_status=0", $langs->trans("BillShortStatusDraft"), 2, $user->hasRight('facture', 'lire'));
1565 $newmenu->add("/compta/facture/list.php?leftmenu=customers_bills_notpaid&amp;search_status=1", $langs->trans("BillShortStatusNotPaid"), 2, $user->hasRight('facture', 'lire'));
1566 $newmenu->add("/compta/facture/list.php?leftmenu=customers_bills_paid&amp;search_status=2", $langs->trans("BillShortStatusPaid"), 2, $user->hasRight('facture', 'lire'));
1567 $newmenu->add("/compta/facture/list.php?leftmenu=customers_bills_canceled&amp;search_status=3", $langs->trans("BillShortStatusCanceled"), 2, $user->hasRight('facture', 'lire'));
1568 }
1569 $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.
1570
1571 $newmenu->add("/compta/paiement/list.php?leftmenu=customers_bills_payment", $langs->trans("Payments"), 1, $user->hasRight('facture', 'lire'), '', $mainmenu, 'customers_bills_payment');
1572
1573 if (getDolGlobalString('BILL_ADD_PAYMENT_VALIDATION') && preg_match('/customers_bills_payment/', $leftmenu)) {
1574 $newmenu->add("/compta/paiement/tovalidate.php?leftmenu=customers_bills_payment_tovalid", $langs->trans("MenuToValid"), 2, $user->hasRight('facture', 'lire'), '', $mainmenu, 'customers_bills_payment_tovalid');
1575 }
1576 if ($usemenuhider || empty($leftmenu) || preg_match('/customers_bills_payment/', $leftmenu)) {
1577 $newmenu->add("/compta/paiement/rapport.php?leftmenu=customers_bills_payment_report", $langs->trans("Reportings"), 2, $user->hasRight('facture', 'lire'), '', $mainmenu, 'customers_bills_payment_report');
1578 }
1579
1580 if (getDolGlobalString('MAIN_STATISTICS_IN_MENU')) {
1581 $newmenu->add("/compta/facture/stats/index.php?leftmenu=customers_bills_stats", $langs->trans("Statistics"), 1, $user->hasRight('facture', 'lire'), '', $mainmenu, 'customers_bills_stats');
1582 }
1583
1584 // Categories
1585 if (isModEnabled('category') && getDolGlobalString('CATEGORY_EDIT_IN_MENU_NOT_IN_POPUP')) {
1586 $langs->load("categories");
1587 $newmenu->add("/categories/categorie_list.php?leftmenu=cat&type=17", $langs->trans("Categories"), 1, $user->rights->categorie->lire, '', $mainmenu, 'cat');
1588 }
1589 }
1590
1591 // Suppliers invoices
1592 if (isModEnabled('societe') && isModEnabled('supplier_invoice') && !getDolGlobalString('SUPPLIER_INVOICE_MENU_DISABLED')) {
1593 $langs->load("bills");
1594
1595 $permInvoiceRightRead = (int) ($user->hasRight('fournisseur', 'facture', 'lire') || $user->hasRight('supplier_invoice', 'lire'));
1596 $permInvoiceRightCreate = (int) ($user->hasRight('fournisseur', 'facture', 'creer') || $user->hasRight('supplier_invoice', 'creer'));
1597
1598 $newmenu->add("/fourn/facture/index.php?leftmenu=suppliers_bills", $langs->trans("BillsSuppliers"), 0, $permInvoiceRightRead, '', $mainmenu, 'suppliers_bills', 0, '', '', '', img_picto('', 'supplier_invoice', 'class="paddingright pictofixedwidth"'));
1599 $newmenu->add("/fourn/facture/card.php?leftmenu=suppliers_bills&action=create", $langs->trans("NewBill"), 1, $permInvoiceRightCreate, '', $mainmenu, 'suppliers_bills_create');
1600 $newmenu->add("/fourn/facture/list.php?leftmenu=suppliers_bills", $langs->trans("List"), 1, $permInvoiceRightRead, '', $mainmenu, 'suppliers_bills_list');
1601
1602 if ($usemenuhider || empty($leftmenu) || preg_match('/suppliers_bills(|_draft|_notpaid|_paid|_canceled)$/', $leftmenu)) {
1603 $newmenu->add("/fourn/facture/list.php?leftmenu=suppliers_bills_draft&amp;search_status=0", $langs->trans("BillShortStatusDraft"), 2, $permInvoiceRightRead, '', $mainmenu, 'suppliers_bills_draft');
1604 $newmenu->add("/fourn/facture/list.php?leftmenu=suppliers_bills_notpaid&amp;search_status=1", $langs->trans("BillShortStatusNotPaid"), 2, $permInvoiceRightRead, '', $mainmenu, 'suppliers_bills_notpaid');
1605 $newmenu->add("/fourn/facture/list.php?leftmenu=suppliers_bills_paid&amp;search_status=2", $langs->trans("BillShortStatusPaid"), 2, $permInvoiceRightRead, '', $mainmenu, 'suppliers_bills_paid');
1606 }
1607
1608 $newmenu->add("/fourn/facture/list-rec.php?leftmenu=supplierinvoicestemplate_list", $langs->trans("ListOfTemplates"), 1, $permInvoiceRightRead, '', $mainmenu, 'supplierinvoicestemplate_list');
1609
1610 $newmenu->add("/fourn/paiement/list.php?leftmenu=suppliers_bills_payment", $langs->trans("Payments"), 1, $permInvoiceRightRead, '', $mainmenu, 'suppliers_bills_payment');
1611
1612 if ($usemenuhider || empty($leftmenu) || preg_match('/suppliers_bills_payment/', $leftmenu)) {
1613 $newmenu->add("/fourn/facture/rapport.php?leftmenu=suppliers_bills_payment_report", $langs->trans("Reportings"), 2, $permInvoiceRightRead, '', $mainmenu, 'suppliers_bills_payment_report');
1614 }
1615
1616 if (getDolGlobalString('MAIN_STATISTICS_IN_MENU')) {
1617 $newmenu->add("/compta/facture/stats/index.php?mode=supplier&amp;leftmenu=suppliers_bills_stats", $langs->trans("Statistics"), 1, $permInvoiceRightRead, '', $mainmenu, 'suppliers_bills_stats');
1618 }
1619
1620 // Categories
1621 if (isModEnabled('category') && getDolGlobalString('CATEGORY_EDIT_IN_MENU_NOT_IN_POPUP')) {
1622 $langs->load("categories");
1623 $newmenu->add("/categories/categorie_list.php?leftmenu=cat&type=21", $langs->trans("Categories"), 1, $user->rights->categorie->lire, '', $mainmenu, 'cat');
1624 }
1625 }
1626
1627 // Orders
1628 if (isModEnabled('order')) {
1629 $langs->load("orders");
1630 if (isModEnabled('invoice')) {
1631 $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"'));
1632 }
1633 //if ($usemenuhider || empty($leftmenu) || $leftmenu=="orders") $newmenu->add("/commande/", $langs->trans("StatusOrderToBill"), 1, $user->hasRight('commande', 'lire'));
1634 }
1635
1636 // Supplier Orders to bill
1637 if (isModEnabled('supplier_invoice')) {
1638 if (getDolGlobalString('SUPPLIER_MENU_ORDER_RECEIVED_INTO_INVOICE')) {
1639 $langs->load("supplier");
1640 $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"'));
1641 //if ($usemenuhider || empty($leftmenu) || $leftmenu=="orders") $newmenu->add("/commande/", $langs->trans("StatusOrderToBill"), 1, $user->hasRight('commande', 'lire'));
1642 }
1643 }
1644
1645
1646 // Donations
1647 if (isModEnabled('don')) {
1648 $langs->load("donations");
1649 $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"'));
1650 if ($usemenuhider || empty($leftmenu) || $leftmenu == "donations") {
1651 $newmenu->add("/don/card.php?leftmenu=donations&action=create", $langs->trans("NewDonation"), 1, $user->hasRight('don', 'creer'));
1652 $newmenu->add("/don/list.php?leftmenu=donations", $langs->trans("List"), 1, $user->hasRight('don', 'lire'));
1653 $newmenu->add("/don/paiement/list.php?leftmenu=donations", $langs->trans("Payments"), 1, $user->hasRight('don', 'lire'));
1654 if (getDolGlobalString('MAIN_STATISTICS_IN_MENU')) {
1655 $newmenu->add("/don/stats/index.php", $langs->trans("Statistics"), 1, $user->hasRight('don', 'lire'));
1656 }
1657 }
1658 }
1659
1660 // Taxes and social contributions
1661 if (isModEnabled('tax')) {
1662 $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"'));
1663
1664 $newmenu->add("/compta/sociales/list.php?leftmenu=tax_social", $langs->trans("MenuSocialContributions"), 1, $user->hasRight('tax', 'charges', 'lire'));
1665 if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_social/i', $leftmenu)) {
1666 $newmenu->add("/compta/sociales/card.php?leftmenu=tax_social&action=create", $langs->trans("MenuNewSocialContribution"), 2, $user->hasRight('tax', 'charges', 'creer'));
1667 $newmenu->add("/compta/sociales/list.php?leftmenu=tax_social", $langs->trans("List"), 2, $user->hasRight('tax', 'charges', 'lire'));
1668 $newmenu->add("/compta/sociales/payments.php?leftmenu=tax_social&amp;mainmenu=billing", $langs->trans("Payments"), 2, $user->hasRight('tax', 'charges', 'lire'));
1669 }
1670 // VAT
1671 if (!getDolGlobalString('TAX_DISABLE_VAT_MENUS')) {
1672 global $mysoc;
1673
1674 $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');
1675 if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_vat/i', $leftmenu)) {
1676 $newmenu->add("/compta/tva/card.php?leftmenu=tax_vat&action=create", $langs->trans("New"), 2, $user->hasRight('tax', 'charges', 'creer'));
1677 $newmenu->add("/compta/tva/list.php?leftmenu=tax_vat", $langs->trans("List"), 2, $user->hasRight('tax', 'charges', 'lire'));
1678 $newmenu->add("/compta/tva/payments.php?mode=tvaonly&amp;leftmenu=tax_vat", $langs->trans("Payments"), 2, $user->hasRight('tax', 'charges', 'lire'));
1679 $newmenu->add("/compta/tva/index.php?leftmenu=tax_vat", $langs->trans("ReportByMonth"), 2, $user->hasRight('tax', 'charges', 'lire'));
1680 $newmenu->add("/compta/tva/clients.php?leftmenu=tax_vat", $langs->trans("ReportByThirdparties"), 2, $user->hasRight('tax', 'charges', 'lire'));
1681 $newmenu->add("/compta/tva/quadri_detail.php?leftmenu=tax_vat", $langs->trans("ReportByQuarter"), 2, $user->hasRight('tax', 'charges', 'lire'));
1682 }
1683
1684 //Local Taxes 1
1685 if ($mysoc->useLocalTax(1) && (isset($mysoc->localtax1_assuj) && $mysoc->localtax1_assuj == "1")) {
1686 $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'));
1687 if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_1_vat/i', $leftmenu)) {
1688 $newmenu->add("/compta/localtax/card.php?leftmenu=tax_1_vat&action=create&amp;localTaxType=1", $langs->trans("New"), 2, $user->hasRight('tax', 'charges', 'creer'));
1689 $newmenu->add("/compta/localtax/list.php?leftmenu=tax_1_vat&amp;localTaxType=1", $langs->trans("List"), 2, $user->hasRight('tax', 'charges', 'lire'));
1690 $newmenu->add("/compta/localtax/index.php?leftmenu=tax_1_vat&amp;localTaxType=1", $langs->trans("ReportByMonth"), 2, $user->hasRight('tax', 'charges', 'lire'));
1691 $newmenu->add("/compta/localtax/clients.php?leftmenu=tax_1_vat&amp;localTaxType=1", $langs->trans("ReportByThirdparties"), 2, $user->hasRight('tax', 'charges', 'lire'));
1692 $newmenu->add("/compta/localtax/quadri_detail.php?leftmenu=tax_1_vat&amp;localTaxType=1", $langs->trans("ReportByQuarter"), 2, $user->hasRight('tax', 'charges', 'lire'));
1693 }
1694 }
1695 //Local Taxes 2
1696 if ($mysoc->useLocalTax(2) && (isset($mysoc->localtax2_assuj) && $mysoc->localtax2_assuj == "1")) {
1697 $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'));
1698 if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_2_vat/i', $leftmenu)) {
1699 $newmenu->add("/compta/localtax/card.php?leftmenu=tax_2_vat&action=create&amp;localTaxType=2", $langs->trans("New"), 2, $user->hasRight('tax', 'charges', 'creer'));
1700 $newmenu->add("/compta/localtax/list.php?leftmenu=tax_2_vat&amp;localTaxType=2", $langs->trans("List"), 2, $user->hasRight('tax', 'charges', 'lire'));
1701 $newmenu->add("/compta/localtax/index.php?leftmenu=tax_2_vat&amp;localTaxType=2", $langs->trans("ReportByMonth"), 2, $user->hasRight('tax', 'charges', 'lire'));
1702 $newmenu->add("/compta/localtax/clients.php?leftmenu=tax_2_vat&amp;localTaxType=2", $langs->trans("ReportByThirdparties"), 2, $user->hasRight('tax', 'charges', 'lire'));
1703 $newmenu->add("/compta/localtax/quadri_detail.php?leftmenu=tax_2_vat&amp;localTaxType=2", $langs->trans("ReportByQuarter"), 2, $user->hasRight('tax', 'charges', 'lire'));
1704 }
1705 }
1706 }
1707 }
1708
1709 // Salaries
1710 if (isModEnabled('salaries')) {
1711 $langs->load("salaries");
1712 $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"'));
1713 if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_salary/i', $leftmenu)) {
1714 $newmenu->add("/salaries/card.php?leftmenu=tax_salary&action=create", $langs->trans("New"), 1, $user->hasRight('salaries', 'write'));
1715 $newmenu->add("/salaries/list.php?leftmenu=tax_salary", $langs->trans("List"), 1, $user->hasRight('salaries', 'read'));
1716 $newmenu->add("/salaries/payments.php?leftmenu=tax_salary", $langs->trans("Payments"), 1, $user->hasRight('salaries', 'read'));
1717 $newmenu->add("/salaries/stats/index.php?leftmenu=tax_salary", $langs->trans("Statistics"), 1, $user->hasRight('salaries', 'read'));
1718 }
1719 }
1720
1721 // Loan
1722 if (isModEnabled('loan')) {
1723 $langs->load("loan");
1724 $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"'));
1725 if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_loan/i', $leftmenu)) {
1726 $newmenu->add("/loan/card.php?leftmenu=tax_loan&action=create", $langs->trans("NewLoan"), 1, $user->hasRight('loan', 'write'));
1727 //$newmenu->add("/loan/payment/list.php?leftmenu=tax_loan",$langs->trans("Payments"),2,$user->hasRight('loan', 'read'));
1728 }
1729 }
1730
1731 // Various payment
1732 if (isModEnabled('bank') && !getDolGlobalString('BANK_USE_OLD_VARIOUS_PAYMENT')) {
1733 $langs->load("banks");
1734 $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"'));
1735 if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_various/i', $leftmenu)) {
1736 $newmenu->add("/compta/bank/various_payment/card.php?leftmenu=tax_various&action=create", $langs->trans("New"), 1, $user->hasRight('banque', 'modifier'));
1737 $newmenu->add("/compta/bank/various_payment/list.php?leftmenu=tax_various", $langs->trans("List"), 1, $user->hasRight('banque', 'lire'));
1738 }
1739 }
1740 }
1741}
1742
1753function get_left_menu_accountancy($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = 'none', $type_user = 0)
1754{
1755 global $user, $conf, $langs;
1756 global $db;
1757
1758 if ($mainmenu == 'accountancy') {
1759 $langs->load("companies");
1760
1761 // Accounting (Double entries)
1762 if (isModEnabled('accounting')) {
1763 //$permtoshowmenu = (isModEnabled('accounting') || $user->hasRight('accounting', 'bind', 'write') || $user->hasRight('compta', 'resultat', 'lire'));
1764 //$newmenu->add("/accountancy/index.php?leftmenu=accountancy", $langs->trans("MenuAccountancy"), 0, $permtoshowmenu, '', $mainmenu, 'accountancy');
1765
1766 // Entry to expand/see all configuration menus
1767 $newmenu->add("/accountancy/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"'));
1768
1769 if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/', $leftmenu)) {
1770 global $mysoc;
1771 $newmenu->add("/accountancy/admin/index.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("General"), 1, $user->hasRight('accounting', 'chartofaccount'), '', $mainmenu, 'accountancy_admin_general', 10);
1772
1773 $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);
1774 $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);
1775 $newmenu->add("/accountancy/admin/account.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("Chartofaccounts"), 1, $user->hasRight('accounting', 'chartofaccount'), '', $mainmenu, 'accountancy_admin_chart', 41);
1776 $newmenu->add("/accountancy/admin/subaccount.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("ChartOfSubaccounts"), 1, $user->hasRight('accounting', 'chartofaccount'), '', $mainmenu, 'accountancy_admin_chart', 41);
1777
1778 // Fiscal year
1779 $newmenu->add("/accountancy/admin/fiscalyear.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("FiscalPeriod"), 1, $user->hasRight('accounting', 'fiscalyear', 'write'), '', $mainmenu, 'fiscalyear', 45);
1780
1781 $newmenu->add("/accountancy/admin/defaultaccounts.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuDefaultAccounts"), 1, $user->hasRight('accounting', 'chartofaccount'), '', $mainmenu, 'accountancy_admin_default', 60);
1782 if (isModEnabled('bank')) {
1783 $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);
1784 }
1785 if (isModEnabled('invoice') || isModEnabled('supplier_invoice')) {
1786 $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);
1787 }
1788 if (isModEnabled('tax')) {
1789 $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);
1790 }
1791 if (isModEnabled('expensereport')) {
1792 $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);
1793 }
1794 $newmenu->add("/accountancy/admin/template/list.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuListBookkeepingTemplates"), 1, $user->hasRight('accounting', 'chartofaccount'), '', $mainmenu, 'accountancy_admin_template', 110);
1795 $newmenu->add("/accountancy/admin/productaccount.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuProductsAccounts"), 1, $user->hasRight('accounting', 'chartofaccount'), '', $mainmenu, 'accountancy_admin_product', 110);
1796 $newmenu->add("/accountancy/admin/closure.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuClosureAccounts"), 1, $user->hasRight('accounting', 'chartofaccount'), '', $mainmenu, 'accountancy_admin_closure', 120);
1797 if (getDolGlobalInt('ACCOUNTING_ENABLE_MULTI_REPORT')) {
1798 $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);
1799 }
1800 $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', 145);
1801 }
1802
1803 // Transfer in accounting
1804 $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"'));
1805
1806 if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_transfer/', $leftmenu)) {
1807 // Binding
1808 // $newmenu->add("", $langs->trans("Binding"), 0, $user->hasRight('accounting', 'bind', 'write'), '', $mainmenu, 'dispatch');
1809 if (isModEnabled('invoice') && !getDolGlobalString('ACCOUNTING_DISABLE_BINDING_ON_SALES')) {
1810 $newmenu->add("/accountancy/customer/index.php?leftmenu=accountancy_transfer_dispatch_customer&mainmenu=accountancy", $langs->trans("CustomersVentilation"), 1, $user->hasRight('accounting', 'bind', 'write'), '', $mainmenu, 'dispatch_customer');
1811 if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_transfer_dispatch_customer/', $leftmenu)) {
1812 $newmenu->add("/accountancy/customer/list.php?mainmenu=accountancy&leftmenu=accountancy_transfer_dispatch_customer", $langs->trans("ToBind"), 2, $user->hasRight('accounting', 'bind', 'write'));
1813 $newmenu->add("/accountancy/customer/lines.php?mainmenu=accountancy&leftmenu=accountancy_transfer_dispatch_customer", $langs->trans("Binded"), 2, $user->hasRight('accounting', 'bind', 'write'));
1814 }
1815 }
1816 if (isModEnabled('supplier_invoice') && !getDolGlobalString('ACCOUNTING_DISABLE_BINDING_ON_PURCHASES')) {
1817 $newmenu->add("/accountancy/supplier/index.php?leftmenu=accountancy_transfer_dispatch_supplier&amp;mainmenu=accountancy", $langs->trans("SuppliersVentilation"), 1, $user->hasRight('accounting', 'bind', 'write'), '', $mainmenu, 'dispatch_supplier');
1818 if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_transfer_dispatch_supplier/', $leftmenu)) {
1819 $newmenu->add("/accountancy/supplier/list.php?mainmenu=accountancy&leftmenu=accountancy_transfer_dispatch_supplier", $langs->trans("ToBind"), 2, $user->hasRight('accounting', 'bind', 'write'));
1820 $newmenu->add("/accountancy/supplier/lines.php?mainmenu=accountancy&leftmenu=accountancy_transfer_dispatch_supplier", $langs->trans("Binded"), 2, $user->hasRight('accounting', 'bind', 'write'));
1821 }
1822 }
1823 if (isModEnabled('expensereport') && !getDolGlobalString('ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS')) {
1824 $newmenu->add("/accountancy/expensereport/index.php?leftmenu=accountancy_transfer_dispatch_expensereport&amp;mainmenu=accountancy", $langs->trans("ExpenseReportsVentilation"), 1, $user->hasRight('accounting', 'bind', 'write'), '', $mainmenu, 'dispatch_expensereport');
1825 if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_transfer_dispatch_expensereport/', $leftmenu)) {
1826 $newmenu->add("/accountancy/expensereport/list.php?mainmenu=accountancy&leftmenu=accountancy_transfer_dispatch_expensereport", $langs->trans("ToBind"), 2, $user->hasRight('accounting', 'bind', 'write'));
1827 $newmenu->add("/accountancy/expensereport/lines.php?mainmenu=accountancy&leftmenu=accountancy_transfer_dispatch_expensereport", $langs->trans("Binded"), 2, $user->hasRight('accounting', 'bind', 'write'));
1828 }
1829 }
1830
1831 // Journals
1832 if (isModEnabled('accounting') && $user->hasRight('accounting', 'comptarapport', 'lire') && $mainmenu == 'accountancy') {
1833 $newmenu->add('', $langs->trans("RegistrationInAccounting"), 1, $user->hasRight('accounting', 'comptarapport', 'lire'), '', $mainmenu, 'accountancy_journal');
1834
1835 // Multi journal
1836 $sql = "SELECT rowid, code, label, nature";
1837 $sql .= " FROM ".MAIN_DB_PREFIX."accounting_journal";
1838 $sql .= " WHERE entity = ".((int) $conf->entity);
1839 if (getDolGlobalString('ACCOUNTING_MODE') == 'RECETTES-DEPENSES') {
1840 $sql .= " AND nature = 4"; // only bank journal when using treasury accounting mode
1841 }
1842 $sql .= " AND active = 1";
1843 $sql .= " ORDER BY nature ASC, label DESC";
1844
1845 $resql = $db->query($sql);
1846 if ($resql) {
1847 $numr = $db->num_rows($resql);
1848 $i = 0;
1849
1850 if ($numr > 0) {
1851 while ($i < $numr) {
1852 $objp = $db->fetch_object($resql);
1853
1854 $nature = '';
1855
1856 // Must match array $sourceList defined into journals_list.php
1857 if ($objp->nature == 2
1858 && isModEnabled('invoice')
1859 && !getDolGlobalInt('ACCOUNTING_DISABLE_BINDING_ON_SALES')) {
1860 $nature = "sells";
1861 }
1862 if ($objp->nature == 6
1863 && isModEnabled('takepos')
1864 && getDolGlobalInt('ACCOUNTING_DISSOCIATE_CASH_SALES')
1865 && !getDolGlobalInt('ACCOUNTING_DISABLE_BINDING_ON_SALES')) {
1866 $nature = "cashsells";
1867 }
1868 if ($objp->nature == 3
1869 && isModEnabled('supplier_invoice')
1870 && !getDolGlobalInt('ACCOUNTING_DISABLE_BINDING_ON_PURCHASES')) {
1871 $nature = "purchases";
1872 }
1873 if ($objp->nature == 4
1874 && isModEnabled('bank')) {
1875 $nature = "bank";
1876 }
1877 if ($objp->nature == 5
1878 && isModEnabled('expensereport')
1879 && !getDolGlobalInt('ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS')) {
1880 $nature = "expensereports";
1881 }
1882 if ($objp->nature == 1
1883 && (isModEnabled('asset') || isModEnabled('invoice') || isModEnabled('supplier_invoice'))) {
1884 $nature = "various";
1885 }
1886 if ($objp->nature == 8) {
1887 $nature = "inventory";
1888 }
1889 if ($objp->nature == 9) {
1890 $nature = "hasnew";
1891 }
1892
1893 // To enable when page exists
1894 if (!getDolGlobalString('ACCOUNTANCY_SHOW_DEVELOP_JOURNAL')) {
1895 if ($nature == 'hasnew' || $nature == 'inventory') {
1896 $nature = '';
1897 }
1898 }
1899
1900 if ($nature) {
1901 $langs->load('accountancy');
1902 $journallabel = '';
1903 $journallabelwithoutspan = '';
1904 if ($objp->label) {
1905 $journallabelwithoutspan = $langs->trans($objp->label);
1906 $journallabel = '<span class="opacitymedium">('.$langs->trans($objp->label).')</span>'; // Label of bank account in llx_accounting_journal
1907 }
1908
1909 $key = $langs->trans("AccountingJournalType".$objp->nature); // $objp->nature is 1, 2, 3 ...
1910 $transferlabel = (($objp->nature && $key != "AccountingJournalType".$objp->nature) ? $key.($journallabelwithoutspan != $key ? ' '.$journallabelwithoutspan : '') : $journallabelwithoutspan);
1911
1912 if (getDolGlobalString('ACCOUNTING_MODE') == 'RECETTES-DEPENSES') {
1913 $journalNaturePrefixUrl = 'treasury';
1914 } else {
1915 $journalNaturePrefixUrl = $nature;
1916 }
1917 $newmenu->add('/accountancy/journal/'.$journalNaturePrefixUrl.'journal.php?mainmenu=accountancy&leftmenu=accountancy_transfer_journal&id_journal='.$objp->rowid, $transferlabel, 2, $user->hasRight('accounting', 'comptarapport', 'lire'));
1918 }
1919 $i++;
1920 }
1921 } else {
1922 // Should not happen. Entries are added
1923 $newmenu->add('', $langs->trans("NoJournalDefined"), 2, $user->hasRight('accounting', 'comptarapport', 'lire'));
1924 }
1925 } else {
1927 }
1928 $db->free($resql);
1929 }
1930
1931 // Files
1932 if (!getDolGlobalString('ACCOUNTANCY_HIDE_EXPORT_FILES_MENU')) {
1933 $newmenu->add("/compta/accounting-files.php?mainmenu=accountancy&leftmenu=accountancy_transfer_sourcefiles", $langs->trans("AccountantFiles"), 1, $user->hasRight('accounting', 'mouvements', 'lire'));
1934 }
1935 }
1936
1937
1938 // Accounting
1939
1940 $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"'));
1941
1942 if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_accountancy/', $leftmenu)) {
1943 // General Ledger
1944 $newmenu->add("/accountancy/bookkeeping/listbyaccount.php?mainmenu=accountancy&leftmenu=accountancy_accountancy", $langs->trans("Bookkeeping"), 1, $user->hasRight('accounting', 'mouvements', 'lire'));
1945
1946 // Journals
1947 $newmenu->add("/accountancy/bookkeeping/list.php?mainmenu=accountancy&leftmenu=accountancy_accountancy", $langs->trans("Journals"), 1, $user->hasRight('accounting', 'mouvements', 'lire'));
1948
1949 // Account Balance
1950 $newmenu->add("/accountancy/bookkeeping/balance.php?mainmenu=accountancy&leftmenu=accountancy_accountancy", $langs->trans("AccountBalance"), 1, $user->hasRight('accounting', 'mouvements', 'lire'));
1951
1952 // Export accountancy
1953 $newmenu->add("/accountancy/bookkeeping/export.php?mainmenu=accountancy&leftmenu=accountancy_accountancy", $langs->trans("MenuExportAccountancy"), 1, $user->hasRight('accounting', 'mouvements', 'lire'));
1954
1955 // Closure
1956 $newmenu->add("/accountancy/closure/index.php?mainmenu=accountancy&leftmenu=accountancy_accountancy_closure", $langs->trans("MenuAccountancyClosure"), 1, $user->hasRight('accounting', 'fiscalyear', 'write'), '', $mainmenu, 'closure');
1957
1958 // Reports
1959 $newmenu->add("/accountancy/index.php?leftmenu=accountancy_accountancy_report", $langs->trans("Reportings"), 1, $user->hasRight('accounting', 'comptarapport', 'lire'), '', $mainmenu, 'ca');
1960
1961 if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_accountancy_report/', $leftmenu)) {
1962 $newmenu->add("/compta/resultat/index.php?leftmenu=accountancy_accountancy_report", $langs->trans("MenuReportInOut"), 2, $user->hasRight('accounting', 'comptarapport', 'lire'));
1963 $newmenu->add("/compta/resultat/clientfourn.php?leftmenu=accountancy_accountancy_report", $langs->trans("ByPredefinedAccountGroups"), 3, $user->hasRight('accounting', 'comptarapport', 'lire'));
1964
1965 if (isModEnabled('comptabilite')) {
1966 $newmenu->add("/compta/resultat/projects.php?leftmenu=accountancy_accountancy_report", $langs->trans("ByProject"), 3, $user->hasRight('accounting', 'comptarapport', 'lire'));
1967 }
1968
1969 if (getDolGlobalInt('ACCOUNTING_ENABLE_MULTI_REPORT')) {
1970 global $mysoc;
1971
1972 // Multi personalized reports
1973 $sql = "SELECT rowid, code, label";
1974 $sql .= " FROM ".MAIN_DB_PREFIX."c_accounting_report";
1975 $sql .= " WHERE entity = ".((int) $conf->entity);
1976 $sql .= " AND fk_country = ".((int) $mysoc->country_id);
1977 $sql .= " AND active = 1";
1978 $sql .= " ORDER BY label DESC";
1979
1980 $resql = $db->query($sql);
1981 if ($resql) {
1982 $numr = $db->num_rows($resql);
1983 $i = 0;
1984
1985 if ($numr > 0) {
1986 while ($i < $numr) {
1987 $objp = $db->fetch_object($resql);
1988 $newmenu->add('/compta/resultat/result.php?mainmenu=accountancy&leftmenu=accountancy_accountancy_report&id_report='.$objp->rowid, $langs->trans("Personalized") . " - " . $objp->label, 3, $user->hasRight('accounting', 'comptarapport', 'lire'));
1989 $i++;
1990 }
1991 } else {
1992 // Should not happen. We keep a link in case it happen to go to the page to explain how to create custom groups.
1993 $newmenu->add("/compta/resultat/result.php?mainmenu=accountancy&leftmenu=accountancy_accountancy_report", $langs->trans("ByPersonalizedAccountGroups"), 3, $user->hasRight('accounting', 'comptarapport', 'lire'));
1994 //$newmenu->add('', $langs->trans("NoReportDefined"), 3, 0);
1995 }
1996 } else {
1998 }
1999 $db->free($resql);
2000 } else {
2001 $newmenu->add("/compta/resultat/result.php?leftmenu=accountancy_accountancy_report", $langs->trans("ByPersonalizedAccountGroups"), 3, $user->hasRight('accounting', 'comptarapport', 'lire'));
2002 }
2003 }
2004 }
2005
2006 $modecompta = 'CREANCES-DETTES';
2007 if (isModEnabled('accounting') && $user->hasRight('accounting', 'comptarapport', 'lire') && $mainmenu == 'accountancy') {
2008 $modecompta = 'BOOKKEEPING'; // Not yet implemented. Should be BOOKKEEPINGCOLLECTED
2009 }
2010 if ($modecompta) {
2011 if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/', $leftmenu)) {
2012 $newmenu->add("/compta/stats/index.php?leftmenu=accountancy_accountancy_report&modecompta=".$modecompta, $langs->trans("ReportTurnover"), 2, $user->hasRight('accounting', 'comptarapport', 'lire'));
2013 $newmenu->add("/compta/stats/casoc.php?leftmenu=accountancy_accountancy_report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 3, $user->hasRight('accounting', 'comptarapport', 'lire'));
2014 $newmenu->add("/compta/stats/cabyuser.php?leftmenu=accountancy_accountancy_report&modecompta=".$modecompta, $langs->trans("ByUsers"), 3, $user->hasRight('accounting', 'comptarapport', 'lire'));
2015 $newmenu->add("/compta/stats/cabyprodserv.php?leftmenu=accountancy_accountancy_report&modecompta=".$modecompta, $langs->trans("ByProductsAndServices"), 3, $user->hasRight('accounting', 'comptarapport', 'lire'));
2016 $newmenu->add("/compta/stats/byratecountry.php?leftmenu=accountancy_accountancy_report&modecompta=".$modecompta, $langs->trans("ByVatRate"), 3, $user->hasRight('accounting', 'comptarapport', 'lire'));
2017 }
2018 }
2019
2020 $modecompta = 'RECETTES-DEPENSES';
2021 //if (isModEnabled('accounting') && $user->hasRight('accounting', 'comptarapport', 'lire') && $mainmenu == 'accountancy') $modecompta=''; // Not yet implemented. Should be BOOKKEEPINGCOLLECTED
2022 if ($modecompta) {
2023 if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/', $leftmenu)) {
2024 $newmenu->add("/compta/stats/index.php?leftmenu=accountancy_accountancy_report&modecompta=".$modecompta, $langs->trans("ReportTurnoverCollected"), 2, $user->hasRight('accounting', 'comptarapport', 'lire'));
2025 $newmenu->add("/compta/stats/casoc.php?leftmenu=accountancy_accountancy_report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 3, $user->hasRight('accounting', 'comptarapport', 'lire'));
2026 $newmenu->add("/compta/stats/cabyuser.php?leftmenu=accountancy_accountancy_report&modecompta=".$modecompta, $langs->trans("ByUsers"), 3, $user->hasRight('accounting', 'comptarapport', 'lire'));
2027 //$newmenu->add("/compta/stats/cabyprodserv.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByProductsAndServices"),3,$user->hasRight('accounting', 'comptarapport', 'lire'));
2028 //$newmenu->add("/compta/stats/byratecountry.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByVatRate"),3,$user->hasRight('accounting', 'comptarapport', 'lire'));
2029 }
2030 }
2031
2032 $modecompta = 'CREANCES-DETTES';
2033 if (isModEnabled('accounting') && $user->hasRight('accounting', 'comptarapport', 'lire') && $mainmenu == 'accountancy') {
2034 $modecompta = 'BOOKKEEPING'; // Not yet implemented.
2035 }
2036 if ($modecompta && isModEnabled('supplier_invoice')) {
2037 if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/', $leftmenu)) {
2038 $newmenu->add("/compta/stats/supplier_turnover.php?leftmenu=accountancy_accountancy_report&modecompta=".$modecompta, $langs->trans("ReportPurchaseTurnover"), 2, $user->hasRight('accounting', 'comptarapport', 'lire'));
2039 $newmenu->add("/compta/stats/supplier_turnover_by_thirdparty.php?leftmenu=accountancy_accountancy_report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 3, $user->hasRight('accounting', 'comptarapport', 'lire'));
2040 $newmenu->add("/compta/stats/supplier_turnover_by_prodserv.php?leftmenu=accountancy_accountancy_report&modecompta=".$modecompta, $langs->trans("ByProductsAndServices"), 3, $user->hasRight('accounting', 'comptarapport', 'lire'));
2041 }
2042 }
2043
2044 $modecompta = 'RECETTES-DEPENSES';
2045 if (isModEnabled('accounting') && $user->hasRight('accounting', 'comptarapport', 'lire') && $mainmenu == 'accountancy') {
2046 $modecompta = 'BOOKKEEPINGCOLLECTED'; // Not yet implemented.
2047 }
2048 if ($modecompta && ((isModEnabled('fournisseur') && !getDolGlobalString('MAIN_USE_NEW_SUPPLIERMOD')) || isModEnabled('supplier_invoice'))) {
2049 if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/', $leftmenu)) {
2050 $newmenu->add("/compta/stats/supplier_turnover.php?leftmenu=accountancy_accountancy_report&modecompta=".$modecompta, $langs->trans("ReportPurchaseTurnoverCollected"), 2, $user->hasRight('accounting', 'comptarapport', 'lire'));
2051 $newmenu->add("/compta/stats/supplier_turnover_by_thirdparty.php?leftmenu=accountancy_accountancy_report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 3, $user->hasRight('accounting', 'comptarapport', 'lire'));
2052 }
2053 }
2054 }
2055
2056 // Accountancy (simple)
2057 if (isModEnabled('comptabilite')) {
2058 // Files
2059 if (!getDolGlobalString('ACCOUNTANCY_HIDE_EXPORT_FILES_MENU')) {
2060 $newmenu->add("/compta/accounting-files.php?mainmenu=accountancy&leftmenu=accountancy_accountancy_files", $langs->trans("AccountantFiles"), 0, $user->hasRight('compta', 'resultat', 'lire'), '', $mainmenu, 'files', 0, '', '', '', img_picto('', 'accountancy', 'class="paddingright pictofixedwidth"'));
2061 }
2062
2063
2064 // Bilan, resultats
2065 $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"'));
2066
2067 if ($usemenuhider || empty($leftmenu) || preg_match('/report/', $leftmenu)) {
2068 $newmenu->add("/compta/resultat/index.php?leftmenu=accountancy_report", $langs->trans("MenuReportInOut"), 1, $user->hasRight('compta', 'resultat', 'lire'));
2069 $newmenu->add("/compta/resultat/clientfourn.php?leftmenu=accountancy_report", $langs->trans("ByPredefinedAccountGroups"), 2, $user->hasRight('compta', 'resultat', 'lire'));
2070 $newmenu->add("/compta/resultat/projects.php?leftmenu=accountancy_report", $langs->trans("ByProject"), 2, $user->hasRight('compta', 'resultat', 'lire'));
2071 /* We will see with double party module
2072 $newmenu->add("/compta/resultat/compteres.php?leftmenu=report","Compte de resultat",2,$user->hasRight('compta', 'resultat', 'lire'));
2073 $newmenu->add("/compta/resultat/bilan.php?leftmenu=report","Bilan",2,$user->hasRight('compta', 'resultat', 'lire'));
2074 */
2075
2076 /*
2077 $newmenu->add("/compta/stats/cumul.php?leftmenu=report","Cumule",2,$user->hasRight('compta', 'resultat', 'lire'));
2078 if (isModEnabled('propal')) {
2079 $newmenu->add("/compta/stats/prev.php?leftmenu=report","Previsionnel",2,$user->hasRight('compta', 'resultat', 'lire'));
2080 $newmenu->add("/compta/stats/comp.php?leftmenu=report","Transferred",2,$user->hasRight('compta', 'resultat', 'lire'));
2081 }
2082 */
2083
2084 $modecompta = 'CREANCES-DETTES';
2085 $newmenu->add("/compta/stats/index.php?leftmenu=report&modecompta=".$modecompta, $langs->trans("ReportTurnover"), 1, $user->hasRight('compta', 'resultat', 'lire'));
2086 $newmenu->add("/compta/stats/casoc.php?leftmenu=report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 2, $user->hasRight('compta', 'resultat', 'lire'));
2087 $newmenu->add("/compta/stats/cabyuser.php?leftmenu=report&modecompta=".$modecompta, $langs->trans("ByUsers"), 2, $user->hasRight('compta', 'resultat', 'lire'));
2088 $newmenu->add("/compta/stats/cabyprodserv.php?leftmenu=report&modecompta=".$modecompta, $langs->trans("ByProductsAndServices"), 2, $user->hasRight('compta', 'resultat', 'lire'));
2089 $newmenu->add("/compta/stats/byratecountry.php?leftmenu=report&modecompta=".$modecompta, $langs->trans("ByVatRate"), 2, $user->hasRight('compta', 'resultat', 'lire'));
2090
2091 $modecompta = 'RECETTES-DEPENSES';
2092 $newmenu->add("/compta/stats/index.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ReportTurnoverCollected"), 1, $user->hasRight('compta', 'resultat', 'lire'));
2093 $newmenu->add("/compta/stats/casoc.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 2, $user->hasRight('compta', 'resultat', 'lire'));
2094 $newmenu->add("/compta/stats/cabyuser.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByUsers"), 2, $user->hasRight('compta', 'resultat', 'lire'));
2095
2096 //Achats
2097 $modecompta = 'CREANCES-DETTES';
2098 $newmenu->add("/compta/stats/supplier_turnover.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ReportPurchaseTurnover"), 1, $user->hasRight('compta', 'resultat', 'lire'));
2099 $newmenu->add("/compta/stats/supplier_turnover_by_thirdparty.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 2, $user->hasRight('compta', 'resultat', 'lire'));
2100 $newmenu->add("/compta/stats/supplier_turnover_by_prodserv.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByProductsAndServices"), 2, $user->hasRight('compta', 'resultat', 'lire'));
2101
2102 /*
2103 $modecompta = 'RECETTES-DEPENSES';
2104 $newmenu->add("/compta/stats/index.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ReportPurchaseTurnoverCollected"), 1, $user->hasRight('compta', 'resultat', 'lire'));
2105 $newmenu->add("/compta/stats/casoc.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 2, $user->hasRight('compta', 'resultat', 'lire'));
2106 $newmenu->add("/compta/stats/cabyuser.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByUsers"), 2, $user->hasRight('compta', 'resultat', 'lire'));
2107 */
2108
2109 // Journals
2110 $newmenu->add("/compta/journal/sellsjournal.php?leftmenu=accountancy_report", $langs->trans("SellsJournal"), 1, $user->hasRight('compta', 'resultat', 'lire'), '', '', '', 50);
2111 $newmenu->add("/compta/journal/purchasesjournal.php?leftmenu=accountancy_report", $langs->trans("PurchasesJournal"), 1, $user->hasRight('compta', 'resultat', 'lire'), '', '', '', 51);
2112 }
2113 //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'));
2114 }
2115
2116 // Intracomm report
2117 if (isModEnabled('intracommreport')) {
2118 $newmenu->add("/intracommreport/list.php?leftmenu=intracommreport", $langs->trans("MenuIntracommReport"), 0, $user->hasRight('intracommreport', 'read'), '', $mainmenu, 'intracommreport', 60, '', '', '', img_picto('', 'intracommreport', 'class="paddingright pictofixedwidth"'));
2119 if ($usemenuhider || empty($leftmenu) || preg_match('/intracommreport/', $leftmenu)) {
2120 // DEB / DES
2121 $newmenu->add("/intracommreport/card.php?action=create&leftmenu=intracommreport", $langs->trans("MenuIntracommReportNew"), 1, $user->hasRight('intracommreport', 'write'), '', $mainmenu, 'intracommreport', 1);
2122 $newmenu->add("/intracommreport/list.php?leftmenu=intracommreport", $langs->trans("MenuIntracommReportList"), 1, $user->hasRight('intracommreport', 'read'), '', $mainmenu, 'intracommreport', 1);
2123 }
2124 }
2125
2126 // Assets
2127 if (isModEnabled('asset')) {
2128 $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"'));
2129 if ($usemenuhider || empty($leftmenu) || preg_match('/asset/', $leftmenu)) {
2130 $newmenu->add("/asset/card.php?leftmenu=asset&action=create", $langs->trans("MenuNewAsset"), 1, $user->hasRight('asset', 'write'));
2131 $newmenu->add("/asset/list.php?leftmenu=asset&mainmenu=accountancy", $langs->trans("MenuListAssets"), 1, $user->hasRight('asset', 'read'));
2132 $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');
2133 if ($usemenuhider || empty($leftmenu) || preg_match('/asset_model/', $leftmenu)) {
2134 $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'))));
2135 $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'))));
2136 }
2137 }
2138 }
2139 }
2140}
2141
2152function get_left_menu_bank($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = 'none', $type_user = 0)
2153{
2154 global $user, $langs;
2155
2156 if ($mainmenu == 'bank') {
2157 // Load translation files required by the page
2158 $langs->loadLangs(array("withdrawals", "banks", "bills", "categories"));
2159
2160 // Bank-Cash account
2161 if (isModEnabled('bank')) {
2162 $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"'));
2163
2164 $newmenu->add("/compta/bank/card.php?action=create&token=" . newToken(), $langs->trans("MenuNewFinancialAccount"), 1, $user->hasRight('banque', 'configurer'));
2165 $newmenu->add("/compta/bank/list.php?leftmenu=bank&mainmenu=bank&search_status=opened", $langs->trans("List"), 1, $user->hasRight('banque', 'lire'), '', $mainmenu, 'bank');
2166 $newmenu->add("/compta/bank/bankentries_list.php", $langs->trans("ListTransactions"), 1, $user->hasRight('banque', 'lire'));
2167 $newmenu->add("/compta/bank/budget.php", $langs->trans("ListTransactionsByCategory"), 1, $user->hasRight('banque', 'lire'));
2168
2169 $newmenu->add("/compta/bank/transfer.php", $langs->trans("MenuBankInternalTransfer"), 1, $user->hasRight('banque', 'transfer'));
2170 }
2171
2172 if (isModEnabled('category') && getDolGlobalString('CATEGORY_EDIT_IN_MENU_NOT_IN_POPUP')) {
2173 $langs->load("categories");
2174 $newmenu->add("/categories/categorie_list.php?type=5", $langs->trans("Rubriques"), 1, $user->hasRight('categorie', 'creer'), '', $mainmenu, 'tags');
2175 $newmenu->add("/categories/categorie_list.php?type=8", $langs->trans("RubriquesTransactions"), 1, $user->hasRight('banque', 'configurer'), '', $mainmenu, 'tags');
2176 }
2177
2178 // Direct debit order
2179 if (isModEnabled('prelevement')) {
2180 $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"'));
2181
2182 if ($usemenuhider || empty($leftmenu) || $leftmenu == "withdraw") {
2183 $newmenu->add("/compta/prelevement/create.php?mainmenu=bank&token=" . newToken(), $langs->trans("NewStandingOrder"), 1, $user->hasRight('prelevement', 'bons', 'creer'));
2184
2185 $newmenu->add("/compta/prelevement/orders_list.php?mainmenu=bank", $langs->trans("List"), 1, $user->hasRight('prelevement', 'bons', 'lire'));
2186 $newmenu->add("/compta/prelevement/list.php?mainmenu=bank", $langs->trans("WithdrawalsLines"), 1, $user->hasRight('prelevement', 'bons', 'lire'));
2187 $newmenu->add("/compta/prelevement/rejets.php?mainmenu=bank", $langs->trans("Rejects"), 1, $user->hasRight('prelevement', 'bons', 'lire'));
2188 $newmenu->add("/compta/prelevement/stats.php?mainmenu=bank", $langs->trans("Statistics"), 1, $user->hasRight('prelevement', 'bons', 'lire'));
2189 }
2190 }
2191
2192 // Bank transfer order
2193 if (isModEnabled('paymentbybanktransfer')) {
2194 $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"'));
2195
2196 if ($usemenuhider || empty($leftmenu) || $leftmenu == "banktransfer") {
2197 $newmenu->add("/compta/prelevement/create.php?type=bank-transfer&mainmenu=bank&token=" . newToken(), $langs->trans("NewPaymentByBankTransfer"), 1, $user->hasRight('paymentbybanktransfer', 'create'));
2198
2199 $newmenu->add("/compta/prelevement/orders_list.php?type=bank-transfer&mainmenu=bank", $langs->trans("List"), 1, $user->hasRight('paymentbybanktransfer', 'read'));
2200 $newmenu->add("/compta/prelevement/list.php?type=bank-transfer&mainmenu=bank", $langs->trans("PaymentByBankTransferLines"), 1, $user->hasRight('paymentbybanktransfer', 'read'));
2201 $newmenu->add("/compta/prelevement/rejets.php?type=bank-transfer&mainmenu=bank", $langs->trans("Rejects"), 1, $user->hasRight('paymentbybanktransfer', 'read'));
2202 $newmenu->add("/compta/prelevement/stats.php?type=bank-transfer&mainmenu=bank", $langs->trans("Statistics"), 1, $user->hasRight('paymentbybanktransfer', 'read'));
2203 }
2204 }
2205
2206 // Management of checks
2207 if (!getDolGlobalString('BANK_DISABLE_CHECK_DEPOSIT') && isModEnabled('bank') && (isModEnabled('invoice') || getDolGlobalString('MAIN_MENU_CHEQUE_DEPOSIT_ON'))) {
2208 $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"'));
2209 if (preg_match('/checks/', $leftmenu)) {
2210 $newmenu->add("/compta/paiement/cheque/card.php?leftmenu=checks_bis&action=new&mainmenu=bank", $langs->trans("NewChequeDeposit"), 1, $user->hasRight('banque', 'cheque'));
2211 $newmenu->add("/compta/paiement/cheque/list.php?leftmenu=checks_bis&mainmenu=bank", $langs->trans("List"), 1, $user->hasRight('banque', 'cheque'));
2212 }
2213 }
2214
2215 // Cash Control
2216 if (isModEnabled('takepos') || isModEnabled('cashdesk')) {
2217 $permtomakecashfence = ($user->hasRight('cashdesk', 'run') || $user->hasRight('takepos', 'run'));
2218 $newmenu->add("/compta/cashcontrol/cashcontrol_list.php", $langs->trans("CashControl"), 0, (int) $permtomakecashfence, '', $mainmenu, 'cashcontrol', 0, '', '', '', img_picto('', 'pos', 'class="paddingright pictofixedwidth"'));
2219 $newmenu->add("/compta/cashcontrol/cashcontrol_card.php?action=create&token=" . newToken(), $langs->trans("NewCashFence"), 1, (int) $permtomakecashfence);
2220 $newmenu->add("/compta/cashcontrol/cashcontrol_list.php", $langs->trans("List"), 1, (int) $permtomakecashfence);
2221 }
2222 }
2223}
2224
2235function get_left_menu_products($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = 'none', $type_user = 0)
2236{
2237 global $user, $langs;
2238
2239 if ($mainmenu == 'products') {
2240 // Products
2241 if (isModEnabled('product')) {
2242 $newmenu->add("/product/index.php?leftmenu=product", $langs->trans("Products"), 0, $user->hasRight('product', 'read'), '', $mainmenu, 'product', 0, '', '', '', img_picto('', 'product', 'class="paddingright pictofixedwidth"'));
2243 $newmenu->add("/product/card.php?leftmenu=product&action=create&type=0", $langs->trans("NewProduct"), 1, $user->hasRight('product', 'creer'));
2244 $newmenu->add("/product/list.php?leftmenu=product&type=0", $langs->trans("List"), 1, $user->hasRight('product', 'read'));
2245 if (isModEnabled('stock')) {
2246 $newmenu->add("/product/reassort.php?type=0", $langs->trans("MenuStocks"), 1, (int) ($user->hasRight('product', 'read') && $user->hasRight('stock', 'lire')));
2247 }
2248 if (isModEnabled('productbatch')) {
2249 $langs->load("stocks");
2250 $newmenu->add("/product/reassortlot.php?type=0&search_subjecttolotserial=1", $langs->trans("StocksByLotSerial"), 1, (int) ($user->hasRight('product', 'read') && $user->hasRight('stock', 'lire')));
2251 $newmenu->add("/product/stock/productlot_list.php", $langs->trans("LotSerial"), 1, (int) ($user->hasRight('product', 'read') && $user->hasRight('stock', 'lire')));
2252 }
2253 if (isModEnabled('variants')) {
2254 $newmenu->add("/variants/list.php", $langs->trans("VariantAttributes"), 1, $user->hasRight('product', 'read'));
2255 }
2256 if (isModEnabled('propal') || isModEnabled('order') || isModEnabled('invoice') || isModEnabled('supplier_proposal') || isModEnabled('supplier_order') || isModEnabled('supplier_invoice')) {
2257 if (getDolGlobalString('MAIN_STATISTICS_IN_MENU')) {
2258 $newmenu->add("/product/stats/index.php?id=all&leftmenu=stats&type=0", $langs->trans("Statistics"), 1, $user->hasRight('product', 'read'));
2259 }
2260 }
2261
2262 // Categories
2263 if (isModEnabled('category') && getDolGlobalString('CATEGORY_EDIT_IN_MENU_NOT_IN_POPUP')) {
2264 $langs->load("categories");
2265 $newmenu->add("/categories/categorie_list.php?leftmenu=cat&type=product", $langs->trans("Categories"), 1, $user->hasRight('categorie', 'lire'), '', $mainmenu, 'cat');
2266 }
2267 }
2268
2269 // Services
2270 if (isModEnabled('service')) {
2271 $newmenu->add("/product/index.php?leftmenu=service", $langs->trans("Services"), 0, $user->hasRight('service', 'read'), '', $mainmenu, 'service', 0, '', '', '', img_picto('', 'service', 'class="paddingright pictofixedwidth"'));
2272 $newmenu->add("/product/card.php?leftmenu=service&action=create&type=1", $langs->trans("NewService"), 1, $user->hasRight('service', 'creer'));
2273 $newmenu->add("/product/list.php?leftmenu=service&type=1", $langs->trans("List"), 1, $user->hasRight('service', 'read'));
2274
2275 if (isModEnabled('stock') && getDolGlobalString('STOCK_SUPPORTS_SERVICES')) {
2276 $newmenu->add("/product/reassort.php?type=1", $langs->trans("MenuStocks"), 1, (int) ($user->hasRight('service', 'read') && $user->hasRight('stock', 'lire')));
2277 }
2278 if (isModEnabled('variants')) {
2279 $newmenu->add("/variants/list.php", $langs->trans("VariantAttributes"), 1, $user->hasRight('service', 'read'));
2280 }
2281 if (isModEnabled('propal') || isModEnabled('order') || isModEnabled('invoice') || isModEnabled('supplier_proposal') || isModEnabled('supplier_order') || isModEnabled('supplier_invoice')) {
2282 if (getDolGlobalString('MAIN_STATISTICS_IN_MENU')) {
2283 $newmenu->add("/product/stats/index.php?id=all&leftmenu=stats&type=1", $langs->trans("Statistics"), 1, $user->hasRight('service', 'read'));
2284 }
2285 }
2286 // Categories
2287 if (isModEnabled('category') && getDolGlobalString('CATEGORY_EDIT_IN_MENU_NOT_IN_POPUP')) {
2288 $langs->load("categories");
2289 $newmenu->add("/categories/categorie_list.php?leftmenu=cat&type=service", $langs->trans("Categories"), 1, $user->hasRight('categorie', 'lire'), '', $mainmenu, 'cat');
2290 }
2291 }
2292
2293 // Warehouse
2294 if (isModEnabled('stock')) {
2295 $langs->load("stocks");
2296 $newmenu->add("/product/index.php?leftmenu=stock", $langs->trans("Warehouses"), 0, $user->hasRight('stock', 'lire'), '', $mainmenu, 'stock', 0, '', '', '', img_picto('', 'stock', 'class="paddingright pictofixedwidth"'));
2297 $newmenu->add("/product/stock/card.php?action=create", $langs->trans("MenuNewWarehouse"), 1, $user->hasRight('stock', 'creer'));
2298 $newmenu->add("/product/stock/list.php", $langs->trans("List"), 1, $user->hasRight('stock', 'lire'));
2299 $newmenu->add("/product/stock/movement_list.php", $langs->trans("Movements"), 1, $user->hasRight('stock', 'mouvement', 'lire'));
2300
2301 $newmenu->add("/product/stock/massstockmove.php?init=1", $langs->trans("MassStockTransferShort"), 1, $user->hasRight('stock', 'mouvement', 'creer'));
2302 if (isModEnabled('supplier_order')) {
2303 $newmenu->add("/product/stock/replenish.php", $langs->trans("Replenishment"), 1, (int) ($user->hasRight('stock', 'mouvement', 'creer') && $user->hasRight('fournisseur', 'lire')));
2304 }
2305 $newmenu->add("/product/stock/stockatdate.php", $langs->trans("StockAtDate"), 1, (int) ($user->hasRight('product', 'read') && $user->hasRight('stock', 'lire')));
2306
2307 // Categories for warehouses
2308 if (isModEnabled('category') && getDolGlobalString('CATEGORY_EDIT_IN_MENU_NOT_IN_POPUP')) {
2309 $newmenu->add("/categories/categorie_list.php?leftmenu=stock&type=9", $langs->trans("Categories"), 1, $user->hasRight('categorie', 'lire'), '', $mainmenu, 'cat');
2310 }
2311 }
2312
2313 if (isModEnabled('stocktransfer')) {
2314 $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"'));
2315 $newmenu->add('/product/stock/stocktransfer/stocktransfer_card.php?action=create', $langs->trans('StockTransferNew'), 1, $user->hasRight('stocktransfer', 'stocktransfer', 'write'));
2316 $newmenu->add('/product/stock/stocktransfer/stocktransfer_list.php', $langs->trans('List'), 1, $user->hasRight('stocktransfer', 'stocktransfer', 'read'));
2317 }
2318
2319 // Inventory
2320 if (isModEnabled('stock')) {
2321 $langs->load("stocks");
2322 if (!getDolGlobalString('MAIN_USE_ADVANCED_PERMS')) {
2323 $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"'));
2324 if ($usemenuhider || empty($leftmenu) || $leftmenu == "stock_inventories") {
2325 $newmenu->add("/product/inventory/card.php?action=create&leftmenu=stock_inventories", $langs->trans("NewInventory"), 1, $user->hasRight('stock', 'creer'));
2326 $newmenu->add("/product/inventory/list.php?leftmenu=stock_inventories", $langs->trans("List"), 1, $user->hasRight('stock', 'lire'));
2327 }
2328 } else {
2329 $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"'));
2330 if ($usemenuhider || empty($leftmenu) || $leftmenu == "stock_inventories") {
2331 $newmenu->add("/product/inventory/card.php?action=create&leftmenu=stock_inventories", $langs->trans("NewInventory"), 1, $user->hasRight('stock', 'inventory_advance', 'write'));
2332 $newmenu->add("/product/inventory/list.php?leftmenu=stock_inventories", $langs->trans("List"), 1, $user->hasRight('stock', 'inventory_advance', 'read'));
2333 }
2334 }
2335 }
2336
2337 // Shipments
2338 if (isModEnabled('shipping')) {
2339 $langs->load("sendings");
2340 $newmenu->add("/expedition/index.php?leftmenu=sendings", $langs->trans("Shipments"), 0, $user->hasRight('expedition', 'lire'), '', $mainmenu, 'sendings', 0, '', '', '', img_picto('', 'shipment', 'class="paddingright pictofixedwidth"'));
2341 $newmenu->add("/expedition/card.php?action=create&leftmenu=sendings", $langs->trans("NewSending"), 1, $user->hasRight('expedition', 'creer'));
2342 $newmenu->add("/expedition/list.php?leftmenu=sendings", $langs->trans("List"), 1, $user->hasRight('expedition', 'lire'));
2343 if ($usemenuhider || empty($leftmenu) || $leftmenu == "sendings") {
2344 $newmenu->add("/expedition/list.php?leftmenu=sendings&search_status=0", $langs->trans("StatusSendingDraftShort"), 2, $user->hasRight('expedition', 'lire'));
2345 $newmenu->add("/expedition/list.php?leftmenu=sendings&search_status=1", $langs->trans("StatusSendingValidatedShort"), 2, $user->hasRight('expedition', 'lire'));
2346 $newmenu->add("/expedition/list.php?leftmenu=sendings&search_status=2", $langs->trans("StatusSendingProcessedShort"), 2, $user->hasRight('expedition', 'lire'));
2347 }
2348 if (getDolGlobalString('MAIN_STATISTICS_IN_MENU')) {
2349 $newmenu->add("/expedition/stats/index.php?leftmenu=sendings", $langs->trans("Statistics"), 1, $user->hasRight('expedition', 'lire'));
2350 }
2351 }
2352
2353 // Receptions
2354 if (isModEnabled('reception')) {
2355 $langs->load("receptions");
2356 $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;"'));
2357 $newmenu->add("/reception/card.php?action=create&leftmenu=receptions", $langs->trans("NewReception"), 1, $user->hasRight('reception', 'creer'));
2358 $newmenu->add("/reception/list.php?leftmenu=receptions", $langs->trans("List"), 1, $user->hasRight('reception', 'lire'));
2359 if ($usemenuhider || empty($leftmenu) || $leftmenu == "receptions") {
2360 $newmenu->add("/reception/list.php?leftmenu=receptions&search_status=0", $langs->trans("StatusReceptionDraftShort"), 2, $user->hasRight('reception', 'lire'));
2361 }
2362 if ($usemenuhider || empty($leftmenu) || $leftmenu == "receptions") {
2363 $newmenu->add("/reception/list.php?leftmenu=receptions&search_status=1", $langs->trans("StatusReceptionValidatedShort"), 2, $user->hasRight('reception', 'lire'));
2364 }
2365 if ($usemenuhider || empty($leftmenu) || $leftmenu == "receptions") {
2366 $newmenu->add("/reception/list.php?leftmenu=receptions&search_status=2", $langs->trans("StatusReceptionProcessedShort"), 2, $user->hasRight('reception', 'lire'));
2367 }
2368 if (getDolGlobalString('MAIN_STATISTICS_IN_MENU')) {
2369 $newmenu->add("/reception/stats/index.php?leftmenu=receptions", $langs->trans("Statistics"), 1, $user->hasRight('reception', 'lire'));
2370 }
2371 }
2372 }
2373}
2374
2385function get_left_menu_mrp($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = 'none', $type_user = 0)
2386{
2387 global $user, $conf, $langs;
2388
2389 if ($mainmenu == 'mrp') {
2390 // BOM
2391 if (isModEnabled('bom') || isModEnabled('mrp')) {
2392 $langs->load("mrp");
2393
2394 $newmenu->add("", $langs->trans("MenuBOM"), 0, $user->hasRight('bom', 'read'), '', $mainmenu, 'bom', 0, '', '', '', img_picto('', 'bom', 'class="paddingright pictofixedwidth"'));
2395 $newmenu->add("/bom/bom_card.php?leftmenu=bom&action=create", $langs->trans("NewBOM"), 1, $user->hasRight('bom', 'write'), '', $mainmenu, 'bom');
2396 $newmenu->add("/bom/bom_list.php?leftmenu=bom", $langs->trans("List"), 1, $user->hasRight('bom', 'read'), '', $mainmenu, 'bom');
2397 }
2398
2399 if (isModEnabled('mrp')) {
2400 $langs->load("mrp");
2401
2402 $newmenu->add("", $langs->trans("MenuMRP"), 0, $user->hasRight('mrp', 'read'), '', $mainmenu, 'mrp', 0, '', '', '', img_picto('', 'mrp', 'class="paddingright pictofixedwidth"'));
2403 $newmenu->add("/mrp/mo_card.php?leftmenu=mrp&action=create", $langs->trans("NewMO"), 1, $user->hasRight('mrp', 'write'), '', $mainmenu, '');
2404 $newmenu->add("/mrp/mo_list.php?leftmenu=mrp", $langs->trans("List"), 1, $user->hasRight('mrp', 'read'), '', $mainmenu, '');
2405 }
2406 }
2407}
2408
2419function get_left_menu_projects($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = 'none', $type_user = 0)
2420{
2421 global $user, $langs;
2422
2423 if ($mainmenu == 'project') {
2424 if (isModEnabled('project')) {
2425 $langs->load("projects");
2426
2427 $search_project_user = GETPOSTINT('search_project_user');
2428
2429 $tmpentry = array(
2430 'enabled' => (int) isModEnabled('project'),
2431 'perms' => (string) (int) $user->hasRight('projet', 'lire'),
2432 'module' => 'projet'
2433 );
2434 $listofmodulesforexternal = explode(',', getDolGlobalString('MAIN_MODULES_FOR_EXTERNAL'));
2435 $showmode = isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal);
2436
2437 $titleboth = $langs->trans("LeadsOrProjects");
2438 $titlenew = $langs->trans("NewLeadOrProject"); // Leads and opportunities by default
2439 if (!getDolGlobalString('PROJECT_USE_OPPORTUNITIES')) {
2440 $titleboth = $langs->trans("Projects");
2441 $titlenew = $langs->trans("NewProject");
2442 }
2443 if (getDolGlobalInt('PROJECT_USE_OPPORTUNITIES') == 2) { // 2 = leads only
2444 $titleboth = $langs->trans("Leads");
2445 $titlenew = $langs->trans("NewLead");
2446 }
2447
2448 // Project assigned to user
2449 $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"'));
2450 $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'));
2451
2452 if (!getDolGlobalString('PROJECT_USE_OPPORTUNITIES')) {
2453 $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');
2454 } elseif (getDolGlobalInt('PROJECT_USE_OPPORTUNITIES') == 1) {
2455 $newmenu->add("/projet/list.php?leftmenu=projects".($search_project_user ? '&search_project_user='.$search_project_user : ''), $langs->trans("List"), 1, $showmode, '', 'project', 'list');
2456 $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);
2457 $newmenu->add('/projet/list.php?mainmenu=project&leftmenu=list&search_opp_status=notopenedopp&search_status=99&contextpage=project', $langs->trans("ListOpenProjects"), 2, $showmode);
2458 } elseif (getDolGlobalInt('PROJECT_USE_OPPORTUNITIES') == 2) { // 2 = leads only
2459 $newmenu->add(dolBuildUrl('/projet/list.php', ['mainmenu' => 'project', 'leftmenu' => 'list', 'search_usage_opportunity' => 1, 'search_status' => 99]), $langs->trans("List"), 2, $showmode);
2460 }
2461
2462 if (getDolGlobalString('MAIN_STATISTICS_IN_MENU')) {
2463 $newmenu->add(dolBuildUrl('/projet/stats/index.php', ['leftmenu' => 'projects']), $langs->trans("Statistics"), 1, $user->hasRight('projet', 'lire'));
2464 }
2465
2466 // Categories
2467 if (isModEnabled('category') && getDolGlobalString('CATEGORY_EDIT_IN_MENU_NOT_IN_POPUP')) {
2468 $langs->load("categories");
2469 $newmenu->add(dolBuildUrl('/categories/categorie_list.php', ['leftmenu' => 'cat', 'type' => 6]), $langs->trans("Categories"), 1, $user->hasRight('categorie', 'lire'), '', $mainmenu, 'cat');
2470 }
2471
2472 if (!getDolGlobalString('PROJECT_HIDE_TASKS')) {
2473 // Project assigned to user
2474 $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"'));
2475 $newmenu->add("/projet/tasks.php?leftmenu=tasks&action=create", $langs->trans("NewTask"), 1, $user->hasRight('projet', 'creer'));
2476 $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'));
2477 if (getDolGlobalString('MAIN_STATISTICS_IN_MENU')) {
2478 $newmenu->add("/projet/tasks/stats/index.php?leftmenu=projects", $langs->trans("Statistics"), 1, $user->hasRight('projet', 'lire'));
2479 }
2480
2481 $optionTimesheet = getDolGlobalString('PROJECT_OPEN_ALWAYS_ON_TIMESHEET', "perweek");
2482 $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"'));
2483 $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'));
2484 }
2485 }
2486 }
2487}
2488
2499function get_left_menu_hrm($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = 'none', $type_user = 0)
2500{
2501 global $user, $langs;
2502
2503 if ($mainmenu == 'hrm') {
2504 // HRM module
2505 if (isModEnabled('hrm')) {
2506 $langs->load("hrm");
2507
2508 $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"'));
2509 $newmenu->add(dolBuildUrl('/user/card.php', ['mainmenu' => 'hrm', 'leftmenu' => 'hrm', 'action' => 'create', 'employee' => 1]), $langs->trans("NewEmployee"), 1, $user->hasRight('user', 'user', 'write'));
2510 $newmenu->add(dolBuildUrl('/user/list.php', ['mainmenu' => 'hrm', 'leftmenu' => 'hrm', 'contextpage' => 'employeelist']), $langs->trans("List"), 1, $user->hasRight('user', 'user', 'read'));
2511
2512 $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"'));
2513
2514 // Skills
2515 $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"'));
2516 //$newmenu->add("/hrm/skill_card.php?mainmenu=hrm&leftmenu=hrm_sm&action=create", $langs->trans("NewSkill"), 1, $user->hasRight('hrm', 'all', 'write'));
2517 //$newmenu->add("/hrm/skill_list.php?mainmenu=hrm&leftmenu=hrm_sm", $langs->trans("List"), 1, $user->hasRight('hrm', 'all', 'read'));
2518
2519 // Job (Description of work to do and skills required)
2520 $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"'));
2521 //$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'));
2522 //$newmenu->add("/hrm/job_list.php?mainmenu=hrm&leftmenu=hrm_sm", $langs->trans("List"), 1, $user->hasRight('hrm', 'all', 'read'));
2523
2524 // Position = Link job - user
2525 $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"'));
2526 //$newmenu->add("/hrm/position.php?mainmenu=hrm&leftmenu=hrm_sm&action=create", $langs->transnoentities("NewObject", $langs->trans("Position")), 1, $user->hasRight('hrm', 'all', 'write'));
2527 //$newmenu->add("/hrm/position_list.php?mainmenu=hrm&leftmenu=hrm_sm", $langs->trans("List"), 1, $user->hasRight('hrm', 'all', 'read'));
2528
2529 // Evaluation
2530 $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"'));
2531 //$newmenu->add("/hrm/evaluation_card.php?mainmenu=hrm&leftmenu=hrm_sm&action=create", $langs->trans("NewEval"), 1, $user->hasRight('hrm', 'evaluation', 'write'));
2532 //$newmenu->add("/hrm/evaluation_list.php?mainmenu=hrm&leftmenu=hrm_sm", $langs->trans("List"), 1, $user->hasRight('hrm', 'evaluation', 'read'));
2533 $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')));
2534 }
2535
2536 // Leave/Holiday/Vacation module
2537 if (isModEnabled('holiday')) {
2538 // Load translation files required by the page
2539 $langs->loadLangs(array("holiday", "trips"));
2540
2541 $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"'));
2542 $newmenu->add(dolBuildUrl('/holiday/card.php', ['mainmenu' => 'hrm', 'leftmenu' => 'holiday', 'action' => 'create']), $langs->trans("New"), 1, $user->hasRight('holiday', 'write'), '', $mainmenu);
2543 $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');
2544 $newmenu->add(dolBuildUrl('/holiday/list.php', ['mainmenu' => 'hrm', 'leftmenu' => 'holiday']), $langs->trans("List"), 1, $user->hasRight('holiday', 'read'), '', $mainmenu);
2545 if ($usemenuhider || empty($leftmenu) || $leftmenu == "holiday") {
2546 $newmenu->add(dolBuildUrl('/holiday/list.php', ['search_status' => 1, 'mainmenu' => 'hrm', 'leftmenu' => 'holiday']), $langs->trans("DraftCP"), 2, $user->hasRight('holiday', 'read'), '', $mainmenu, 'holiday_sm');
2547 $newmenu->add(dolBuildUrl('/holiday/list.php', ['search_status' => 2, 'mainmenu' => 'hrm', 'leftmenu' => 'holiday']), $langs->trans("ToReviewCP"), 2, $user->hasRight('holiday', 'read'), '', $mainmenu, 'holiday_sm');
2548 $newmenu->add(dolBuildUrl('/holiday/list.php', ['search_status' => 3, 'mainmenu' => 'hrm', 'leftmenu' => 'holiday']), $langs->trans("ApprovedCP"), 2, $user->hasRight('holiday', 'read'), '', $mainmenu, 'holiday_sm');
2549 $newmenu->add(dolBuildUrl('/holiday/list.php', ['search_status' => 4, 'mainmenu' => 'hrm', 'leftmenu' => 'holiday']), $langs->trans("CancelCP"), 2, $user->hasRight('holiday', 'read'), '', $mainmenu, 'holiday_sm');
2550 $newmenu->add(dolBuildUrl('/holiday/list.php', ['search_status' => 5, 'mainmenu' => 'hrm', 'leftmenu' => 'holiday']), $langs->trans("RefuseCP"), 2, $user->hasRight('holiday', 'read'), '', $mainmenu, 'holiday_sm');
2551 }
2552 $newmenu->add(dolBuildUrl('/holiday/define_holiday.php', ['mainmenu' => 'hrm']), $langs->trans("MenuConfCP"), 1, $user->hasRight('holiday', 'read'), '', $mainmenu, 'holiday_sm');
2553 $newmenu->add(dolBuildUrl('/holiday/month_report.php', ['mainmenu' => 'hrm', 'leftmenu' => 'holiday']), $langs->trans("MenuReportMonth"), 1, $user->hasRight('holiday', 'readall'), '', $mainmenu, 'holiday_sm');
2554 $newmenu->add(dolBuildUrl('/holiday/view_log.php', ['mainmenu' => 'hrm', 'leftmenu' => 'holiday']), $langs->trans("MenuLogCP"), 1, $user->hasRight('holiday', 'define_holiday'), '', $mainmenu, 'holiday_sm');
2555 }
2556
2557 // Expense report
2558 if (isModEnabled('expensereport')) {
2559 $langs->loadLangs(array("trips", "bills"));
2560 $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"'));
2561 $newmenu->add(dolBuildUrl('/expensereport/card.php', ['action' => 'create', 'leftmenu' => 'expensereport', 'mainmenu' => 'hrm']), $langs->trans("New"), 1, $user->hasRight('expensereport', 'creer'));
2562 $newmenu->add(dolBuildUrl('/expensereport/list.php', ['leftmenu' => 'expensereport', 'mainmenu' => 'hrm']), $langs->trans("List"), 1, $user->hasRight('expensereport', 'lire'));
2563 if ($usemenuhider || empty($leftmenu) || $leftmenu == "expensereport") {
2564 $newmenu->add(dolBuildUrl('/expensereport/list.php', ['search_status' => 0, 'leftmenu' => 'expensereport', 'mainmenu' => 'hrm']), $langs->trans("Draft"), 2, $user->hasRight('expensereport', 'lire'));
2565 $newmenu->add(dolBuildUrl('/expensereport/list.php', ['search_status' => 2, 'leftmenu' => 'expensereport', 'mainmenu' => 'hrm']), $langs->trans("Validated"), 2, $user->hasRight('expensereport', 'lire'));
2566 $newmenu->add(dolBuildUrl('/expensereport/list.php', ['search_status' => 5, 'leftmenu' => 'expensereport', 'mainmenu' => 'hrm']), $langs->trans("Approved"), 2, $user->hasRight('expensereport', 'lire'));
2567 $newmenu->add(dolBuildUrl('/expensereport/list.php', ['search_status' => 6, 'leftmenu' => 'expensereport', 'mainmenu' => 'hrm']), $langs->trans("Paid"), 2, $user->hasRight('expensereport', 'lire'));
2568 $newmenu->add(dolBuildUrl('/expensereport/list.php', ['search_status' => 4, 'leftmenu' => 'expensereport', 'mainmenu' => 'hrm']), $langs->trans("Canceled"), 2, $user->hasRight('expensereport', 'lire'));
2569 $newmenu->add(dolBuildUrl('/expensereport/list.php', ['search_status' => 99, 'leftmenu' => 'expensereport', 'mainmenu' => 'hrm']), $langs->trans("Refused"), 2, $user->hasRight('expensereport', 'lire'));
2570 }
2571 if (isModEnabled('bank')) {
2572 $newmenu->add(dolBuildUrl('/expensereport/payment/list.php', ['leftmenu' => 'expensereport_payments', 'mainmenu' => 'hrm']), $langs->trans("Payments"), 1, (int) ($user->hasRight('expensereport', 'read')));
2573 }
2574 if (getDolGlobalString('MAIN_STATISTICS_IN_MENU')) {
2575 $newmenu->add(dolBuildUrl('/expensereport/stats/index.php', ['leftmenu' => 'expensereport', 'mainmenu' => 'hrm']), $langs->trans("Statistics"), 1, $user->hasRight('expensereport', 'lire'));
2576 }
2577 }
2578
2579 if (isModEnabled('project')) {
2580 if (!getDolGlobalString('PROJECT_HIDE_TASKS')) {
2581 $langs->load("projects");
2582
2583 $search_project_user = GETPOSTINT('search_project_user');
2584
2585 $optionTimesheet = getDolGlobalString('PROJECT_OPEN_ALWAYS_ON_TIMESHEET', "perweek");
2586 $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"'));
2587 }
2588 }
2589 }
2590}
2591
2592
2603function get_left_menu_tools($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = 'none', $type_user = 0)
2604{
2605 global $user, $langs;
2606
2607 if ($mainmenu == 'tools') {
2608 if (isModEnabled('category')) {
2609 $titleindex = $langs->trans("Categories");
2610 $newmenu->add(dolBuildUrl('/categories/index.php', ['leftmenu' => 'category']), $titleindex, 0, $user->hasRight('category', 'read'), '', $mainmenu, 'category', 5, '', '', '', img_picto('', 'category', 'class="paddingright pictofixedwidth"'));
2611 }
2612
2613 if (!getDolGlobalInt('MENU_HIDE_EMAIL_TEMPLATES') && empty($user->socid)) { // limit to internal users
2614 $langs->load("mails");
2615 $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"'));
2616 }
2617
2618 if (isModEnabled('mailing')) {
2619 $titleindex = $langs->trans("EMailings");
2620 $titlenew = $langs->trans("NewMailing");
2621 $titlelist = $langs->trans("List");
2622 if (getDolGlobalInt('EMAILINGS_SUPPORT_ALSO_SMS')) {
2623 $titleindex .= ' | '.$langs->trans("SMSings");
2624 $titlenew .= ' | '.$langs->trans("NewSMSing");
2625 }
2626 $newmenu->add(dolBuildUrl('/comm/mailing/index.php', ['leftmenu' => 'mailing']), $titleindex, 0, $user->hasRight('mailing', 'lire'), '', $mainmenu, 'mailing', 15, '', '', '', img_picto('', 'mail-bulk', 'class="paddingright pictofixedwidth"'));
2627 $newmenu->add(dolBuildUrl('/comm/mailing/card.php', ['leftmenu' => 'mailing', 'action' => 'create']), $titlenew, 1, $user->hasRight('mailing', 'creer'));
2628 $newmenu->add(dolBuildUrl('/comm/mailing/list.php', ['leftmenu' => 'mailing']), $titlelist, 1, $user->hasRight('mailing', 'lire'));
2629 }
2630
2631 $title = "ImportExportArea";
2632 if (isModEnabled('import') && !isModEnabled('export')) {
2633 $title = "FormatedImport";
2634 }
2635 if (!isModEnabled('import') && isModEnabled('export')) {
2636 $title = "FormatedExport";
2637 }
2638 if (isModEnabled('import') || isModEnabled('export')) {
2639 $langs->load("exports");
2640 $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"'));
2641 $newmenu->add(dolBuildUrl('/imports/import.php', ['leftmenu' => 'import']), $langs->trans("NewImport"), 1, $user->hasRight('import', 'run'));
2642 $newmenu->add(dolBuildUrl('/exports/export.php', ['leftmenu' => 'export']), $langs->trans("NewExport"), 1, $user->hasRight('export', 'lire'));
2643 }
2644 /*
2645 if (isModEnabled('export')) {
2646 $langs->load("exports");
2647 $newmenu->add("/exports/index.php?leftmenu=export", $langs->trans("FormatedExport"), 0, $user->hasRight('export', 'lire'), '', $mainmenu, 'export', 0, '', '', '', img_picto('', 'technic', 'class="paddingright pictofixedwidth"'));
2648 $newmenu->add("/exports/export.php?leftmenu=export", $langs->trans("NewExport"), 1, $user->hasRight('export', 'lire'));
2649 } */
2650
2651 $newmenu->add(dolBuildUrl('/core/customreports.php', ['leftmenu' => 'customreports']), $langs->trans("BICustomReports"), 0, $user->isExternalUser() ? 0 : 1, '', $mainmenu, 'customreports', 100, '', '', '', img_picto('', 'graph', 'class="paddingright pictofixedwidth"'));
2652 }
2653}
2654
2665function get_left_menu_members($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = 'none', $type_user = 0)
2666{
2667 global $user, $langs;
2668
2669 if ($mainmenu == 'members') {
2670 if (isModEnabled('member')) {
2671 // Load translation files required by the page
2672 $langs->loadLangs(array("members", "compta"));
2673
2674 $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"'));
2675 $newmenu->add(dolBuildUrl('/adherents/card.php', ['leftmenu' => 'members', 'action' => 'create']), $langs->trans("NewMember"), 1, $user->hasRight('adherent', 'write'));
2676 $newmenu->add(dolBuildUrl('/adherents/list.php', ['leftmenu' => 'members']), $langs->trans("List"), 1, $user->hasRight('adherent', 'read'));
2677 $newmenu->add(dolBuildUrl('/adherents/list.php', ['leftmenu' => 'members', 'statut' => -1]), $langs->trans("MenuMembersToValidate"), 2, $user->hasRight('adherent', 'read'));
2678 $newmenu->add(dolBuildUrl('/adherents/list.php', ['leftmenu' => 'members', 'statut' => 1]), $langs->trans("MenuMembersValidated"), 2, $user->hasRight('adherent', 'read'));
2679 $newmenu->add(dolBuildUrl('/adherents/list.php', ['leftmenu' => 'members', 'statut' => 1, 'filter' => 'waitingsubscription']), $langs->trans("WaitingSubscription"), 3, $user->hasRight('adherent', 'read'));
2680 $newmenu->add(dolBuildUrl('/adherents/list.php', ['leftmenu' => 'members', 'statut' => 1, 'filter' => 'uptodate']), $langs->trans("UpToDate"), 3, $user->hasRight('adherent', 'read'));
2681 $newmenu->add(dolBuildUrl('/adherents/list.php', ['leftmenu' => 'members', 'statut' => 1, 'filter' => 'outofdate']), $langs->trans("OutOfDate"), 3, $user->hasRight('adherent', 'read'));
2682 $newmenu->add(dolBuildUrl('/adherents/list.php', ['leftmenu' => 'members', 'statut' => 0]), $langs->trans("MenuMembersResiliated"), 2, $user->hasRight('adherent', 'read'));
2683 $newmenu->add(dolBuildUrl('/adherents/list.php', ['leftmenu' => 'members', 'statut' => -2]), $langs->trans("MenuMembersExcluded"), 2, $user->hasRight('adherent', 'read'));
2684 $newmenu->add(dolBuildUrl('/adherents/stats/geo.php', ['leftmenu' => 'members']), $langs->trans("MenuMembersStats"), 1, $user->hasRight('adherent', 'read'));
2685
2686 $newmenu->add(dolBuildUrl('/adherents/cartes/carte.php', ['leftmenu' => 'export']), $langs->trans("MembersCards"), 1, $user->hasRight('adherent', 'export'));
2687
2688 if (isModEnabled('category') && getDolGlobalString('CATEGORY_EDIT_IN_MENU_NOT_IN_POPUP')) {
2689 $langs->load("categories");
2690 $newmenu->add(dolBuildUrl('/categories/categorie_list.php', ['leftmenu'=> 'cat', 'type' => 3]), $langs->trans("Categories"), 1, $user->hasRight('categorie', 'read'), '', $mainmenu, 'cat');
2691 }
2692
2693 $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"'));
2694 $newmenu->add(dolBuildUrl('/adherents/list.php', ['leftmenu' => 'members', 'statut' => '-1,1', 'mainmenu' => 'members']), $langs->trans("NewMembership"), 1, $user->hasRight('adherent', 'cotisation', 'write'));
2695 $newmenu->add(dolBuildUrl('/adherents/subscription/list.php', ['leftmenu' => 'members']), $langs->trans("List"), 1, $user->hasRight('adherent', 'cotisation', 'read'));
2696 $newmenu->add(dolBuildUrl('/adherents/stats/index.php', ['leftmenu' => 'members']), $langs->trans("MenuMembersStats"), 1, $user->hasRight('adherent', 'read'));
2697
2698 // $newmenu->add(dolBuildUrl('/adherents/index.php', ['leftmenu' => 'export', 'mainmenu'=>'members']),$langs->trans("Tools"),0,$user->hasRight('adherent', 'export'), '', $mainmenu, 'export');
2699 // if (isModEnabled('export') && ($usemenuhider || empty($leftmenu) || $leftmenu=="export")) $newmenu->add(dolBuildUrl('/exports/index.php', ['leftmenu' => 'export']),$langs->trans("Datas"),1,$user->hasRight('adherent', 'export'));
2700
2701 // Type
2702 $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"'));
2703 $newmenu->add(dolBuildUrl('/adherents/type.php', ['leftmenu' => 'setup', 'mainmenu' => 'members', 'action' => 'create']), $langs->trans("New"), 1, $user->hasRight('adherent', 'configurer'));
2704 $newmenu->add(dolBuildUrl('/adherents/type.php', ['leftmenu' => 'setup', 'mainmenu' => 'members']), $langs->trans("List"), 1, $user->hasRight('adherent', 'configurer'));
2705 }
2706 }
2707}
$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:646
print_end_menu_entry($showmode)
Output end menu entry.
Definition eldy.lib.php:722
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:668
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:735
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:632
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.
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $db
API class for accounts.
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.
dol_string_nohtmltag($stringtoclean, $removelinefeed=1, $pagecodeto='UTF-8', $strip_tags=0, $removedoublespaces=1)
Clean a string from all HTML tags and entities.
dolBuildUrl($url, $params=[], $addtoken=false, $anchor='')
Return path of url.
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...
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...
print $langs trans("Show") . '< td style="' . $timeColor . '" align="center"> s</td > badge status0 badge status4 badge status3 Error badge status8< td align="center">< span class="badge ' . $badge . '"></span ></td >< td align="center">< a href="#" class="button button-small" onclick="openLogModal(this)" data-req="' . dol_escape_htmltag($reqSafe) . '" data-res="' . dol_escape_htmltag($resSafe) . '" data-err="' . dol_escape_htmltag($errSafe) . '">< span class="fa fa-search-plus"></span ></a ></td ></tr >< tr >< td colspan="' . $colspan . '" class="opacitymedium"></td ></tr ></table ></div ></form > logModal none logModal none s a JSON string
buildzip.php