dolibarr 18.0.6
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{
36
42 public function __construct($db)
43 {
44 $this->db = $db;
45 $this->numero = 22;
46
47 // Family can be 'base' (core modules),'crm','financial','hr','projects','products','ecm','technic' (transverse modules),'interface' (link with external tools),'other','...'
48 // It is used to group modules by family in module setup page
49 $this->family = "interface";
50 // Module position in the family on 2 digits ('01', '10', '20', ...)
51 $this->module_position = '23';
52
53 // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
54 $this->name = preg_replace('/^mod/i', '', get_class($this));
55 $this->description = "Gestion des EMailings";
56 // Possible values for version are: 'development', 'experimental', 'dolibarr' or version
57 $this->version = 'dolibarr';
58 $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
59 $this->picto = 'email';
60
61 // Data directories to create when module is enabled
62 $this->dirs = array("/mailing/temp");
63
64 // Dependencies
65 $this->hidden = false; // A condition to hide module
66 $this->depends = array(); // List of module class names as string that must be enabled if this module is enabled
67 $this->requiredby = array(); // List of module ids to disable if this one is disabled
68 $this->conflictwith = array(); // List of module class names as string this module is in conflict with
69 $this->phpmin = array(7, 0); // Minimum version of PHP required by module
70 $this->langfiles = array("mails");
71
72 // Config pages
73 $this->config_page_url = array("mailing.php");
74
75 // Constants
76 $this->const = array();
77 $r = 0;
78
79 $this->const[$r][0] = "MAILING_CONTACT_DEFAULT_BULK_STATUS";
80 $this->const[$r][1] = "chaine";
81 $this->const[$r][2] = "0";
82 $this->const[$r][3] = 'Default value for field "Refuse bulk email" when creating a contact';
83 $this->const[$r][4] = 0;
84 $r++;
85
86 // Boxes
87 $this->boxes = array();
88
89 // Permissions
90 $this->rights = array();
91 $this->rights_class = 'mailing';
92 $r = 0;
93
94 $r++;
95 $this->rights[$r][0] = 221; // id de la permission
96 $this->rights[$r][1] = 'Consulter les mailings'; // libelle de la permission
97 $this->rights[$r][2] = 'r'; // type de la permission (deprecie a ce jour)
98 $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut
99 $this->rights[$r][4] = 'lire';
100
101 $r++;
102 $this->rights[$r][0] = 222;
103 $this->rights[$r][1] = 'Creer/modifier les mailings (sujet, destinataires...)';
104 $this->rights[$r][2] = 'w';
105 $this->rights[$r][3] = 0;
106 $this->rights[$r][4] = 'creer';
107
108 $r++;
109 $this->rights[$r][0] = 223;
110 $this->rights[$r][1] = 'Valider les mailings (permet leur envoi)';
111 $this->rights[$r][2] = 'w';
112 $this->rights[$r][3] = 0;
113 $this->rights[$r][4] = 'valider';
114
115 $r++;
116 $this->rights[$r][0] = 229;
117 $this->rights[$r][1] = 'Supprimer les mailings';
118 $this->rights[$r][2] = 'd';
119 $this->rights[$r][3] = 0;
120 $this->rights[$r][4] = 'supprimer';
121
122 $r++;
123 $this->rights[$r][0] = 237;
124 $this->rights[$r][1] = 'View recipients and info';
125 $this->rights[$r][2] = 'r';
126 $this->rights[$r][3] = 0;
127 $this->rights[$r][4] = 'mailing_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on
128 $this->rights[$r][5] = 'recipient';
129
130 $r++;
131 $this->rights[$r][0] = 238;
132 $this->rights[$r][1] = 'Manually send mailings';
133 $this->rights[$r][2] = 'w';
134 $this->rights[$r][3] = 0;
135 $this->rights[$r][4] = 'mailing_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on
136 $this->rights[$r][5] = 'send';
137
138 $r++;
139 $this->rights[$r][0] = 239;
140 $this->rights[$r][1] = 'Delete mailings after validation and/or sent';
141 $this->rights[$r][2] = 'd';
142 $this->rights[$r][3] = 0;
143 $this->rights[$r][4] = 'mailing_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on
144 $this->rights[$r][5] = 'delete';
145
146 // Menus
147 //-------
148 $this->menu = 1; // This module add menu entries. They are coded into menu manager.
149 }
150
151
160 public function init($options = '')
161 {
162 $result = $this->_load_tables('/install/mysql/', 'mailing');
163 if ($result < 0) {
164 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')
165 }
166
167 // Permissions
168 $this->remove($options);
169
170 $sql = array();
171
172 return $this->_init($sql, $options);
173 }
174}
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:123