diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 625e1ef00b3..b103a309f59 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -54,13 +54,14 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = $substitarray = getCommonSubstitutionArray($langs, 0, null, null); - if (empty($noout)) print_start_menu_array(); + if (empty($noout)) { + print_start_menu_array(); + } $usemenuhider = 1; // Show/Hide vertical menu. The hamburger icon for .menuhider action. - if ($mode != 'jmobile' && $mode != 'topnb' && $usemenuhider && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) - { + if ($mode != 'jmobile' && $mode != 'topnb' && $usemenuhider && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { $showmode = 1; $classname = 'class="tmenu menuhider"'; $idsel = 'menu'; @@ -412,29 +413,23 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = ); // Add menus - foreach ($menu_arr as $key => $smenu) - { + foreach ($menu_arr as $key => $smenu) { $smenu = (object) $smenu; - if ($smenu->enabled) - { - if ($smenu->session) - { + if ($smenu->enabled) { + if ($smenu->session) { $_SESSION['idmenu'] = ''; } // Load Langue - if (!empty($smenu->loadLangs)) - { + if (!empty($smenu->loadLangs)) { $langs->loadLangs($smenu->loadLangs); } // Trans title $mtitle = ''; - if (is_array($smenu->title)) - { - foreach ($smenu->title as $item) - { + if (is_array($smenu->title)) { + foreach ($smenu->title as $item) { $mtitle .= $langs->trans($item); } } else { @@ -451,8 +446,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = $newTabMenu = $menuArbo->menuTopCharger('', '', $type_user, 'eldy', $tabMenu); // Return tabMenu with only top entries $num = count($newTabMenu); - for ($i = 0; $i < $num; $i++) - { + for ($i = 0; $i < $num; $i++) { //var_dump($type_user.' '.$newTabMenu[$i]['url'].' '.$showmode.' '.$newTabMenu[$i]['perms']); $idsel = (empty($newTabMenu[$i]['mainmenu']) ? 'none' : $newTabMenu[$i]['mainmenu']); @@ -460,35 +454,50 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = // url = url from host, shorturl = relative path into dolibarr sources $url = $shorturl = $newTabMenu[$i]['url']; - if (!preg_match("/^(http:\/\/|https:\/\/)/i", $newTabMenu[$i]['url'])) // Do not change url content for external links - { + if (!preg_match("/^(http:\/\/|https:\/\/)/i", $newTabMenu[$i]['url'])) { // Do not change url content for external links $tmp = explode('?', $newTabMenu[$i]['url'], 2); $url = $shorturl = $tmp[0]; $param = (isset($tmp[1]) ? $tmp[1] : ''); - if (!preg_match('/mainmenu/i', $param) || !preg_match('/leftmenu/i', $param)) $param .= ($param ? '&' : '').'mainmenu='.$newTabMenu[$i]['mainmenu'].'&leftmenu='; + if (!preg_match('/mainmenu/i', $param) || !preg_match('/leftmenu/i', $param)) { + $param .= ($param ? '&' : '').'mainmenu='.$newTabMenu[$i]['mainmenu'].'&leftmenu='; + } //$url.="idmenu=".$newTabMenu[$i]['rowid']; // Already done by menuLoad $url = dol_buildpath($url, 1).($param ? '?'.$param : ''); //$shorturl = $shorturl.($param?'?'.$param:''); $shorturl = $url; - if (DOL_URL_ROOT) $shorturl = preg_replace('/^'.preg_quote(DOL_URL_ROOT, '/').'/', '', $shorturl); + if (DOL_URL_ROOT) { + $shorturl = preg_replace('/^'.preg_quote(DOL_URL_ROOT, '/').'/', '', $shorturl); + } } $showmode = isVisibleToUserType($type_user, $newTabMenu[$i], $listofmodulesforexternal); - if ($showmode == 1) - { + if ($showmode == 1) { // Define the class (top menu selected or not) - if (!empty($_SESSION['idmenu']) && $newTabMenu[$i]['rowid'] == $_SESSION['idmenu']) $classname = 'class="tmenusel"'; - elseif (!empty($_SESSION["mainmenu"]) && $newTabMenu[$i]['mainmenu'] == $_SESSION["mainmenu"]) $classname = 'class="tmenusel"'; - else $classname = 'class="tmenu"'; + if (!empty($_SESSION['idmenu']) && $newTabMenu[$i]['rowid'] == $_SESSION['idmenu']) { + $classname = 'class="tmenusel"'; + } elseif (!empty($_SESSION["mainmenu"]) && $newTabMenu[$i]['mainmenu'] == $_SESSION["mainmenu"]) { + $classname = 'class="tmenusel"'; + } else { + $classname = 'class="tmenu"'; + } } elseif ($showmode == 2) { $classname = 'class="tmenu"'; } - $menu->add($shorturl, $newTabMenu[$i]['titre'], 0, $showmode, ($newTabMenu[$i]['target'] ? $newTabMenu[$i]['target'] : $atarget), + $menu->add( + $shorturl, + $newTabMenu[$i]['titre'], + 0, + $showmode, + ($newTabMenu[$i]['target'] ? $newTabMenu[$i]['target'] : $atarget), ($newTabMenu[$i]['mainmenu'] ? $newTabMenu[$i]['mainmenu'] : $newTabMenu[$i]['rowid']), ($newTabMenu[$i]['leftmenu'] ? $newTabMenu[$i]['leftmenu'] : ''), - $newTabMenu[$i]['position'], $id, $idsel, $classname); + $newTabMenu[$i]['position'], + $id, + $idsel, + $classname + ); } // Sort on position @@ -496,8 +505,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = // Output menu entries // Show logo company - if (empty($conf->global->MAIN_MENU_INVERT) && empty($noout) && !empty($conf->global->MAIN_SHOW_LOGO) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) - { + if (empty($conf->global->MAIN_MENU_INVERT) && empty($noout) && !empty($conf->global->MAIN_SHOW_LOGO) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { //$mysoc->logo_mini=(empty($conf->global->MAIN_INFO_SOCIETE_LOGO_MINI)?'':$conf->global->MAIN_INFO_SOCIETE_LOGO_MINI); $mysoc->logo_squarred_mini = (empty($conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED_MINI) ? '' : $conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED_MINI); @@ -506,8 +514,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = $logoContainerAdditionalClass = ''; } - if (!empty($mysoc->logo_squarred_mini) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_squarred_mini)) - { + if (!empty($mysoc->logo_squarred_mini) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_squarred_mini)) { $urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_squarred_mini); } /*elseif (! empty($mysoc->logo_mini) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini)) @@ -570,8 +577,7 @@ function print_start_menu_array() */ function print_start_menu_entry($idsel, $classname, $showmode) { - if ($showmode) - { + if ($showmode) { print ''; } print "\n"; @@ -655,9 +660,10 @@ function print_end_menu_array() * @param string $forcemainmenu 'x'=Force mainmenu to mainmenu='x' * @param string $forceleftmenu 'all'=Force leftmenu to '' (= all). If value come being '', we change it to value in session and 'none' if not defined in session. * @param array $moredata An array with more data to output + * @param int $type_user 0=Menu for backoffice, 1=Menu for front office * @return int Nb of menu entries */ -function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabMenu, &$menu, $noout = 0, $forcemainmenu = '', $forceleftmenu = '', $moredata = null) +function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabMenu, &$menu, $noout = 0, $forcemainmenu = '', $forceleftmenu = '', $moredata = null, $type_user = 0) { global $user, $conf, $langs, $dolibarr_main_db_name, $mysoc; @@ -670,8 +676,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM $usemenuhider = 0; - 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 - { + 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 print "\n"; print "\n"; print '
'."\n"; @@ -680,8 +685,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM print "\n"; } - if (is_array($moredata) && !empty($moredata['bookmarks'])) - { + if (is_array($moredata) && !empty($moredata['bookmarks'])) { print "\n"; print "\n"; print '
'."\n"; @@ -696,13 +700,11 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM * We update newmenu with entries found into database * -------------------------------------------------- */ - if ($mainmenu) // If this is empty, loading hard coded menu and loading personalised menu will fail - { + if ($mainmenu) { // If this is empty, loading hard coded menu and loading personalised menu will fail /* * Menu HOME */ - if ($mainmenu == 'home') - { + if ($mainmenu == 'home') { $langs->load("users"); // Home - dashboard @@ -711,22 +713,19 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM // Setup $newmenu->add("/admin/index.php?mainmenu=home&leftmenu=setup", $langs->trans("Setup"), 0, $user->admin, '', $mainmenu, 'setup', 0, '', '', '', ''); - if ($usemenuhider || empty($leftmenu) || $leftmenu == "setup") - { + if ($usemenuhider || empty($leftmenu) || $leftmenu == "setup") { // Load translation files required by the page $langs->loadLangs(array("admin", "help")); $warnpicto = ''; - if (empty($conf->global->MAIN_INFO_SOCIETE_NOM) || empty($conf->global->MAIN_INFO_SOCIETE_COUNTRY)) - { + if (empty($conf->global->MAIN_INFO_SOCIETE_NOM) || empty($conf->global->MAIN_INFO_SOCIETE_COUNTRY)) { $langs->load("errors"); $warnpicto = img_warning($langs->trans("WarningMandatorySetupNotComplete")); } $newmenu->add("/admin/company.php?mainmenu=home", $langs->trans("MenuCompanySetup").$warnpicto, 1); $warnpicto = ''; - if (count($conf->modules) <= (empty($conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING) ? 1 : $conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING)) // If only user module enabled - { + if (count($conf->modules) <= (empty($conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING) ? 1 : $conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING)) { // If only user module enabled $langs->load("errors"); $warnpicto = img_warning($langs->trans("WarningMandatorySetupNotComplete")); } @@ -760,8 +759,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM // System tools $newmenu->add("/admin/tools/index.php?mainmenu=home&leftmenu=admintools", $langs->trans("AdminTools"), 0, $user->admin, '', $mainmenu, 'admintools', 0, '', '', '', ''); - if ($usemenuhider || empty($leftmenu) || preg_match('/^admintools/', $leftmenu)) - { + if ($usemenuhider || empty($leftmenu) || preg_match('/^admintools/', $leftmenu)) { // Load translation files required by the page $langs->loadLangs(array('admin', 'help')); @@ -788,24 +786,20 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM $newmenu->add("/admin/tools/listsessions.php?mainmenu=home&leftmenu=admintools", $langs->trans("Sessions"), 1); $newmenu->add('/admin/system/about.php?mainmenu=home&leftmenu=admintools', $langs->trans('ExternalResources'), 1); - if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) - { + if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) { $langs->load("products"); $newmenu->add("/product/admin/product_tools.php?mainmenu=home&leftmenu=admintools", $langs->trans("ProductVatMassChange"), 1, $user->admin); } } $newmenu->add("/user/home.php?leftmenu=users", $langs->trans("MenuUsersAndGroups"), 0, $user->rights->user->user->lire, '', $mainmenu, 'users', 0, '', '', '', ''); - if ($user->rights->user->user->lire) - { - if ($usemenuhider || empty($leftmenu) || $leftmenu == "users") - { + if ($user->rights->user->user->lire) { + if ($usemenuhider || empty($leftmenu) || $leftmenu == "users") { $newmenu->add("", $langs->trans("Users"), 1, $user->rights->user->user->lire || $user->admin); $newmenu->add("/user/card.php?leftmenu=users&action=create", $langs->trans("NewUser"), 2, ($user->rights->user->user->creer || $user->admin) && !(!empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE), '', 'home'); $newmenu->add("/user/list.php?leftmenu=users", $langs->trans("ListOfUsers"), 2, $user->rights->user->user->lire || $user->admin); $newmenu->add("/user/hierarchy.php?leftmenu=users", $langs->trans("HierarchicView"), 2, $user->rights->user->user->lire || $user->admin); - if (!empty($conf->categorie->enabled)) - { + if (!empty($conf->categorie->enabled)) { $langs->load("categories"); $newmenu->add("/categories/index.php?leftmenu=users&type=7", $langs->trans("UsersCategoriesShort"), 2, $user->rights->categorie->lire, '', $mainmenu, 'cat'); } @@ -820,26 +814,24 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM /* * Menu THIRDPARTIES */ - if ($mainmenu == 'companies') - { + if ($mainmenu == 'companies') { // Societes - if (!empty($conf->societe->enabled)) - { + if (!empty($conf->societe->enabled)) { $langs->load("companies"); $newmenu->add("/societe/index.php?leftmenu=thirdparties", $langs->trans("ThirdParty"), 0, $user->rights->societe->lire, '', $mainmenu, 'thirdparties'); - if ($user->rights->societe->creer) - { + if ($user->rights->societe->creer) { $newmenu->add("/societe/card.php?action=create", $langs->trans("MenuNewThirdParty"), 1); - if (!$conf->use_javascript_ajax) $newmenu->add("/societe/card.php?action=create&private=1", $langs->trans("MenuNewPrivateIndividual"), 1); + if (!$conf->use_javascript_ajax) { + $newmenu->add("/societe/card.php?action=create&private=1", $langs->trans("MenuNewPrivateIndividual"), 1); + } } } $newmenu->add("/societe/list.php?leftmenu=thirdparties", $langs->trans("List"), 1); // Prospects - if (!empty($conf->societe->enabled) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) - { + if (!empty($conf->societe->enabled) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) { $langs->load("commercial"); $newmenu->add("/societe/list.php?type=p&leftmenu=prospects", $langs->trans("ListProspectsShort"), 2, $user->rights->societe->lire, '', $mainmenu, 'prospects'); /* no more required, there is a filter that can do more @@ -853,8 +845,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM } // Customers/Prospects - if (!empty($conf->societe->enabled) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) - { + if (!empty($conf->societe->enabled) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) { $langs->load("commercial"); $newmenu->add("/societe/list.php?type=c&leftmenu=customers", $langs->trans("ListCustomersShort"), 2, $user->rights->societe->lire, '', $mainmenu, 'customers'); @@ -862,28 +853,28 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM } // Suppliers - if (!empty($conf->societe->enabled) && ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) || !empty($conf->supplier_proposal->enabled))) - { + if (!empty($conf->societe->enabled) && ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) || !empty($conf->supplier_proposal->enabled))) { $langs->load("suppliers"); $newmenu->add("/societe/list.php?type=f&leftmenu=suppliers", $langs->trans("ListSuppliersShort"), 2, ($user->rights->fournisseur->lire), '', $mainmenu, 'suppliers'); $newmenu->add("/societe/card.php?leftmenu=suppliers&action=create&type=f", $langs->trans("MenuNewSupplier"), 3, $user->rights->societe->creer && ($user->rights->fournisseur->lire)); } // Categories - if (!empty($conf->categorie->enabled)) - { + if (!empty($conf->categorie->enabled)) { $langs->load("categories"); - if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) - { + if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) { // Categories prospects/customers $menutoshow = $langs->trans("CustomersProspectsCategoriesShort"); - if (!empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) $menutoshow = $langs->trans("CustomersCategoriesShort"); - if (!empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) $menutoshow = $langs->trans("ProspectsCategoriesShort"); + if (!empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) { + $menutoshow = $langs->trans("CustomersCategoriesShort"); + } + if (!empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) { + $menutoshow = $langs->trans("ProspectsCategoriesShort"); + } $newmenu->add("/categories/index.php?leftmenu=cat&type=2", $menutoshow, 1, $user->rights->categorie->lire, '', $mainmenu, 'cat'); } // Categories suppliers - if (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) - { + if (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) { $newmenu->add("/categories/index.php?leftmenu=catfournish&type=1", $langs->trans("SuppliersCategoriesShort"), 1, $user->rights->categorie->lire); } } @@ -892,15 +883,20 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM $newmenu->add("/societe/index.php?leftmenu=thirdparties", (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses")), 0, $user->rights->societe->contact->lire, '', $mainmenu, 'contacts'); $newmenu->add("/contact/card.php?leftmenu=contacts&action=create", (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("NewContact") : $langs->trans("NewContactAddress")), 1, $user->rights->societe->contact->creer); $newmenu->add("/contact/list.php?leftmenu=contacts", $langs->trans("List"), 1, $user->rights->societe->contact->lire); - if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) $newmenu->add("/contact/list.php?leftmenu=contacts&type=p", $langs->trans("Prospects"), 2, $user->rights->societe->contact->lire); - if (empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) $newmenu->add("/contact/list.php?leftmenu=contacts&type=c", $langs->trans("Customers"), 2, $user->rights->societe->contact->lire); - if (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) $newmenu->add("/contact/list.php?leftmenu=contacts&type=f", $langs->trans("Suppliers"), 2, $user->rights->societe->contact->lire); + if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) { + $newmenu->add("/contact/list.php?leftmenu=contacts&type=p", $langs->trans("Prospects"), 2, $user->rights->societe->contact->lire); + } + if (empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) { + $newmenu->add("/contact/list.php?leftmenu=contacts&type=c", $langs->trans("Customers"), 2, $user->rights->societe->contact->lire); + } + if (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) { + $newmenu->add("/contact/list.php?leftmenu=contacts&type=f", $langs->trans("Suppliers"), 2, $user->rights->societe->contact->lire); + } $newmenu->add("/contact/list.php?leftmenu=contacts&type=o", $langs->trans("ContactOthers"), 2, $user->rights->societe->contact->lire); //$newmenu->add("/contact/list.php?userid=$user->id", $langs->trans("MyContacts"), 1, $user->rights->societe->contact->lire); // Categories - if (!empty($conf->categorie->enabled)) - { + if (!empty($conf->categorie->enabled)) { $langs->load("categories"); // Categories Contact $newmenu->add("/categories/index.php?leftmenu=catcontact&type=4", $langs->trans("ContactCategoriesShort"), 1, $user->rights->categorie->lire, '', $mainmenu, 'cat'); @@ -910,13 +906,11 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM /* * Menu COMMERCIAL (propal, commande, supplier_proposal, supplier_order, contrat, ficheinter) */ - if ($mainmenu == 'commercial') - { + if ($mainmenu == 'commercial') { $langs->load("companies"); // Customer proposal - if (!empty($conf->propal->enabled)) - { + if (!empty($conf->propal->enabled)) { $langs->load("propal"); $newmenu->add("/comm/propal/index.php?leftmenu=propals", $langs->trans("Proposals"), 0, $user->rights->propale->lire, '', $mainmenu, 'propals', 100); $newmenu->add("/comm/propal/card.php?action=create&leftmenu=propals", $langs->trans("NewPropal"), 1, $user->rights->propale->creer); @@ -933,8 +927,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM } // Customers orders - if (!empty($conf->commande->enabled)) - { + if (!empty($conf->commande->enabled)) { $langs->load("orders"); $newmenu->add("/commande/index.php?leftmenu=orders", $langs->trans("CustomersOrders"), 0, $user->rights->commande->lire, '', $mainmenu, 'orders', 200); $newmenu->add("/commande/card.php?action=create&leftmenu=orders", $langs->trans("NewOrder"), 1, $user->rights->commande->creer); @@ -942,7 +935,9 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM if ($usemenuhider || empty($leftmenu) || $leftmenu == "orders") { $newmenu->add("/commande/list.php?leftmenu=orders&search_status=0", $langs->trans("StatusOrderDraftShort"), 2, $user->rights->commande->lire); $newmenu->add("/commande/list.php?leftmenu=orders&search_status=1", $langs->trans("StatusOrderValidated"), 2, $user->rights->commande->lire); - if (!empty($conf->expedition->enabled)) $newmenu->add("/commande/list.php?leftmenu=orders&search_status=2", $langs->trans("StatusOrderSentShort"), 2, $user->rights->commande->lire); + if (!empty($conf->expedition->enabled)) { + $newmenu->add("/commande/list.php?leftmenu=orders&search_status=2", $langs->trans("StatusOrderSentShort"), 2, $user->rights->commande->lire); + } $newmenu->add("/commande/list.php?leftmenu=orders&search_status=3", $langs->trans("StatusOrderDelivered"), 2, $user->rights->commande->lire); //$newmenu->add("/commande/list.php?leftmenu=orders&search_status=4", $langs->trans("StatusOrderProcessed"), 2, $user->rights->commande->lire); $newmenu->add("/commande/list.php?leftmenu=orders&search_status=-1", $langs->trans("StatusOrderCanceledShort"), 2, $user->rights->commande->lire); @@ -951,8 +946,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM } // Supplier proposal - if (!empty($conf->supplier_proposal->enabled)) - { + if (!empty($conf->supplier_proposal->enabled)) { $langs->load("supplier_proposal"); $newmenu->add("/supplier_proposal/index.php?leftmenu=propals_supplier", $langs->trans("SupplierProposalsShort"), 0, $user->rights->supplier_proposal->lire, '', $mainmenu, 'propals_supplier', 300); $newmenu->add("/supplier_proposal/card.php?action=create&leftmenu=supplier_proposals", $langs->trans("SupplierProposalNew"), 1, $user->rights->supplier_proposal->creer); @@ -961,8 +955,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM } // Suppliers orders - if (!empty($conf->supplier_order->enabled)) - { + if (!empty($conf->supplier_order->enabled)) { $langs->load("orders"); $newmenu->add("/fourn/commande/index.php?leftmenu=orders_suppliers", $langs->trans("SuppliersOrders"), 0, $user->rights->fournisseur->commande->lire, '', $mainmenu, 'orders_suppliers', 400); $newmenu->add("/fourn/commande/card.php?action=create&leftmenu=orders_suppliers", $langs->trans("NewOrder"), 1, $user->rights->fournisseur->commande->creer); @@ -970,7 +963,9 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM if ($usemenuhider || empty($leftmenu) || $leftmenu == "orders_suppliers") { $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=0", $langs->trans("StatusSupplierOrderDraftShort"), 2, $user->rights->fournisseur->commande->lire); - if (empty($conf->global->SUPPLIER_ORDER_HIDE_VALIDATED)) $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=1", $langs->trans("StatusSupplierOrderValidated"), 2, $user->rights->fournisseur->commande->lire); + if (empty($conf->global->SUPPLIER_ORDER_HIDE_VALIDATED)) { + $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=1", $langs->trans("StatusSupplierOrderValidated"), 2, $user->rights->fournisseur->commande->lire); + } $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=2", $langs->trans("StatusSupplierOrderApprovedShort"), 2, $user->rights->fournisseur->commande->lire); $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=3", $langs->trans("StatusSupplierOrderOnProcessShort"), 2, $user->rights->fournisseur->commande->lire); $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=4", $langs->trans("StatusSupplierOrderReceivedPartiallyShort"), 2, $user->rights->fournisseur->commande->lire); @@ -985,8 +980,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM } // Contrat - if (!empty($conf->contrat->enabled)) - { + if (!empty($conf->contrat->enabled)) { $langs->load("contracts"); $newmenu->add("/contrat/index.php?leftmenu=contracts", $langs->trans("ContractsSubscriptions"), 0, $user->rights->contrat->lire, '', $mainmenu, 'contracts', 2000); $newmenu->add("/contrat/card.php?action=create&leftmenu=contracts", $langs->trans("NewContractSubscription"), 1, $user->rights->contrat->creer); @@ -1001,13 +995,14 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM } // Interventions - if (!empty($conf->ficheinter->enabled)) - { + if (!empty($conf->ficheinter->enabled)) { $langs->load("interventions"); $newmenu->add("/fichinter/index.php?leftmenu=ficheinter", $langs->trans("Interventions"), 0, $user->rights->ficheinter->lire, '', $mainmenu, 'ficheinter', 2200); $newmenu->add("/fichinter/card.php?action=create&leftmenu=ficheinter", $langs->trans("NewIntervention"), 1, $user->rights->ficheinter->creer, '', '', '', 201); $newmenu->add("/fichinter/list.php?leftmenu=ficheinter", $langs->trans("List"), 1, $user->rights->ficheinter->lire, '', '', '', 202); - if ($conf->global->MAIN_FEATURES_LEVEL >= 2) $newmenu->add("/fichinter/card-rec.php?leftmenu=ficheinter", $langs->trans("ListOfTemplates"), 1, $user->rights->ficheinter->lire, '', '', '', 203); + if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { + $newmenu->add("/fichinter/card-rec.php?leftmenu=ficheinter", $langs->trans("ListOfTemplates"), 1, $user->rights->ficheinter->lire, '', '', '', 203); + } $newmenu->add("/fichinter/stats/index.php?leftmenu=ficheinter", $langs->trans("Statistics"), 1, $user->rights->ficheinter->lire); } } @@ -1016,20 +1011,17 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM /* * Menu COMPTA-FINANCIAL */ - if ($mainmenu == 'billing') - { + if ($mainmenu == 'billing') { $langs->load("companies"); // Customers invoices - if (!empty($conf->facture->enabled)) - { + if (!empty($conf->facture->enabled)) { $langs->load("bills"); $newmenu->add("/compta/facture/index.php?leftmenu=customers_bills", $langs->trans("BillsCustomers"), 0, $user->rights->facture->lire, '', $mainmenu, 'customers_bills'); $newmenu->add("/compta/facture/card.php?action=create", $langs->trans("NewBill"), 1, $user->rights->facture->creer); $newmenu->add("/compta/facture/list.php?leftmenu=customers_bills", $langs->trans("List"), 1, $user->rights->facture->lire, '', $mainmenu, 'customers_bills_list'); - if ($usemenuhider || empty($leftmenu) || preg_match('/customers_bills(|_draft|_notpaid|_paid|_canceled)$/', $leftmenu)) - { + if ($usemenuhider || empty($leftmenu) || preg_match('/customers_bills(|_draft|_notpaid|_paid|_canceled)$/', $leftmenu)) { $newmenu->add("/compta/facture/list.php?leftmenu=customers_bills_draft&search_status=0", $langs->trans("BillShortStatusDraft"), 2, $user->rights->facture->lire); $newmenu->add("/compta/facture/list.php?leftmenu=customers_bills_notpaid&search_status=1", $langs->trans("BillShortStatusNotPaid"), 2, $user->rights->facture->lire); $newmenu->add("/compta/facture/list.php?leftmenu=customers_bills_paid&search_status=2", $langs->trans("BillShortStatusPaid"), 2, $user->rights->facture->lire); @@ -1039,8 +1031,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM $newmenu->add("/compta/paiement/list.php?leftmenu=customers_bills_payment", $langs->trans("Payments"), 1, $user->rights->facture->lire, '', $mainmenu, 'customers_bills_payment'); - if (!empty($conf->global->BILL_ADD_PAYMENT_VALIDATION)) - { + if (!empty($conf->global->BILL_ADD_PAYMENT_VALIDATION)) { $newmenu->add("/compta/paiement/tovalidate.php?leftmenu=customers_bills_tovalid", $langs->trans("MenuToValid"), 2, $user->rights->facture->lire, '', $mainmenu, 'customer_bills_tovalid'); } $newmenu->add("/compta/paiement/rapport.php?leftmenu=customers_bills_reports", $langs->trans("Reportings"), 2, $user->rights->facture->lire, '', $mainmenu, 'customers_bills_reports'); @@ -1049,8 +1040,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM } // Suppliers invoices - if (!empty($conf->societe->enabled) && !empty($conf->supplier_invoice->enabled)) - { + if (!empty($conf->societe->enabled) && !empty($conf->supplier_invoice->enabled)) { $langs->load("bills"); $newmenu->add("/fourn/facture/index.php?leftmenu=suppliers_bills", $langs->trans("BillsSuppliers"), 0, $user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills'); $newmenu->add("/fourn/facture/card.php?leftmenu=suppliers_bills&action=create", $langs->trans("NewBill"), 1, $user->rights->fournisseur->facture->creer, '', $mainmenu, 'suppliers_bills_create'); @@ -1070,18 +1060,17 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM } // Orders - if (!empty($conf->commande->enabled)) - { + if (!empty($conf->commande->enabled)) { $langs->load("orders"); - if (!empty($conf->facture->enabled)) $newmenu->add("/commande/list.php?leftmenu=orders&search_status=-3&billed=0&contextpage=billableorders", $langs->trans("MenuOrdersToBill2"), 0, $user->rights->commande->lire, '', $mainmenu, 'orders'); + if (!empty($conf->facture->enabled)) { + $newmenu->add("/commande/list.php?leftmenu=orders&search_status=-3&billed=0&contextpage=billableorders", $langs->trans("MenuOrdersToBill2"), 0, $user->rights->commande->lire, '', $mainmenu, 'orders'); + } //if ($usemenuhider || empty($leftmenu) || $leftmenu=="orders") $newmenu->add("/commande/", $langs->trans("StatusOrderToBill"), 1, $user->rights->commande->lire); } // Supplier Orders to bill - if (!empty($conf->supplier_invoice->enabled)) - { - if (!empty($conf->global->SUPPLIER_MENU_ORDER_RECEIVED_INTO_INVOICE)) - { + if (!empty($conf->supplier_invoice->enabled)) { + if (!empty($conf->global->SUPPLIER_MENU_ORDER_RECEIVED_INTO_INVOICE)) { $langs->load("supplier"); $newmenu->add("/fourn/commande/list.php?leftmenu=orders&search_status=5&billed=0", $langs->trans("MenuOrdersSupplierToBill"), 0, $user->rights->commande->lire, '', $mainmenu, 'orders'); //if ($usemenuhider || empty($leftmenu) || $leftmenu=="orders") $newmenu->add("/commande/", $langs->trans("StatusOrderToBill"), 1, $user->rights->commande->lire); @@ -1090,8 +1079,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM // Donations - if (!empty($conf->don->enabled)) - { + if (!empty($conf->don->enabled)) { $langs->load("donations"); $newmenu->add("/don/index.php?leftmenu=donations&mainmenu=billing", $langs->trans("Donations"), 0, $user->rights->don->lire, '', $mainmenu, 'donations'); if ($usemenuhider || empty($leftmenu) || $leftmenu == "donations") { @@ -1102,8 +1090,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM } // Taxes and social contributions - if (!empty($conf->tax->enabled)) - { + if (!empty($conf->tax->enabled)) { $newmenu->add("/compta/charges/index.php?leftmenu=tax&mainmenu=billing", $langs->trans("MenuTaxesAndSpecialExpenses"), 0, $user->rights->tax->charges->lire, '', $mainmenu, 'tax'); $newmenu->add("/compta/sociales/list.php?leftmenu=tax_social", $langs->trans("MenuSocialContributions"), 1, $user->rights->tax->charges->lire); @@ -1113,8 +1100,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM $newmenu->add("/compta/sociales/payments.php?leftmenu=tax_social&mainmenu=billing", $langs->trans("Payments"), 2, $user->rights->tax->charges->lire); } // VAT - if (empty($conf->global->TAX_DISABLE_VAT_MENUS)) - { + if (empty($conf->global->TAX_DISABLE_VAT_MENUS)) { global $mysoc; $newmenu->add("/compta/tva/list.php?leftmenu=tax_vat&mainmenu=billing", $langs->transcountry("VAT", $mysoc->country_code), 1, $user->rights->tax->charges->lire, '', $mainmenu, 'tax_vat'); @@ -1127,8 +1113,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM } //Local Taxes 1 - if ($mysoc->useLocalTax(1) && (isset($mysoc->localtax1_assuj) && $mysoc->localtax1_assuj == "1")) - { + if ($mysoc->useLocalTax(1) && (isset($mysoc->localtax1_assuj) && $mysoc->localtax1_assuj == "1")) { $newmenu->add("/compta/localtax/list.php?leftmenu=tax_1_vat&mainmenu=billing&localTaxType=1", $langs->transcountry("LT1", $mysoc->country_code), 1, $user->rights->tax->charges->lire); if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_1_vat/i', $leftmenu)) { $newmenu->add("/compta/localtax/card.php?leftmenu=tax_1_vat&action=create&localTaxType=1", $langs->trans("New"), 2, $user->rights->tax->charges->creer); @@ -1139,8 +1124,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM } } //Local Taxes 2 - if ($mysoc->useLocalTax(2) && (isset($mysoc->localtax2_assuj) && $mysoc->localtax2_assuj == "1")) - { + if ($mysoc->useLocalTax(2) && (isset($mysoc->localtax2_assuj) && $mysoc->localtax2_assuj == "1")) { $newmenu->add("/compta/localtax/list.php?leftmenu=tax_2_vat&mainmenu=billing&localTaxType=2", $langs->transcountry("LT2", $mysoc->country_code), 1, $user->rights->tax->charges->lire); if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_2_vat/i', $leftmenu)) { $newmenu->add("/compta/localtax/card.php?leftmenu=tax_2_vat&action=create&localTaxType=2", $langs->trans("New"), 2, $user->rights->tax->charges->creer); @@ -1154,8 +1138,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM } // Salaries - if (!empty($conf->salaries->enabled)) - { + if (!empty($conf->salaries->enabled)) { $langs->load("salaries"); $newmenu->add("/salaries/list.php?leftmenu=tax_salary&mainmenu=billing", $langs->trans("Salaries"), 0, $user->rights->salaries->read, '', $mainmenu, 'tax_salary'); if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_salary/i', $leftmenu)) { @@ -1166,8 +1149,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM } // Loan - if (!empty($conf->loan->enabled)) - { + if (!empty($conf->loan->enabled)) { $langs->load("loan"); $newmenu->add("/loan/list.php?leftmenu=tax_loan&mainmenu=billing", $langs->trans("Loans"), 0, $user->rights->loan->read, '', $mainmenu, 'tax_loan'); if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_loan/i', $leftmenu)) { @@ -1177,8 +1159,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM } // Various payment - if (!empty($conf->banque->enabled) && empty($conf->global->BANK_USE_OLD_VARIOUS_PAYMENT)) - { + if (!empty($conf->banque->enabled) && empty($conf->global->BANK_USE_OLD_VARIOUS_PAYMENT)) { $langs->load("banks"); $newmenu->add("/compta/bank/various_payment/list.php?leftmenu=tax_various&mainmenu=billing", $langs->trans("MenuVariousPayment"), 0, $user->rights->banque->lire, '', $mainmenu, 'tax_various'); if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_various/i', $leftmenu)) { @@ -1191,13 +1172,11 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM /* * Menu COMPTA-FINANCIAL */ - if ($mainmenu == 'accountancy') - { + if ($mainmenu == 'accountancy') { $langs->load("companies"); // Accounting (Double entries) - if (!empty($conf->accounting->enabled)) - { + if (!empty($conf->accounting->enabled)) { $permtoshowmenu = (!empty($conf->accounting->enabled) || $user->rights->accounting->bind->write || $user->rights->compta->resultat->lire); //$newmenu->add("/accountancy/index.php?leftmenu=accountancy", $langs->trans("MenuAccountancy"), 0, $permtoshowmenu, '', $mainmenu, 'accountancy'); @@ -1241,24 +1220,21 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM // Binding // $newmenu->add("", $langs->trans("Binding"), 0, $user->rights->accounting->bind->write, '', $mainmenu, 'dispatch'); - if (!empty($conf->facture->enabled) && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_SALES)) - { + if (!empty($conf->facture->enabled) && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_SALES)) { $newmenu->add("/accountancy/customer/index.php?leftmenu=accountancy_dispatch_customer&mainmenu=accountancy", $langs->trans("CustomersVentilation"), 1, $user->rights->accounting->bind->write, '', $mainmenu, 'dispatch_customer'); if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_dispatch_customer/', $leftmenu)) { $newmenu->add("/accountancy/customer/list.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_customer", $langs->trans("ToBind"), 2, $user->rights->accounting->bind->write); $newmenu->add("/accountancy/customer/lines.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_customer", $langs->trans("Binded"), 2, $user->rights->accounting->bind->write); } } - if (!empty($conf->supplier_invoice->enabled) && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_PURCHASES)) - { + if (!empty($conf->supplier_invoice->enabled) && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_PURCHASES)) { $newmenu->add("/accountancy/supplier/index.php?leftmenu=accountancy_dispatch_supplier&mainmenu=accountancy", $langs->trans("SuppliersVentilation"), 1, $user->rights->accounting->bind->write, '', $mainmenu, 'dispatch_supplier'); if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_dispatch_supplier/', $leftmenu)) { $newmenu->add("/accountancy/supplier/list.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_supplier", $langs->trans("ToBind"), 2, $user->rights->accounting->bind->write); $newmenu->add("/accountancy/supplier/lines.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_supplier", $langs->trans("Binded"), 2, $user->rights->accounting->bind->write); } } - if (!empty($conf->expensereport->enabled) && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS)) - { + if (!empty($conf->expensereport->enabled) && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS)) { $newmenu->add("/accountancy/expensereport/index.php?leftmenu=accountancy_dispatch_expensereport&mainmenu=accountancy", $langs->trans("ExpenseReportsVentilation"), 1, $user->rights->accounting->bind->write, '', $mainmenu, 'dispatch_expensereport'); if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_dispatch_expensereport/', $leftmenu)) { $newmenu->add("/accountancy/expensereport/list.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_expensereport", $langs->trans("ToBind"), 2, $user->rights->accounting->bind->write); @@ -1267,8 +1243,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM } // Journals - if (!empty($conf->accounting->enabled) && !empty($user->rights->accounting->comptarapport->lire) && $mainmenu == 'accountancy') - { + if (!empty($conf->accounting->enabled) && !empty($user->rights->accounting->comptarapport->lire) && $mainmenu == 'accountancy') { $newmenu->add('', $langs->trans("RegistrationInAccounting"), 1, $user->rights->accounting->comptarapport->lire); // Multi journal @@ -1279,39 +1254,49 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM $sql .= " ORDER BY label DESC"; $resql = $db->query($sql); - if ($resql) - { + if ($resql) { $numr = $db->num_rows($resql); $i = 0; - if ($numr > 0) - { - while ($i < $numr) - { + if ($numr > 0) { + while ($i < $numr) { $objp = $db->fetch_object($resql); $nature = ''; // Must match array $sourceList defined into journals_list.php - if ($objp->nature == 2 && !empty($conf->facture->enabled) && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_SALES)) $nature = "sells"; + if ($objp->nature == 2 && !empty($conf->facture->enabled) && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_SALES)) { + $nature = "sells"; + } if ($objp->nature == 3 && (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_invoice->enabled)) - && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_PURCHASES)) + && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_PURCHASES)) { $nature = "purchases"; - if ($objp->nature == 4 && !empty($conf->banque->enabled)) $nature = "bank"; - if ($objp->nature == 5 && !empty($conf->expensereport->enabled) && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS)) $nature = "expensereports"; - if ($objp->nature == 1) $nature = "various"; - if ($objp->nature == 8) $nature = "inventory"; - if ($objp->nature == 9) $nature = "hasnew"; - - // To enable when page exists - if (empty($conf->global->ACCOUNTANCY_SHOW_DEVELOP_JOURNAL)) - { - if ($nature == 'various' || $nature == 'hasnew' || $nature == 'inventory') $nature = ''; + } + if ($objp->nature == 4 && !empty($conf->banque->enabled)) { + $nature = "bank"; + } + if ($objp->nature == 5 && !empty($conf->expensereport->enabled) && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS)) { + $nature = "expensereports"; + } + if ($objp->nature == 1) { + $nature = "various"; + } + if ($objp->nature == 8) { + $nature = "inventory"; + } + if ($objp->nature == 9) { + $nature = "hasnew"; } - if ($nature) - { + // To enable when page exists + if (empty($conf->global->ACCOUNTANCY_SHOW_DEVELOP_JOURNAL)) { + if ($nature == 'various' || $nature == 'hasnew' || $nature == 'inventory') { + $nature = ''; + } + } + + if ($nature) { $langs->load('accountancy'); $journallabel = $langs->transnoentities($objp->label); // Labels in this table are set by loading llx_accounting_abc.sql. Label can be 'ACCOUNTING_SELL_JOURNAL', 'InventoryJournal', ... $newmenu->add('/accountancy/journal/'.$nature.'journal.php?mainmenu=accountancy&leftmenu=accountancy_journal&id_journal='.$objp->rowid, $journallabel, 2, $user->rights->accounting->comptarapport->lire); @@ -1322,7 +1307,9 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM // Should not happend. Entries are added $newmenu->add('', $langs->trans("NoJournalDefined"), 2, $user->rights->accounting->comptarapport->lire); } - } else dol_print_error($db); + } else { + dol_print_error($db); + } $db->free($resql); } @@ -1339,8 +1326,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM $newmenu->add("/accountancy/bookkeeping/list.php?mainmenu=accountancy&leftmenu=accountancy_accountancy", $langs->trans("Journals"), 1, $user->rights->accounting->mouvements->lire); // Files - if (empty($conf->global->ACCOUNTANCY_HIDE_EXPORT_FILES_MENU)) - { + if (empty($conf->global->ACCOUNTANCY_HIDE_EXPORT_FILES_MENU)) { $newmenu->add("/compta/accounting-files.php?mainmenu=accountancy&leftmenu=accountancy_files", $langs->trans("AccountantFiles"), 1, $user->rights->accounting->mouvements->lire); } @@ -1363,9 +1349,10 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM } $modecompta = 'CREANCES-DETTES'; - if (!empty($conf->accounting->enabled) && !empty($user->rights->accounting->comptarapport->lire) && $mainmenu == 'accountancy') $modecompta = 'BOOKKEEPING'; // Not yet implemented. Should be BOOKKEEPINGCOLLECTED - if ($modecompta) - { + if (!empty($conf->accounting->enabled) && !empty($user->rights->accounting->comptarapport->lire) && $mainmenu == 'accountancy') { + $modecompta = 'BOOKKEEPING'; // Not yet implemented. Should be BOOKKEEPINGCOLLECTED + } + if ($modecompta) { if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/', $leftmenu)) { $newmenu->add("/compta/stats/index.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ReportTurnover"), 2, $user->rights->accounting->comptarapport->lire); $newmenu->add("/compta/stats/casoc.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 3, $user->rights->accounting->comptarapport->lire); @@ -1377,8 +1364,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM $modecompta = 'RECETTES-DEPENSES'; //if (! empty($conf->accounting->enabled) && ! empty($user->rights->accounting->comptarapport->lire) && $mainmenu == 'accountancy') $modecompta=''; // Not yet implemented. Should be BOOKKEEPINGCOLLECTED - if ($modecompta) - { + if ($modecompta) { if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/', $leftmenu)) { $newmenu->add("/compta/stats/index.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ReportTurnoverCollected"), 2, $user->rights->accounting->comptarapport->lire); $newmenu->add("/compta/stats/casoc.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 3, $user->rights->accounting->comptarapport->lire); @@ -1389,9 +1375,10 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM } $modecompta = 'CREANCES-DETTES'; - if (!empty($conf->accounting->enabled) && !empty($user->rights->accounting->comptarapport->lire) && $mainmenu == 'accountancy') $modecompta = 'BOOKKEEPING'; // Not yet implemented. Should be BOOKKEEPINGCOLLECTED - if ($modecompta && $conf->fournisseur->enabled) - { + if (!empty($conf->accounting->enabled) && !empty($user->rights->accounting->comptarapport->lire) && $mainmenu == 'accountancy') { + $modecompta = 'BOOKKEEPING'; // Not yet implemented. Should be BOOKKEEPINGCOLLECTED + } + if ($modecompta && $conf->fournisseur->enabled) { if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/', $leftmenu)) { $newmenu->add("/compta/stats/supplier_turnover.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ReportPurchaseTurnover"), 2, $user->rights->accounting->comptarapport->lire); $newmenu->add("/compta/stats/supplier_turnover_by_thirdparty.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 3, $user->rights->accounting->comptarapport->lire); @@ -1401,8 +1388,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM $modecompta = 'RECETTES-DEPENSES'; //if (! empty($conf->accounting->enabled) && ! empty($user->rights->accounting->comptarapport->lire) && $mainmenu == 'accountancy') $modecompta=''; // Not yet implemented. Should be BOOKKEEPINGCOLLECTED - if ($modecompta && $conf->fournisseur->enabled) - { + if ($modecompta && $conf->fournisseur->enabled) { if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/', $leftmenu)) { $newmenu->add("/compta/stats/supplier_turnover.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ReportPurchaseTurnoverCollected"), 2, $user->rights->accounting->comptarapport->lire); $newmenu->add("/compta/stats/supplier_turnover_by_thirdparty.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 3, $user->rights->accounting->comptarapport->lire); @@ -1411,11 +1397,9 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM } // Accountancy (simple) - if (!empty($conf->comptabilite->enabled)) - { + if (!empty($conf->comptabilite->enabled)) { // Files - if (empty($conf->global->ACCOUNTANCY_HIDE_EXPORT_FILES_MENU)) - { + if (empty($conf->global->ACCOUNTANCY_HIDE_EXPORT_FILES_MENU)) { $newmenu->add("/compta/accounting-files.php?mainmenu=accountancy&leftmenu=accountancy_files", $langs->trans("AccountantFiles"), 0, $user->rights->compta->resultat->lire, '', $mainmenu, 'files'); } @@ -1426,18 +1410,18 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM $newmenu->add("/compta/resultat/index.php?leftmenu=report", $langs->trans("MenuReportInOut"), 1, $user->rights->compta->resultat->lire); $newmenu->add("/compta/resultat/clientfourn.php?leftmenu=report", $langs->trans("ByCompanies"), 2, $user->rights->compta->resultat->lire); /* On verra ca avec module compabilite expert - $newmenu->add("/compta/resultat/compteres.php?leftmenu=report","Compte de resultat",2,$user->rights->compta->resultat->lire); - $newmenu->add("/compta/resultat/bilan.php?leftmenu=report","Bilan",2,$user->rights->compta->resultat->lire); - */ + $newmenu->add("/compta/resultat/compteres.php?leftmenu=report","Compte de resultat",2,$user->rights->compta->resultat->lire); + $newmenu->add("/compta/resultat/bilan.php?leftmenu=report","Bilan",2,$user->rights->compta->resultat->lire); + */ $newmenu->add("/compta/stats/index.php?leftmenu=report", $langs->trans("ReportTurnover"), 1, $user->rights->compta->resultat->lire); /* - $newmenu->add("/compta/stats/cumul.php?leftmenu=report","Cumule",2,$user->rights->compta->resultat->lire); - if (! empty($conf->propal->enabled)) { - $newmenu->add("/compta/stats/prev.php?leftmenu=report","Previsionnel",2,$user->rights->compta->resultat->lire); - $newmenu->add("/compta/stats/comp.php?leftmenu=report","Transforme",2,$user->rights->compta->resultat->lire); - } - */ + $newmenu->add("/compta/stats/cumul.php?leftmenu=report","Cumule",2,$user->rights->compta->resultat->lire); + if (! empty($conf->propal->enabled)) { + $newmenu->add("/compta/stats/prev.php?leftmenu=report","Previsionnel",2,$user->rights->compta->resultat->lire); + $newmenu->add("/compta/stats/comp.php?leftmenu=report","Transforme",2,$user->rights->compta->resultat->lire); + } + */ $newmenu->add("/compta/stats/casoc.php?leftmenu=report", $langs->trans("ByCompanies"), 2, $user->rights->compta->resultat->lire); $newmenu->add("/compta/stats/cabyuser.php?leftmenu=report", $langs->trans("ByUsers"), 2, $user->rights->compta->resultat->lire); $newmenu->add("/compta/stats/cabyprodserv.php?leftmenu=report", $langs->trans("ByProductsAndServices"), 2, $user->rights->compta->resultat->lire); @@ -1454,8 +1438,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM } // Intracomm report - if (!empty($conf->intracommreport->enabled)) - { + if (!empty($conf->intracommreport->enabled)) { $newmenu->add("/intracommreport/list.php?leftmenu=intracommreport", $langs->trans("MenuIntracommReport"), 0, $user->rights->intracommreport->read, '', $mainmenu, 'intracommreport', 1); if ($usemenuhider || empty($leftmenu) || preg_match('/intracommreport/', $leftmenu)) { // DEB / DES @@ -1465,8 +1448,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM } // Assets - if (!empty($conf->asset->enabled)) - { + if (!empty($conf->asset->enabled)) { $newmenu->add("/asset/list.php?leftmenu=asset&mainmenu=accountancy", $langs->trans("MenuAssets"), 0, $user->rights->asset->read, '', $mainmenu, 'asset'); $newmenu->add("/asset/card.php?leftmenu=asset&action=create", $langs->trans("MenuNewAsset"), 1, $user->rights->asset->write); $newmenu->add("/asset/list.php?leftmenu=asset&mainmenu=accountancy", $langs->trans("MenuListAssets"), 1, $user->rights->asset->read); @@ -1482,14 +1464,12 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM /* * Menu BANK */ - if ($mainmenu == 'bank') - { + if ($mainmenu == 'bank') { // Load translation files required by the page $langs->loadLangs(array("withdrawals", "banks", "bills", "categories")); // Bank-Cash account - if (!empty($conf->banque->enabled)) - { + if (!empty($conf->banque->enabled)) { $newmenu->add("/compta/bank/list.php?leftmenu=bank&mainmenu=bank", $langs->trans("MenuBankCash"), 0, $user->rights->banque->lire, '', $mainmenu, 'bank'); $newmenu->add("/compta/bank/card.php?action=create", $langs->trans("MenuNewFinancialAccount"), 1, $user->rights->banque->configurer); @@ -1500,16 +1480,14 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM $newmenu->add("/compta/bank/transfer.php", $langs->trans("MenuBankInternalTransfer"), 1, $user->rights->banque->transfer); } - if (!empty($conf->categorie->enabled)) - { + if (!empty($conf->categorie->enabled)) { $langs->load("categories"); $newmenu->add("/categories/index.php?type=5", $langs->trans("Rubriques"), 1, $user->rights->categorie->creer, '', $mainmenu, 'tags'); $newmenu->add("/compta/bank/categ.php", $langs->trans("RubriquesTransactions"), 1, $user->rights->banque->configurer, '', $mainmenu, 'tags'); } // Direct debit order - if (!empty($conf->prelevement->enabled)) - { + if (!empty($conf->prelevement->enabled)) { $newmenu->add("/compta/prelevement/index.php?leftmenu=withdraw&mainmenu=bank", $langs->trans("PaymentByDirectDebit"), 0, $user->rights->prelevement->bons->lire, '', $mainmenu, 'withdraw'); if ($usemenuhider || empty($leftmenu) || $leftmenu == "withdraw") { @@ -1523,8 +1501,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM } // Bank transfer order - if (!empty($conf->paymentbybanktransfer->enabled)) - { + if (!empty($conf->paymentbybanktransfer->enabled)) { $newmenu->add("/compta/paymentbybanktransfer/index.php?leftmenu=banktransfer&mainmenu=bank", $langs->trans("PaymentByBankTransfer"), 0, $user->rights->paymentbybanktransfer->read, '', $mainmenu, 'banktransfer'); if ($usemenuhider || empty($leftmenu) || $leftmenu == "banktransfer") { @@ -1538,8 +1515,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM } // Management of checks - if (empty($conf->global->BANK_DISABLE_CHECK_DEPOSIT) && !empty($conf->banque->enabled) && (!empty($conf->facture->enabled) || !empty($conf->global->MAIN_MENU_CHEQUE_DEPOSIT_ON))) - { + if (empty($conf->global->BANK_DISABLE_CHECK_DEPOSIT) && !empty($conf->banque->enabled) && (!empty($conf->facture->enabled) || !empty($conf->global->MAIN_MENU_CHEQUE_DEPOSIT_ON))) { $newmenu->add("/compta/paiement/cheque/index.php?leftmenu=checks&mainmenu=bank", $langs->trans("MenuChequeDeposits"), 0, $user->rights->banque->cheque, '', $mainmenu, 'checks'); if (preg_match('/checks/', $leftmenu)) { $newmenu->add("/compta/paiement/cheque/card.php?leftmenu=checks_bis&action=new&mainmenu=bank", $langs->trans("NewChequeDeposit"), 1, $user->rights->banque->cheque); @@ -1548,8 +1524,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM } // Cash Control - if (!empty($conf->takepos->enabled) || !empty($conf->cashdesk->enabled)) - { + if (!empty($conf->takepos->enabled) || !empty($conf->cashdesk->enabled)) { $permtomakecashfence = ($user->rights->cashdesk->run || $user->rights->takepos->run); $newmenu->add("/compta/cashcontrol/cashcontrol_list.php?action=list", $langs->trans("POS"), 0, $permtomakecashfence, '', $mainmenu, 'cashcontrol'); $newmenu->add("/compta/cashcontrol/cashcontrol_card.php?action=create", $langs->trans("NewCashFence"), 1, $permtomakecashfence); @@ -1560,36 +1535,29 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM /* * Menu PRODUCTS-SERVICES */ - if ($mainmenu == 'products') - { + if ($mainmenu == 'products') { // Products - if (!empty($conf->product->enabled)) - { + if (!empty($conf->product->enabled)) { $newmenu->add("/product/index.php?leftmenu=product&type=0", $langs->trans("Products"), 0, $user->rights->produit->lire, '', $mainmenu, 'product'); $newmenu->add("/product/card.php?leftmenu=product&action=create&type=0", $langs->trans("NewProduct"), 1, $user->rights->produit->creer); $newmenu->add("/product/list.php?leftmenu=product&type=0", $langs->trans("List"), 1, $user->rights->produit->lire); - if (!empty($conf->stock->enabled)) - { + if (!empty($conf->stock->enabled)) { $newmenu->add("/product/reassort.php?type=0", $langs->trans("MenuStocks"), 1, $user->rights->produit->lire && $user->rights->stock->lire); } - if (!empty($conf->productbatch->enabled)) - { + if (!empty($conf->productbatch->enabled)) { $langs->load("stocks"); $newmenu->add("/product/reassortlot.php?type=0", $langs->trans("StocksByLotSerial"), 1, $user->rights->produit->lire && $user->rights->stock->lire); $newmenu->add("/product/stock/productlot_list.php", $langs->trans("LotSerial"), 1, $user->rights->produit->lire && $user->rights->stock->lire); } - if (!empty($conf->variants->enabled)) - { + if (!empty($conf->variants->enabled)) { $newmenu->add("/variants/list.php", $langs->trans("VariantAttributes"), 1, $user->rights->produit->lire); } - if (!empty($conf->propal->enabled) || !empty($conf->commande->enabled) || !empty($conf->facture->enabled) || !empty($conf->fournisseur->enabled) || !empty($conf->supplier_proposal->enabled)) - { + if (!empty($conf->propal->enabled) || !empty($conf->commande->enabled) || !empty($conf->facture->enabled) || !empty($conf->fournisseur->enabled) || !empty($conf->supplier_proposal->enabled)) { $newmenu->add("/product/stats/card.php?id=all&leftmenu=stats&type=0", $langs->trans("Statistics"), 1, $user->rights->produit->lire && $user->rights->propale->lire); } // Categories - if (!empty($conf->categorie->enabled)) - { + if (!empty($conf->categorie->enabled)) { $langs->load("categories"); $newmenu->add("/categories/index.php?leftmenu=cat&type=0", $langs->trans("Categories"), 1, $user->rights->categorie->lire, '', $mainmenu, 'cat'); //if ($usemenuhider || empty($leftmenu) || $leftmenu=="cat") $newmenu->add("/categories/list.php", $langs->trans("List"), 1, $user->rights->categorie->lire); @@ -1597,18 +1565,15 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM } // Services - if (!empty($conf->service->enabled)) - { + if (!empty($conf->service->enabled)) { $newmenu->add("/product/index.php?leftmenu=service&type=1", $langs->trans("Services"), 0, $user->rights->service->lire, '', $mainmenu, 'service'); $newmenu->add("/product/card.php?leftmenu=service&action=create&type=1", $langs->trans("NewService"), 1, $user->rights->service->creer); $newmenu->add("/product/list.php?leftmenu=service&type=1", $langs->trans("List"), 1, $user->rights->service->lire); - if (!empty($conf->propal->enabled) || !empty($conf->commande->enabled) || !empty($conf->facture->enabled) || !empty($conf->fournisseur->enabled) || !empty($conf->supplier_proposal->enabled)) - { + if (!empty($conf->propal->enabled) || !empty($conf->commande->enabled) || !empty($conf->facture->enabled) || !empty($conf->fournisseur->enabled) || !empty($conf->supplier_proposal->enabled)) { $newmenu->add("/product/stats/card.php?id=all&leftmenu=stats&type=1", $langs->trans("Statistics"), 1, $user->rights->service->lire && $user->rights->propale->lire); } // Categories - if (!empty($conf->categorie->enabled)) - { + if (!empty($conf->categorie->enabled)) { $langs->load("categories"); $newmenu->add("/categories/index.php?leftmenu=cat&type=0", $langs->trans("Categories"), 1, $user->rights->categorie->lire, '', $mainmenu, 'cat'); //if ($usemenuhider || empty($leftmenu) || $leftmenu=="cat") $newmenu->add("/categories/list.php", $langs->trans("List"), 1, $user->rights->categorie->lire); @@ -1616,8 +1581,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM } // Warehouse - if (!empty($conf->stock->enabled)) - { + if (!empty($conf->stock->enabled)) { $langs->load("stocks"); $newmenu->add("/product/stock/index.php?leftmenu=stock", $langs->trans("Warehouses"), 0, $user->rights->stock->lire, '', $mainmenu, 'stock'); $newmenu->add("/product/stock/card.php?action=create", $langs->trans("MenuNewWarehouse"), 1, $user->rights->stock->creer); @@ -1625,24 +1589,22 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM $newmenu->add("/product/stock/movement_list.php", $langs->trans("Movements"), 1, $user->rights->stock->mouvement->lire); $newmenu->add("/product/stock/massstockmove.php", $langs->trans("MassStockTransferShort"), 1, $user->rights->stock->mouvement->creer); - if ($conf->supplier_order->enabled) $newmenu->add("/product/stock/replenish.php", $langs->trans("Replenishment"), 1, $user->rights->stock->mouvement->creer && $user->rights->fournisseur->lire); + if ($conf->supplier_order->enabled) { + $newmenu->add("/product/stock/replenish.php", $langs->trans("Replenishment"), 1, $user->rights->stock->mouvement->creer && $user->rights->fournisseur->lire); + } $newmenu->add("/product/stock/stockatdate.php", $langs->trans("StockAtDate"), 1, $user->rights->produit->lire && $user->rights->stock->lire && $conf->global->MAIN_FEATURES_LEVEL >= 2); // Categories for warehouses - if (!empty($conf->categorie->enabled)) - { + if (!empty($conf->categorie->enabled)) { $newmenu->add("/categories/index.php?leftmenu=stock&type=9", $langs->trans("Categories"), 1, $user->rights->categorie->lire, '', $mainmenu, 'cat'); } } // Inventory - if ($conf->global->MAIN_FEATURES_LEVEL >= 2) - { - if (!empty($conf->stock->enabled)) - { + if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { + if (!empty($conf->stock->enabled)) { $langs->load("stocks"); - if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) - { + if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) { $newmenu->add("/product/inventory/list.php?leftmenu=stock_inventories", $langs->trans("Inventories"), 0, $user->rights->stock->lire, '', $mainmenu, 'stock'); if ($usemenuhider || empty($leftmenu) || $leftmenu == "stock_inventories") { $newmenu->add("/product/inventory/card.php?action=create&leftmenu=stock_inventories", $langs->trans("NewInventory"), 1, $user->rights->stock->creer); @@ -1659,8 +1621,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM } // Shipments - if (!empty($conf->expedition->enabled)) - { + if (!empty($conf->expedition->enabled)) { $langs->load("sendings"); $newmenu->add("/expedition/index.php?leftmenu=sendings", $langs->trans("Shipments"), 0, $user->rights->expedition->lire, '', $mainmenu, 'sendings'); $newmenu->add("/expedition/card.php?action=create2&leftmenu=sendings", $langs->trans("NewSending"), 1, $user->rights->expedition->creer); @@ -1674,15 +1635,20 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM } // Receptions - if (!empty($conf->reception->enabled)) - { + if (!empty($conf->reception->enabled)) { $langs->load("receptions"); $newmenu->add("/reception/index.php?leftmenu=receptions", $langs->trans("Receptions"), 0, $user->rights->reception->lire, '', $mainmenu, 'receptions'); $newmenu->add("/reception/card.php?action=create2&leftmenu=receptions", $langs->trans("NewReception"), 1, $user->rights->reception->creer); $newmenu->add("/reception/list.php?leftmenu=receptions", $langs->trans("List"), 1, $user->rights->reception->lire); - if ($usemenuhider || empty($leftmenu) || $leftmenu == "receptions") $newmenu->add("/reception/list.php?leftmenu=receptions&search_status=0", $langs->trans("StatusReceptionDraftShort"), 2, $user->rights->reception->lire); - if ($usemenuhider || empty($leftmenu) || $leftmenu == "receptions") $newmenu->add("/reception/list.php?leftmenu=receptions&search_status=1", $langs->trans("StatusReceptionValidatedShort"), 2, $user->rights->reception->lire); - if ($usemenuhider || empty($leftmenu) || $leftmenu == "receptions") $newmenu->add("/reception/list.php?leftmenu=receptions&search_status=2", $langs->trans("StatusReceptionProcessedShort"), 2, $user->rights->reception->lire); + if ($usemenuhider || empty($leftmenu) || $leftmenu == "receptions") { + $newmenu->add("/reception/list.php?leftmenu=receptions&search_status=0", $langs->trans("StatusReceptionDraftShort"), 2, $user->rights->reception->lire); + } + if ($usemenuhider || empty($leftmenu) || $leftmenu == "receptions") { + $newmenu->add("/reception/list.php?leftmenu=receptions&search_status=1", $langs->trans("StatusReceptionValidatedShort"), 2, $user->rights->reception->lire); + } + if ($usemenuhider || empty($leftmenu) || $leftmenu == "receptions") { + $newmenu->add("/reception/list.php?leftmenu=receptions&search_status=2", $langs->trans("StatusReceptionProcessedShort"), 2, $user->rights->reception->lire); + } $newmenu->add("/reception/stats/index.php?leftmenu=receptions", $langs->trans("Statistics"), 1, $user->rights->reception->lire); } } @@ -1690,11 +1656,9 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM /* * Menu PRODUCTS-SERVICES MRP - GPAO */ - if ($mainmenu == 'mrp') - { + if ($mainmenu == 'mrp') { // BOM - if (!empty($conf->bom->enabled) || !empty($conf->mrp->enabled)) - { + if (!empty($conf->bom->enabled) || !empty($conf->mrp->enabled)) { $langs->load("mrp"); $newmenu->add("", $langs->trans("MenuBOM"), 0, $user->rights->bom->read, '', $mainmenu, 'bom'); @@ -1702,8 +1666,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM $newmenu->add("/bom/bom_list.php?leftmenu=bom", $langs->trans("List"), 1, $user->rights->bom->read, '', $mainmenu, 'bom'); } - if (!empty($conf->mrp->enabled)) - { + if (!empty($conf->mrp->enabled)) { $langs->load("mrp"); $newmenu->add("", $langs->trans("MenuMRP"), 0, $user->rights->mrp->read, '', $mainmenu, 'mo'); @@ -1715,10 +1678,8 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM /* * Menu PROJECTS */ - if ($mainmenu == 'project') - { - if (!empty($conf->projet->enabled)) - { + if ($mainmenu == 'project') { + if (!empty($conf->projet->enabled)) { $langs->load("projects"); $search_project_user = GETPOST('search_project_user', 'int'); @@ -1732,8 +1693,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM $titleboth = $langs->trans("LeadsOrProjects"); $titlenew = $langs->trans("NewLeadOrProject"); // Leads and opportunities by default - if ($conf->global->PROJECT_USE_OPPORTUNITIES == 0) - { + if ($conf->global->PROJECT_USE_OPPORTUNITIES == 0) { $titleboth = $langs->trans("Projects"); $titlenew = $langs->trans("NewProject"); } @@ -1746,11 +1706,9 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM $newmenu->add("/projet/index.php?leftmenu=projects".($search_project_user ? '&search_project_user='.$search_project_user : ''), $titleboth, 0, $user->rights->projet->lire, '', $mainmenu, 'projects'); $newmenu->add("/projet/card.php?leftmenu=projects&action=create".($search_project_user ? '&search_project_user='.$search_project_user : ''), $titlenew, 1, $user->rights->projet->creer); - if ($conf->global->PROJECT_USE_OPPORTUNITIES == 0) - { + if ($conf->global->PROJECT_USE_OPPORTUNITIES == 0) { $newmenu->add("/projet/list.php?leftmenu=projets".($search_project_user ? '&search_project_user='.$search_project_user : '').'&search_status=99', $langs->trans("List"), 1, $showmode, '', 'project', 'list'); - } elseif ($conf->global->PROJECT_USE_OPPORTUNITIES == 1) - { + } elseif ($conf->global->PROJECT_USE_OPPORTUNITIES == 1) { $newmenu->add("/projet/list.php?leftmenu=projets".($search_project_user ? '&search_project_user='.$search_project_user : ''), $langs->trans("List"), 1, $showmode, '', 'project', 'list'); $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); $newmenu->add('/projet/list.php?mainmenu=project&leftmenu=list&search_opp_status=notopenedopp&search_status=99&contextpage=project', $langs->trans("ListOpenProjects"), 2, $showmode); @@ -1761,14 +1719,12 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM $newmenu->add("/projet/stats/index.php?leftmenu=projects", $langs->trans("Statistics"), 1, $user->rights->projet->lire); // Categories - if (!empty($conf->categorie->enabled)) - { + if (!empty($conf->categorie->enabled)) { $langs->load("categories"); $newmenu->add("/categories/index.php?leftmenu=cat&type=6", $langs->trans("Categories"), 1, $user->rights->categorie->lire, '', $mainmenu, 'cat'); } - if (empty($conf->global->PROJECT_HIDE_TASKS)) - { + if (empty($conf->global->PROJECT_HIDE_TASKS)) { // Project affected to user $newmenu->add("/projet/activity/index.php?leftmenu=tasks".($search_project_user ? '&search_project_user='.$search_project_user : ''), $langs->trans("Activities"), 0, $user->rights->projet->lire, '', 'project', 'tasks'); $newmenu->add("/projet/tasks.php?leftmenu=tasks&action=create", $langs->trans("NewTask"), 1, $user->rights->projet->creer); @@ -1783,11 +1739,9 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM /* * Menu HRM */ - if ($mainmenu == 'hrm') - { + if ($mainmenu == 'hrm') { // HRM module - if (!empty($conf->hrm->enabled)) - { + if (!empty($conf->hrm->enabled)) { $langs->load("hrm"); $newmenu->add("/user/list.php?mainmenu=hrm&leftmenu=hrm&mode=employee", $langs->trans("Employees"), 0, $user->rights->hrm->employee->read, '', $mainmenu, 'hrm'); @@ -1796,8 +1750,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM } // Leave/Holiday/Vacation module - if (!empty($conf->holiday->enabled)) - { + if (!empty($conf->holiday->enabled)) { // Load translation files required by the page $langs->loadLangs(array("holiday", "trips")); @@ -1817,8 +1770,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM } // Trips and expenses (old module) - if (!empty($conf->deplacement->enabled)) - { + if (!empty($conf->deplacement->enabled)) { $langs->load("trips"); $newmenu->add("/compta/deplacement/index.php?leftmenu=tripsandexpenses&mainmenu=hrm", $langs->trans("TripsAndExpenses"), 0, $user->rights->deplacement->lire, '', $mainmenu, 'tripsandexpenses'); $newmenu->add("/compta/deplacement/card.php?action=create&leftmenu=tripsandexpenses&mainmenu=hrm", $langs->trans("New"), 1, $user->rights->deplacement->creer); @@ -1827,8 +1779,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM } // Expense report - if (!empty($conf->expensereport->enabled)) - { + if (!empty($conf->expensereport->enabled)) { $langs->load("trips"); $newmenu->add("/expensereport/index.php?leftmenu=expensereport&mainmenu=hrm", $langs->trans("TripsAndExpenses"), 0, $user->rights->expensereport->lire, '', $mainmenu, 'expensereport'); $newmenu->add("/expensereport/card.php?action=create&leftmenu=expensereport&mainmenu=hrm", $langs->trans("New"), 1, $user->rights->expensereport->creer); @@ -1844,10 +1795,8 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM $newmenu->add("/expensereport/stats/index.php?leftmenu=expensereport&mainmenu=hrm", $langs->trans("Statistics"), 1, $user->rights->expensereport->lire); } - if (!empty($conf->projet->enabled)) - { - if (empty($conf->global->PROJECT_HIDE_TASKS)) - { + if (!empty($conf->projet->enabled)) { + if (empty($conf->global->PROJECT_HIDE_TASKS)) { $langs->load("projects"); $search_project_user = GETPOST('search_project_user', 'int'); @@ -1861,31 +1810,26 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM /* * Menu TOOLS */ - if ($mainmenu == 'tools') - { - if (empty($user->socid)) // limit to internal users - { + if ($mainmenu == 'tools') { + if (empty($user->socid)) { // limit to internal users $langs->load("mails"); $newmenu->add("/admin/mails_templates.php?leftmenu=email_templates", $langs->trans("EMailTemplates"), 0, 1, '', $mainmenu, 'email_templates'); } - if (!empty($conf->mailing->enabled)) - { + if (!empty($conf->mailing->enabled)) { $newmenu->add("/comm/mailing/index.php?leftmenu=mailing", $langs->trans("EMailings"), 0, $user->rights->mailing->lire, '', $mainmenu, 'mailing'); $newmenu->add("/comm/mailing/card.php?leftmenu=mailing&action=create", $langs->trans("NewMailing"), 1, $user->rights->mailing->creer); $newmenu->add("/comm/mailing/list.php?leftmenu=mailing", $langs->trans("List"), 1, $user->rights->mailing->lire); } - if (!empty($conf->export->enabled)) - { + if (!empty($conf->export->enabled)) { $langs->load("exports"); $newmenu->add("/exports/index.php?leftmenu=export", $langs->trans("FormatedExport"), 0, $user->rights->export->lire, '', $mainmenu, 'export'); $newmenu->add("/exports/export.php?leftmenu=export", $langs->trans("NewExport"), 1, $user->rights->export->creer); //$newmenu->add("/exports/export.php?leftmenu=export",$langs->trans("List"),1, $user->rights->export->lire); } - if (!empty($conf->import->enabled)) - { + if (!empty($conf->import->enabled)) { $langs->load("exports"); $newmenu->add("/imports/index.php?leftmenu=import", $langs->trans("FormatedImport"), 0, $user->rights->import->run, '', $mainmenu, 'import'); $newmenu->add("/imports/import.php?leftmenu=import", $langs->trans("NewImport"), 1, $user->rights->import->run); @@ -1895,10 +1839,8 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM /* * Menu MEMBERS */ - if ($mainmenu == 'members') - { - if (!empty($conf->adherent->enabled)) - { + if ($mainmenu == 'members') { + if (!empty($conf->adherent->enabled)) { // Load translation files required by the page $langs->loadLangs(array("members", "compta")); @@ -1914,10 +1856,11 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM $newmenu->add("/adherents/stats/index.php?leftmenu=members", $langs->trans("MenuMembersStats"), 1, $user->rights->adherent->lire); $newmenu->add("/adherents/cartes/carte.php?leftmenu=export", $langs->trans("MembersCards"), 1, $user->rights->adherent->export); - if (!empty($conf->global->MEMBER_LINK_TO_HTPASSWDFILE) && ($usemenuhider || empty($leftmenu) || $leftmenu == 'none' || $leftmenu == "members" || $leftmenu == "export")) $newmenu->add("/adherents/htpasswd.php?leftmenu=export", $langs->trans("Filehtpasswd"), 1, $user->rights->adherent->export); + if (!empty($conf->global->MEMBER_LINK_TO_HTPASSWDFILE) && ($usemenuhider || empty($leftmenu) || $leftmenu == 'none' || $leftmenu == "members" || $leftmenu == "export")) { + $newmenu->add("/adherents/htpasswd.php?leftmenu=export", $langs->trans("Filehtpasswd"), 1, $user->rights->adherent->export); + } - if (!empty($conf->categorie->enabled)) - { + if (!empty($conf->categorie->enabled)) { $langs->load("categories"); $newmenu->add("/categories/index.php?leftmenu=cat&type=3", $langs->trans("Categories"), 1, $user->rights->categorie->lire, '', $mainmenu, 'cat'); } @@ -1943,16 +1886,13 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM $newmenu = $menuArbo->menuLeftCharger($newmenu, $mainmenu, $leftmenu, (empty($user->socid) ? 0 : 1), 'eldy', $tabMenu); //var_dump($newmenu->liste); // - if (!empty($conf->ftp->enabled) && $mainmenu == 'ftp') // Entry for FTP - { + if (!empty($conf->ftp->enabled) && $mainmenu == 'ftp') { // Entry for FTP $MAXFTP = 20; $i = 1; - while ($i <= $MAXFTP) - { + while ($i <= $MAXFTP) { $paramkey = 'FTP_NAME_'.$i; //print $paramkey; - if (!empty($conf->global->$paramkey)) - { + if (!empty($conf->global->$paramkey)) { $link = "/ftp/index.php?idmenu=".$_SESSION["idmenu"]."&numero_ftp=".$i; $newmenu->add($link, dol_trunc($conf->global->$paramkey, 24)); @@ -1969,10 +1909,16 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM //var_dump($menu_array_before);exit; //var_dump($menu_array_after);exit; $menu_array = $newmenu->liste; - if (is_array($menu_array_before)) $menu_array = array_merge($menu_array_before, $menu_array); - if (is_array($menu_array_after)) $menu_array = array_merge($menu_array, $menu_array_after); + if (is_array($menu_array_before)) { + $menu_array = array_merge($menu_array_before, $menu_array); + } + if (is_array($menu_array_after)) { + $menu_array = array_merge($menu_array, $menu_array_after); + } //var_dump($menu_array);exit; - if (!is_array($menu_array)) return 0; + if (!is_array($menu_array)) { + return 0; + } // TODO Use the position property in menu_array to reorder the $menu_array //var_dump($menu_array); @@ -1982,19 +1928,19 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM while (findNextEntryForLevel($menu_array, $cursor, $position, $level)) { - $cursor++; + $cursor++; }*/ // Show menu $invert = empty($conf->global->MAIN_MENU_INVERT) ? "" : "invert"; - if (empty($noout)) - { + if (empty($noout)) { $altok = 0; $blockvmenuopened = false; $lastlevel0 = ''; $num = count($menu_array); - for ($i = 0; $i < $num; $i++) // Loop on each menu entry - { + for ($i = 0; $i < $num; $i++) { // Loop on each menu entry $showmenu = true; - if (!empty($conf->global->MAIN_MENU_HIDE_UNAUTHORIZED) && empty($menu_array[$i]['enabled'])) $showmenu = false; + if (!empty($conf->global->MAIN_MENU_HIDE_UNAUTHORIZED) && empty($menu_array[$i]['enabled'])) { + $showmenu = false; + } // Begin of new left menu block if (empty($menu_array[$i]['level']) && $showmenu) { @@ -2002,7 +1948,9 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM $blockvmenuopened = true; $lastopened = true; for ($j = ($i + 1); $j < $num; $j++) { - if (empty($menu_array[$j]['level'])) $lastopened = false; + if (empty($menu_array[$j]['level'])) { + $lastopened = false; + } } if ($altok % 2 == 0) { print '
'."\n"; @@ -2025,19 +1973,16 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM $menu_array[$i]['url'] = make_substitutions($menu_array[$i]['url'], $substitarray); $url = $shorturl = $shorturlwithoutparam = $menu_array[$i]['url']; - if (!preg_match("/^(http:\/\/|https:\/\/)/i", $menu_array[$i]['url'])) - { + if (!preg_match("/^(http:\/\/|https:\/\/)/i", $menu_array[$i]['url'])) { $tmp = explode('?', $menu_array[$i]['url'], 2); $url = $shorturl = $tmp[0]; $param = (isset($tmp[1]) ? $tmp[1] : ''); // params in url of the menu link // Complete param to force leftmenu to '' to close open menu when we click on a link with no leftmenu defined. - if ((!preg_match('/mainmenu/i', $param)) && (!preg_match('/leftmenu/i', $param)) && !empty($menu_array[$i]['mainmenu'])) - { + if ((!preg_match('/mainmenu/i', $param)) && (!preg_match('/leftmenu/i', $param)) && !empty($menu_array[$i]['mainmenu'])) { $param .= ($param ? '&' : '').'mainmenu='.$menu_array[$i]['mainmenu'].'&leftmenu='; } - if ((!preg_match('/mainmenu/i', $param)) && (!preg_match('/leftmenu/i', $param)) && empty($menu_array[$i]['mainmenu'])) - { + if ((!preg_match('/mainmenu/i', $param)) && (!preg_match('/leftmenu/i', $param)) && empty($menu_array[$i]['mainmenu'])) { $param .= ($param ? '&' : '').'leftmenu='; } //$url.="idmenu=".$menu_array[$i]['rowid']; // Already done by menuLoad @@ -2050,64 +1995,77 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM print ''."\n"; // Menu level 0 - if ($menu_array[$i]['level'] == 0) - { - if ($menu_array[$i]['enabled']) // Enabled so visible - { + if ($menu_array[$i]['level'] == 0) { + if ($menu_array[$i]['enabled']) { // Enabled so visible print ''."\n"; $lastlevel0 = 'enabled'; - } elseif ($showmenu) // Not enabled but visible (so greyed) - { + } elseif ($showmenu) { // Not enabled but visible (so greyed) print ''."\n"; $lastlevel0 = 'greyed'; } else { $lastlevel0 = 'hidden'; } - if ($showmenu) - { + if ($showmenu) { print ''."\n"; } } // Menu level > 0 - if ($menu_array[$i]['level'] > 0) - { + if ($menu_array[$i]['level'] > 0) { $cssmenu = ''; - if ($menu_array[$i]['url']) $cssmenu = ' menu_contenu'.dol_string_nospecial(preg_replace('/\.php.*$/', '', $menu_array[$i]['url'])); + if ($menu_array[$i]['url']) { + $cssmenu = ' menu_contenu'.dol_string_nospecial(preg_replace('/\.php.*$/', '', $menu_array[$i]['url'])); + } - if ($menu_array[$i]['enabled'] && $lastlevel0 == 'enabled') // Enabled so visible, except if parent was not enabled. - { + if ($menu_array[$i]['enabled'] && $lastlevel0 == 'enabled') { // Enabled so visible, except if parent was not enabled. print ''."\n"; - } elseif ($showmenu && $lastlevel0 == 'enabled') // Not enabled but visible (so greyed), except if parent was not enabled. - { + } elseif ($showmenu && $lastlevel0 == 'enabled') { // Not enabled but visible (so greyed), except if parent was not enabled. print ''."\n"; } } // If next is a new block or if there is nothing after - if (empty($menu_array[$i + 1]['level'])) // End menu block - { - if ($showmenu) + if (empty($menu_array[$i + 1]['level'])) { // End menu block + if ($showmenu) { print ''."\n"; - if ($blockvmenuopened) { print '
'."\n"; $blockvmenuopened = false; } + } + if ($blockvmenuopened) { + print '
'."\n"; $blockvmenuopened = false; + } } } - if ($altok) print '
'; // End menu block + if ($altok) { + print '
'; // End menu block + } } return count($menu_array); diff --git a/htdocs/core/menus/standard/eldy_menu.php b/htdocs/core/menus/standard/eldy_menu.php index 56a56d3af9b..a024e6743e8 100644 --- a/htdocs/core/menus/standard/eldy_menu.php +++ b/htdocs/core/menus/standard/eldy_menu.php @@ -67,12 +67,15 @@ class MenuManager global $conf, $user, $langs; // We save into session the main menu selected - if (GETPOSTISSET("mainmenu")) $_SESSION["mainmenu"] = GETPOST("mainmenu", 'aZ09'); - if (GETPOSTISSET("idmenu")) $_SESSION["idmenu"] = GETPOST("idmenu", 'int'); + if (GETPOSTISSET("mainmenu")) { + $_SESSION["mainmenu"] = GETPOST("mainmenu", 'aZ09'); + } + if (GETPOSTISSET("idmenu")) { + $_SESSION["idmenu"] = GETPOST("idmenu", 'int'); + } // Read now mainmenu and leftmenu that define which menu to show - if (GETPOSTISSET("mainmenu")) - { + if (GETPOSTISSET("mainmenu")) { // On sauve en session le menu principal choisi $mainmenu = GETPOST("mainmenu", 'aZ09'); $_SESSION["mainmenu"] = $mainmenu; @@ -81,16 +84,16 @@ class MenuManager // On va le chercher en session si non defini par le lien $mainmenu = isset($_SESSION["mainmenu"]) ? $_SESSION["mainmenu"] : ''; } - if (!empty($forcemainmenu)) $mainmenu = $forcemainmenu; + if (!empty($forcemainmenu)) { + $mainmenu = $forcemainmenu; + } - if (GETPOSTISSET("leftmenu")) - { + if (GETPOSTISSET("leftmenu")) { // On sauve en session le menu principal choisi $leftmenu = GETPOST("leftmenu", 'aZ09'); $_SESSION["leftmenu"] = $leftmenu; - if ($_SESSION["leftmenuopened"] == $leftmenu) // To collapse - { + if ($_SESSION["leftmenuopened"] == $leftmenu) { // To collapse //$leftmenu=""; $_SESSION["leftmenuopened"] = ""; } else { @@ -100,7 +103,9 @@ class MenuManager // On va le chercher en session si non defini par le lien $leftmenu = isset($_SESSION["leftmenu"]) ? $_SESSION["leftmenu"] : ''; } - if (!empty($forceleftmenu)) $leftmenu = $forceleftmenu; + if (!empty($forceleftmenu)) { + $leftmenu = $forceleftmenu; + } require_once DOL_DOCUMENT_ROOT.'/core/class/menubase.class.php'; $tabMenu = array(); @@ -129,8 +134,7 @@ class MenuManager require_once DOL_DOCUMENT_ROOT.'/core/menus/standard/eldy.lib.php'; - if ($this->type_user == 1) - { + if ($this->type_user == 1) { $conf->global->MAIN_SEARCHFORM_SOCIETE_DISABLED = 1; $conf->global->MAIN_SEARCHFORM_CONTACT_DISABLED = 1; } @@ -138,36 +142,39 @@ class MenuManager require_once DOL_DOCUMENT_ROOT.'/core/class/menu.class.php'; $this->menu = new Menu(); - if (empty($conf->global->MAIN_MENU_INVERT)) - { - if ($mode == 'top') print_eldy_menu($this->db, $this->atarget, $this->type_user, $this->tabMenu, $this->menu, 0, $mode); - if ($mode == 'left') print_left_eldy_menu($this->db, $this->menu_array, $this->menu_array_after, $this->tabMenu, $this->menu, 0, '', '', $moredata); + if (empty($conf->global->MAIN_MENU_INVERT)) { + if ($mode == 'top') { + print_eldy_menu($this->db, $this->atarget, $this->type_user, $this->tabMenu, $this->menu, 0, $mode); + } + if ($mode == 'left') { + print_left_eldy_menu($this->db, $this->menu_array, $this->menu_array_after, $this->tabMenu, $this->menu, 0, '', '', $moredata, $this->type_user); + } } else { $conf->global->MAIN_SHOW_LOGO = 0; - if ($mode == 'top') print_left_eldy_menu($this->db, $this->menu_array, $this->menu_array_after, $this->tabMenu, $this->menu, 0); - if ($mode == 'left') print_eldy_menu($this->db, $this->atarget, $this->type_user, $this->tabMenu, $this->menu, 0, $mode); + if ($mode == 'top') { + print_left_eldy_menu($this->db, $this->menu_array, $this->menu_array_after, $this->tabMenu, $this->menu, 0, '', '', $moredata, $this->type_user); + } + if ($mode == 'left') { + print_eldy_menu($this->db, $this->atarget, $this->type_user, $this->tabMenu, $this->menu, 0, $mode); + } } - if ($mode == 'topnb') - { + if ($mode == 'topnb') { print_eldy_menu($this->db, $this->atarget, $this->type_user, $this->tabMenu, $this->menu, 1, $mode); // no output return $this->menu->getNbOfVisibleMenuEntries(); } - if ($mode == 'jmobile') // Used to get menu in xml ul/li - { + if ($mode == 'jmobile') { // Used to get menu in xml ul/li print_eldy_menu($this->db, $this->atarget, $this->type_user, $this->tabMenu, $this->menu, 1, $mode); // Fill this->menu that is empty with top menu // $this->menu->liste is top menu //var_dump($this->menu->liste);exit; $lastlevel = array(); print ''."\n"; - foreach ($this->menu->liste as $key => $val) // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu' - { + foreach ($this->menu->liste as $key => $val) { // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu' print '