23 include_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
24 include_once DOL_DOCUMENT_ROOT.
'/societe/class/societe.class.php';
25 include_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
26 include_once DOL_DOCUMENT_ROOT.
'/core/lib/security.lib.php';
51 global $langs, $conf, $db, $user;
53 $langs->load(
"companies");
55 $sql =
"SELECT c.rowid";
56 $sql .=
" FROM ".MAIN_DB_PREFIX.
"socpeople as c";
57 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s ON c.fk_soc = s.rowid";
58 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"socpeople_extrafields as spe ON spe.fk_object = c.rowid";
59 $sql .=
" WHERE (c.statut=1 AND c.no_email=0 AND (spe.datapolicy_consentement=0 OR spe.datapolicy_consentement IS NULL) AND (spe.datapolicy_opposition_traitement=0 OR spe.datapolicy_opposition_traitement IS NULL) AND (spe.datapolicy_opposition_prospection=0 OR spe.datapolicy_opposition_prospection IS NULL))";
60 $sql .=
" AND spe.datapolicy_send IS NULL";
61 $sql .=
" AND c.entity=".$conf->entity;
67 $obj = $this->
db->fetch_object(
$resql);
69 $contact->fetch($obj->rowid);
75 $this->error = $this->
db->error();
87 global $langs, $conf, $db, $user;
89 $langs->load(
"companies");
91 $sql =
"SELECT s.rowid";
92 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s";
93 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe_extrafields as se ON se.fk_object = s.rowid";
94 $sql .=
" WHERE s.statut=0 AND (se.datapolicy_consentement=0 OR se.datapolicy_consentement IS NULL) AND (se.datapolicy_opposition_traitement=0 OR se.datapolicy_opposition_traitement IS NULL) AND (se.datapolicy_opposition_prospection=0 OR se.datapolicy_opposition_prospection IS NULL)";
95 $sql .=
" AND se.datapolicy_send IS NULL";
96 $sql .=
" AND s.entity=".$conf->entity;
102 $obj = $this->
db->fetch_object(
$resql);
104 $societe->fetch($obj->rowid);
110 $this->error = $this->
db->error();
122 global $langs, $conf, $db, $user;
124 $langs->load(
"adherent");
126 $sql =
"SELECT a.rowid";
127 $sql .=
" FROM ".MAIN_DB_PREFIX.
"adherent as a";
128 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"adherent_extrafields as ae ON ae.fk_object = a.rowid";
129 $sql .=
" WHERE a.statut=0 AND (ae.datapolicy_consentement=0 OR ae.datapolicy_consentement IS NULL) AND (ae.datapolicy_opposition_traitement=0 OR ae.datapolicy_opposition_traitement IS NULL) AND (ae.datapolicy_opposition_prospection=0 OR ae.datapolicy_opposition_prospection IS NULL)";
130 $sql .=
" AND ae.datapolicy_send IS NULL";
131 $sql .=
" AND a.entity=".$conf->entity;
137 $obj = $this->
db->fetch_object(
$resql);
139 $adherent->fetch($obj->rowid);
145 $this->error = $this->
db->error();
158 global $langs, $conf, $db, $user;
162 $from = $user->getFullName($langs).
' <'.$user->email.
'>';
164 $sendto = $contact->email;
165 $code =
dol_hash($contact->email,
'md5');
166 if (!empty($contact->default_lang)) {
167 $l = $contact->default_lang;
169 $l = $langs->defaultlang;
172 $s =
"DATAPOLICYSUBJECT_".$l;
173 $ma =
"DATAPOLICYCONTENT_".$l;
174 $la =
'TXTLINKDATAPOLICYACCEPT_'.$l;
175 $lr =
'TXTLINKDATAPOLICYREFUSE_'.$l;
177 $subject = $conf->global->$s;
178 $message = $conf->global->$ma;
179 $linka = $conf->global->$la;
180 $linkr = $conf->global->$lr;
181 $sendtocc = $sendtobcc =
'';
182 $filepath = $mimetype = $filename = array();
183 $deliveryreceipt = 0;
185 $substitutionarray = array(
186 '__LINKACCEPT__' =>
'<a href="'.
dol_buildpath(
'/public/datapolicy/index.php?action=1&c='.$contact->id.
'&l='.$l.
'&key='.$code, 3).
'" target="_blank" rel="noopener noreferrer">'.$linka.
'</a>',
187 '__LINKREFUSED__' =>
'<a href="'.dol_buildpath(
'/public/datapolicy/index.php?action=2&c='.$contact->id.
'&l='.$l.
'&key='.$code, 3).
'" target="_blank" rel="noopener noreferrer">'.$linkr.
'</a>',
188 '__FIRSTNAME__' => $contact->firstname,
189 '__NAME__' => $contact->lastname,
190 '__CIVILITY__' => $contact->civility,
195 $actiontypecode =
'AC_EMAIL';
196 $actionmsg = $langs->transnoentities(
'MailSentBy').
' '.$from.
' '.$langs->transnoentities(
'To').
' '.$sendto;
199 $actionmsg =
dol_concatdesc($actionmsg, $langs->transnoentities(
'Bcc').
": ".$sendtocc);
201 $actionmsg =
dol_concatdesc($actionmsg, $langs->transnoentities(
'MailTopic').
": ".$subject);
202 $actionmsg =
dol_concatdesc($actionmsg, $langs->transnoentities(
'TextUsedInTheMessageBody').
":");
208 require_once DOL_DOCUMENT_ROOT.
'/core/class/CMailFile.class.php';
209 $mailfile =
new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, $sendtocc, $sendtobcc, $deliveryreceipt, -1);
211 if ($mailfile->error) {
212 $resultmasssend .=
'<div class="error">'.$mailfile->error.
'</div>';
214 $result4 = $mailfile->sendfile();
216 $resultmasssend .= $langs->trans(
"MailSent").
': '.$sendto.
"<br>";
217 $contact->array_options[
'options_datapolicy_send'] = date(
'Y-m-d', time());
218 $contact->update($contact->id);
234 global $langs, $conf, $db, $user;
238 $from = $user->getFullName($langs).
' <'.$user->email.
'>';
240 $sendto = $societe->email;
242 $code =
dol_hash($societe->email,
'md5');
243 if (!empty($societe->default_lang)) {
244 $l = $societe->default_lang;
246 $l = $langs->defaultlang;
249 $s =
"DATAPOLICYSUBJECT_".$l;
250 $ma =
"DATAPOLICYCONTENT_".$l;
251 $la =
'TXTLINKDATAPOLICYACCEPT_'.$l;
252 $lr =
'TXTLINKDATAPOLICYREFUSE_'.$l;
254 $subject = $conf->global->$s;
255 $message = $conf->global->$ma;
256 $linka = $conf->global->$la;
257 $linkr = $conf->global->$lr;
258 $sendtocc = $sendtobcc =
'';
259 $filepath = $mimetype = $filename = array();
260 $deliveryreceipt = 0;
262 $substitutionarray = array(
263 '__LINKACCEPT__' =>
'<a href="'.
dol_buildpath(
'/public/datapolicy/index.php?action=1&s='.$societe->id.
'&l='.$l.
'&key='.$code, 3).
'" target="_blank" rel="noopener noreferrer">'.$linka.
'</a>',
264 '__LINKREFUSED__' =>
'<a href="'.dol_buildpath(
'/public/datapolicy/index.php?action=2&s='.$societe->id.
'&l='.$l.
'&key='.$code, 3).
'" target="_blank" rel="noopener noreferrer">'.$linkr.
'</a>',
269 $actiontypecode =
'AC_EMAIL';
270 $actionmsg = $langs->transnoentities(
'MailSentBy').
' '.$from.
' '.$langs->transnoentities(
'To').
' '.$sendto;
273 $actionmsg =
dol_concatdesc($actionmsg, $langs->transnoentities(
'Bcc').
": ".$sendtocc);
275 $actionmsg =
dol_concatdesc($actionmsg, $langs->transnoentities(
'MailTopic').
": ".$subject);
276 $actionmsg =
dol_concatdesc($actionmsg, $langs->transnoentities(
'TextUsedInTheMessageBody').
":");
281 require_once DOL_DOCUMENT_ROOT.
'/core/class/CMailFile.class.php';
282 $mailfile =
new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, $sendtocc, $sendtobcc, $deliveryreceipt, -1);
283 if ($mailfile->error) {
284 $resultmasssend .=
'<div class="error">'.$mailfile->error.
'</div>';
286 $result4 = $mailfile->sendfile();
289 $resultmasssend .= $langs->trans(
"MailSent").
': '.$sendto.
"<br>";
290 $societe->array_options[
'options_datapolicy_send'] = date(
'Y-m-d', time());
291 $societe->update($societe->id);
307 global $langs, $conf, $db, $user;
311 $from = $user->getFullName($langs).
' <'.$user->email.
'>';
313 $sendto = $adherent->email;
315 $code =
dol_hash($adherent->email,
'md5');
316 if (!empty($adherent->default_lang)) {
317 $l = $adherent->default_lang;
319 $l = $langs->defaultlang;
322 $s =
'TXTLINKDATAPOLICYSUBJECT_'.$l;
323 $ma =
'TXTLINKDATAPOLICYMESSAGE_'.$l;
324 $la =
'TXTLINKDATAPOLICYACCEPT_'.$l;
325 $lr =
'TXTLINKDATAPOLICYREFUSE_'.$l;
327 $subject = $conf->global->$s;
328 $message = $conf->global->$ma;
329 $linka = $conf->global->$la;
330 $linkr = $conf->global->$lr;
331 $sendtocc = $sendtobcc =
'';
332 $filepath = $mimetype = $filename = array();
333 $deliveryreceipt = 0;
335 $substitutionarray = array(
336 '__LINKACCEPT__' =>
'<a href="'.
dol_buildpath(
'/public/datapolicy/index.php?action=1&a='.$adherent->id.
'&l='.$l.
'&key='.$code, 3).
'" target="_blank" rel="noopener noreferrer">'.$linka.
'</a>',
337 '__LINKREFUSED__' =>
'<a href="'.dol_buildpath(
'/public/datapolicy/index.php?action=2&a='.$adherent->id.
'&l='.$l.
'&key='.$code, 3).
'" target="_blank" rel="noopener noreferrer">'.$linkr.
'</a>',
342 $actiontypecode =
'AC_EMAIL';
343 $actionmsg = $langs->transnoentities(
'MailSentBy').
' '.$from.
' '.$langs->transnoentities(
'To').
' '.$sendto;
346 $actionmsg =
dol_concatdesc($actionmsg, $langs->transnoentities(
'Bcc').
": ".$sendtocc);
348 $actionmsg =
dol_concatdesc($actionmsg, $langs->transnoentities(
'MailTopic').
": ".$subject);
349 $actionmsg =
dol_concatdesc($actionmsg, $langs->transnoentities(
'TextUsedInTheMessageBody').
":");
355 require_once DOL_DOCUMENT_ROOT.
'/core/class/CMailFile.class.php';
356 $mailfile =
new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, $sendtocc, $sendtobcc, $deliveryreceipt, -1);
357 if ($mailfile->error) {
358 $resultmasssend .=
'<div class="error">'.$mailfile->error.
'</div>';
360 $result4 = $mailfile->sendfile();
363 $resultmasssend .= $langs->trans(
"MailSent").
': '.$sendto.
"<br>";
364 $adherent->array_options[
'options_datapolicy_send'] = date(
'Y-m-d', time());
365 $adherent->update($user);
Class to manage members of a foundation.
Class to send emails (with attachments or not) Usage: $mailfile = new CMailFile($subject,...
__construct($db)
Constructor.
static sendMailDataPolicyAdherent($adherent)
sendMailDataPolicyAdherent
getAllContactNotInformed()
getAllContactNotInformed
static sendMailDataPolicyContact($contact)
sendMailDataPolicyContact
getAllCompaniesNotInformed()
getAllCompaniesNotInformed
getAllAdherentsNotInformed()
getAllAdherentsNotInformed
static sendMailDataPolicyCompany($societe)
sendMailDataPolicyCompany
Class to manage third parties objects (customers, suppliers, prospects...)
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_concatdesc($text1, $text2, $forxml=false, $invert=false)
Concat 2 descriptions with a new line between them (second operand after first one with appropriate n...
make_substitutions($text, $substitutionarray, $outputlangs=null, $converttextinhtmlifnecessary=0)
Make substitution into a text string, replacing keys with vals from $substitutionarray (oldval=>newva...
setEventMessage($mesgs, $style='mesgs')
Set event message in dol_events session object.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
dol_hash($chain, $type='0')
Returns a hash (non reversible encryption) of a string.
$conf db
API class for accounts.