diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php
index 8c48d0314e0..9d2ab29da74 100644
--- a/htdocs/comm/mailing/cibles.php
+++ b/htdocs/comm/mailing/cibles.php
@@ -31,8 +31,13 @@ require("./pre.inc.php");
$langs->load("mails");
-$dir=DOL_DOCUMENT_ROOT."/includes/modules/mailings";
+$user->getrights("mailing");
+if (! $user->rights->mailing->lire || $user->societe_id > 0)
+ accessforbidden();
+
+
+$dir=DOL_DOCUMENT_ROOT."/includes/modules/mailings";
$mesg = '';
diff --git a/htdocs/comm/mailing/fiche.php b/htdocs/comm/mailing/fiche.php
index d619480aa02..d950d34b68e 100644
--- a/htdocs/comm/mailing/fiche.php
+++ b/htdocs/comm/mailing/fiche.php
@@ -21,7 +21,8 @@
*
*/
-/** \file htdocs/comm/mailing/fiche.php
+/**
+ \file htdocs/comm/mailing/fiche.php
\brief Fiche mailing, onglet général
\version $Revision$
*/
@@ -30,6 +31,12 @@ require("./pre.inc.php");
$langs->load("mails");
+$user->getrights("mailing");
+
+if (! $user->rights->mailing->lire || $user->societe_id > 0)
+ accessforbidden();
+
+
$message = '';
@@ -328,7 +335,7 @@ else
{
print "\n\n
\n";
- if ($mil->statut == 0)
+ if ($mil->statut == 0 && $user->rights->mailing->creer)
{
print '
'.$langs->trans("EditMailing").'';
}
@@ -337,17 +344,17 @@ else
print '
'.$langs->trans("TestMailing").'';
- if ($mil->statut == 0 && $mil->nbemail > 0)
+ if ($mil->statut == 0 && $mil->nbemail > 0 && $user->rights->mailing->valider)
{
print '
'.$langs->trans("ValidMailing").'';
}
- if ($mil->statut == 1 && $mil->nbemail > 0)
+ if ($mil->statut == 1 && $mil->nbemail > 0 && $user->rights->mailing->valider)
{
print '
'.$langs->trans("SendMailing").'';
}
- if ($mil->statut <= 1)
+ if ($mil->statut <= 1 && $user->rights->mailing->supprimer)
{
print '
'.$langs->trans("DeleteMailing").'';
}
diff --git a/htdocs/comm/mailing/index.php b/htdocs/comm/mailing/index.php
index c2e1d46fe44..90a0fdc0bdb 100644
--- a/htdocs/comm/mailing/index.php
+++ b/htdocs/comm/mailing/index.php
@@ -30,14 +30,16 @@
require("./pre.inc.php");
-if ($user->societe_id > 0)
-{
- accessforbidden();
-}
-
$langs->load("commercial");
$langs->load("orders");
+$user->getrights("mailing");
+
+if (! $user->rights->mailing->lire || $user->societe_id > 0)
+ accessforbidden();
+
+
+
llxHeader('','Mailing');
/*
diff --git a/htdocs/comm/mailing/pre.inc.php b/htdocs/comm/mailing/pre.inc.php
index f241a6fb273..c526697c91b 100644
--- a/htdocs/comm/mailing/pre.inc.php
+++ b/htdocs/comm/mailing/pre.inc.php
@@ -21,7 +21,8 @@
*
*/
-/** \file htdocs/comm/mailing/pre.inc.php
+/**
+ \file htdocs/comm/mailing/pre.inc.php
\brief Fichier de gestion du menu gauche de l'espace mailing
\version $Revision$
*/
@@ -41,9 +42,14 @@ function llxHeader($head = "", $title = "") {
$menu = new Menu();
- $menu->add(DOL_URL_ROOT."/comm/mailing/index.php", $langs->trans("Mailings"));
- $menu->add_submenu(DOL_URL_ROOT."/comm/mailing/fiche.php?action=create", $langs->trans("NewMailing"));
-
+ if ($user->rights->mailing->lire) {
+ $menu->add(DOL_URL_ROOT."/comm/mailing/index.php", $langs->trans("Mailings"));
+ }
+
+ if ($user->rights->mailing->creer) {
+ $menu->add_submenu(DOL_URL_ROOT."/comm/mailing/fiche.php?action=create", $langs->trans("NewMailing"));
+ }
+
left_menu($menu->liste);
}
diff --git a/htdocs/includes/menus/barre_left/eldy.php b/htdocs/includes/menus/barre_left/eldy.php
index 21b8fe9d74d..eb9d5a62666 100644
--- a/htdocs/includes/menus/barre_left/eldy.php
+++ b/htdocs/includes/menus/barre_left/eldy.php
@@ -20,7 +20,8 @@
*
*/
-/** \file htdocs/includes/menus/barre_left/eldy.php
+/**
+ \file htdocs/includes/menus/barre_left/eldy.php
\brief Gestionnaire du menu du gauche Eldy
\version $Revision$
@@ -33,7 +34,8 @@
*/
-/** \class MenuLeft
+/**
+ \class MenuLeft
\brief Classe permettant la gestion du menu du gauche Eldy
*/
@@ -448,13 +450,13 @@ class MenuLeft {
*/
if ($mainmenu == 'tools') {
- $newmenu->add(DOL_URL_ROOT."/comm/mailing/index.php?leftmenu=mailing", $langs->trans("EMailings"));
-
- if($user->admin) // \todo en attendant droits d'un module mailing
+ if ($conf->mailing->enabled)
{
$langs->load("admin");
$langs->load("mails");
- $newmenu->add_submenu(DOL_URL_ROOT."/comm/mailing/fiche.php?leftmenu=mailing&action=create", $langs->trans("NewMailing"));
+
+ $newmenu->add(DOL_URL_ROOT."/comm/mailing/index.php?leftmenu=mailing", $langs->trans("EMailings"),0,$user->rights->mailing->lire);
+ $newmenu->add_submenu(DOL_URL_ROOT."/comm/mailing/fiche.php?leftmenu=mailing&action=create", $langs->trans("NewMailing"),1,$user->rights->mailing->creer);
}
if ($conf->projet->enabled)
diff --git a/htdocs/includes/modules/modMailing.class.php b/htdocs/includes/modules/modMailing.class.php
index 25a7543eee3..79b53b61536 100644
--- a/htdocs/includes/modules/modMailing.class.php
+++ b/htdocs/includes/modules/modMailing.class.php
@@ -1,5 +1,6 @@
+/* Copyright (C) 2005 Rodolphe Quiedeville
+ * Copyright (C) 2005 Laurent Destailleur
*
* 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
@@ -22,13 +23,13 @@
/**
\defgroup mailing Module mailing
- \brief Module pour gérer la téléphonie
+ \brief Module pour gérer les mailings
*/
/**
\file htdocs/includes/modules/modMailing.class.php
\ingroup mailing
- \brief Fichier de description et activation du module de Téléphonie
+ \brief Fichier de description et activation du module Mailing
*/
include_once "DolibarrModules.class.php";
@@ -51,13 +52,13 @@ class modMailing extends DolibarrModules
$this->numero = 22 ;
$this->family = "technic";
- $this->name = "Mailing";
- $this->description = "Gestion des Mailing";
- $this->version = 'experimental'; // 'experimental' or 'dolibarr' or version
+ $this->name = "Mailings";
+ $this->description = "Gestion des Mailings";
+ $this->version = 'dolibarr'; // 'experimental' or 'dolibarr' or version
$this->const_name = "MAIN_MODULE_MAILING";
$this->const_config = MAIN_MODULE_MAILING;
$this->special = 1;
- //$this->picto='phoning';
+ $this->picto='email';
// Dir
$this->dirs = array();
@@ -93,10 +94,22 @@ class modMailing extends DolibarrModules
$this->rights[1][4] = 'lire';
$this->rights[2][0] = 222;
- $this->rights[2][1] = 'Créer des mailing';
+ $this->rights[2][1] = 'Créer/modifier les mailings (sujet, destinataires...)';
$this->rights[2][2] = 'w';
$this->rights[2][3] = 0;
$this->rights[2][4] = 'creer';
+
+ $this->rights[3][0] = 223;
+ $this->rights[3][1] = 'Valider les mailings (permet leur envoi)';
+ $this->rights[3][2] = 'w';
+ $this->rights[3][3] = 0;
+ $this->rights[3][4] = 'valider';
+
+ $this->rights[4][0] = 229;
+ $this->rights[4][1] = 'Supprimer les mailings)';
+ $this->rights[4][2] = 'd';
+ $this->rights[4][3] = 0;
+ $this->rights[4][4] = 'supprimer';
return $this->_init($sql);
}
diff --git a/htdocs/master.inc.php b/htdocs/master.inc.php
index 0f5aa49514d..972ec536edf 100644
--- a/htdocs/master.inc.php
+++ b/htdocs/master.inc.php
@@ -187,6 +187,10 @@ if (defined("MAIN_MODULE_DEPLACEMENT"))
{
$conf->deplacement->enabled=MAIN_MODULE_DEPLACEMENT;
}
+if (defined("MAIN_MODULE_MAILING"))
+{
+ $conf->mailing->enabled=MAIN_MODULE_MAILING;
+}
if (defined("MAIN_MODULE_EXTERNALRSS"))
{
$conf->externalrss->enabled=MAIN_MODULE_EXTERNALRSS;