dolibarr 21.0.0-beta
modMailing.class.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3 * Copyright (C) 2005-2008 Laurent Destailleur <eldy@users.sourceforge.net>
4 * Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
28include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';
29
30
35{
41 public function __construct($db)
42 {
43 $this->db = $db;
44 $this->numero = 22;
45
46 // Family can be 'base' (core modules),'crm','financial','hr','projects','products','ecm','technic' (transverse modules),'interface' (link with external tools),'other','...'
47 // It is used to group modules by family in module setup page
48 $this->family = "interface";
49 // Module position in the family on 2 digits ('01', '10', '20', ...)
50 $this->module_position = '23';
51
52 // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
53 $this->name = preg_replace('/^mod/i', '', get_class($this));
54 $this->description = "Gestion des EMailings";
55 // Possible values for version are: 'development', 'experimental', 'dolibarr' or version
56 $this->version = 'dolibarr';
57 $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
58 $this->picto = 'email';
59
60 // Data directories to create when module is enabled
61 $this->dirs = array("/mailing/temp");
62
63 // Dependencies
64 $this->hidden = false; // A condition to hide module
65 $this->depends = array(); // List of module class names as string that must be enabled if this module is enabled
66 $this->requiredby = array(); // List of module ids to disable if this one is disabled
67 $this->conflictwith = array(); // List of module class names as string this module is in conflict with
68 $this->phpmin = array(7, 0); // Minimum version of PHP required by module
69 $this->langfiles = array("mails");
70
71 // Config pages
72 $this->config_page_url = array("mailing.php");
73
74 // Constants
75 $this->const = array();
76 $r = 0;
77
78 $this->const[$r][0] = "MAILING_CONTACT_DEFAULT_BULK_STATUS";
79 $this->const[$r][1] = "chaine";
80 $this->const[$r][2] = "0";
81 $this->const[$r][3] = 'Default value for field "Refuse bulk email" when creating a contact';
82 $this->const[$r][4] = 0;
83 $r++;
84
85 // Boxes
86 $this->boxes = array();
87
88 // Permissions
89 $this->rights = array();
90 $this->rights_class = 'mailing';
91 $r = 0;
92
93 $r++;
94 $this->rights[$r][0] = 221; // id de la permission
95 $this->rights[$r][1] = 'Consulter les mailings'; // libelle de la permission
96 $this->rights[$r][2] = 'r'; // type de la permission (deprecated)
97 $this->rights[$r][3] = 0; // La permission est-elle une permission par default
98 $this->rights[$r][4] = 'lire';
99
100 $r++;
101 $this->rights[$r][0] = 222;
102 $this->rights[$r][1] = 'Creer/modifier les mailings (sujet, destinataires...)';
103 $this->rights[$r][2] = 'w';
104 $this->rights[$r][3] = 0;
105 $this->rights[$r][4] = 'creer';
106
107 $r++;
108 $this->rights[$r][0] = 223;
109 $this->rights[$r][1] = 'Valider les mailings (permet leur envoi)';
110 $this->rights[$r][2] = 'w';
111 $this->rights[$r][3] = 0;
112 $this->rights[$r][4] = 'valider';
113
114 $r++;
115 $this->rights[$r][0] = 229;
116 $this->rights[$r][1] = 'Supprimer les mailings';
117 $this->rights[$r][2] = 'd';
118 $this->rights[$r][3] = 0;
119 $this->rights[$r][4] = 'supprimer';
120
121 $r++;
122 $this->rights[$r][0] = 237;
123 $this->rights[$r][1] = 'View recipients and info';
124 $this->rights[$r][2] = 'r';
125 $this->rights[$r][3] = 0;
126 $this->rights[$r][4] = 'mailing_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on
127 $this->rights[$r][5] = 'recipient';
128
129 $r++;
130 $this->rights[$r][0] = 238;
131 $this->rights[$r][1] = 'Manually send mailings';
132 $this->rights[$r][2] = 'w';
133 $this->rights[$r][3] = 0;
134 $this->rights[$r][4] = 'mailing_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on
135 $this->rights[$r][5] = 'send';
136
137 $r++;
138 $this->rights[$r][0] = 239;
139 $this->rights[$r][1] = 'Delete mailings after validation and/or sent';
140 $this->rights[$r][2] = 'd';
141 $this->rights[$r][3] = 0;
142 $this->rights[$r][4] = 'mailing_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on
143 $this->rights[$r][5] = 'delete';
144
145 // Menus
146 //-------
147 $this->menu = 1; // This module add menu entries. They are coded into menu manager.
148 }
149
150
159 public function init($options = '')
160 {
161 $result = $this->_load_tables('/install/mysql/', 'mailing');
162 if ($result < 0) {
163 return -1; // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default')
164 }
165
166 // Permissions
167 $this->remove($options);
168
169 $sql = array();
170
171 return $this->_init($sql, $options);
172 }
173}
Class DolibarrModules.
_init($array_sql, $options='')
Enables a module.
_load_tables($reldir, $onlywithsuffix='')
Create tables and keys required by module:
Class to describe and enable module Mailing.
__construct($db)
Constructor.
init($options='')
Function called when module is enabled.
print $script_file $mode $langs defaultlang(is_numeric($duration_value) ? " delay=". $duration_value :"").(is_numeric($duration_value2) ? " after cd cd cd description as description
Only used if Module[ID]Desc translation string is not found.
$conf db name
Only used if Module[ID]Name translation string is not found.
Definition repair.php:152