';
diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql
index 9270b946199..96625dd1f95 100644
--- a/htdocs/core/menus/init_menu_auguria.sql
+++ b/htdocs/core/menus/init_menu_auguria.sql
@@ -15,7 +15,7 @@ insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, left
insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 2__+MAX_llx_menu__, 'societe|fournisseur|supplier_order|supplier_invoice', '($conf->societe->enabled && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) || !empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || $conf->supplier_order->enabled || $conf->supplier_invoice->enabled))', __HANDLER__, 'top', 'companies', '', 0, '/societe/index.php?mainmenu=companies&leftmenu=', 'ThirdParties', -1, 'companies', '$user->rights->societe->lire || $user->rights->societe->contact->lire', '', 2, 20, __ENTITY__);
insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 3__+MAX_llx_menu__, 'product|service', '$conf->product->enabled || $conf->service->enabled', __HANDLER__, 'top', 'products', '', 0, '/product/index.php?mainmenu=products&leftmenu=', 'ProductsPipeServices', -1, 'products', '$user->rights->produit->lire||$user->rights->service->lire', '', 0, 30, __ENTITY__);
insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 16__+MAX_llx_menu__, 'bom|mrp', '$conf->bom->enabled || $conf->mrp->enabled', __HANDLER__, 'top', 'mrp', '', 0, '/mrp/index.php?mainmenu=mrp&leftmenu=', 'MRP', -1, 'mrp', '$user->rights->bom->read||$user->rights->mrp->read', '', 0, 31, __ENTITY__);
-insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 7__+MAX_llx_menu__, 'projet', '$conf->projet->enabled', __HANDLER__, 'top', 'project', '', 0, '/projet/index.php?mainmenu=project&leftmenu=', 'Projects', -1, 'projects', '$user->rights->projet->lire', '', 2, 32, __ENTITY__);
+insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 7__+MAX_llx_menu__, 'projet', '$conf->project->enabled', __HANDLER__, 'top', 'project', '', 0, '/projet/index.php?mainmenu=project&leftmenu=', 'Projects', -1, 'projects', '$user->rights->projet->lire', '', 2, 32, __ENTITY__);
insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 5__+MAX_llx_menu__, 'propal|commande|fournisseur|supplier_order|supplier_invoice|contrat|ficheinter', '$conf->propal->enabled || $conf->commande->enabled || $conf->supplier_order->enabled || $conf->contrat->enabled || $conf->ficheinter->enabled', __HANDLER__, 'top', 'commercial', '', 0, '/comm/index.php?mainmenu=commercial&leftmenu=', 'Commercial', -1, 'commercial', '$user->rights->societe->lire || $user->rights->societe->contact->lire', '', 2, 40, __ENTITY__);
insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 6__+MAX_llx_menu__, 'facture|don|tax|salaries|loan|banque', '$conf->comptabilite->enabled || $conf->accounting->enabled || $conf->facture->enabled || $conf->don->enabled || $conf->tax->enabled || $conf->salaries->enabled || $conf->supplier_invoice->enabled || $conf->loan->enabled || $conf->banque->enabled', __HANDLER__, 'top', 'billing', '', 0, '/compta/index.php?mainmenu=billing&leftmenu=', 'MenuFinancial', -1, 'compta', '$user->rights->facture->lire|| $user->rights->don->lire || $user->rights->tax->charges->lire || $user->rights->salaries->read || $user->rights->loan->read || $user->rights->banque->lire', '', 2, 50, __ENTITY__);
insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 14__+MAX_llx_menu__, 'banque|prelevement', '$conf->banque->enabled || $conf->prelevement->enabled', __HANDLER__, 'top', 'bank', '', 0, '/compta/bank/list.php?mainmenu=bank&leftmenu=bank', 'MenuBankCash', -1, 'banks', '$user->rights->banque->lire || $user->rights->prelevement->bons->lire', '', 0, 52, __ENTITY__);
@@ -404,19 +404,19 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
-- Project
-insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3600__+MAX_llx_menu__, 'project', 'projects', 7__+MAX_llx_menu__, '/projet/index.php?mainmenu=project&leftmenu=projects', 'LeadsOrProjects', 0, 'projects', '$user->rights->projet->lire', '', 2, 0, __ENTITY__);
-insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3601__+MAX_llx_menu__, 'project', '', 3600__+MAX_llx_menu__, '/projet/card.php?mainmenu=project&leftmenu=projects&action=create', 'New', 1, 'projects', '$user->rights->projet->creer', '', 2, 1, __ENTITY__);
-insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3602__+MAX_llx_menu__, 'project', '', 3600__+MAX_llx_menu__, '/projet/list.php?mainmenu=project&leftmenu=projects', 'List', 1, 'projects', '$user->rights->projet->lire', '', 2, 2, __ENTITY__);
-insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled && $conf->global->PROJECT_USE_OPPORTUNITIES != 0', __HANDLER__, 'left', 3603__+MAX_llx_menu__, 'project', '', 3600__+MAX_llx_menu__, '/projet/list.php?mainmenu=project&leftmenu=projects&search_opp_status=openedopp&search_status=99', 'ListOpenLeads', 1, 'projects', '$user->rights->projet->lire', '', 2, 2, __ENTITY__);
-insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled && $conf->global->PROJECT_USE_OPPORTUNITIES != 2', __HANDLER__, 'left', 3604__+MAX_llx_menu__, 'project', '', 3600__+MAX_llx_menu__, '/projet/list.php?mainmenu=project&leftmenu=projects&search_opp_status=notopenedopp&search_status=99', 'ListOpenProjects', 1, 'projects', '$user->rights->projet->lire', '', 2, 2, __ENTITY__);
-insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3605__+MAX_llx_menu__, 'project', '', 3600__+MAX_llx_menu__, '/projet/stats/index.php?mainmenu=project&leftmenu=projects', 'Statistics', 1, 'projects', '$user->rights->projet->lire', '', 2, 3, __ENTITY__);
+insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->project->enabled', __HANDLER__, 'left', 3600__+MAX_llx_menu__, 'project', 'projects', 7__+MAX_llx_menu__, '/projet/index.php?mainmenu=project&leftmenu=projects', 'LeadsOrProjects', 0, 'projects', '$user->rights->projet->lire', '', 2, 0, __ENTITY__);
+insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->project->enabled', __HANDLER__, 'left', 3601__+MAX_llx_menu__, 'project', '', 3600__+MAX_llx_menu__, '/projet/card.php?mainmenu=project&leftmenu=projects&action=create', 'New', 1, 'projects', '$user->rights->projet->creer', '', 2, 1, __ENTITY__);
+insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->project->enabled', __HANDLER__, 'left', 3602__+MAX_llx_menu__, 'project', '', 3600__+MAX_llx_menu__, '/projet/list.php?mainmenu=project&leftmenu=projects', 'List', 1, 'projects', '$user->rights->projet->lire', '', 2, 2, __ENTITY__);
+insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->project->enabled && $conf->global->PROJECT_USE_OPPORTUNITIES != 0', __HANDLER__, 'left', 3603__+MAX_llx_menu__, 'project', '', 3600__+MAX_llx_menu__, '/projet/list.php?mainmenu=project&leftmenu=projects&search_opp_status=openedopp&search_status=99', 'ListOpenLeads', 1, 'projects', '$user->rights->projet->lire', '', 2, 2, __ENTITY__);
+insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->project->enabled && $conf->global->PROJECT_USE_OPPORTUNITIES != 2', __HANDLER__, 'left', 3604__+MAX_llx_menu__, 'project', '', 3600__+MAX_llx_menu__, '/projet/list.php?mainmenu=project&leftmenu=projects&search_opp_status=notopenedopp&search_status=99', 'ListOpenProjects', 1, 'projects', '$user->rights->projet->lire', '', 2, 2, __ENTITY__);
+insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->project->enabled', __HANDLER__, 'left', 3605__+MAX_llx_menu__, 'project', '', 3600__+MAX_llx_menu__, '/projet/stats/index.php?mainmenu=project&leftmenu=projects', 'Statistics', 1, 'projects', '$user->rights->projet->lire', '', 2, 3, __ENTITY__);
-insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled && !$conf->global->PROJECT_HIDE_TASKS', __HANDLER__, 'left', 3700__+MAX_llx_menu__, 'project', '', 7__+MAX_llx_menu__, '/projet/activity/index.php?mainmenu=project&leftmenu=projects', 'Activities', 0, 'projects', '$user->rights->projet->lire', '', 2, 0, __ENTITY__);
-insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled && !$conf->global->PROJECT_HIDE_TASKS', __HANDLER__, 'left', 3701__+MAX_llx_menu__, 'project', '', 3700__+MAX_llx_menu__, '/projet/tasks.php?mainmenu=project&leftmenu=projects&action=create', 'NewTask', 1, 'projects', '$user->rights->projet->creer', '', 2, 1, __ENTITY__);
-insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled && !$conf->global->PROJECT_HIDE_TASKS', __HANDLER__, 'left', 3702__+MAX_llx_menu__, 'project', '', 3700__+MAX_llx_menu__, '/projet/tasks/list.php?mainmenu=project&leftmenu=projects', 'List', 1, 'projects', '$user->rights->projet->lire', '', 2, 2, __ENTITY__);
-insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled && !$conf->global->PROJECT_HIDE_TASKS', __HANDLER__, 'left', 3704__+MAX_llx_menu__, 'project', '', 3700__+MAX_llx_menu__, '/projet/tasks/stats/index.php?mainmenu=project&leftmenu=projects', 'Statistics', 1, 'projects', '$user->rights->projet->lire', '', 2, 4, __ENTITY__);
+insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->project->enabled && !$conf->global->PROJECT_HIDE_TASKS', __HANDLER__, 'left', 3700__+MAX_llx_menu__, 'project', '', 7__+MAX_llx_menu__, '/projet/activity/index.php?mainmenu=project&leftmenu=projects', 'Activities', 0, 'projects', '$user->rights->projet->lire', '', 2, 0, __ENTITY__);
+insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->project->enabled && !$conf->global->PROJECT_HIDE_TASKS', __HANDLER__, 'left', 3701__+MAX_llx_menu__, 'project', '', 3700__+MAX_llx_menu__, '/projet/tasks.php?mainmenu=project&leftmenu=projects&action=create', 'NewTask', 1, 'projects', '$user->rights->projet->creer', '', 2, 1, __ENTITY__);
+insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->project->enabled && !$conf->global->PROJECT_HIDE_TASKS', __HANDLER__, 'left', 3702__+MAX_llx_menu__, 'project', '', 3700__+MAX_llx_menu__, '/projet/tasks/list.php?mainmenu=project&leftmenu=projects', 'List', 1, 'projects', '$user->rights->projet->lire', '', 2, 2, __ENTITY__);
+insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->project->enabled && !$conf->global->PROJECT_HIDE_TASKS', __HANDLER__, 'left', 3704__+MAX_llx_menu__, 'project', '', 3700__+MAX_llx_menu__, '/projet/tasks/stats/index.php?mainmenu=project&leftmenu=projects', 'Statistics', 1, 'projects', '$user->rights->projet->lire', '', 2, 4, __ENTITY__);
-insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled && !$conf->global->PROJECT_HIDE_TASKS', __HANDLER__, 'left', 3400__+MAX_llx_menu__, 'project', '', 7__+MAX_llx_menu__, '/projet/activity/perweek.php?mainmenu=project&leftmenu=projects', 'NewTimeSpent', 0, 'projects', '$user->rights->projet->lire', '', 2, 3, __ENTITY__);
+insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->project->enabled && !$conf->global->PROJECT_HIDE_TASKS', __HANDLER__, 'left', 3400__+MAX_llx_menu__, 'project', '', 7__+MAX_llx_menu__, '/projet/activity/perweek.php?mainmenu=project&leftmenu=projects', 'NewTimeSpent', 0, 'projects', '$user->rights->projet->lire', '', 2, 3, __ENTITY__);
-- Project - Categories
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->categorie->enabled', __HANDLER__, 'left', 3804__+MAX_llx_menu__, 'project', 'cat', 7__+MAX_llx_menu__, '/categories/index.php?mainmenu=project&leftmenu=cat&type=6', 'Categories', 0, 'categories', '$user->rights->categorie->lire', '', 2, 4, __ENTITY__);
diff --git a/htdocs/core/menus/standard/auguria.lib.php b/htdocs/core/menus/standard/auguria.lib.php
index ea6d21fe457..adc4f8d487c 100644
--- a/htdocs/core/menus/standard/auguria.lib.php
+++ b/htdocs/core/menus/standard/auguria.lib.php
@@ -229,7 +229,7 @@ function print_start_menu_entry_auguria($idsel, $classname, $showmode)
*/
function print_text_menu_entry_auguria($text, $showmode, $url, $id, $idsel, $classname, $atarget)
{
- global $langs;
+ global $langs, $conf;
$classnameimg = str_replace('class="', 'class="tmenuimage ', $classname);
$classnametxt = str_replace('class="', 'class="tmenulabel ', $classname);
@@ -339,7 +339,7 @@ function print_left_auguria_menu($db, $menu_array_before, $menu_array_after, &$t
$newmenu = $menuArbo->menuLeftCharger($newmenu, $mainmenu, $leftmenu, ($user->socid ? 1 : 0), 'auguria', $tabMenu);
// We update newmenu for special dynamic menus
- if (!empty($conf->banque->enabled) && $user->rights->banque->lire && $mainmenu == 'bank') { // Entry for each bank account
+ if (isModEnabled('banque') && $user->rights->banque->lire && $mainmenu == 'bank') { // Entry for each bank account
include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // Required for to get Account::TYPE_CASH for example
$sql = "SELECT rowid, label, courant, rappro, courant";
@@ -371,7 +371,7 @@ function print_left_auguria_menu($db, $menu_array_before, $menu_array_after, &$t
$db->free($resql);
}
- if (!empty($conf->accounting->enabled) && !empty($user->rights->accounting->comptarapport->lire) && $mainmenu == 'accountancy') { // Entry in accountancy journal for each bank account
+ if (isModEnabled('accounting') && !empty($user->rights->accounting->comptarapport->lire) && $mainmenu == 'accountancy') { // Entry in accountancy journal for each bank account
$newmenu->add('', $langs->trans("RegistrationInAccounting"), 1, $user->rights->accounting->comptarapport->lire, '', 'accountancy', 'accountancy', 10);
// Multi journal
@@ -393,18 +393,18 @@ function print_left_auguria_menu($db, $menu_array_before, $menu_array_after, &$t
$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)) {
+ if ($objp->nature == 2 && isModEnabled('facture') && 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))
+ && ((isModEnabled('fournisseur') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled('supplier_invoice'))
&& empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_PURCHASES)) {
$nature = "purchases";
}
- if ($objp->nature == 4 && !empty($conf->banque->enabled)) {
+ if ($objp->nature == 4 && isModEnabled('banque')) {
$nature = "bank";
}
- if ($objp->nature == 5 && !empty($conf->expensereport->enabled) && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS)) {
+ if ($objp->nature == 5 && isModEnabled('expensereport') && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS)) {
$nature = "expensereports";
}
if ($objp->nature == 1) {
@@ -441,7 +441,7 @@ function print_left_auguria_menu($db, $menu_array_before, $menu_array_after, &$t
$db->free($resql);
}
- if (!empty($conf->ftp->enabled) && $mainmenu == 'ftp') { // Entry for FTP
+ if (isModEnabled('ftp') && $mainmenu == 'ftp') { // Entry for FTP
$MAXFTP = 20;
$i = 1;
while ($i <= $MAXFTP) {
diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php
index 61d9872e09f..9e88d4dda3d 100644
--- a/htdocs/core/menus/standard/eldy.lib.php
+++ b/htdocs/core/menus/standard/eldy.lib.php
@@ -94,7 +94,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout =
// Members
$tmpentry = array(
- 'enabled' => (!empty($conf->adherent->enabled)),
+ 'enabled' => (isModEnabled('adherent')),
'perms' => (!empty($user->rights->adherent->lire)),
'module' => 'adherent'
);
@@ -119,10 +119,10 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout =
// Third parties
$tmpentry = array(
- 'enabled'=> ((!empty($conf->societe->enabled) &&
+ 'enabled'=> ((isModEnabled('societe') &&
(empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS))
)
- || ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled))
+ || ((isModEnabled('fournisseur') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled('supplier_order') || isModEnabled('supplier_invoice'))
),
'perms'=> (!empty($user->rights->societe->lire) || !empty($user->rights->fournisseur->lire) || !empty($user->rights->supplier_order->lire) || !empty($user->rights->supplier_invoice->lire) || !empty($user->rights->supplier_proposal->lire)),
'module'=>'societe|fournisseur'
@@ -148,16 +148,16 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout =
// Products-Services
$tmpentry = array(
- 'enabled'=> (!empty($conf->product->enabled) || !empty($conf->service->enabled) || !empty($conf->expedition->enabled)),
+ 'enabled'=> (isModEnabled('product') || isModEnabled('service') || isModEnabled('expedition')),
'perms'=> (!empty($user->rights->produit->lire) || !empty($user->rights->service->lire) || !empty($user->rights->expedition->lire)),
'module'=>'product|service'
);
$menu_arr[] = array(
'name' => 'Products',
'link' => '/product/index.php?mainmenu=products&leftmenu=',
- 'title' => (!empty($conf->product->enabled) && !empty($conf->service->enabled))
+ 'title' => (isModEnabled('product') && isModEnabled('service'))
? (array("TMenuProducts", " | ", "TMenuServices"))
- : (!empty($conf->product->enabled) ? "TMenuProducts" : "TMenuServices"),
+ : (isModEnabled('product') ? "TMenuProducts" : "TMenuServices"),
'level' => 0,
'enabled' => $showmode = isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal),
'target' => $atarget,
@@ -175,7 +175,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout =
// MRP - GPAO
$tmpentry = array(
- 'enabled'=>(!empty($conf->bom->enabled) || !empty($conf->mrp->enabled)),
+ 'enabled'=>(isModEnabled('bom') || isModEnabled('mrp')),
'perms'=>(!empty($user->rights->bom->read) || !empty($user->rights->mrp->read)),
'module'=>'bom|mrp'
);
@@ -200,7 +200,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout =
// Projects
$tmpentry = array(
- 'enabled'=> (!empty($conf->projet->enabled) ? 1 : 0),
+ 'enabled'=> (isModEnabled('projet') ? 1 : 0),
'perms'=> (!empty($user->rights->projet->lire) ? 1 : 0),
'module'=>'projet'
);
@@ -225,13 +225,13 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout =
// Commercial (propal, commande, supplier_proposal, supplier_order, contrat, ficheinter)
$tmpentry = array(
- 'enabled'=>(!empty($conf->propal->enabled)
- || !empty($conf->commande->enabled)
- || !empty($conf->fournisseur->enabled)
- || !empty($conf->supplier_proposal->enabled)
- || !empty($conf->supplier_order->enabled)
- || !empty($conf->contrat->enabled)
- || !empty($conf->ficheinter->enabled)
+ 'enabled'=>(isModEnabled('propal')
+ || isModEnabled('commande')
+ || isModEnabled('fournisseur')
+ || isModEnabled('supplier_proposal')
+ || isModEnabled('supplier_order')
+ || isModEnabled('contrat')
+ || isModEnabled('ficheinter')
) ? 1 : 0,
'perms'=>(!empty($user->rights->propal->lire)
|| !empty($user->rights->commande->lire)
@@ -274,13 +274,13 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout =
// Billing - Financial
$tmpentry = array(
- 'enabled'=>(!empty($conf->facture->enabled) ||
- !empty($conf->don->enabled) ||
- !empty($conf->tax->enabled) ||
- !empty($conf->salaries->enabled) ||
- !empty($conf->supplier_invoice->enabled) ||
- !empty($conf->loan->enabled) ||
- !empty($conf->margins->enabled)
+ 'enabled'=>(isModEnabled('facture') ||
+ isModEnabled('don') ||
+ isModEnabled('tax') ||
+ isModEnabled('salaries') ||
+ isModEnabled('supplier_invoice') ||
+ isModEnabled('loan') ||
+ isModEnabled('margins')
) ? 1 : 0,
'perms'=>(!empty($user->rights->facture->lire) || !empty($user->rights->don->contact->lire)
|| !empty($user->rights->tax->charges->lire) || !empty($user->rights->salaries->read)
@@ -308,7 +308,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout =
// Bank
$tmpentry = array(
- 'enabled'=>(!empty($conf->banque->enabled) || !empty($conf->prelevement->enabled)),
+ 'enabled'=>(isModEnabled('banque') || isModEnabled('prelevement')),
'perms'=>(!empty($user->rights->banque->lire) || !empty($user->rights->prelevement->lire) || !empty($user->rights->paymentbybanktransfer->read)),
'module'=>'banque|prelevement|paymentbybanktransfer'
);
@@ -333,7 +333,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout =
// Accounting
$tmpentry = array(
- 'enabled'=>(!empty($conf->comptabilite->enabled) || !empty($conf->accounting->enabled) || !empty($conf->asset->enabled) || !empty($conf->intracommreport->enabled)),
+ 'enabled'=>(isModEnabled('comptabilite') || isModEnabled('accounting') || isModEnabled('asset') || isModEnabled('intracommreport')),
'perms'=>(!empty($user->rights->compta->resultat->lire) || !empty($user->rights->accounting->comptarapport->lire) || !empty($user->rights->accounting->mouvements->lire) || !empty($user->rights->asset->read) || !empty($user->rights->intracommreport->read)),
'module'=>'comptabilite|accounting|asset|intracommreport'
);
@@ -358,7 +358,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout =
// HRM
$tmpentry = array(
- 'enabled'=>(!empty($conf->hrm->enabled) || (!empty($conf->holiday->enabled)) || !empty($conf->deplacement->enabled) || !empty($conf->expensereport->enabled) || !empty($conf->recruitment->enabled)),
+ 'enabled'=>(isModEnabled('hrm') || (isModEnabled('holiday')) || isModEnabled('deplacement') || isModEnabled('expensereport') || isModEnabled('recruitment')),
'perms'=>(!empty($user->rights->user->user->lire) || !empty($user->rights->holiday->read) || !empty($user->rights->deplacement->lire) || !empty($user->rights->expensereport->lire) || !empty($user->rights->recruitment->recruitmentjobposition->read)),
'module'=>'hrm|holiday|deplacement|expensereport|recruitment'
);
@@ -384,12 +384,12 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout =
// Tickets and knowledge base
$tmpentry = array(
- 'enabled'=>(!empty($conf->ticket->enabled) || !empty($conf->knowledgemanagement->enabled)),
+ 'enabled'=>(isModEnabled('ticket') || isModEnabled('knowledgemanagement')),
'perms'=>(!empty($user->rights->ticket->read) || !empty($user->rights->knowledgemanagement->knowledgerecord->read)),
'module'=>'ticket|knowledgemanagement'
);
$link = '';
- if (!empty($conf->ticket->enabled)) {
+ if (isModEnabled('ticket')) {
$link = '/ticket/index.php?mainmenu=ticket&leftmenu=';
} else {
$link = '/knowledgemanagement/knowledgerecord_list.php?mainmenu=ticket&leftmenu=';
@@ -827,7 +827,7 @@ 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 (isModEnabled('ftp') && $mainmenu == 'ftp') { // Entry for FTP
$MAXFTP = 20;
$i = 1;
while ($i <= $MAXFTP) {
@@ -1142,7 +1142,7 @@ function get_left_menu_home($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu =
$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 (isModEnabled('product') || isModEnabled('service')) {
$langs->load("products");
$newmenu->add("/product/admin/product_tools.php?mainmenu=home&leftmenu=admintools", $langs->trans("ProductVatMassChange"), 1, $user->admin);
}
@@ -1152,16 +1152,16 @@ function get_left_menu_home($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu =
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/card.php?leftmenu=users&action=create", $langs->trans("NewUser"), 2, ($user->rights->user->user->creer || $user->admin) && !(isModEnabled('multicompany') && $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 (isModEnabled('categorie')) {
$langs->load("categories");
$newmenu->add("/categories/index.php?leftmenu=users&type=7", $langs->trans("UsersCategoriesShort"), 2, $user->rights->categorie->lire, '', $mainmenu, 'cat');
}
- $newmenu->add("", $langs->trans("Groups"), 1, ($user->rights->user->user->lire || $user->admin) && !(!empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE));
- $newmenu->add("/user/group/card.php?leftmenu=users&action=create", $langs->trans("NewGroup"), 2, ((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) ? $user->rights->user->group_advance->write : $user->rights->user->user->creer) || $user->admin) && !(!empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE));
- $newmenu->add("/user/group/list.php?leftmenu=users", $langs->trans("ListOfGroups"), 2, ((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) ? $user->rights->user->group_advance->read : $user->rights->user->user->lire) || $user->admin) && !(!empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE));
+ $newmenu->add("", $langs->trans("Groups"), 1, ($user->rights->user->user->lire || $user->admin) && !(isModEnabled('multicompany') && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE));
+ $newmenu->add("/user/group/card.php?leftmenu=users&action=create", $langs->trans("NewGroup"), 2, ((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) ? $user->rights->user->group_advance->write : $user->rights->user->user->creer) || $user->admin) && !(isModEnabled('multicompany') && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE));
+ $newmenu->add("/user/group/list.php?leftmenu=users", $langs->trans("ListOfGroups"), 2, ((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) ? $user->rights->user->group_advance->read : $user->rights->user->user->lire) || $user->admin) && !(isModEnabled('multicompany') && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE));
}
}
}
@@ -1183,7 +1183,7 @@ function get_left_menu_thridparties($mainmenu, &$newmenu, $usemenuhider = 1, $le
if ($mainmenu == 'companies') {
// Societes
- if (!empty($conf->societe->enabled)) {
+ if (isModEnabled('societe')) {
$langs->load("companies");
$newmenu->add("/societe/index.php?leftmenu=thirdparties", $langs->trans("ThirdParty"), 0, $user->rights->societe->lire, '', $mainmenu, 'thirdparties', 0, '', '', '', img_picto('', 'company', 'class="paddingright pictofixedwidth"'));
@@ -1198,7 +1198,7 @@ function get_left_menu_thridparties($mainmenu, &$newmenu, $usemenuhider = 1, $le
$newmenu->add("/societe/list.php?leftmenu=thirdparties", $langs->trans("List"), 1);
// Prospects
- if (!empty($conf->societe->enabled) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) {
+ if (isModEnabled('societe') && 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
@@ -1212,7 +1212,7 @@ function get_left_menu_thridparties($mainmenu, &$newmenu, $usemenuhider = 1, $le
}
// Customers/Prospects
- if (!empty($conf->societe->enabled) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) {
+ if (isModEnabled('societe') && 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');
@@ -1220,14 +1220,14 @@ function get_left_menu_thridparties($mainmenu, &$newmenu, $usemenuhider = 1, $le
}
// 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 (isModEnabled('societe') && (((isModEnabled('fournisseur') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled('supplier_order') || isModEnabled('supplier_invoice')) || isModEnabled('supplier_proposal'))) {
$langs->load("suppliers");
$newmenu->add("/societe/list.php?type=f&leftmenu=suppliers", $langs->trans("ListSuppliersShort"), 2, ($user->rights->fournisseur->lire || $user->rights->supplier_order->lire || $user->rights->supplier_invoice->lire || $user->rights->supplier_proposal->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 || $user->rights->supplier_order->lire || $user->rights->supplier_invoice->lire || $user->rights->supplier_proposal->lire));
}
// Categories
- if (!empty($conf->categorie->enabled)) {
+ if (isModEnabled('categorie')) {
$langs->load("categories");
if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) {
// Categories prospects/customers
@@ -1241,7 +1241,7 @@ function get_left_menu_thridparties($mainmenu, &$newmenu, $usemenuhider = 1, $le
$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 ((isModEnabled('fournisseur') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled('supplier_order') || isModEnabled('supplier_invoice')) {
$newmenu->add("/categories/index.php?leftmenu=catfournish&type=1", $langs->trans("SuppliersCategoriesShort"), 1, $user->rights->categorie->lire);
}
}
@@ -1257,14 +1257,14 @@ function get_left_menu_thridparties($mainmenu, &$newmenu, $usemenuhider = 1, $le
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)) {
+ if ((isModEnabled('fournisseur') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled('supplier_order') || isModEnabled('supplier_invoice')) {
$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 (isModEnabled('categorie')) {
$langs->load("categories");
// Categories Contact
$newmenu->add("/categories/index.php?leftmenu=catcontact&type=4", $langs->trans("ContactCategoriesShort"), 1, $user->rights->categorie->lire, '', $mainmenu, 'cat');
@@ -1290,7 +1290,7 @@ function get_left_menu_commercial($mainmenu, &$newmenu, $usemenuhider = 1, $left
$langs->load("companies");
// Customer proposal
- if (!empty($conf->propal->enabled)) {
+ if (isModEnabled('propal')) {
$langs->load("propal");
$newmenu->add("/comm/propal/index.php?leftmenu=propals", $langs->trans("Proposals"), 0, $user->rights->propale->lire, '', $mainmenu, 'propals', 100, '', '', '', img_picto('', 'propal', 'class="paddingright pictofixedwidth"'));
$newmenu->add("/comm/propal/card.php?action=create&leftmenu=propals", $langs->trans("NewPropal"), 1, $user->rights->propale->creer);
@@ -1307,7 +1307,7 @@ function get_left_menu_commercial($mainmenu, &$newmenu, $usemenuhider = 1, $left
}
// Customers orders
- if (!empty($conf->commande->enabled)) {
+ if (isModEnabled('commande')) {
$langs->load("orders");
$newmenu->add("/commande/index.php?leftmenu=orders", $langs->trans("CustomersOrders"), 0, $user->rights->commande->lire, '', $mainmenu, 'orders', 200, '', '', '', img_picto('', 'order', 'class="paddingright pictofixedwidth"'));
$newmenu->add("/commande/card.php?action=create&leftmenu=orders", $langs->trans("NewOrder"), 1, $user->rights->commande->creer);
@@ -1315,7 +1315,7 @@ function get_left_menu_commercial($mainmenu, &$newmenu, $usemenuhider = 1, $left
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)) {
+ if (isModEnabled('expedition')) {
$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);
@@ -1326,7 +1326,7 @@ function get_left_menu_commercial($mainmenu, &$newmenu, $usemenuhider = 1, $left
}
// Supplier proposal
- if (!empty($conf->supplier_proposal->enabled)) {
+ if (isModEnabled('supplier_proposal')) {
$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, '', '', '', img_picto('', 'supplier_proposal', 'class="paddingright pictofixedwidth"'));
$newmenu->add("/supplier_proposal/card.php?action=create&leftmenu=supplier_proposals", $langs->trans("SupplierProposalNew"), 1, $user->rights->supplier_proposal->creer);
@@ -1335,7 +1335,7 @@ function get_left_menu_commercial($mainmenu, &$newmenu, $usemenuhider = 1, $left
}
// Suppliers orders
- if (!empty($conf->supplier_order->enabled)) {
+ if (isModEnabled('supplier_order')) {
$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, '', '', '', img_picto('', 'supplier_order', 'class="paddingright pictofixedwidth"'));
$newmenu->add("/fourn/commande/card.php?action=create&leftmenu=orders_suppliers", $langs->trans("NewSupplierOrderShort"), 1, $user->rights->fournisseur->commande->creer);
@@ -1360,7 +1360,7 @@ function get_left_menu_commercial($mainmenu, &$newmenu, $usemenuhider = 1, $left
}
// Contrat
- if (!empty($conf->contrat->enabled)) {
+ if (isModEnabled('contrat')) {
$langs->load("contracts");
$newmenu->add("/contrat/index.php?leftmenu=contracts", $langs->trans("ContractsSubscriptions"), 0, $user->rights->contrat->lire, '', $mainmenu, 'contracts', 2000, '', '', '', img_picto('', 'contract', 'class="paddingright pictofixedwidth"'));
$newmenu->add("/contrat/card.php?action=create&leftmenu=contracts", $langs->trans("NewContractSubscription"), 1, $user->rights->contrat->creer);
@@ -1375,7 +1375,7 @@ function get_left_menu_commercial($mainmenu, &$newmenu, $usemenuhider = 1, $left
}
// Interventions
- if (!empty($conf->ficheinter->enabled)) {
+ if (isModEnabled('ficheinter')) {
$langs->load("interventions");
$newmenu->add("/fichinter/index.php?leftmenu=ficheinter", $langs->trans("Interventions"), 0, $user->rights->ficheinter->lire, '', $mainmenu, 'ficheinter', 2200, '', '', '', img_picto('', 'intervention', 'class="paddingright pictofixedwidth"'));
$newmenu->add("/fichinter/card.php?action=create&leftmenu=ficheinter", $langs->trans("NewIntervention"), 1, $user->rights->ficheinter->creer, '', '', '', 201);
@@ -1406,7 +1406,7 @@ function get_left_menu_billing($mainmenu, &$newmenu, $usemenuhider = 1, $leftmen
$langs->load("companies");
// Customers invoices
- if (!empty($conf->facture->enabled)) {
+ if (isModEnabled('facture')) {
$langs->load("bills");
$newmenu->add("/compta/facture/index.php?leftmenu=customers_bills", $langs->trans("BillsCustomers"), 0, $user->rights->facture->lire, '', $mainmenu, 'customers_bills', 0, '', '', '', img_picto('', 'bill', 'class="paddingright pictofixedwidth"'));
$newmenu->add("/compta/facture/card.php?action=create", $langs->trans("NewBill"), 1, $user->rights->facture->creer);
@@ -1433,7 +1433,7 @@ function get_left_menu_billing($mainmenu, &$newmenu, $usemenuhider = 1, $leftmen
}
// Suppliers invoices
- if (!empty($conf->societe->enabled) && !empty($conf->supplier_invoice->enabled)) {
+ if (isModEnabled('societe') && isModEnabled('supplier_invoice')) {
$langs->load("bills");
$newmenu->add("/fourn/facture/index.php?leftmenu=suppliers_bills", $langs->trans("BillsSuppliers"), 0, $user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills', 0, '', '', '', img_picto('', 'supplier_invoice', 'class="paddingright pictofixedwidth"'));
$newmenu->add("/fourn/facture/card.php?leftmenu=suppliers_bills&action=create", $langs->trans("NewBill"), 1, ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer), '', $mainmenu, 'suppliers_bills_create');
@@ -1457,16 +1457,16 @@ function get_left_menu_billing($mainmenu, &$newmenu, $usemenuhider = 1, $leftmen
}
// Orders
- if (!empty($conf->commande->enabled)) {
+ if (isModEnabled('commande')) {
$langs->load("orders");
- if (!empty($conf->facture->enabled)) {
+ if (isModEnabled('facture')) {
$newmenu->add("/commande/list.php?leftmenu=orders&search_status=-3&billed=0&contextpage=billableorders", $langs->trans("MenuOrdersToBill2"), 0, $user->rights->commande->lire, '', $mainmenu, 'orders', 0, '', '', '', img_picto('', 'order', 'class="paddingright pictofixedwidth"'));
}
//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 (isModEnabled('supplier_invoice')) {
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', 0, '', '', '', img_picto('', 'supplier_order', 'class="paddingright pictofixedwidth"'));
@@ -1476,7 +1476,7 @@ function get_left_menu_billing($mainmenu, &$newmenu, $usemenuhider = 1, $leftmen
// Donations
- if (!empty($conf->don->enabled)) {
+ if (isModEnabled('don')) {
$langs->load("donations");
$newmenu->add("/don/index.php?leftmenu=donations&mainmenu=billing", $langs->trans("Donations"), 0, $user->rights->don->lire, '', $mainmenu, 'donations', 0, '', '', '', img_picto('', 'donation', 'class="paddingright pictofixedwidth"'));
if ($usemenuhider || empty($leftmenu) || $leftmenu == "donations") {
@@ -1487,7 +1487,7 @@ function get_left_menu_billing($mainmenu, &$newmenu, $usemenuhider = 1, $leftmen
}
// Taxes and social contributions
- if (!empty($conf->tax->enabled)) {
+ if (isModEnabled('tax')) {
$newmenu->add("/compta/charges/index.php?leftmenu=tax&mainmenu=billing", $langs->trans("MenuTaxesAndSpecialExpenses"), 0, $user->rights->tax->charges->lire, '', $mainmenu, 'tax', 0, '', '', '', img_picto('', 'payment', 'class="paddingright pictofixedwidth"'));
$newmenu->add("/compta/sociales/list.php?leftmenu=tax_social", $langs->trans("MenuSocialContributions"), 1, $user->rights->tax->charges->lire);
@@ -1536,7 +1536,7 @@ function get_left_menu_billing($mainmenu, &$newmenu, $usemenuhider = 1, $leftmen
}
// Salaries
- if (!empty($conf->salaries->enabled)) {
+ if (isModEnabled('salaries')) {
$langs->load("salaries");
$newmenu->add("/salaries/list.php?leftmenu=tax_salary&mainmenu=billing", $langs->trans("Salaries"), 0, $user->rights->salaries->read, '', $mainmenu, 'tax_salary', 0, '', '', '', img_picto('', 'salary', 'class="paddingright pictofixedwidth"'));
if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_salary/i', $leftmenu)) {
@@ -1548,7 +1548,7 @@ function get_left_menu_billing($mainmenu, &$newmenu, $usemenuhider = 1, $leftmen
}
// Loan
- if (!empty($conf->loan->enabled)) {
+ if (isModEnabled('loan')) {
$langs->load("loan");
$newmenu->add("/loan/list.php?leftmenu=tax_loan&mainmenu=billing", $langs->trans("Loans"), 0, $user->rights->loan->read, '', $mainmenu, 'tax_loan', 0, '', '', '', img_picto('', 'loan', 'class="paddingright pictofixedwidth"'));
if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_loan/i', $leftmenu)) {
@@ -1558,7 +1558,7 @@ function get_left_menu_billing($mainmenu, &$newmenu, $usemenuhider = 1, $leftmen
}
// Various payment
- if (!empty($conf->banque->enabled) && empty($conf->global->BANK_USE_OLD_VARIOUS_PAYMENT)) {
+ if (isModEnabled('banque') && 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', 0, '', '', '', img_picto('', 'payment', 'class="paddingright pictofixedwidth"'));
if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_various/i', $leftmenu)) {
@@ -1588,8 +1588,8 @@ function get_left_menu_accountancy($mainmenu, &$newmenu, $usemenuhider = 1, $lef
$langs->load("companies");
// Accounting (Double entries)
- if (!empty($conf->accounting->enabled)) {
- //$permtoshowmenu = (!empty($conf->accounting->enabled) || $user->rights->accounting->bind->write || $user->rights->compta->resultat->lire);
+ if (isModEnabled('accounting')) {
+ //$permtoshowmenu = (isModEnabled('accounting') || $user->rights->accounting->bind->write || $user->rights->compta->resultat->lire);
//$newmenu->add("/accountancy/index.php?leftmenu=accountancy", $langs->trans("MenuAccountancy"), 0, $permtoshowmenu, '', $mainmenu, 'accountancy');
// Configuration
@@ -1609,16 +1609,16 @@ function get_left_menu_accountancy($mainmenu, &$newmenu, $usemenuhider = 1, $lef
$newmenu->add("/accountancy/admin/subaccount.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("ChartOfSubaccounts"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_chart', 41);
$newmenu->add("/accountancy/admin/categories_list.php?id=32&search_country_id=".$mysoc->country_id."&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("AccountingCategory"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_chart', 50);
$newmenu->add("/accountancy/admin/defaultaccounts.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuDefaultAccounts"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_default', 60);
- if (!empty($conf->banque->enabled)) {
+ if (isModEnabled('banque')) {
$newmenu->add("/compta/bank/list.php?mainmenu=accountancy&leftmenu=accountancy_admin&search_status=-1", $langs->trans("MenuBankAccounts"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_bank', 70);
}
- if (!empty($conf->facture->enabled) || ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_invoice->enabled))) {
+ if (isModEnabled('facture') || ((isModEnabled('fournisseur') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled('supplier_invoice'))) {
$newmenu->add("/admin/dict.php?id=10&from=accountancy&search_country_id=".$mysoc->country_id."&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuVatAccounts"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_default', 80);
}
- if (!empty($conf->tax->enabled)) {
+ if (isModEnabled('tax')) {
$newmenu->add("/admin/dict.php?id=7&from=accountancy&search_country_id=".$mysoc->country_id."&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuTaxAccounts"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_default', 90);
}
- if (!empty($conf->expensereport->enabled)) {
+ if (isModEnabled('expensereport')) {
$newmenu->add("/admin/dict.php?id=17&from=accountancy&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuExpenseReportAccounts"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_default', 100);
}
$newmenu->add("/accountancy/admin/productaccount.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuProductsAccounts"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_product', 110);
@@ -1633,21 +1633,21 @@ function get_left_menu_accountancy($mainmenu, &$newmenu, $usemenuhider = 1, $lef
// 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 (isModEnabled('facture') && 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 (isModEnabled('supplier_invoice') && 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 (isModEnabled('expensereport') && 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);
@@ -1656,7 +1656,7 @@ function get_left_menu_accountancy($mainmenu, &$newmenu, $usemenuhider = 1, $lef
}
// Journals
- if (!empty($conf->accounting->enabled) && !empty($user->rights->accounting->comptarapport->lire) && $mainmenu == 'accountancy') {
+ if (isModEnabled('accounting') && !empty($user->rights->accounting->comptarapport->lire) && $mainmenu == 'accountancy') {
$newmenu->add('', $langs->trans("RegistrationInAccounting"), 1, $user->rights->accounting->comptarapport->lire, '', '', '');
// Multi journal
@@ -1678,21 +1678,21 @@ function get_left_menu_accountancy($mainmenu, &$newmenu, $usemenuhider = 1, $lef
$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)) {
+ if ($objp->nature == 2 && isModEnabled('facture') && 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))
+ && ((isModEnabled('fournisseur') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled('supplier_invoice'))
&& empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_PURCHASES)) {
$nature = "purchases";
}
- if ($objp->nature == 4 && !empty($conf->banque->enabled)) {
+ if ($objp->nature == 4 && isModEnabled('banque')) {
$nature = "bank";
}
- if ($objp->nature == 5 && !empty($conf->expensereport->enabled) && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS)) {
+ if ($objp->nature == 5 && isModEnabled('expensereport') && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS)) {
$nature = "expensereports";
}
- if ($objp->nature == 1 && !empty($conf->asset->enabled)) {
+ if ($objp->nature == 1 && isModEnabled('asset')) {
$nature = "various"; // Warning: The page /accountancy/journal/variousjournal.php is bugged. It read tables that does not exists.
}
if ($objp->nature == 8) {
@@ -1757,7 +1757,7 @@ function get_left_menu_accountancy($mainmenu, &$newmenu, $usemenuhider = 1, $lef
}
$modecompta = 'CREANCES-DETTES';
- if (!empty($conf->accounting->enabled) && !empty($user->rights->accounting->comptarapport->lire) && $mainmenu == 'accountancy') {
+ if (isModEnabled('accounting') && !empty($user->rights->accounting->comptarapport->lire) && $mainmenu == 'accountancy') {
$modecompta = 'BOOKKEEPING'; // Not yet implemented. Should be BOOKKEEPINGCOLLECTED
}
if ($modecompta) {
@@ -1771,7 +1771,7 @@ function get_left_menu_accountancy($mainmenu, &$newmenu, $usemenuhider = 1, $lef
}
$modecompta = 'RECETTES-DEPENSES';
- //if (! empty($conf->accounting->enabled) && ! empty($user->rights->accounting->comptarapport->lire) && $mainmenu == 'accountancy') $modecompta=''; // Not yet implemented. Should be BOOKKEEPINGCOLLECTED
+ //if (isModEnabled('accounting') && ! empty($user->rights->accounting->comptarapport->lire) && $mainmenu == 'accountancy') $modecompta=''; // 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("ReportTurnoverCollected"), 2, $user->rights->accounting->comptarapport->lire);
@@ -1783,10 +1783,10 @@ function get_left_menu_accountancy($mainmenu, &$newmenu, $usemenuhider = 1, $lef
}
$modecompta = 'CREANCES-DETTES';
- if (!empty($conf->accounting->enabled) && !empty($user->rights->accounting->comptarapport->lire) && $mainmenu == 'accountancy') {
+ if (isModEnabled('accounting') && !empty($user->rights->accounting->comptarapport->lire) && $mainmenu == 'accountancy') {
$modecompta = 'BOOKKEEPING'; // Not yet implemented.
}
- if ($modecompta && ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_invoice->enabled))) {
+ if ($modecompta && ((isModEnabled('fournisseur') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled('supplier_invoice'))) {
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);
@@ -1795,10 +1795,10 @@ function get_left_menu_accountancy($mainmenu, &$newmenu, $usemenuhider = 1, $lef
}
$modecompta = 'RECETTES-DEPENSES';
- if (!empty($conf->accounting->enabled) && !empty($user->rights->accounting->comptarapport->lire) && $mainmenu == 'accountancy') {
+ if (isModEnabled('accounting') && !empty($user->rights->accounting->comptarapport->lire) && $mainmenu == 'accountancy') {
$modecompta = 'BOOKKEEPINGCOLLECTED'; // Not yet implemented.
}
- if ($modecompta && ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_invoice->enabled))) {
+ if ($modecompta && ((isModEnabled('fournisseur') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled('supplier_invoice'))) {
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);
@@ -1807,7 +1807,7 @@ function get_left_menu_accountancy($mainmenu, &$newmenu, $usemenuhider = 1, $lef
}
// Accountancy (simple)
- if (!empty($conf->comptabilite->enabled)) {
+ if (isModEnabled('comptabilite')) {
// Files
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');
@@ -1826,7 +1826,7 @@ function get_left_menu_accountancy($mainmenu, &$newmenu, $usemenuhider = 1, $lef
/*
$newmenu->add("/compta/stats/cumul.php?leftmenu=report","Cumule",2,$user->rights->compta->resultat->lire);
- if (! empty($conf->propal->enabled)) {
+ if (isModEnabled('propal')) {
$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);
}
@@ -1865,7 +1865,7 @@ function get_left_menu_accountancy($mainmenu, &$newmenu, $usemenuhider = 1, $lef
}
// Intracomm report
- if (!empty($conf->intracommreport->enabled)) {
+ if (isModEnabled('intracommreport')) {
$newmenu->add("/intracommreport/list.php?leftmenu=intracommreport", $langs->trans("MenuIntracommReport"), 0, $user->rights->intracommreport->read, '', $mainmenu, 'intracommreport', 60, '', '', '', img_picto('', 'intracommreport', 'class="paddingright pictofixedwidth"'));
if ($usemenuhider || empty($leftmenu) || preg_match('/intracommreport/', $leftmenu)) {
// DEB / DES
@@ -1875,7 +1875,7 @@ function get_left_menu_accountancy($mainmenu, &$newmenu, $usemenuhider = 1, $lef
}
// Assets
- if (!empty($conf->asset->enabled)) {
+ if (isModEnabled('asset')) {
$newmenu->add("/asset/list.php?leftmenu=asset&mainmenu=accountancy", $langs->trans("MenuAssets"), 0, $user->rights->asset->read, '', $mainmenu, 'asset', 100, '', '', '', img_picto('', 'payment', 'class="paddingright pictofixedwidth"'));
$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);
@@ -1907,7 +1907,7 @@ function get_left_menu_bank($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu =
$langs->loadLangs(array("withdrawals", "banks", "bills", "categories"));
// Bank-Cash account
- if (!empty($conf->banque->enabled)) {
+ if (isModEnabled('banque')) {
$newmenu->add("/compta/bank/list.php?leftmenu=bank&mainmenu=bank", $langs->trans("MenuBankCash"), 0, $user->rights->banque->lire, '', $mainmenu, 'bank', 0, '', '', '', img_picto('', 'bank_account', 'class="paddingright pictofixedwidth"'));
$newmenu->add("/compta/bank/card.php?action=create", $langs->trans("MenuNewFinancialAccount"), 1, $user->rights->banque->configurer);
@@ -1918,14 +1918,14 @@ function get_left_menu_bank($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu =
$newmenu->add("/compta/bank/transfer.php", $langs->trans("MenuBankInternalTransfer"), 1, $user->rights->banque->transfer);
}
- if (!empty($conf->categorie->enabled)) {
+ if (isModEnabled('categorie')) {
$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 (isModEnabled('prelevement')) {
$newmenu->add("/compta/prelevement/index.php?leftmenu=withdraw&mainmenu=bank", $langs->trans("PaymentByDirectDebit"), 0, $user->rights->prelevement->bons->lire, '', $mainmenu, 'withdraw', 0, '', '', '', img_picto('', 'payment', 'class="paddingright pictofixedwidth"'));
if ($usemenuhider || empty($leftmenu) || $leftmenu == "withdraw") {
@@ -1939,7 +1939,7 @@ function get_left_menu_bank($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu =
}
// Bank transfer order
- if (!empty($conf->paymentbybanktransfer->enabled)) {
+ if (isModEnabled('paymentbybanktransfer')) {
$newmenu->add("/compta/paymentbybanktransfer/index.php?leftmenu=banktransfer&mainmenu=bank", $langs->trans("PaymentByBankTransfer"), 0, $user->rights->paymentbybanktransfer->read, '', $mainmenu, 'banktransfer', 0, '', '', '', img_picto('', 'payment', 'class="paddingright pictofixedwidth"'));
if ($usemenuhider || empty($leftmenu) || $leftmenu == "banktransfer") {
@@ -1953,7 +1953,7 @@ function get_left_menu_bank($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu =
}
// 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) && isModEnabled('banque') && (isModEnabled('facture') || !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', 0, '', '', '', img_picto('', 'payment', 'class="paddingright pictofixedwidth"'));
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);
@@ -1962,7 +1962,7 @@ function get_left_menu_bank($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu =
}
// Cash Control
- if (!empty($conf->takepos->enabled) || !empty($conf->cashdesk->enabled)) {
+ if (isModEnabled('takepos') || isModEnabled('cashdesk')) {
$permtomakecashfence = ($user->hasRight('cashdesk', 'run')|| $user->hasRight('takepos', 'run'));
$newmenu->add("/compta/cashcontrol/cashcontrol_list.php?action=list", $langs->trans("POS"), 0, $permtomakecashfence, '', $mainmenu, 'cashcontrol', 0, '', '', '', img_picto('', 'pos', 'class="pictofixedwidth"'));
$newmenu->add("/compta/cashcontrol/cashcontrol_card.php?action=create", $langs->trans("NewCashFence"), 1, $permtomakecashfence);
@@ -1987,27 +1987,27 @@ function get_left_menu_products($mainmenu, &$newmenu, $usemenuhider = 1, $leftme
if ($mainmenu == 'products') {
// Products
- if (!empty($conf->product->enabled)) {
+ if (isModEnabled('product')) {
$newmenu->add("/product/index.php?leftmenu=product&type=0", $langs->trans("Products"), 0, $user->rights->produit->lire, '', $mainmenu, 'product', 0, '', '', '', img_picto('', 'product', 'class="pictofixedwidth"'));
$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 (isModEnabled('stock')) {
$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 (isModEnabled('productbatch')) {
$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 (isModEnabled('variants')) {
$newmenu->add("/variants/list.php", $langs->trans("VariantAttributes"), 1, $user->rights->produit->lire);
}
- if (!empty($conf->propal->enabled) || (!empty($conf->commande->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->facture->enabled) || !empty($conf->fournisseur->enabled) || !empty($conf->supplier_proposal->enabled) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->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);
+ if (isModEnabled('propal') || (isModEnabled('commande') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled('facture') || isModEnabled('fournisseur') || isModEnabled('supplier_proposal') || isModEnabled('supplier_order') || isModEnabled('supplier_invoice')) {
+ $newmenu->add("/product/stats/card.php?id=all&leftmenu=stats&type=0", $langs->trans("Statistics"), 1, $user->rights->produit->lire);
}
// Categories
- if (!empty($conf->categorie->enabled)) {
+ if (isModEnabled('categorie')) {
$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);
@@ -2015,15 +2015,15 @@ function get_left_menu_products($mainmenu, &$newmenu, $usemenuhider = 1, $leftme
}
// Services
- if (!empty($conf->service->enabled)) {
+ if (isModEnabled('service')) {
$newmenu->add("/product/index.php?leftmenu=service&type=1", $langs->trans("Services"), 0, $user->rights->service->lire, '', $mainmenu, 'service', 0, '', '', '', img_picto('', 'service', 'class="pictofixedwidth"'));
$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->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_proposal->enabled) || !empty($conf->supplier_oder->enabled) || !empty($conf->supplier_invoice->enabled)) {
- $newmenu->add("/product/stats/card.php?id=all&leftmenu=stats&type=1", $langs->trans("Statistics"), 1, $user->rights->service->lire || $user->rights->product->lire);
+ if (isModEnabled('propal') || isModEnabled('commande') || isModEnabled('facture') || (isModEnabled('fournisseur') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled('supplier_proposal') || isModEnabled('supplier_order') || isModEnabled('supplier_invoice')) {
+ $newmenu->add("/product/stats/card.php?id=all&leftmenu=stats&type=1", $langs->trans("Statistics"), 1, $user->rights->service->lire);
}
// Categories
- if (!empty($conf->categorie->enabled)) {
+ if (isModEnabled('categorie')) {
$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);
@@ -2057,7 +2057,7 @@ function get_left_menu_products($mainmenu, &$newmenu, $usemenuhider = 1, $leftme
}
// Inventory
- if (!empty($conf->stock->enabled)) {
+ if (isModEnabled('stock')) {
$langs->load("stocks");
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', 0, '', '', '', img_picto('', 'inventory', 'class="pictofixedwidth"'));
@@ -2075,7 +2075,7 @@ function get_left_menu_products($mainmenu, &$newmenu, $usemenuhider = 1, $leftme
}
// Shipments
- if (!empty($conf->expedition->enabled)) {
+ if (isModEnabled('expedition')) {
$langs->load("sendings");
$newmenu->add("/expedition/index.php?leftmenu=sendings", $langs->trans("Shipments"), 0, $user->rights->expedition->lire, '', $mainmenu, 'sendings', 0, '', '', '', img_picto('', 'shipment', 'class="pictofixedwidth"'));
$newmenu->add("/expedition/card.php?action=create2&leftmenu=sendings", $langs->trans("NewSending"), 1, $user->rights->expedition->creer);
@@ -2089,7 +2089,7 @@ function get_left_menu_products($mainmenu, &$newmenu, $usemenuhider = 1, $leftme
}
// Receptions
- if (!empty($conf->reception->enabled)) {
+ if (isModEnabled('reception')) {
$langs->load("receptions");
$newmenu->add("/reception/index.php?leftmenu=receptions", $langs->trans("Receptions"), 0, $user->rights->reception->lire, '', $mainmenu, 'receptions', 0, '', '', '', img_picto('', 'dollyrevert', 'class="pictofixedwidth"'));
$newmenu->add("/reception/card.php?action=create2&leftmenu=receptions", $langs->trans("NewReception"), 1, $user->rights->reception->creer);
@@ -2124,7 +2124,7 @@ function get_left_menu_mrp($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu =
if ($mainmenu == 'mrp') {
// BOM
- if (!empty($conf->bom->enabled) || !empty($conf->mrp->enabled)) {
+ if (isModEnabled('bom') || isModEnabled('mrp')) {
$langs->load("mrp");
$newmenu->add("", $langs->trans("MenuBOM"), 0, $user->rights->bom->read, '', $mainmenu, 'bom', 0, '', '', '', img_picto('', 'bom', 'class="paddingrightonly pictofixedwidth"'));
@@ -2132,7 +2132,7 @@ function get_left_menu_mrp($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu =
$newmenu->add("/bom/bom_list.php?leftmenu=bom", $langs->trans("List"), 1, $user->rights->bom->read, '', $mainmenu, 'bom');
}
- if (!empty($conf->mrp->enabled)) {
+ if (isModEnabled('mrp')) {
$langs->load("mrp");
$newmenu->add("", $langs->trans("MenuMRP"), 0, $user->rights->mrp->read, '', $mainmenu, 'mo', 0, '', '', '', img_picto('', 'mrp', 'class="paddingrightonly pictofixedwidth"'));
@@ -2157,13 +2157,13 @@ function get_left_menu_projects($mainmenu, &$newmenu, $usemenuhider = 1, $leftme
global $user, $conf, $langs;
if ($mainmenu == 'project') {
- if (!empty($conf->projet->enabled)) {
+ if (isModEnabled('projet')) {
$langs->load("projects");
$search_project_user = GETPOST('search_project_user', 'int');
$tmpentry = array(
- 'enabled'=>(!empty($conf->projet->enabled)),
+ 'enabled'=>(isModEnabled('projet')),
'perms'=>(!empty($user->rights->projet->lire)),
'module'=>'projet'
);
@@ -2198,7 +2198,7 @@ function get_left_menu_projects($mainmenu, &$newmenu, $usemenuhider = 1, $leftme
$newmenu->add("/projet/stats/index.php?leftmenu=projects", $langs->trans("Statistics"), 1, $user->rights->projet->lire);
// Categories
- if (!empty($conf->categorie->enabled)) {
+ if (isModEnabled('categorie')) {
$langs->load("categories");
$newmenu->add("/categories/index.php?leftmenu=cat&type=6", $langs->trans("Categories"), 1, $user->rights->categorie->lire, '', $mainmenu, 'cat');
}
@@ -2211,6 +2211,7 @@ function get_left_menu_projects($mainmenu, &$newmenu, $usemenuhider = 1, $leftme
$newmenu->add("/projet/tasks/stats/index.php?leftmenu=projects", $langs->trans("Statistics"), 1, $user->rights->projet->lire);
$newmenu->add("/projet/activity/perweek.php?leftmenu=tasks".($search_project_user ? '&search_project_user='.$search_project_user : ''), $langs->trans("NewTimeSpent"), 0, $user->rights->projet->lire, '', 'project', 'timespent', 0, '', '', '', img_picto('', 'timespent', 'class="pictofixedwidth"'));
+ $newmenu->add("/projet/tasks/time.php?leftmenu=tasks".($search_project_user ? '&search_project_user='.$search_project_user : ''), $langs->trans("List"), 1, $user->rights->projet->lire);
}
}
}
@@ -2232,7 +2233,7 @@ function get_left_menu_hrm($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu =
if ($mainmenu == 'hrm') {
// HRM module
- if (!empty($conf->hrm->enabled)) {
+ if (isModEnabled('hrm')) {
$langs->load("hrm");
$newmenu->add("/user/list.php?mainmenu=hrm&leftmenu=hrm&mode=employee", $langs->trans("Employees"), 0, $user->rights->user->user->lire, '', $mainmenu, 'hrm', 0, '', '', '', img_picto('', 'user', 'class="pictofixedwidth"'));
@@ -2264,7 +2265,7 @@ function get_left_menu_hrm($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu =
}
// Leave/Holiday/Vacation module
- if (!empty($conf->holiday->enabled)) {
+ if (isModEnabled('holiday')) {
// Load translation files required by the page
$langs->loadLangs(array("holiday", "trips"));
@@ -2284,7 +2285,7 @@ function get_left_menu_hrm($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu =
}
// Trips and expenses (old module)
- if (!empty($conf->deplacement->enabled)) {
+ if (isModEnabled('deplacement')) {
$langs->load("trips");
$newmenu->add("/compta/deplacement/index.php?leftmenu=tripsandexpenses&mainmenu=hrm", $langs->trans("TripsAndExpenses"), 0, $user->rights->deplacement->lire, '', $mainmenu, 'tripsandexpenses', 0, '', '', '', img_picto('', 'trip', 'class="pictofixedwidth"'));
$newmenu->add("/compta/deplacement/card.php?action=create&leftmenu=tripsandexpenses&mainmenu=hrm", $langs->trans("New"), 1, $user->rights->deplacement->creer);
@@ -2293,7 +2294,7 @@ function get_left_menu_hrm($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu =
}
// Expense report
- if (!empty($conf->expensereport->enabled)) {
+ if (isModEnabled('expensereport')) {
$langs->loadLangs(array("trips", "bills"));
$newmenu->add("/expensereport/index.php?leftmenu=expensereport&mainmenu=hrm", $langs->trans("TripsAndExpenses"), 0, $user->rights->expensereport->lire, '', $mainmenu, 'expensereport', 0, '', '', '', img_picto('', 'trip', 'class="pictofixedwidth"'));
$newmenu->add("/expensereport/card.php?action=create&leftmenu=expensereport&mainmenu=hrm", $langs->trans("New"), 1, $user->rights->expensereport->creer);
@@ -2310,7 +2311,7 @@ function get_left_menu_hrm($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu =
$newmenu->add("/expensereport/stats/index.php?leftmenu=expensereport&mainmenu=hrm", $langs->trans("Statistics"), 1, $user->rights->expensereport->lire);
}
- if (!empty($conf->projet->enabled)) {
+ if (isModEnabled('projet')) {
if (empty($conf->global->PROJECT_HIDE_TASKS)) {
$langs->load("projects");
@@ -2343,20 +2344,20 @@ function get_left_menu_tools($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu
$newmenu->add("/admin/mails_templates.php?leftmenu=email_templates", $langs->trans("EMailTemplates"), 0, 1, '', $mainmenu, 'email_templates', 0, '', '', '', img_picto('', 'email', 'class="paddingright pictofixedwidth"'));
}
- if (!empty($conf->mailing->enabled)) {
+ if (isModEnabled('mailing')) {
$newmenu->add("/comm/mailing/index.php?leftmenu=mailing", $langs->trans("EMailings"), 0, $user->rights->mailing->lire, '', $mainmenu, 'mailing', 0, '', '', '', img_picto('', 'email', 'class="paddingright pictofixedwidth"'));
$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 (isModEnabled('export')) {
$langs->load("exports");
$newmenu->add("/exports/index.php?leftmenu=export", $langs->trans("FormatedExport"), 0, $user->rights->export->lire, '', $mainmenu, 'export', 0, '', '', '', img_picto('', 'technic', 'class="paddingright pictofixedwidth"'));
$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 (isModEnabled('import')) {
$langs->load("exports");
$newmenu->add("/imports/index.php?leftmenu=import", $langs->trans("FormatedImport"), 0, $user->rights->import->run, '', $mainmenu, 'import', 0, '', '', '', img_picto('', 'technic', 'class="paddingright pictofixedwidth"'));
$newmenu->add("/imports/import.php?leftmenu=import", $langs->trans("NewImport"), 1, $user->rights->import->run);
@@ -2379,7 +2380,7 @@ function get_left_menu_members($mainmenu, &$newmenu, $usemenuhider = 1, $leftmen
global $user, $conf, $langs;
if ($mainmenu == 'members') {
- if (!empty($conf->adherent->enabled)) {
+ if (isModEnabled('adherent')) {
// Load translation files required by the page
$langs->loadLangs(array("members", "compta"));
@@ -2399,7 +2400,7 @@ function get_left_menu_members($mainmenu, &$newmenu, $usemenuhider = 1, $leftmen
$newmenu->add("/adherents/htpasswd.php?leftmenu=export", $langs->trans("Filehtpasswd"), 1, $user->rights->adherent->export);
}
- if (!empty($conf->categorie->enabled)) {
+ if (isModEnabled('categorie')) {
$langs->load("categories");
$newmenu->add("/categories/index.php?leftmenu=cat&type=3", $langs->trans("Categories"), 1, $user->rights->categorie->lire, '', $mainmenu, 'cat');
}
@@ -2410,7 +2411,7 @@ function get_left_menu_members($mainmenu, &$newmenu, $usemenuhider = 1, $leftmen
$newmenu->add("/adherents/stats/index.php?leftmenu=members", $langs->trans("MenuMembersStats"), 1, $user->rights->adherent->lire);
//$newmenu->add("/adherents/index.php?leftmenu=export&mainmenu=members",$langs->trans("Tools"),0,$user->rights->adherent->export, '', $mainmenu, 'export');
- //if (! empty($conf->export->enabled) && ($usemenuhider || empty($leftmenu) || $leftmenu=="export")) $newmenu->add("/exports/index.php?leftmenu=export",$langs->trans("Datas"),1,$user->rights->adherent->export);
+ //if (isModEnabled('export') && ($usemenuhider || empty($leftmenu) || $leftmenu=="export")) $newmenu->add("/exports/index.php?leftmenu=export",$langs->trans("Datas"),1,$user->rights->adherent->export);
// Type
$newmenu->add("/adherents/type.php?leftmenu=setup&mainmenu=members", $langs->trans("MembersTypes"), 0, $user->rights->adherent->configurer, '', $mainmenu, 'setup', 0, '', '', '', img_picto('', 'members', 'class="paddingright pictofixedwidth"'));
diff --git a/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php b/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php
index ef43bb57e05..23917c4b79c 100644
--- a/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php
+++ b/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php
@@ -246,6 +246,7 @@ class doc_generic_bom_odt extends ModelePDFBom
}
$object->fetch_thirdparty();
+ $object->fetch_product();
$dir = $conf->bom->multidir_output[isset($object->entity) ? $object->entity : 1];
$objectref = dol_sanitizeFileName($object->ref);
diff --git a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php
index 212d324acaf..b2d0c1c0f30 100644
--- a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php
+++ b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php
@@ -27,7 +27,7 @@
/**
* \file htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php
* \ingroup commande
- * \brief File of Class to generate PDF orders with template Eratosthène
+ * \brief File of Class to generate PDF orders with template Eratosthene
*/
require_once DOL_DOCUMENT_ROOT.'/core/modules/commande/modules_commande.php';
diff --git a/htdocs/core/modules/commande/mod_commande_marbre.php b/htdocs/core/modules/commande/mod_commande_marbre.php
index 0cc9324ef16..8c9ef0385eb 100644
--- a/htdocs/core/modules/commande/mod_commande_marbre.php
+++ b/htdocs/core/modules/commande/mod_commande_marbre.php
@@ -48,6 +48,18 @@ class mod_commande_marbre extends ModeleNumRefCommandes
public $name = 'Marbre';
+ /**
+ * Constructor
+ */
+ public function __construct()
+ {
+ global $conf, $mysoc;
+
+ if ((float) $conf->global->MAIN_VERSION_LAST_INSTALL >= 16.0 && $mysoc->country_code != 'FR') {
+ $this->prefix = 'SO'; // We use correct standard code "SO = Sale Order"
+ }
+ }
+
/**
* Return description of numbering module
*
diff --git a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php
index 907688b4878..6dae41ca2af 100644
--- a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php
+++ b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php
@@ -152,7 +152,7 @@ class pdf_standard extends ModeleExpenseReport
$this->posxqty = 150;
$this->postotalht = 160;
$this->postotalttc = 180;
- // if (empty($conf->projet->enabled)) {
+ // if (empty($conf->project->enabled)) {
// $this->posxtva-=20;
// $this->posxup-=20;
// $this->posxqty-=20;
@@ -581,7 +581,7 @@ class pdf_standard extends ModeleExpenseReport
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) {
$nextColumnPosX = $this->posxtva;
}
- if (!empty($conf->projet->enabled)) {
+ if (!empty($conf->project->enabled)) {
$nextColumnPosX = $this->posxprojet;
}
@@ -597,7 +597,7 @@ class pdf_standard extends ModeleExpenseReport
//$pdf->MultiCell($nextColumnPosX-$this->posxtype-0.8, 4, $expensereporttypecodetoshow, 0, 'C');
// Project
- //if (! empty($conf->projet->enabled))
+ //if (! empty($conf->project->enabled))
//{
// $pdf->SetFont('','', $default_font_size - 1);
// $pdf->SetXY($this->posxprojet, $curY);
@@ -955,7 +955,7 @@ class pdf_standard extends ModeleExpenseReport
// $pdf->MultiCell($this->posxprojet-$this->posxtype - 1, 2, $outputlangs->transnoentities("Type"), '', 'C');
//}
- //if (!empty($conf->projet->enabled))
+ //if (!empty($conf->project->enabled))
//{
// // Project
// $pdf->line($this->posxprojet - 1, $tab_top, $this->posxprojet - 1, $tab_top + $tab_height);
diff --git a/htdocs/core/modules/facture/mod_facture_mars.php b/htdocs/core/modules/facture/mod_facture_mars.php
index ef34b145e52..9e0ff0d5b4e 100644
--- a/htdocs/core/modules/facture/mod_facture_mars.php
+++ b/htdocs/core/modules/facture/mod_facture_mars.php
@@ -55,7 +55,15 @@ class mod_facture_mars extends ModeleNumRefFactures
*/
public function __construct()
{
- global $conf;
+ global $conf, $mysoc;
+
+ if ((float) $conf->global->MAIN_VERSION_LAST_INSTALL >= 16.0 && $mysoc->country_code != 'FR') {
+ $this->prefixinvoice = 'IN'; // We use correct standard code "IN = Invoice"
+ $this->prefixreplacement = 'IR';
+ $this->prefixdeposit = 'ID';
+ $this->prefixcreditnote = 'IC';
+ }
+
if (!empty($conf->global->INVOICE_NUMBERING_MARS_FORCE_PREFIX)) {
$this->prefixinvoice = $conf->global->INVOICE_NUMBERING_MARS_FORCE_PREFIX;
}
diff --git a/htdocs/core/modules/facture/mod_facture_terre.php b/htdocs/core/modules/facture/mod_facture_terre.php
index 9660be93266..2b11ee3976f 100644
--- a/htdocs/core/modules/facture/mod_facture_terre.php
+++ b/htdocs/core/modules/facture/mod_facture_terre.php
@@ -42,6 +42,12 @@ class mod_facture_terre extends ModeleNumRefFactures
*/
public $prefixinvoice = 'FA';
+ /**
+ * Prefix for replacement invoices
+ * @var string
+ */
+ public $prefixreplacement = 'FA';
+
/**
* Prefix for credit note
* @var string
@@ -65,7 +71,15 @@ class mod_facture_terre extends ModeleNumRefFactures
*/
public function __construct()
{
- global $conf;
+ global $conf, $mysoc;
+
+ if ((float) $conf->global->MAIN_VERSION_LAST_INSTALL >= 16.0 && $mysoc->country_code != 'FR') {
+ $this->prefixinvoice = 'IN'; // We use correct standard code "IN = Invoice"
+ $this->prefixreplacement = 'IR';
+ $this->prefixdeposit = 'ID';
+ $this->prefixcreditnote = 'IC';
+ }
+
if (!empty($conf->global->INVOICE_NUMBERING_TERRE_FORCE_PREFIX)) {
$this->prefixinvoice = $conf->global->INVOICE_NUMBERING_TERRE_FORCE_PREFIX;
}
diff --git a/htdocs/core/modules/mailings/contacts1.modules.php b/htdocs/core/modules/mailings/contacts1.modules.php
index e3e349d2a17..decbc81716b 100644
--- a/htdocs/core/modules/mailings/contacts1.modules.php
+++ b/htdocs/core/modules/mailings/contacts1.modules.php
@@ -310,7 +310,7 @@ class mailing_contacts1 extends MailingTargets
// Choose language
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
$formadmin = new FormAdmin($this->db);
- $s .= $langs->trans("DefaultLang").': ';
+ $s .= ' '.$langs->trans("DefaultLang").': ';
$s .= $formadmin->select_language($langs->getDefaultLang(1), 'filter_lang', 0, 0, 1, 0, 0, '', 0, 0, 0, null, 1);
return $s;
diff --git a/htdocs/core/modules/mailings/thirdparties.modules.php b/htdocs/core/modules/mailings/thirdparties.modules.php
index 073d45439eb..89bc2cf2b5e 100644
--- a/htdocs/core/modules/mailings/thirdparties.modules.php
+++ b/htdocs/core/modules/mailings/thirdparties.modules.php
@@ -117,6 +117,10 @@ class mailing_thirdparties extends MailingTargets
$addFilter .= " AND s.default_lang LIKE '".$this->db->escape(GETPOST('default_lang', 'alpha'))."%'";
$addDescription = $langs->trans('DefaultLang')."=";
}
+ if (GETPOST('filter_lang_thirdparties', 'alpha')) {
+ $addFilter .= " AND s.default_lang LIKE '".$this->db->escape(GETPOST('filter_lang_thirdparties', 'alpha'))."%'";
+ $addDescription = $langs->trans('DefaultLang')."=";
+ }
$sql = "SELECT s.rowid as id, s.email as email, s.nom as name, null as fk_contact, null as firstname, c.label as label";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."categorie_societe as cs, ".MAIN_DB_PREFIX."categorie as c";
@@ -315,8 +319,8 @@ class mailing_thirdparties extends MailingTargets
// Choose language
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
$formadmin = new FormAdmin($this->db);
- $s .= $langs->trans("DefaultLang").': ';
- $s .= $formadmin->select_language($langs->getDefaultLang(1), 'filter_lang', 0, 0, 1, 0, 0, '', 0, 0, 0, null, 1);
+ $s .= ' '.$langs->trans("DefaultLang").': ';
+ $s .= $formadmin->select_language($langs->getDefaultLang(1), 'filter_lang_thirdparties', 0, null, 1, 0, 0, '', 0, 0, 0, null, 1);
return $s;
}
diff --git a/htdocs/core/modules/mailings/xinputfile.modules.php b/htdocs/core/modules/mailings/xinputfile.modules.php
index 77044ddb29e..9a80484f83b 100644
--- a/htdocs/core/modules/mailings/xinputfile.modules.php
+++ b/htdocs/core/modules/mailings/xinputfile.modules.php
@@ -151,10 +151,12 @@ class mailing_xinputfile extends MailingTargets
$cpt++;
$buffer = trim(fgets($handle));
$tab = explode(';', $buffer, 4);
- $email = $tab[0];
- $name = $tab[1];
- $firstname = $tab[2];
- $other = $tab[3];
+
+ $email = dol_string_nohtmltag($tab[0]);
+ $name = dol_string_nohtmltag(empty($tab[1]) ? '' : $tab[1]);
+ $firstname = dol_string_nohtmltag(empty($tab[2]) ? '' : $tab[2]);
+ $other = dol_string_nohtmltag(empty($tab[3]) ? '' : $tab[3]);
+
if (!empty($buffer)) {
//print 'xx'.dol_strlen($buffer).empty($buffer)." \n";
if (isValidEMail($email)) {
diff --git a/htdocs/core/modules/mailings/xinputuser.modules.php b/htdocs/core/modules/mailings/xinputuser.modules.php
index 117a5722c3c..74ed18ba91f 100644
--- a/htdocs/core/modules/mailings/xinputuser.modules.php
+++ b/htdocs/core/modules/mailings/xinputuser.modules.php
@@ -127,10 +127,11 @@ class mailing_xinputuser extends MailingTargets
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$tmparray = explode(';', GETPOST('xinputuser'));
+
$email = $tmparray[0];
- $lastname = $tmparray[1];
- $firstname = $tmparray[2];
- $other = $tmparray[3];
+ $lastname = empty($tmparray[1]) ? '' : $tmparray[1];
+ $firstname = empty($tmparray[2]) ? '' : $tmparray[2];
+ $other = empty($tmparray[3]) ? '' : $tmparray[3];
$cibles = array();
if (!empty($email)) {
diff --git a/htdocs/core/modules/modCategorie.class.php b/htdocs/core/modules/modCategorie.class.php
index 9e138c6ccef..57ac7a637dc 100644
--- a/htdocs/core/modules/modCategorie.class.php
+++ b/htdocs/core/modules/modCategorie.class.php
@@ -145,7 +145,7 @@ class modCategorie extends DolibarrModules
if (!empty($conf->bank->enabled)) {
$typeexample .= ($typeexample ? " / " : "")."5=Bank account";
}
- if (!empty($conf->projet->enabled)) {
+ if (!empty($conf->project->enabled)) {
$typeexample .= ($typeexample ? " / " : "")."6=Project";
}
if (!empty($conf->user->enabled)) {
@@ -157,7 +157,7 @@ class modCategorie extends DolibarrModules
if (!empty($conf->stock->enabled)) {
$typeexample .= ($typeexample ? " / " : "")."9=Warehouse";
}
- if (!empty($conf->agenda->enabled)) {
+ if (isModEnabled('agenda')) {
$typeexample .= ($typeexample ? " / " : "")."10=Agenda event";
}
if (!empty($conf->website->enabled)) {
@@ -379,7 +379,7 @@ class modCategorie extends DolibarrModules
$this->export_code[$r] = $this->rights_class.'_6_'.Categorie::$MAP_ID_TO_CODE[6];
$this->export_label[$r] = 'CatProjectsList';
$this->export_icon[$r] = $this->picto;
- $this->export_enabled[$r] = '!empty($conf->projet->enabled)';
+ $this->export_enabled[$r] = '!empty($conf->project->enabled)';
$this->export_permission[$r] = array(array("categorie", "lire"), array("projet", "export"));
$this->export_fields_array[$r] = array('cat.rowid'=>"CategId", 'cat.label'=>"Label", 'cat.description'=>"Description", 'cat.fk_parent'=>"ParentCategory", 'p.rowid'=>'ProjectId', 'p.ref'=>'Ref', 's.rowid'=>"IdThirdParty", 's.nom'=>"Name");
$this->export_TypeFields_array[$r] = array('cat.label'=>"Text", 'cat.description'=>"Text", 'cat.fk_parent'=>'List:categorie:label:rowid', 'p.ref'=>'Text', 's.rowid'=>"Numeric", 's.nom'=>"Text");
@@ -568,7 +568,7 @@ class modCategorie extends DolibarrModules
// 5 Bank accounts, TODO ?
// 6 Projects
- if (!empty($conf->projet->enabled)) {
+ if (!empty($conf->project->enabled)) {
$r++;
$this->import_code[$r] = $this->rights_class.'_6_'.Categorie::$MAP_ID_TO_CODE[6];
$this->import_label[$r] = "CatProjectsLinks"; // Translation key
diff --git a/htdocs/core/modules/modCommande.class.php b/htdocs/core/modules/modCommande.class.php
index 80e5468b140..e75147ba78a 100644
--- a/htdocs/core/modules/modCommande.class.php
+++ b/htdocs/core/modules/modCommande.class.php
@@ -370,7 +370,7 @@ class modCommande extends DolibarrModules
),
);
- //Import CPV Lines
+ //Import Order Lines
$r++;
$this->import_code[$r] = 'commande_lines_'.$r;
$this->import_label[$r] = 'SaleOrderLines';
diff --git a/htdocs/core/modules/modFacture.class.php b/htdocs/core/modules/modFacture.class.php
index 817fa1b53cf..80a6ff1a805 100644
--- a/htdocs/core/modules/modFacture.class.php
+++ b/htdocs/core/modules/modFacture.class.php
@@ -224,6 +224,274 @@ class modFacture extends DolibarrModules
$this->menu = 1; // This module add menu entries. They are coded into menu manager.
+ // Imports
+ //--------
+ $r = 1;
+
+ $r++;
+ $this->import_code[$r] = $this->rights_class.'_'.$r;
+ $this->import_label[$r] = "Invoices"; // Translation key
+ $this->import_icon[$r] = $this->picto;
+ $this->import_entities_array[$r] = array(); // We define here only fields that use another icon that the one defined into import_icon
+ $this->import_tables_array[$r] = array('f' => MAIN_DB_PREFIX.'facture', 'extra' => MAIN_DB_PREFIX.'facture_extrafields');
+ $this->import_tables_creator_array[$r] = array('f' => 'fk_user_author'); // Fields to store import user id
+ $this->import_fields_array[$r] = array(
+ 'f.ref' => 'InvoiceRef*',
+ 'f.ref_ext' => 'ExternalRef',
+ 'f.ref_int' => 'ExternalRef',
+ 'f.ref_client' => 'CutomerRef',
+ 'f.type' => 'Type*',
+ 'f.fk_soc' => 'Customer*',
+ 'f.datec' => 'InvoiceDateCreation',
+ 'f.datef' => 'DateInvoice',
+ 'f.date_valid' => 'Validation Date',
+ 'f.paye' => 'InvoicePaid',
+ 'f.remise_percent' => 'RemisePercent',
+ 'f.remise_absolue' => 'RemiseAbsolue',
+ 'f.remise' => 'Remise',
+ 'f.total_tva' => 'TotalVAT',
+ 'f.total_ht' => 'TotalHT',
+ 'f.total_ttc' => 'TotalTTC',
+ 'f.fk_statut' => 'InvoiceStatus',
+ 'f.fk_user_modif' => 'Modifier Id',
+ 'f.fk_user_valid' => 'Validator Id',
+ 'f.fk_user_closing' => 'Closer Id',
+ 'f.fk_facture_source' => 'Invoice Source Id',
+ 'f.fk_projet' => 'Project Id',
+ 'f.fk_account' => 'Bank Account',
+ 'f.fk_currency' => 'Currency*',
+ 'f.fk_cond_reglement' => 'Payment Condition',
+ 'f.fk_mode_reglement' => 'Payment Mode',
+ 'f.date_lim_reglement' => 'DateMaxPayment',
+ 'f.note_public' => 'InvoiceNote',
+ 'f.note_private' => 'NotePrivate',
+ 'f.model_pdf' => 'Model'
+ );
+ if (!empty($conf->multicurrency->enabled)) {
+ $this->import_fields_array[$r]['f.multicurrency_code'] = 'Currency';
+ $this->import_fields_array[$r]['f.multicurrency_tx'] = 'CurrencyRate';
+ $this->import_fields_array[$r]['f.multicurrency_total_ht'] = 'MulticurrencyAmountHT';
+ $this->import_fields_array[$r]['f.multicurrency_total_tva'] = 'MulticurrencyAmountVAT';
+ $this->import_fields_array[$r]['f.multicurrency_total_ttc'] = 'MulticurrencyAmountTTC';
+ }
+ // Add extra fields
+ $import_extrafield_sample = array();
+ $sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'facture' AND entity IN (0, ".$conf->entity.")";
+ $resql = $this->db->query($sql);
+ if ($resql) {
+ while ($obj = $this->db->fetch_object($resql)) {
+ $fieldname = 'extra.'.$obj->name;
+ $fieldlabel = ucfirst($obj->label);
+ $this->import_fields_array[$r][$fieldname] = $fieldlabel.($obj->fieldrequired ? '*' : '');
+ $import_extrafield_sample[$fieldname] = $fieldlabel;
+ }
+ }
+ // End add extra fields
+ $this->import_fieldshidden_array[$r] = array('extra.fk_object' => 'lastrowid-'.MAIN_DB_PREFIX.'facture');
+ $this->import_regex_array[$r] = array('f.multicurrency_code' => 'code@'.MAIN_DB_PREFIX.'multicurrency');
+ $import_sample = array(
+ 'f.ref' => '(PROV0001)',
+ 'f.ref_ext' => '',
+ 'f.ref_int' => '',
+ 'f.ref_client' => '',
+ 'f.type' => '0',
+ 'f.fk_soc' => '80LIMIT',
+ 'f.datec' => '2021-11-24',
+ 'f.datef' => '2021-11-24',
+ 'f.date_valid' => '2021-11-24',
+ 'f.paye' => '1',
+ 'f.remise_percent' => '0',
+ 'f.remise_absolue' => '0',
+ 'f.remise' => '0',
+ 'f.total_tva' => '21',
+ 'f.total_ht' => '100',
+ 'f.total_ttc' => '121',
+ 'f.fk_statut' => '1',
+ 'f.fk_user_modif' => '',
+ 'f.fk_user_valid' => '',
+ 'f.fk_user_closing' => '',
+ 'f.fk_facture_source' => '',
+ 'f.fk_projet' => '',
+ 'f.fk_account' => '',
+ 'f.fk_currency' => 'EUR',
+ 'f.fk_cond_reglement' => '30D',
+ 'f.fk_mode_reglement' => 'VIR',
+ 'f.date_lim_reglement' => '2021-12-24',
+ 'f.note_public' => '',
+ 'f.note_private' => '',
+ 'f.model_pdf' => 'crabe',
+ 'f.multicurrency_code' => 'EUR',
+ 'f.multicurrency_tx' => '1',
+ 'f.multicurrency_total_ht' => '100',
+ 'f.multicurrency_total_tva' => '21',
+ 'f.multicurrency_total_ttc' => '121'
+ );
+ $this->import_examplevalues_array[$r] = array_merge($import_sample, $import_extrafield_sample);
+ $this->import_updatekeys_array[$r] = array('f.ref' => 'Ref');
+ $this->import_convertvalue_array[$r] = array(
+ 'f.fk_soc' => array(
+ 'rule' => 'fetchidfromref',
+ 'file' => '/societe/class/societe.class.php',
+ 'class' => 'Societe',
+ 'method' => 'fetch',
+ 'element' => 'ThirdParty'
+ ),
+ 'f.fk_projet' => array(
+ 'rule' => 'fetchidfromref',
+ 'file' => '/projet/class/project.class.php',
+ 'class' => 'Project',
+ 'method' => 'fetch',
+ 'element' => 'facture'
+ ),
+ 'f.fk_cond_reglement' => array(
+ 'rule' => 'fetchidfromcodeorlabel',
+ 'file' => '/compta/facture/class/paymentterm.class.php',
+ 'class' => 'PaymentTerm',
+ 'method' => 'fetch',
+ 'element' => 'c_payment_term'
+ )
+ );
+
+ //Import Supplier Invoice Lines
+ $r++;
+ $this->import_code[$r] = $this->rights_class.'_'.$r;
+ $this->import_label[$r] = "InvoiceLine"; // Translation key
+ $this->import_icon[$r] = $this->picto;
+ $this->import_entities_array[$r] = array(); // We define here only fields that use another icon that the one defined into import_icon
+ $this->import_tables_array[$r] = array('fd' => MAIN_DB_PREFIX.'facturedet', 'extra' => MAIN_DB_PREFIX.'facturedet_extrafields');
+ $this->import_fields_array[$r] = array(
+ 'fd.fk_facture' => 'InvoiceRef*',
+ 'fd.fk_parent_line' => 'FacParentLine',
+ 'fd.fk_product' => 'IdProduct',
+ 'fd.label' => 'Label',
+ 'fd.description' => 'LineDescription*',
+ 'fd.vat_src_code' => 'Vat Source Code',
+ 'fd.tva_tx' => 'LineVATRate*',
+ // localtax1_tx
+ // localtax1_type
+ // localtax2_tx
+ // localtax2_type
+ 'fd.qty' => 'LineQty',
+ 'fd.remise_percent' => 'Reduc. (%)',
+ // remise
+ // fk_remise_except
+ // subprice
+ // price
+ 'fd.total_ht' => 'LineTotalHT',
+ 'fd.total_tva' => 'LineTotalVAT',
+ // total_localtax1
+ // total_localtax2
+ 'fd.total_ttc' => 'LineTotalTTC',
+ 'fd.product_type' => 'TypeOfLineServiceOrProduct',
+ 'fd.date_start' => 'Start Date',
+ 'fd.date_end' => 'End Date',
+ // info_bits
+ // buy_price_ht
+ // fk_product_fournisseur_price
+ // specia_code
+ // rang
+ // fk_contract_line
+ 'fd.fk_unit' => 'Unit',
+ // fk_code_ventilation
+ // situation_percent
+ // fk_prev_id
+ // fk_user_author
+ // fk_user_modif
+ // ref_ext
+ );
+ if (!empty($conf->multicurrency->enabled)) {
+ $this->import_fields_array[$r]['fd.multicurrency_code'] = 'Currency';
+ $this->import_fields_array[$r]['fd.multicurrency_subprice'] = 'CurrencyRate';
+ $this->import_fields_array[$r]['fd.multicurrency_total_ht'] = 'MulticurrencyAmountHT';
+ $this->import_fields_array[$r]['fd.multicurrency_total_tva'] = 'MulticurrencyAmountVAT';
+ $this->import_fields_array[$r]['fd.multicurrency_total_ttc'] = 'MulticurrencyAmountTTC';
+ }
+ // Add extra fields
+ $import_extrafield_sample = array();
+ $sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'facture_det' AND entity IN (0, ".$conf->entity.")";
+ $resql = $this->db->query($sql);
+ if ($resql) {
+ while ($obj = $this->db->fetch_object($resql)) {
+ $fieldname = 'extra.'.$obj->name;
+ $fieldlabel = ucfirst($obj->label);
+ $this->import_fields_array[$r][$fieldname] = $fieldlabel.($obj->fieldrequired ? '*' : '');
+ $import_extrafield_sample[$fieldname] = $fieldlabel;
+ }
+ }
+ // End add extra fields
+ $this->import_fieldshidden_array[$r] = array('extra.fk_object' => 'lastrowid-'.MAIN_DB_PREFIX.'facturedet');
+ $this->import_regex_array[$r] = array(
+ 'fd.fk_product' => 'rowid@'.MAIN_DB_PREFIX.'product',
+ 'fd.multicurrency_code' => 'code@'.MAIN_DB_PREFIX.'multicurrency'
+ );
+ $import_sample = array(
+ 'fd.fk_facture' => '(PROV00001)',
+ 'fd.fk_parent_line' => '',
+ 'fd.fk_product' => '',
+ 'fd.label' => '',
+ 'fd.description' => 'Test product',
+ 'fd.vat_src_code' => '',
+ 'fd.tva_tx' => '21',
+ // localtax1_tx
+ // localtax1_type
+ // localtax2_tx
+ // localtax2_type
+ 'fd.qty' => '1',
+ 'fd.remise_percent' => '0',
+ // remise
+ // fk_remise_except
+ // subprice
+ // price
+ 'fd.total_ht' => '100',
+ 'fd.total_tva' => '21',
+ // total_localtax1
+ // total_localtax2
+ 'fd.total_ttc' => '121',
+ 'fd.product_type' => '0',
+ 'fd.date_start' => '',
+ 'fd.date_end' => '',
+ // info_bits
+ // buy_price_ht
+ // fk_product_fournisseur_price
+ // specia_code
+ // rang
+ // fk_contract_line
+ 'fd.fk_unit' => '',
+ // fk_code_ventilation
+ // situation_percent
+ // fk_prev_id
+ // fk_user_author
+ // fk_user_modif
+ // ref_ext
+ 'fd.multicurrency_code' => 'EUR',
+ 'fd.multicurrency_tx' => '21',
+ 'fd.multicurrency_total_ht' => '100',
+ 'fd.multicurrency_total_tva' => '21',
+ 'fd.multicurrency_total_ttc' => '121'
+ );
+ $this->import_examplevalues_array[$r] = array_merge($import_sample, $import_extrafield_sample);
+ $this->import_updatekeys_array[$r] = array(
+ 'fd.rowid' => 'Row Id',
+ 'fd.fk_facture' => 'Invoice Id'
+ );
+ $this->import_convertvalue_array[$r] = array(
+ 'fd.fk_facture' => array(
+ 'rule' => 'fetchidfromref',
+ 'file' => '/compta/facture/class/facture.class.php',
+ 'class' => 'Facture',
+ 'method' => 'fetch',
+ 'element' => 'facture'
+ ),
+ 'fd.fk_projet' => array(
+ 'rule' => 'fetchidfromref',
+ 'file' => '/projet/class/project.class.php',
+ 'class' => 'Project',
+ 'method' => 'fetch',
+ 'element' => 'facture'
+ ),
+ );
+
+
// Exports
//--------
$r = 1;
diff --git a/htdocs/core/modules/modSociete.class.php b/htdocs/core/modules/modSociete.class.php
index 322988e7a7b..327262ce39f 100644
--- a/htdocs/core/modules/modSociete.class.php
+++ b/htdocs/core/modules/modSociete.class.php
@@ -832,8 +832,18 @@ class modSociete extends DolibarrModules
's.note_public' => "My public note"
);
$this->import_updatekeys_array[$r] = array(
- 's.rowid' => 'Id'
+ 's.rowid' => 'Id',
+ 's.lastname' => "Lastname",
);
+ if (!empty($conf->socialnetworks->enabled)) {
+ $sql = "SELECT code, label FROM ".MAIN_DB_PREFIX."c_socialnetworks WHERE active = 1";
+ $resql = $this->db->query($sql);
+ while ($obj = $this->db->fetch_object($resql)) {
+ $fieldname = 's.socialnetworks_'.$obj->code;
+ $fieldlabel = ucfirst($obj->label);
+ $this->import_updatekeys_array[$r][$fieldname] = $fieldlabel;
+ }
+ }
// Import Bank Accounts
$r++;
diff --git a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php
index 69a7a3f6232..8bd8d030a37 100644
--- a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php
+++ b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php
@@ -40,10 +40,10 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
if (!empty($conf->propal->enabled)) {
require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
}
-if (!empty($conf->facture->enabled)) {
+if (isModEnabled('facture')) {
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
}
-if (!empty($conf->facture->enabled)) {
+if (isModEnabled('facture')) {
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture-rec.class.php';
}
if (!empty($conf->commande->enabled)) {
@@ -64,7 +64,7 @@ if (!empty($conf->ficheinter->enabled)) {
if (!empty($conf->deplacement->enabled)) {
require_once DOL_DOCUMENT_ROOT.'/compta/deplacement/class/deplacement.class.php';
}
-if (!empty($conf->agenda->enabled)) {
+if (isModEnabled('agenda')) {
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
}
@@ -522,7 +522,7 @@ class doc_generic_project_odt extends ModelePDFProjects
// Load translation files required by the page
$outputlangs->loadLangs(array("main", "dict", "companies", "projects"));
- if ($conf->projet->dir_output) {
+ if ($conf->project->dir_output) {
// If $object is id instead of object
if (!is_object($object)) {
$id = $object;
@@ -536,7 +536,7 @@ class doc_generic_project_odt extends ModelePDFProjects
$object->fetch_thirdparty();
- $dir = $conf->projet->dir_output;
+ $dir = $conf->project->dir_output;
$objectref = dol_sanitizeFileName($object->ref);
if (!preg_match('/specimen/i', $objectref)) {
$dir .= "/".$objectref;
@@ -575,9 +575,9 @@ class doc_generic_project_odt extends ModelePDFProjects
//print "file=".$file;
//print "conf->societe->dir_temp=".$conf->societe->dir_temp;
- dol_mkdir($conf->projet->dir_temp);
- if (!is_writable($conf->projet->dir_temp)) {
- $this->error = "Failed to write in temp directory ".$conf->projet->dir_temp;
+ dol_mkdir($conf->project->dir_temp);
+ if (!is_writable($conf->project->dir_temp)) {
+ $this->error = "Failed to write in temp directory ".$conf->project->dir_temp;
dol_syslog('Error in write_file: '.$this->error, LOG_ERR);
return -1;
}
@@ -615,7 +615,7 @@ class doc_generic_project_odt extends ModelePDFProjects
$odfHandler = new odf(
$srctemplatepath,
array(
- 'PATH_TO_TMP' => $conf->projet->dir_temp,
+ 'PATH_TO_TMP' => $conf->project->dir_temp,
'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy.
'DELIMITER_LEFT' => '{',
'DELIMITER_RIGHT' => '}'
@@ -826,7 +826,7 @@ class doc_generic_project_odt extends ModelePDFProjects
// Replace tags of project files
$listtasksfiles = $listlines->__get('tasksfiles');
- $upload_dir = $conf->projet->dir_output.'/'.dol_sanitizeFileName($object->ref).'/'.dol_sanitizeFileName($task->ref);
+ $upload_dir = $conf->project->dir_output.'/'.dol_sanitizeFileName($object->ref).'/'.dol_sanitizeFileName($task->ref);
$filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', 'name', SORT_ASC, 1);
@@ -861,7 +861,7 @@ class doc_generic_project_odt extends ModelePDFProjects
try {
$listlines = $odfHandler->setSegment('projectfiles');
- $upload_dir = $conf->projet->dir_output.'/'.dol_sanitizeFileName($object->ref);
+ $upload_dir = $conf->project->dir_output.'/'.dol_sanitizeFileName($object->ref);
$filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', 'name', SORT_ASC, 1);
foreach ($filearray as $filedetail) {
diff --git a/htdocs/core/modules/project/doc/pdf_baleine.modules.php b/htdocs/core/modules/project/doc/pdf_baleine.modules.php
index cf9e84a3deb..bb6eb75bf75 100644
--- a/htdocs/core/modules/project/doc/pdf_baleine.modules.php
+++ b/htdocs/core/modules/project/doc/pdf_baleine.modules.php
@@ -195,11 +195,11 @@ class pdf_baleine extends ModelePDFProjects
// Load traductions files required by page
$outputlangs->loadLangs(array("main", "dict", "companies", "projects"));
- if ($conf->projet->dir_output) {
+ if ($conf->project->dir_output) {
//$nblines = count($object->lines); // This is set later with array of tasks
$objectref = dol_sanitizeFileName($object->ref);
- $dir = $conf->projet->dir_output;
+ $dir = $conf->project->dir_output;
if (!preg_match('/specimen/i', $objectref)) {
$dir .= "/".$objectref;
}
diff --git a/htdocs/core/modules/project/doc/pdf_beluga.modules.php b/htdocs/core/modules/project/doc/pdf_beluga.modules.php
index abd05f63651..4aa6f754ad9 100644
--- a/htdocs/core/modules/project/doc/pdf_beluga.modules.php
+++ b/htdocs/core/modules/project/doc/pdf_beluga.modules.php
@@ -242,11 +242,11 @@ class pdf_beluga extends ModelePDFProjects
// Load traductions files required by page
$outputlangs->loadLangs(array("main", "dict", "companies", "projects"));
- if ($conf->projet->dir_output) {
+ if ($conf->project->dir_output) {
//$nblines = count($object->lines); // This is set later with array of tasks
$objectref = dol_sanitizeFileName($object->ref);
- $dir = $conf->projet->dir_output;
+ $dir = $conf->project->dir_output;
if (!preg_match('/specimen/i', $objectref)) {
$dir .= "/".$objectref;
}
diff --git a/htdocs/core/modules/project/doc/pdf_timespent.modules.php b/htdocs/core/modules/project/doc/pdf_timespent.modules.php
index cb7430c3011..741476de117 100644
--- a/htdocs/core/modules/project/doc/pdf_timespent.modules.php
+++ b/htdocs/core/modules/project/doc/pdf_timespent.modules.php
@@ -195,11 +195,11 @@ class pdf_timespent extends ModelePDFProjects
// Load traductions files required by page
$outputlangs->loadLangs(array("main", "dict", "companies", "projects"));
- if ($conf->projet->dir_output) {
+ if ($conf->project->dir_output) {
//$nblines = count($object->lines); // This is set later with array of tasks
$objectref = dol_sanitizeFileName($object->ref);
- $dir = $conf->projet->dir_output;
+ $dir = $conf->project->dir_output;
if (!preg_match('/specimen/i', $objectref)) {
$dir .= "/".$objectref;
}
diff --git a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php
index fc83ab505d2..e26318b749c 100644
--- a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php
+++ b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php
@@ -41,10 +41,10 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
if (!empty($conf->propal->enabled)) {
require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
}
-if (!empty($conf->facture->enabled)) {
+if (isModEnabled('facture')) {
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
}
-if (!empty($conf->facture->enabled)) {
+if (isModEnabled('facture')) {
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture-rec.class.php';
}
if (!empty($conf->commande->enabled)) {
@@ -65,7 +65,7 @@ if (!empty($conf->ficheinter->enabled)) {
if (!empty($conf->deplacement->enabled)) {
require_once DOL_DOCUMENT_ROOT.'/compta/deplacement/class/deplacement.class.php';
}
-if (!empty($conf->agenda->enabled)) {
+if (isModEnabled('agenda')) {
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
}
@@ -133,8 +133,8 @@ class doc_generic_task_odt extends ModelePDFTask
// Get source company
$this->emetteur = $mysoc;
- if (!$this->emetteur->pays_code) {
- $this->emetteur->pays_code = substr($langs->defaultlang, -2); // By default, if was not defined
+ if (!$this->emetteur->country_code) {
+ $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default, if was not defined
}
}
@@ -481,7 +481,7 @@ class doc_generic_task_odt extends ModelePDFTask
// Load translation files required by the page
$outputlangs->loadLangs(array("main", "dict", "companies", "projects"));
- if ($conf->projet->dir_output) {
+ if ($conf->project->dir_output) {
// If $object is id instead of object
if (!is_object($object)) {
$id = $object;
@@ -496,7 +496,7 @@ class doc_generic_task_odt extends ModelePDFTask
$project->fetch($object->fk_project);
$project->fetch_thirdparty();
- $dir = $conf->projet->dir_output."/".$project->ref."/";
+ $dir = $conf->project->dir_output."/".$project->ref."/";
$objectref = dol_sanitizeFileName($object->ref);
if (!preg_match('/specimen/i', $objectref)) {
$dir .= "/".$objectref;
@@ -525,9 +525,9 @@ class doc_generic_task_odt extends ModelePDFTask
//print "file=".$file;
//print "conf->societe->dir_temp=".$conf->societe->dir_temp;
- dol_mkdir($conf->projet->dir_temp);
- if (!is_writable($conf->projet->dir_temp)) {
- $this->error = "Failed to write in temp directory ".$conf->projet->dir_temp;
+ dol_mkdir($conf->project->dir_temp);
+ if (!is_writable($conf->project->dir_temp)) {
+ $this->error = "Failed to write in temp directory ".$conf->project->dir_temp;
dol_syslog('Error in write_file: '.$this->error, LOG_ERR);
return -1;
}
@@ -550,7 +550,7 @@ class doc_generic_task_odt extends ModelePDFTask
$odfHandler = new odf(
$srctemplatepath,
array(
- 'PATH_TO_TMP' => $conf->projet->dir_temp,
+ 'PATH_TO_TMP' => $conf->project->dir_temp,
'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy.
'DELIMITER_LEFT' => '{',
'DELIMITER_RIGHT' => '}'
@@ -708,7 +708,7 @@ class doc_generic_task_odt extends ModelePDFTask
// Replace tags of project files
$listtasksfiles = $odfHandler->setSegment('tasksfiles');
- $upload_dir = $conf->projet->dir_output.'/'.dol_sanitizeFileName($project->ref).'/'.dol_sanitizeFileName($object->ref);
+ $upload_dir = $conf->project->dir_output.'/'.dol_sanitizeFileName($project->ref).'/'.dol_sanitizeFileName($object->ref);
$filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', 'name', SORT_ASC, 1);
@@ -741,7 +741,7 @@ class doc_generic_task_odt extends ModelePDFTask
try {
$listlines = $odfHandler->setSegment('projectfiles');
- $upload_dir = $conf->projet->dir_output.'/'.dol_sanitizeFileName($object->ref);
+ $upload_dir = $conf->project->dir_output.'/'.dol_sanitizeFileName($object->ref);
$filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', 'name', SORT_ASC, 1);
diff --git a/htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php b/htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php
index 74b0ea032b9..c00bf34621e 100644
--- a/htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php
+++ b/htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php
@@ -22,9 +22,9 @@
*/
/**
- * \file htdocs/core/modules/expedition/doc/pdf_rouget.modules.php
+ * \file htdocs/core/modules/expedition/doc/pdf_eagle.modules.php
* \ingroup expedition
- * \brief Class file used to generate the dispatch slips for the Rouget model
+ * \brief Class file used to generate the dispatch slips for the Eagle model
*/
require_once DOL_DOCUMENT_ROOT . '/core/modules/stocktransfer/modules_stocktransfer.php';
diff --git a/htdocs/core/modules/stocktransfer/doc/pdf_eagle_proforma.modules.php b/htdocs/core/modules/stocktransfer/doc/pdf_eagle_proforma.modules.php
index bd9e4d3f11a..5bff26a9d1d 100644
--- a/htdocs/core/modules/stocktransfer/doc/pdf_eagle_proforma.modules.php
+++ b/htdocs/core/modules/stocktransfer/doc/pdf_eagle_proforma.modules.php
@@ -26,9 +26,9 @@
*/
/**
- * \file htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php
+ * \file htdocs/core/modules/commande/doc/pdf_eagle_proforma.modules.php
* \ingroup commande
- * \brief File of Class to generate PDF orders with template Eratosthène
+ * \brief File of Class to generate PDF orders with template Eagle
*/
require_once DOL_DOCUMENT_ROOT.'/core/modules/commande/modules_commande.php';
@@ -39,7 +39,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
/**
- * Class to generate PDF orders with template Eratosthene
+ * Class to generate PDF orders with template Eagle
*/
class pdf_eagle_proforma extends ModelePDFCommandes
{
diff --git a/htdocs/core/tpl/card_presend.tpl.php b/htdocs/core/tpl/card_presend.tpl.php
index 0c744e165d3..7b47c4676a6 100644
--- a/htdocs/core/tpl/card_presend.tpl.php
+++ b/htdocs/core/tpl/card_presend.tpl.php
@@ -1,5 +1,6 @@
+ * Copyright (C) 2022 Charlene Benke
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -58,11 +59,11 @@ if ($action == 'presend') {
// Define output language
$outputlangs = $langs;
$newlang = '';
- if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) {
- $newlang = GETPOST('lang_id', 'aZ09');
- }
- if ($conf->global->MAIN_MULTILANGS && empty($newlang)) {
+ if (!empty($conf->global->MAIN_MULTILANGS) && empty($newlang)) {
$newlang = $object->thirdparty->default_lang;
+ if (GETPOST('lang_id', 'aZ09')) {
+ $newlang = GETPOST('lang_id', 'aZ09');
+ }
}
if (!empty($newlang)) {
@@ -212,7 +213,14 @@ if ($action == 'presend') {
$formmail->setSubstitFromObject($object, $langs);
}
$substitutionarray = getCommonSubstitutionArray($outputlangs, 0, $arrayoffamiliestoexclude, $object);
- $substitutionarray['__CHECK_READ__'] = (is_object($object) && is_object($object->thirdparty)) ? ' ' : '';
+ $substitutionarray['__CHECK_READ__'] = "";
+ if (is_object($object) && is_object($object->thirdparty)) {
+ $checkRead= ' global->MAILING_EMAIL_UNSUBSCRIBE_KEY)?urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY):"");
+ $checkRead.='" width="1" height="1" style="width:1px;height:1px" border="0"/>';
+ $substitutionarray['__CHECK_READ__'] = $checkRead;
+ }
$substitutionarray['__PERSONALIZED__'] = ''; // deprecated
$substitutionarray['__CONTACTCIVNAME__'] = '';
$parameters = array(
diff --git a/htdocs/core/tpl/commonfields_edit.tpl.php b/htdocs/core/tpl/commonfields_edit.tpl.php
index 39103fdbb0a..1439ce73afe 100644
--- a/htdocs/core/tpl/commonfields_edit.tpl.php
+++ b/htdocs/core/tpl/commonfields_edit.tpl.php
@@ -63,9 +63,11 @@ foreach ($object->fields as $key => $val) {
}
print ' | ';
print '';
+
if (!empty($val['picto'])) {
print img_picto('', $val['picto'], '', false, 0, 0, '', 'pictofixedwidth');
}
+
if (in_array($val['type'], array('int', 'integer'))) {
$value = GETPOSTISSET($key) ?GETPOST($key, 'int') : $object->$key;
} elseif ($val['type'] == 'double') {
@@ -78,6 +80,8 @@ foreach ($object->fields as $key => $val) {
$check = 'restricthtml';
}
$value = GETPOSTISSET($key) ? GETPOST($key, $check) : $object->$key;
+ } elseif (in_array($val['type'], array('date', 'datetime'))) {
+ $value = GETPOSTISSET($key) ? dol_mktime(GETPOST($key.'hour', 'int'), GETPOST($key.'min', 'int'), GETPOST($key.'sec', 'int'), GETPOST($key.'month', 'int'), GETPOST($key.'day', 'int'), GETPOST($key.'year', 'int')) : $object->$key;
} elseif ($val['type'] == 'price') {
$value = GETPOSTISSET($key) ? price2num(GETPOST($key)) : price2num($object->$key);
} elseif ($key == 'lang') {
diff --git a/htdocs/core/tpl/filemanager.tpl.php b/htdocs/core/tpl/filemanager.tpl.php
index 955e9dd479a..ddcb23da891 100644
--- a/htdocs/core/tpl/filemanager.tpl.php
+++ b/htdocs/core/tpl/filemanager.tpl.php
@@ -94,9 +94,11 @@ if ($permtoadd && GETPOSTISSET('website')) { // If on file manager to manage med
print img_picto('', 'images', '', false, 0, 0, '', 'size15x flip marginrightonly');
print '';
} elseif ($permtoadd && $module == 'ecm') { // If on file manager medias in ecm
- print '';
- print img_picto('', 'images', '', false, 0, 0, '', 'size15x flip marginrightonly');
- print '';
+ if (getDolGlobalInt('ECM_SHOW_GENERATE_WEBP_BUTTON')) {
+ print '';
+ print img_picto('', 'images', '', false, 0, 0, '', 'size15x flip marginrightonly');
+ print '';
+ }
}
print " |