dolibarr  19.0.0-dev
mailing.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
3  * Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <https://www.gnu.org/licenses/>.
17  */
18 
25 // Load Dolibarr environment
26 require '../../main.inc.php';
27 require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
28 require_once DOL_DOCUMENT_ROOT.'/datapolicy/class/datapolicy.class.php';
29 
30 $idcontact = GETPOST('idc', 'int');
31 $idcompany = GETPOST('ids', 'int');
32 $idmember = GETPOST('ida', 'int');
33 
34 // Security
35 if (!isModEnabled("datapolicy")) {
37 }
38 if (!$user->admin) {
40 }
41 
42 
43 /*
44  * Actions
45  */
46 
47 if (!empty($idcontact)) {
48  $contact = new Contact($db);
49  $contact->fetch($idcontact);
51 } elseif (!empty($idcompany)) {
52  $company = new Societe($db);
53  $company->fetch($idcompany);
55 } elseif (!empty($idmember)) {
56  $member = new Adherent($db);
57  $member->fetch($idmember);
59 } else {
60  $contacts = new DataPolicy($db);
61 
62  // Send email to all contacts where email was not already sent
63  $contacts->getAllContactNotInformed();
64  $contacts->getAllCompaniesNotInformed();
65  $contacts->getAllAdherentsNotInformed();
66 }
67 
68 
69 /*
70  * View
71  */
72 
73 echo $langs->trans('AllAgreementSend');
Societe
Class to manage third parties objects (customers, suppliers, prospects...)
Definition: societe.class.php:51
DataPolicy\sendMailDataPolicyAdherent
static sendMailDataPolicyAdherent($adherent)
sendMailDataPolicyAdherent
Definition: datapolicy.class.php:311
GETPOST
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
Definition: functions.lib.php:609
DataPolicy\sendMailDataPolicyContact
static sendMailDataPolicyContact($contact)
sendMailDataPolicyContact
Definition: datapolicy.class.php:162
Contact
Class to manage contact/addresses.
Definition: contact.class.php:42
Adherent
Class to manage members of a foundation.
Definition: adherent.class.php:47
isModEnabled
isModEnabled($module)
Is Dolibarr module enabled.
Definition: functions.lib.php:207
DataPolicy\sendMailDataPolicyCompany
static sendMailDataPolicyCompany($societe)
sendMailDataPolicyCompany
Definition: datapolicy.class.php:238
accessforbidden
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.
Definition: security.lib.php:1169
DataPolicy
Class DataPolicy.
Definition: datapolicy.class.php:32