Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NEW : use specific landing page to home menu entry #30244

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions htdocs/core/menus/standard/eldy.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,15 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout =
$menu_arr = array();

// Home
$landingpage = (empty($user->conf->MAIN_LANDING_PAGE) ? (!getDolGlobalString('MAIN_LANDING_PAGE') ? '' : $conf->global->MAIN_LANDING_PAGE) : $user->conf->MAIN_LANDING_PAGE);
Copy link
Member

@eldy eldy Jul 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use of conf->global->xxx or user->conf->xxx is no more allowed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry it was a copy/paste from main.inc.php 😉

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$user->conf-> is also not allowed.
use getDolUserString

if (! empty($landingpage)) {
$landingpage = str_replace(DOL_URL_ROOT, '', dol_buildpath($landingpage, 1));
} else {
$landingpage = '/index.php?mainmenu=home&leftmenu=home';
}
$menu_arr[] = array(
'name' => 'Home',
'link' => '/index.php?mainmenu=home&leftmenu=home',
'link' => $landingpage,
'title' => "Home",
'level' => 0,
'enabled' => $showmode = 1,
Expand Down Expand Up @@ -1120,7 +1126,13 @@ function get_left_menu_home($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu =
$langs->load("users");

// Home - dashboard
$newmenu->add("/index.php?mainmenu=home&amp;leftmenu=home", $langs->trans("MyDashboard"), 0, 1, '', $mainmenu, 'home', 0, '', '', '', '<i class="fas fa-chart-bar fa-fw paddingright pictofixedwidth"></i>');
$landingpage = (empty($user->conf->MAIN_LANDING_PAGE) ? (!getDolGlobalString('MAIN_LANDING_PAGE') ? '' : $conf->global->MAIN_LANDING_PAGE) : $user->conf->MAIN_LANDING_PAGE);
if (! empty($landingpage)) {
$landingpage = str_replace(DOL_URL_ROOT, '', dol_buildpath($landingpage, 1));
} else {
$landingpage = '/index.php?mainmenu=home&amp;leftmenu=home';
}
$newmenu->add($landingpage, $langs->trans("MyDashboard"), 0, 1, '', $mainmenu, 'home', 0, '', '', '', '<i class="fas fa-chart-bar fa-fw paddingright pictofixedwidth"></i>');

// Setup
$newmenu->add("/admin/index.php?mainmenu=home&amp;leftmenu=setup", $langs->trans("Setup"), 0, $user->admin, '', $mainmenu, 'setup', 0, '', '', '', '<i class="fa fa-tools fa-fw paddingright pictofixedwidth"></i>');
Expand Down
Loading