phpcs fix
This commit is contained in:
parent
dfd6a0feaa
commit
461da700d5
@ -219,68 +219,68 @@ Class DataPolicy
|
|||||||
*/
|
*/
|
||||||
function sendMailDataPolicyCompany($societe)
|
function sendMailDataPolicyCompany($societe)
|
||||||
{
|
{
|
||||||
global $langs, $conf, $db, $user;
|
global $langs, $conf, $db, $user;
|
||||||
|
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
$from = $user->getFullName($langs) . ' <' . $user->email . '>';
|
$from = $user->getFullName($langs) . ' <' . $user->email . '>';
|
||||||
|
|
||||||
$sendto = $societe->email;
|
$sendto = $societe->email;
|
||||||
|
|
||||||
$code= md5($societe->email);
|
$code= md5($societe->email);
|
||||||
if (!empty($societe->default_lang)) {
|
if (!empty($societe->default_lang)) {
|
||||||
$l = $societe->default_lang;
|
$l = $societe->default_lang;
|
||||||
} else {
|
} else {
|
||||||
$l = $langs->defaultlang;
|
$l = $langs->defaultlang;
|
||||||
}
|
}
|
||||||
$s = "DATAPOLICIESSUBJECT_" . $l;
|
$s = "DATAPOLICIESSUBJECT_" . $l;
|
||||||
$ma = "DATAPOLICIESCONTENT_" . $l;
|
$ma = "DATAPOLICIESCONTENT_" . $l;
|
||||||
$la = 'TXTLINKDATAPOLICIESACCEPT_' . $l;
|
$la = 'TXTLINKDATAPOLICIESACCEPT_' . $l;
|
||||||
$lr = 'TXTLINKDATAPOLICIESREFUSE_' . $l;
|
$lr = 'TXTLINKDATAPOLICIESREFUSE_' . $l;
|
||||||
|
|
||||||
$subject = $conf->global->$s;
|
$subject = $conf->global->$s;
|
||||||
$message = $conf->global->$ma;
|
$message = $conf->global->$ma;
|
||||||
$linka = $conf->global->$la;
|
$linka = $conf->global->$la;
|
||||||
$linkr = $conf->global->$lr;
|
$linkr = $conf->global->$lr;
|
||||||
$sendtocc = $sendtobcc = '';
|
$sendtocc = $sendtobcc = '';
|
||||||
$filepath = $mimetype = $filename = array();
|
$filepath = $mimetype = $filename = array();
|
||||||
$deliveryreceipt = 0;
|
$deliveryreceipt = 0;
|
||||||
|
|
||||||
$substitutionarray = array(
|
$substitutionarray = array(
|
||||||
'__LINKACCEPT__' => '<a href="'.dol_buildpath('/datapolicy/public/index.php?action=1&s='.$societe->id.'&l='.$l.'&key='.$code, 3).'" target="_blank">'.$linka.'</a>',
|
'__LINKACCEPT__' => '<a href="'.dol_buildpath('/datapolicy/public/index.php?action=1&s='.$societe->id.'&l='.$l.'&key='.$code, 3).'" target="_blank">'.$linka.'</a>',
|
||||||
'__LINKREFUSED__' => '<a href="'.dol_buildpath('/datapolicy/public/index.php?action=2&s='.$societe->id.'&l='.$l.'&key='.$code, 3).'" target="_blank">'.$linkr.'</a>',
|
'__LINKREFUSED__' => '<a href="'.dol_buildpath('/datapolicy/public/index.php?action=2&s='.$societe->id.'&l='.$l.'&key='.$code, 3).'" target="_blank">'.$linkr.'</a>',
|
||||||
);
|
);
|
||||||
$subject = make_substitutions($subject, $substitutionarray);
|
$subject = make_substitutions($subject, $substitutionarray);
|
||||||
$message = make_substitutions($message, $substitutionarray);
|
$message = make_substitutions($message, $substitutionarray);
|
||||||
|
|
||||||
$actiontypecode = 'AC_EMAIL';
|
$actiontypecode = 'AC_EMAIL';
|
||||||
$actionmsg = $langs->transnoentities('MailSentBy') . ' ' . $from . ' ' . $langs->transnoentities('To') . ' ' . $sendto;
|
$actionmsg = $langs->transnoentities('MailSentBy') . ' ' . $from . ' ' . $langs->transnoentities('To') . ' ' . $sendto;
|
||||||
if ($message) {
|
if ($message) {
|
||||||
if ($sendtocc) {
|
if ($sendtocc) {
|
||||||
$actionmsg .= dol_concatdesc($actionmsg, $langs->transnoentities('Bcc') . ": " . $sendtocc);
|
$actionmsg .= dol_concatdesc($actionmsg, $langs->transnoentities('Bcc') . ": " . $sendtocc);
|
||||||
}
|
}
|
||||||
$actionmsg .= dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic') . ": " . $subject);
|
$actionmsg .= dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic') . ": " . $subject);
|
||||||
$actionmsg .= dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":");
|
$actionmsg .= dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":");
|
||||||
$actionmsg .= dol_concatdesc($actionmsg, $message);
|
$actionmsg .= dol_concatdesc($actionmsg, $message);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send mail
|
// Send mail
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/class/CMailFile.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/class/CMailFile.class.php';
|
||||||
$mailfile = new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, $sendtocc, $sendtobcc, $deliveryreceipt, -1);
|
$mailfile = new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, $sendtocc, $sendtobcc, $deliveryreceipt, -1);
|
||||||
if ($mailfile->error) {
|
if ($mailfile->error) {
|
||||||
$resultmasssend .= '<div class="error">' . $mailfile->error . '</div>';
|
$resultmasssend .= '<div class="error">' . $mailfile->error . '</div>';
|
||||||
} else {
|
} else {
|
||||||
$result4 = $mailfile->sendfile();
|
$result4 = $mailfile->sendfile();
|
||||||
|
|
||||||
if (!$error) {
|
if (!$error) {
|
||||||
$resultmasssend .= $langs->trans("MailSent") . ': ' . $sendto . "<br>";
|
$resultmasssend .= $langs->trans("MailSent") . ': ' . $sendto . "<br>";
|
||||||
$societe->array_options['options_datapolicy_send'] = date('Y-m-d', time());
|
$societe->array_options['options_datapolicy_send'] = date('Y-m-d', time());
|
||||||
$societe->update($societe->id);
|
$societe->update($societe->id);
|
||||||
} else {
|
} else {
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
setEventMessage($resultmasssend);
|
setEventMessage($resultmasssend);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user