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';
50 global $langs, $conf, $db, $user;
52 $langs->load(
"companies");
54 $sql =
"SELECT c.rowid";
55 $sql .=
" FROM ".MAIN_DB_PREFIX.
"socpeople as c";
56 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s ON c.fk_soc = s.rowid";
57 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"socpeople_extrafields as spe ON spe.fk_object = c.rowid";
58 $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))";
59 $sql .=
" AND spe.datapolicy_send IS NULL";
60 $sql .=
" AND c.entity=".$conf->entity;
66 $obj = $this->
db->fetch_object(
$resql);
68 $contact->fetch($obj->rowid);
74 $this->error = $this->
db->error();
86 global $langs, $conf, $db, $user;
88 $langs->load(
"companies");
90 $sql =
"SELECT s.rowid";
91 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s";
92 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe_extrafields as se ON se.fk_object = s.rowid";
93 $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)";
94 $sql .=
" AND se.datapolicy_send IS NULL";
95 $sql .=
" AND s.entity=".$conf->entity;
101 $obj = $this->
db->fetch_object(
$resql);
103 $societe->fetch($obj->rowid);
109 $this->error = $this->
db->error();
121 global $langs, $conf, $db, $user;
123 $langs->load(
"adherent");
125 $sql =
"SELECT a.rowid";
126 $sql .=
" FROM ".MAIN_DB_PREFIX.
"adherent as a";
127 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"adherent_extrafields as ae ON ae.fk_object = a.rowid";
128 $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)";
129 $sql .=
" AND ae.datapolicy_send IS NULL";
130 $sql .=
" AND a.entity=".$conf->entity;
136 $obj = $this->
db->fetch_object(
$resql);
138 $adherent->fetch($obj->rowid);
144 $this->error = $this->
db->error();
157 global $langs, $conf, $db, $user;
161 $from = $user->getFullName($langs).
' <'.$user->email.
'>';
163 $sendto = $contact->email;
164 $code = md5($contact->email);
165 if (!empty($contact->default_lang)) {
166 $l = $contact->default_lang;
168 $l = $langs->defaultlang;
171 $s =
"DATAPOLICIESSUBJECT_".$l;
172 $ma =
"DATAPOLICIESCONTENT_".$l;
173 $la =
'TXTLINKDATAPOLICIESACCEPT_'.$l;
174 $lr =
'TXTLINKDATAPOLICIESREFUSE_'.$l;
176 $subject = $conf->global->$s;
177 $message = $conf->global->$ma;
178 $linka = $conf->global->$la;
179 $linkr = $conf->global->$lr;
180 $sendtocc = $sendtobcc =
'';
181 $filepath = $mimetype = $filename = array();
182 $deliveryreceipt = 0;
184 $substitutionarray = array(
185 '__LINKACCEPT__' =>
'<a href="'.
dol_buildpath(
'/datapolicy/public/index.php?action=1&c='.$contact->id.
'&l='.$l.
'&key='.$code, 3).
'" target="_blank">'.$linka.
'</a>',
186 '__LINKREFUSED__' =>
'<a href="'.dol_buildpath(
'/datapolicy/public/index.php?action=2&c='.$contact->id.
'&l='.$l.
'&key='.$code, 3).
'" target="_blank">'.$linkr.
'</a>',
187 '__FIRSTNAME__' => $contact->firstname,
188 '__NAME__' => $contact->lastname,
189 '__CIVILITY__' => $contact->civility,
194 $actiontypecode =
'AC_EMAIL';
195 $actionmsg = $langs->transnoentities(
'MailSentBy').
' '.$from.
' '.$langs->transnoentities(
'To').
' '.$sendto;
198 $actionmsg =
dol_concatdesc($actionmsg, $langs->transnoentities(
'Bcc').
": ".$sendtocc);
199 $actionmsg =
dol_concatdesc($actionmsg, $langs->transnoentities(
'MailTopic').
": ".$subject);
200 $actionmsg =
dol_concatdesc($actionmsg, $langs->transnoentities(
'TextUsedInTheMessageBody').
":");
206 require_once DOL_DOCUMENT_ROOT.
'/core/class/CMailFile.class.php';
207 $mailfile =
new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, $sendtocc, $sendtobcc, $deliveryreceipt, -1);
209 if ($mailfile->error) {
210 $resultmasssend .=
'<div class="error">'.$mailfile->error.
'</div>';
212 $result4 = $mailfile->sendfile();
214 $resultmasssend .= $langs->trans(
"MailSent").
': '.$sendto.
"<br>";
215 $contact->array_options[
'options_datapolicy_send'] = date(
'Y-m-d', time());
216 $contact->update($contact->id);
232 global $langs, $conf, $db, $user;
236 $from = $user->getFullName($langs).
' <'.$user->email.
'>';
238 $sendto = $societe->email;
240 $code = md5($societe->email);
241 if (!empty($societe->default_lang)) {
242 $l = $societe->default_lang;
244 $l = $langs->defaultlang;
247 $s =
"DATAPOLICIESSUBJECT_".$l;
248 $ma =
"DATAPOLICIESCONTENT_".$l;
249 $la =
'TXTLINKDATAPOLICIESACCEPT_'.$l;
250 $lr =
'TXTLINKDATAPOLICIESREFUSE_'.$l;
252 $subject = $conf->global->$s;
253 $message = $conf->global->$ma;
254 $linka = $conf->global->$la;
255 $linkr = $conf->global->$lr;
256 $sendtocc = $sendtobcc =
'';
257 $filepath = $mimetype = $filename = array();
258 $deliveryreceipt = 0;
260 $substitutionarray = array(
261 '__LINKACCEPT__' =>
'<a href="'.
dol_buildpath(
'/datapolicy/public/index.php?action=1&s='.$societe->id.
'&l='.$l.
'&key='.$code, 3).
'" target="_blank">'.$linka.
'</a>',
262 '__LINKREFUSED__' =>
'<a href="'.dol_buildpath(
'/datapolicy/public/index.php?action=2&s='.$societe->id.
'&l='.$l.
'&key='.$code, 3).
'" target="_blank">'.$linkr.
'</a>',
267 $actiontypecode =
'AC_EMAIL';
268 $actionmsg = $langs->transnoentities(
'MailSentBy').
' '.$from.
' '.$langs->transnoentities(
'To').
' '.$sendto;
271 $actionmsg .=
dol_concatdesc($actionmsg, $langs->transnoentities(
'Bcc').
": ".$sendtocc);
273 $actionmsg .=
dol_concatdesc($actionmsg, $langs->transnoentities(
'MailTopic').
": ".$subject);
274 $actionmsg .=
dol_concatdesc($actionmsg, $langs->transnoentities(
'TextUsedInTheMessageBody').
":");
279 require_once DOL_DOCUMENT_ROOT.
'/core/class/CMailFile.class.php';
280 $mailfile =
new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, $sendtocc, $sendtobcc, $deliveryreceipt, -1);
281 if ($mailfile->error) {
282 $resultmasssend .=
'<div class="error">'.$mailfile->error.
'</div>';
284 $result4 = $mailfile->sendfile();
287 $resultmasssend .= $langs->trans(
"MailSent").
': '.$sendto.
"<br>";
288 $societe->array_options[
'options_datapolicy_send'] = date(
'Y-m-d', time());
289 $societe->update($societe->id);
305 global $langs, $conf, $db, $user;
309 $from = $user->getFullName($langs).
' <'.$user->email.
'>';
311 $sendto = $adherent->email;
314 $code = md5($adherent->email);
315 if (!empty($adherent->default_lang)) {
316 $l = $adherent->default_lang;
318 $l = $langs->defaultlang;
321 $s =
'TXTLINKDATAPOLICIESSUBJECT_'.$l;
322 $ma =
'TXTLINKDATAPOLICIESMESSAGE_'.$l;
323 $la =
'TXTLINKDATAPOLICIESACCEPT_'.$l;
324 $lr =
'TXTLINKDATAPOLICIESREFUSE_'.$l;
326 $subject = $conf->global->$s;
327 $message = $conf->global->$ma;
328 $linka = $conf->global->$la;
329 $linkr = $conf->global->$lr;
330 $sendtocc = $sendtobcc =
'';
331 $filepath = $mimetype = $filename = array();
332 $deliveryreceipt = 0;
334 $substitutionarray = array(
335 '__LINKACCEPT__' =>
'<a href="'.
dol_buildpath(
'/datapolicy/public/index.php?action=1&a='.$adherent->id.
'&l='.$l.
'&key='.$code, 3).
'" target="_blank">'.$linka.
'</a>',
336 '__LINKREFUSED__' =>
'<a href="'.dol_buildpath(
'/datapolicy/public/index.php?action=2&a='.$adherent->id.
'&l='.$l.
'&key='.$code, 3).
'" target="_blank">'.$linkr.
'</a>',
341 $actiontypecode =
'AC_EMAIL';
342 $actionmsg = $langs->transnoentities(
'MailSentBy').
' '.$from.
' '.$langs->transnoentities(
'To').
' '.$sendto;
345 $actionmsg .=
dol_concatdesc($actionmsg, $langs->transnoentities(
'Bcc').
": ".$sendtocc);
347 $actionmsg .=
dol_concatdesc($actionmsg, $langs->transnoentities(
'MailTopic').
": ".$subject);
348 $actionmsg .=
dol_concatdesc($actionmsg, $langs->transnoentities(
'TextUsedInTheMessageBody').
":");
354 require_once DOL_DOCUMENT_ROOT.
'/core/class/CMailFile.class.php';
355 $mailfile =
new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, $sendtocc, $sendtobcc, $deliveryreceipt, -1);
356 if ($mailfile->error) {
357 $resultmasssend .=
'<div class="error">'.$mailfile->error.
'</div>';
359 $result4 = $mailfile->sendfile();
362 $resultmasssend .= $langs->trans(
"MailSent").
': '.$sendto.
"<br>";
363 $adherent->array_options[
'options_datapolicy_send'] = date(
'Y-m-d', time());
364 $adherent->update($user);
setEventMessage($mesgs, $style= 'mesgs')
Set event message in dol_events session object.
getAllContactNotInformed()
getAllContactNotInformed
getAllCompaniesNotInformed()
getAllCompaniesNotInformed
static sendMailDataPolicyContact($contact)
sendMailDataPolicyContact
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...
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
$conf db
API class for accounts.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to send emails (with attachments or not) Usage: $mailfile = new CMailFile($subject,$sendto,$replyto,$message,$filepath,$mimetype,$filename,$cc,$ccc,$deliveryreceipt,$msgishtml,$errors_to,$css,$trackid,$moreinheader,$sendcontext,$replyto); $mailfile->sendfile();.
Class to manage members of a foundation.
static sendMailDataPolicyAdherent($adherent)
sendMailDataPolicyAdherent
static sendMailDataPolicyCompany($societe)
sendMailDataPolicyCompany
__construct($db)
Constructor.
if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->don->lire) if(!empty($conf->tax->enabled)&&$user->rights->tax->charges->lire) if(!empty($conf->facture->enabled)&&!empty($conf->commande->enabled)&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) $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...
getAllAdherentsNotInformed()
getAllAdherentsNotInformed
make_substitutions($text, $substitutionarray, $outputlangs=null)
Make substitution into a text string, replacing keys with vals from $substitutionarray (oldval=>newva...