Merge pull request #21106 from frederic34/patch-1
New isModEnabled function
This commit is contained in:
commit
00c22eff6b
@ -13,7 +13,7 @@
|
|||||||
* Copyright (C) 2014 Cédric GROSS <c.gross@kreiz-it.fr>
|
* Copyright (C) 2014 Cédric GROSS <c.gross@kreiz-it.fr>
|
||||||
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
|
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
|
||||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||||
* Copyright (C) 2018-2021 Frédéric France <frederic.france@netlogic.fr>
|
* Copyright (C) 2018-2022 Frédéric France <frederic.france@netlogic.fr>
|
||||||
* Copyright (C) 2019 Thibault Foucart <support@ptibogxiv.net>
|
* Copyright (C) 2019 Thibault Foucart <support@ptibogxiv.net>
|
||||||
* Copyright (C) 2020 Open-Dsi <support@open-dsi.fr>
|
* Copyright (C) 2020 Open-Dsi <support@open-dsi.fr>
|
||||||
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
|
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
|
||||||
@ -68,6 +68,17 @@ function getDolGlobalInt($key, $default = 0)
|
|||||||
return (int) (empty($conf->global->$key) ? $default : $conf->global->$key);
|
return (int) (empty($conf->global->$key) ? $default : $conf->global->$key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is Dolibarr module enabled
|
||||||
|
* @param string $module module name to check
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
function isModEnabled($module)
|
||||||
|
{
|
||||||
|
global $conf;
|
||||||
|
return !empty($conf->$module->enabled);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a DoliDB instance (database handler).
|
* Return a DoliDB instance (database handler).
|
||||||
*
|
*
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||||
* Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
|
* Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
|
||||||
* Copyright (C) 2018-2019 Frédéric France <frederic.france@netlogic.fr>
|
* Copyright (C) 2018-2022 Frédéric France <frederic.france@netlogic.fr>
|
||||||
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
|
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -2030,7 +2030,7 @@ function get_left_menu_products($mainmenu, &$newmenu, $usemenuhider = 1, $leftme
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Warehouse
|
// Warehouse
|
||||||
if (!empty($conf->stock->enabled)) {
|
if (isModEnabled('stock')) {
|
||||||
$langs->load("stocks");
|
$langs->load("stocks");
|
||||||
$newmenu->add("/product/stock/index.php?leftmenu=stock", $langs->trans("Warehouses"), 0, $user->rights->stock->lire, '', $mainmenu, 'stock', 0, '', '', '', img_picto('', 'stock', 'class="pictofixedwidth"'));
|
$newmenu->add("/product/stock/index.php?leftmenu=stock", $langs->trans("Warehouses"), 0, $user->rights->stock->lire, '', $mainmenu, 'stock', 0, '', '', '', img_picto('', 'stock', 'class="pictofixedwidth"'));
|
||||||
$newmenu->add("/product/stock/card.php?action=create", $langs->trans("MenuNewWarehouse"), 1, $user->rights->stock->creer);
|
$newmenu->add("/product/stock/card.php?action=create", $langs->trans("MenuNewWarehouse"), 1, $user->rights->stock->creer);
|
||||||
@ -2038,18 +2038,18 @@ function get_left_menu_products($mainmenu, &$newmenu, $usemenuhider = 1, $leftme
|
|||||||
$newmenu->add("/product/stock/movement_list.php", $langs->trans("Movements"), 1, $user->rights->stock->mouvement->lire);
|
$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);
|
$newmenu->add("/product/stock/massstockmove.php", $langs->trans("MassStockTransferShort"), 1, $user->rights->stock->mouvement->creer);
|
||||||
if ($conf->supplier_order->enabled) {
|
if (isModEnabled('supplier_order')) {
|
||||||
$newmenu->add("/product/stock/replenish.php", $langs->trans("Replenishment"), 1, $user->rights->stock->mouvement->creer && $user->rights->fournisseur->lire);
|
$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);
|
$newmenu->add("/product/stock/stockatdate.php", $langs->trans("StockAtDate"), 1, $user->rights->produit->lire && $user->rights->stock->lire);
|
||||||
|
|
||||||
// Categories for warehouses
|
// Categories for warehouses
|
||||||
if (!empty($conf->categorie->enabled)) {
|
if (isModEnabled('categorie')) {
|
||||||
$newmenu->add("/categories/index.php?leftmenu=stock&type=9", $langs->trans("Categories"), 1, $user->rights->categorie->lire, '', $mainmenu, 'cat');
|
$newmenu->add("/categories/index.php?leftmenu=stock&type=9", $langs->trans("Categories"), 1, $user->rights->categorie->lire, '', $mainmenu, 'cat');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($conf->stocktransfer->enabled) {
|
if (isModEnabled('stocktransfer')) {
|
||||||
$newmenu->add('/product/stock/stocktransfer/stocktransfer_list.php', $langs->trans("ModuleStockTransferName"), 0, $user->rights->stocktransfer->stocktransfer->read, '', $mainmenu, 'stocktransfer', 0, '', '', '', img_picto('', 'stock', 'class="pictofixedwidth"'));
|
$newmenu->add('/product/stock/stocktransfer/stocktransfer_list.php', $langs->trans("ModuleStockTransferName"), 0, $user->rights->stocktransfer->stocktransfer->read, '', $mainmenu, 'stocktransfer', 0, '', '', '', img_picto('', 'stock', 'class="pictofixedwidth"'));
|
||||||
$newmenu->add('/product/stock/stocktransfer/stocktransfer_card.php?action=create', $langs->trans('StockTransferNew'), 1, $user->rights->stocktransfer->stocktransfer->write);
|
$newmenu->add('/product/stock/stocktransfer/stocktransfer_card.php?action=create', $langs->trans('StockTransferNew'), 1, $user->rights->stocktransfer->stocktransfer->write);
|
||||||
$newmenu->add('/product/stock/stocktransfer/stocktransfer_list.php', $langs->trans('List'), 1, $user->rights->stocktransfer->stocktransfer->read);
|
$newmenu->add('/product/stock/stocktransfer/stocktransfer_list.php', $langs->trans('List'), 1, $user->rights->stocktransfer->stocktransfer->read);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user