2011-09-21 18:40:52 +02:00
|
|
|
<?php
|
2011-09-21 15:05:32 +02:00
|
|
|
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
|
|
|
|
* Copyright (C) 2005-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
2012-12-30 15:13:49 +01:00
|
|
|
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
2011-09-21 15:05:32 +02:00
|
|
|
*
|
|
|
|
|
* 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
|
2013-01-16 15:36:08 +01:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
2011-09-21 15:05:32 +02:00
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* \defgroup mailing Module emailing
|
|
|
|
|
* \brief Module to manage EMailings
|
2011-10-24 14:11:49 +02:00
|
|
|
* \file htdocs/core/modules/modMailing.class.php
|
2011-09-21 15:05:32 +02:00
|
|
|
* \ingroup mailing
|
|
|
|
|
* \brief Fichier de description et activation du module Mailing
|
|
|
|
|
*/
|
|
|
|
|
|
2012-08-23 02:04:35 +02:00
|
|
|
include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php';
|
2011-09-21 15:05:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2015-09-07 15:55:26 +02:00
|
|
|
* Class to describe and enable module Mailing
|
2011-09-21 15:05:32 +02:00
|
|
|
*/
|
|
|
|
|
class modMailing extends DolibarrModules
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
/**
|
2011-09-26 16:22:35 +02:00
|
|
|
* Constructor. Define names, constants, directories, boxes, permissions
|
|
|
|
|
*
|
2012-01-04 21:23:50 +01:00
|
|
|
* @param DoliDB $db Database handler
|
2011-09-21 15:05:32 +02:00
|
|
|
*/
|
2012-07-30 17:17:33 +02:00
|
|
|
function __construct($db)
|
2011-09-21 15:05:32 +02:00
|
|
|
{
|
2012-01-04 21:23:50 +01:00
|
|
|
$this->db = $db;
|
|
|
|
|
$this->numero = 22;
|
2011-09-21 15:05:32 +02:00
|
|
|
|
|
|
|
|
$this->family = "technic";
|
|
|
|
|
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
|
|
|
|
|
$this->name = preg_replace('/^mod/i','',get_class($this));
|
|
|
|
|
$this->description = "Gestion des EMailings";
|
2017-08-22 18:34:58 +02:00
|
|
|
// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
|
|
|
|
|
$this->version = 'dolibarr';
|
2011-09-21 15:05:32 +02:00
|
|
|
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
|
|
|
|
|
$this->special = 0;
|
|
|
|
|
$this->picto='email';
|
|
|
|
|
|
|
|
|
|
// Data directories to create when module is enabled
|
|
|
|
|
$this->dirs = array("/mailing/temp");
|
|
|
|
|
|
2015-09-07 15:29:51 +02:00
|
|
|
// Dependencies
|
2011-09-21 15:05:32 +02:00
|
|
|
$this->depends = array();
|
|
|
|
|
$this->requiredby = array();
|
|
|
|
|
$this->langfiles = array("mails");
|
|
|
|
|
|
|
|
|
|
// Config pages
|
|
|
|
|
$this->config_page_url = array("mailing.php");
|
|
|
|
|
|
2015-09-07 15:40:55 +02:00
|
|
|
// Constants
|
2011-09-21 15:05:32 +02:00
|
|
|
$this->const = array();
|
|
|
|
|
|
2015-09-07 15:46:57 +02:00
|
|
|
// Boxes
|
2011-09-21 15:05:32 +02:00
|
|
|
$this->boxes = array();
|
|
|
|
|
|
|
|
|
|
// Permissions
|
|
|
|
|
$this->rights = array();
|
|
|
|
|
$this->rights_class = 'mailing';
|
2012-07-02 19:30:37 +02:00
|
|
|
$r=0;
|
2012-10-03 00:30:50 +02:00
|
|
|
|
2012-06-13 21:45:47 +02:00
|
|
|
$r++;
|
|
|
|
|
$this->rights[$r][0] = 221; // id de la permission
|
|
|
|
|
$this->rights[$r][1] = 'Consulter les mailings'; // libelle de la permission
|
|
|
|
|
$this->rights[$r][2] = 'r'; // type de la permission (deprecie a ce jour)
|
2016-06-04 12:16:30 +02:00
|
|
|
$this->rights[$r][3] = 0; // La permission est-elle une permission par defaut
|
2012-06-13 21:45:47 +02:00
|
|
|
$this->rights[$r][4] = 'lire';
|
2012-10-03 00:30:50 +02:00
|
|
|
|
2012-06-13 21:45:47 +02:00
|
|
|
$r++;
|
|
|
|
|
$this->rights[$r][0] = 222;
|
|
|
|
|
$this->rights[$r][1] = 'Creer/modifier les mailings (sujet, destinataires...)';
|
|
|
|
|
$this->rights[$r][2] = 'w';
|
|
|
|
|
$this->rights[$r][3] = 0;
|
|
|
|
|
$this->rights[$r][4] = 'creer';
|
2012-10-03 00:30:50 +02:00
|
|
|
|
2012-06-13 21:45:47 +02:00
|
|
|
$r++;
|
|
|
|
|
$this->rights[$r][0] = 223;
|
|
|
|
|
$this->rights[$r][1] = 'Valider les mailings (permet leur envoi)';
|
|
|
|
|
$this->rights[$r][2] = 'w';
|
|
|
|
|
$this->rights[$r][3] = 0;
|
|
|
|
|
$this->rights[$r][4] = 'valider';
|
2012-10-03 00:30:50 +02:00
|
|
|
|
2012-06-13 21:45:47 +02:00
|
|
|
$r++;
|
|
|
|
|
$this->rights[$r][0] = 229;
|
|
|
|
|
$this->rights[$r][1] = 'Supprimer les mailings';
|
|
|
|
|
$this->rights[$r][2] = 'd';
|
|
|
|
|
$this->rights[$r][3] = 0;
|
|
|
|
|
$this->rights[$r][4] = 'supprimer';
|
2012-10-03 00:30:50 +02:00
|
|
|
|
2012-07-02 19:30:37 +02:00
|
|
|
$r++;
|
|
|
|
|
$this->rights[$r][0] = 237;
|
|
|
|
|
$this->rights[$r][1] = 'View recipients and info';
|
|
|
|
|
$this->rights[$r][2] = 'r';
|
|
|
|
|
$this->rights[$r][3] = 0;
|
|
|
|
|
$this->rights[$r][4] = 'mailing_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on
|
2012-06-14 20:08:46 +02:00
|
|
|
$this->rights[$r][5] = 'recipient';
|
2012-10-03 00:30:50 +02:00
|
|
|
|
2012-07-02 19:30:37 +02:00
|
|
|
$r++;
|
|
|
|
|
$this->rights[$r][0] = 238;
|
|
|
|
|
$this->rights[$r][1] = 'Manually send mailings';
|
|
|
|
|
$this->rights[$r][2] = 'w';
|
|
|
|
|
$this->rights[$r][3] = 0;
|
|
|
|
|
$this->rights[$r][4] = 'mailing_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on
|
2012-06-14 20:08:46 +02:00
|
|
|
$this->rights[$r][5] = 'send';
|
2012-10-03 00:30:50 +02:00
|
|
|
|
2012-07-02 19:30:37 +02:00
|
|
|
$r++;
|
|
|
|
|
$this->rights[$r][0] = 239;
|
|
|
|
|
$this->rights[$r][1] = 'Delete mailings after validation and/or sent';
|
|
|
|
|
$this->rights[$r][2] = 'd';
|
|
|
|
|
$this->rights[$r][3] = 0;
|
|
|
|
|
$this->rights[$r][4] = 'mailing_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on
|
2012-06-14 20:08:46 +02:00
|
|
|
$this->rights[$r][5] = 'delete';
|
2011-09-21 15:05:32 +02:00
|
|
|
|
2016-09-30 13:02:13 +02:00
|
|
|
// Menus
|
|
|
|
|
//-------
|
|
|
|
|
$this->menu = 1; // This module add menu entries. They are coded into menu manager.
|
2017-08-22 18:34:58 +02:00
|
|
|
|
2011-09-21 15:05:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2012-01-04 21:23:50 +01:00
|
|
|
* Function called when module is enabled.
|
|
|
|
|
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
|
|
|
|
|
* It also creates data directories
|
|
|
|
|
*
|
|
|
|
|
* @param string $options Options when enabling module ('', 'noboxes')
|
|
|
|
|
* @return int 1 if OK, 0 if KO
|
2011-09-21 15:05:32 +02:00
|
|
|
*/
|
2012-01-04 21:23:50 +01:00
|
|
|
function init($options='')
|
2011-09-21 15:05:32 +02:00
|
|
|
{
|
|
|
|
|
// Permissions
|
2012-03-03 17:37:45 +01:00
|
|
|
$this->remove($options);
|
2011-09-21 15:05:32 +02:00
|
|
|
|
2011-12-05 19:03:36 +01:00
|
|
|
$sql = array();
|
|
|
|
|
|
2012-01-04 21:23:50 +01:00
|
|
|
return $this->_init($sql,$options);
|
2011-09-21 15:05:32 +02:00
|
|
|
}
|
|
|
|
|
}
|