25 if (!defined(
'NOLOGIN')) {
28 if (!defined(
'NOCSRFCHECK')) {
29 define(
'NOCSRFCHECK',
'1');
31 if (!defined(
'NOREQUIREMENU')) {
32 define(
'NOREQUIREMENU',
'1');
35 require
'../../main.inc.php';
36 require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
37 require_once DOL_DOCUMENT_ROOT.
'/societe/class/societe.class.php';
38 require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
39 require_once DOL_DOCUMENT_ROOT.
'/user/class/user.class.php';
40 require_once DOL_DOCUMENT_ROOT.
'/datapolicy/class/datapolicy.class.php';
45 $action =
GETPOST(
'action',
'aZ09');
47 $code =
GETPOST(
'key',
'alpha');
49 $acc =
"DATAPOLICIESACCEPT_".$lang;
50 $ref =
"DATAPOLICIESREFUSE_".$lang;
51 $langs->load(
'datapolicy@datapolicy', 0, 0, $lang);
53 if (empty($action) || (empty($idc) && empty($ids) && empty($ida))) {
55 } elseif (!empty($idc)) {
57 $contact->fetch($idc);
58 $check = md5($contact->email);
59 if ($check != $code) {
60 $return = $langs->trans(
'ErrorEmailDATAPOLICIES');
61 } elseif ($action == 1) {
62 $contact->array_options[
'options_datapolicy_consentement'] = 1;
63 $contact->array_options[
'options_datapolicy_opposition_traitement'] = 0;
64 $contact->array_options[
'options_datapolicy_opposition_prospection'] = 0;
65 $contact->array_options[
'options_datapolicy_date'] = date(
'Y-m-d', time());
67 $return = $conf->global->$acc;
68 } elseif ($action == 2) {
69 $contact->no_email = 1;
70 $contact->array_options[
'options_datapolicy_consentement'] = 0;
71 $contact->array_options[
'options_datapolicy_opposition_traitement'] = 1;
72 $contact->array_options[
'options_datapolicy_opposition_prospection'] = 1;
73 $contact->array_options[
'options_datapolicy_date'] = date(
'Y-m-d', time());
75 $return = $conf->global->$ref;
77 $contact->update($idc);
78 } elseif (!empty($ids)) {
80 $societe->fetch($ids);
81 $check = md5($societe->email);
82 if ($check != $code) {
83 $return = $langs->trans(
'ErrorEmailDATAPOLICIES');
84 } elseif ($action == 1) {
85 $societe->array_options[
'options_datapolicy_consentement'] = 1;
86 $societe->array_options[
'options_datapolicy_opposition_traitement'] = 0;
87 $societe->array_options[
'options_datapolicy_opposition_prospection'] = 0;
88 $societe->array_options[
'options_datapolicy_date'] = date(
'Y-m-d', time());
89 $return = $conf->global->$acc;
90 } elseif ($action == 2) {
91 $societe->array_options[
'options_datapolicy_consentement'] = 0;
92 $societe->array_options[
'options_datapolicy_opposition_traitement'] = 1;
93 $societe->array_options[
'options_datapolicy_opposition_prospection'] = 1;
94 $societe->array_options[
'options_datapolicy_date'] = date(
'Y-m-d', time());
96 $return = $conf->global->$ref;
98 $societe->update($ids);
99 } elseif (!empty($ida)) {
101 $adherent->fetch($ida);
102 $check = md5($adherent->email);
103 if ($check != $code) {
104 $return = $langs->trans(
'ErrorEmailDATAPOLICIES');
105 } elseif ($action == 1) {
106 $adherent->array_options[
'options_datapolicy_consentement'] = 1;
107 $adherent->array_options[
'options_datapolicy_opposition_traitement'] = 0;
108 $adherent->array_options[
'options_datapolicy_opposition_prospection'] = 0;
110 $return = $conf->global->$acc;
111 } elseif ($action == 2) {
112 $adherent->array_options[
'options_datapolicy_consentement'] = 0;
113 $adherent->array_options[
'options_datapolicy_opposition_traitement'] = 1;
114 $adherent->array_options[
'options_datapolicy_opposition_prospection'] = 1;
117 $return = $conf->global->$ref;
119 $newuser =
new User($db);
120 $adherent->update($newuser);
123 header(
"Content-type: text/html; charset=".$conf->file->character_set_client);
125 print
'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">';
129 print
'<meta name="robots" content="noindex,nofollow">'.
"\n";
130 print
'<meta name="keywords" content="dolibarr">'.
"\n";
131 print
'<meta name="description" content="Dolibarr DATAPOLICIES">'.
"\n";
132 print
"<title>".$langs->trans(
"DATAPOLICIESReturn").
"</title>\n";
133 print
'<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.$conf->css.
'?lang='.$lang.
'">'.
"\n";
134 print
'<style type="text/css">';
135 print
'.CTableRow1 { margin: 1px; padding: 3px; font: 12px verdana,arial; background: #e6E6eE; color: #000000; -moz-border-radius-topleft:6px; -moz-border-radius-topright:6px; -moz-border-radius-bottomleft:6px; -moz-border-radius-bottomright:6px;}';
136 print
'.CTableRow2 { margin: 1px; padding: 3px; font: 12px verdana,arial; background: #FFFFFF; color: #000000; -moz-border-radius-topleft:6px; -moz-border-radius-topright:6px; -moz-border-radius-bottomleft:6px; -moz-border-radius-bottomright:6px;}';
140 print
'<body style="margin: 10% 40%">'.
"\n";
141 print
'<table class="CTableRow1" ><tr><td style="text_align:center;">';
142 print $return.
"<br>\n";
143 print
'</td></tr></table>';