diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 66e0fc07014..12457a41339 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -51,6 +51,12 @@ class Conf public $mycompany; public $admin; public $medias; + //! To store properties of multi-company + public $multicompany; + + //! To store module status of special module names + public $expedition_bon; + public $delivery_note; //! To store if javascript/ajax is enabked @@ -84,8 +90,6 @@ class Conf */ public $loghandlers = array(); - //! To store properties of multi-company - public $multicompany; //! Used to store running instance for multi-company (default 1) public $entity = 1; //! Used to store list of entities to use for each element @@ -148,8 +152,6 @@ class Conf // First level object that are modules. // TODO Remove this part. $this->multicompany = new stdClass(); - $this->expedition_bon = new stdClass(); - $this->delivery_note = new stdClass(); $this->fournisseur = new stdClass(); $this->product = new stdClass(); $this->service = new stdClass(); @@ -164,7 +166,6 @@ class Conf $this->adherent = new stdClass(); $this->bank = new stdClass(); $this->notification = new stdClass(); - $this->mailing = new stdClass(); $this->expensereport = new stdClass(); $this->productbatch = new stdClass(); } @@ -217,8 +218,6 @@ class Conf // First level object // TODO Remove this part. - $this->expedition_bon = new stdClass(); - $this->delivery_note = new stdClass(); $this->fournisseur = new stdClass(); $this->product = new stdClass(); $this->service = new stdClass(); @@ -233,7 +232,6 @@ class Conf $this->adherent = new stdClass(); $this->bank = new stdClass(); $this->notification = new stdClass(); - $this->mailing = new stdClass(); $this->expensereport = new stdClass(); $this->productbatch = new stdClass(); @@ -503,8 +501,10 @@ class Conf // Exception: Some dir are not the name of module. So we keep exception here for backward compatibility. // Sous module bons d'expedition + $this->expedition_bon = new stdClass(); $this->expedition_bon->enabled = (empty($this->global->MAIN_SUBMODULE_EXPEDITION) ? 0 : $this->global->MAIN_SUBMODULE_EXPEDITION); // Sub module delivery note Sous module bons de livraison + $this->delivery_note = new stdClass(); $this->delivery_note->enabled = (empty($this->global->MAIN_SUBMODULE_DELIVERY) ? 0 : $this->global->MAIN_SUBMODULE_DELIVERY); // Module fournisseur @@ -705,22 +705,26 @@ class Conf $this->theme = $this->global->MAIN_THEME; $this->css = "/theme/".$this->theme."/style.css.php"; - // conf->email_from = email pour envoi par dolibarr des mails automatiques + // conf->email_from = email by default to send Dolibarr automatic emails $this->email_from = "robot@example.com"; if (!empty($this->global->MAIN_MAIL_EMAIL_FROM)) { $this->email_from = $this->global->MAIN_MAIL_EMAIL_FROM; } - // conf->notification->email_from = email pour envoi par Dolibarr des notifications - $this->notification->email_from = $this->email_from; - if (!empty($this->global->NOTIFICATION_EMAIL_FROM)) { - $this->notification->email_from = $this->global->NOTIFICATION_EMAIL_FROM; + // conf->notification->email_from = email by default to send Dolibarr notifications + if (isModEnabled('notification')) { + $this->notification->email_from = $this->email_from; + if (!empty($this->global->NOTIFICATION_EMAIL_FROM)) { + $this->notification->email_from = $this->global->NOTIFICATION_EMAIL_FROM; + } } - // conf->mailing->email_from = email pour envoi par Dolibarr des mailings - $this->mailing->email_from = $this->email_from; - if (!empty($this->global->MAILING_EMAIL_FROM)) { - $this->mailing->email_from = $this->global->MAILING_EMAIL_FROM; + // conf->mailing->email_from = email by default to send Dolibarr emailings + if (isModEnabled('mailing')) { + $this->mailing->email_from = $this->email_from; + if (!empty($this->global->MAILING_EMAIL_FROM)) { + $this->mailing->email_from = $this->global->MAILING_EMAIL_FROM; + } } if (!isset($this->global->MAIN_HIDE_WARNING_TO_ENCOURAGE_SMTP_SETUP)) { diff --git a/htdocs/core/lib/propal.lib.php b/htdocs/core/lib/propal.lib.php index 3d380a3904a..b5e459c8637 100644 --- a/htdocs/core/lib/propal.lib.php +++ b/htdocs/core/lib/propal.lib.php @@ -47,10 +47,10 @@ function propal_prepare_head($object) $langs->load("sendings"); $text = ''; $head[$h][0] = DOL_URL_ROOT.'/expedition/propal.php?id='.$object->id; - if ($conf->expedition_bon->enabled) { + if (isModEnabled('expedition_bon')) { $text = $langs->trans("Shipment"); } - if ($conf->delivery_note->enabled) { + if (isModEnabled('delivery_note')) { $text .= '/'.$langs->trans("Receivings"); } $head[$h][1] = $text; diff --git a/htdocs/core/lib/sendings.lib.php b/htdocs/core/lib/sendings.lib.php index a2fbaeef92e..4013c6d41e9 100644 --- a/htdocs/core/lib/sendings.lib.php +++ b/htdocs/core/lib/sendings.lib.php @@ -133,7 +133,7 @@ function delivery_prepare_head($object) $h = 0; $head = array(); - if ($conf->expedition_bon->enabled && $user->rights->expedition->lire) { + if (isModEnabled('expedition_bon') && $user->rights->expedition->lire) { $head[$h][0] = DOL_URL_ROOT."/expedition/card.php?id=".$object->origin_id; $head[$h][1] = $langs->trans("SendingCard"); $head[$h][2] = 'shipping'; diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql index 5c819488971..417744bc49d 100644 --- a/htdocs/core/menus/init_menu_auguria.sql +++ b/htdocs/core/menus/init_menu_auguria.sql @@ -437,9 +437,9 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left -- Tools insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'empty($user->socid)', __HANDLER__, 'left', 3900__+MAX_llx_menu__, 'tools', 'email_templates', 8__+MAX_llx_menu__, '/admin/mails_templates.php?mainmenu=tools&leftmenu=email_templates', 'EMailTemplates', 0, '', '', '', 0, 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->mailing->enabled', __HANDLER__, 'left', 3910__+MAX_llx_menu__, 'tools', 'mailing', 8__+MAX_llx_menu__, '/comm/mailing/index.php?mainmenu=tools&leftmenu=mailing', 'EMailings', 0, 'mails', '$user->rights->mailing->lire', '', 0, 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->mailing->enabled', __HANDLER__, 'left', 3911__+MAX_llx_menu__, 'tools', '', 3910__+MAX_llx_menu__, '/comm/mailing/card.php?mainmenu=tools&leftmenu=mailing&action=create', 'NewMailing', 1, 'mails', '$user->rights->mailing->creer', '', 0, 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->mailing->enabled', __HANDLER__, 'left', 3912__+MAX_llx_menu__, 'tools', '', 3910__+MAX_llx_menu__, '/comm/mailing/list.php?mainmenu=tools&leftmenu=mailing', 'List', 1, 'mails', '$user->rights->mailing->lire', '', 0, 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 ('', 'isModEnabled("mailing")', __HANDLER__, 'left', 3910__+MAX_llx_menu__, 'tools', 'mailing', 8__+MAX_llx_menu__, '/comm/mailing/index.php?mainmenu=tools&leftmenu=mailing', 'EMailings', 0, 'mails', '$user->rights->mailing->lire', '', 0, 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 ('', 'isModEnabled("mailing")', __HANDLER__, 'left', 3911__+MAX_llx_menu__, 'tools', '', 3910__+MAX_llx_menu__, '/comm/mailing/card.php?mainmenu=tools&leftmenu=mailing&action=create', 'NewMailing', 1, 'mails', '$user->rights->mailing->creer', '', 0, 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 ('', 'isModEnabled("mailing")', __HANDLER__, 'left', 3912__+MAX_llx_menu__, 'tools', '', 3910__+MAX_llx_menu__, '/comm/mailing/list.php?mainmenu=tools&leftmenu=mailing', 'List', 1, 'mails', '$user->rights->mailing->lire', '', 0, 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->export->enabled', __HANDLER__, 'left', 4100__+MAX_llx_menu__, 'tools', 'export', 8__+MAX_llx_menu__, '/exports/index.php?mainmenu=tools&leftmenu=export', 'FormatedExport', 0, 'exports', '$user->rights->export->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->export->enabled', __HANDLER__, 'left', 4101__+MAX_llx_menu__, 'tools', '', 4100__+MAX_llx_menu__, '/exports/export.php?mainmenu=tools&leftmenu=export', 'NewExport', 1, 'exports', '$user->rights->export->creer', '', 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->import->enabled', __HANDLER__, 'left', 4130__+MAX_llx_menu__, 'tools', 'import', 8__+MAX_llx_menu__, '/imports/index.php?mainmenu=tools&leftmenu=import', 'FormatedImport', 0, 'exports', '$user->rights->import->run', '', 2, 2, __ENTITY__); diff --git a/htdocs/delivery/card.php b/htdocs/delivery/card.php index c1b27af2ce0..ea345efadcb 100644 --- a/htdocs/delivery/card.php +++ b/htdocs/delivery/card.php @@ -104,7 +104,7 @@ if ($action == 'add') { $object->commande_id = GETPOST("commande_id", 'int'); $object->fk_incoterms = GETPOST('incoterm_id', 'int'); - if (!$conf->expedition_bon->enabled && isModEnabled('stock')) { + if (!isModEnabled('expedition_bon') && isModEnabled('stock')) { $expedition->entrepot_id = GETPOST('entrepot_id', 'int'); } @@ -479,7 +479,7 @@ if ($action == 'create') { print '