24if (!defined(
'NOLOGIN')) {
27if (!defined(
'NOREQUIREMENU')) {
28 define(
'NOREQUIREMENU',
'1');
32require
'../../main.inc.php';
33require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
34require_once DOL_DOCUMENT_ROOT.
'/societe/class/societe.class.php';
35require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
36require_once DOL_DOCUMENT_ROOT.
'/user/class/user.class.php';
37require_once DOL_DOCUMENT_ROOT.
'/datapolicy/class/datapolicy.class.php';
38require_once DOL_DOCUMENT_ROOT.
'/core/lib/security.lib.php';
43$action =
GETPOST(
'action',
'aZ09');
45$securitykey =
GETPOST(
'key',
'alpha');
47$acc =
"DATAPOLICIESACCEPT_".$l;
48$ref =
"DATAPOLICIESREFUSE_".$l;
49$langs->load(
'datapolicy', 0, 0, $l);
56if (empty($action) || (empty($idc) && empty($ids) && empty($ida))) {
57 print
'Missing paramater s, c or a';
59} elseif (!empty($idc)) {
61 $contact->fetch($idc);
62 $check =
dol_hash($contact->email,
'md5');
63 if ($check != $securitykey) {
64 $return = $langs->trans(
'Bad value for key.');
65 } elseif ($action == 1) {
66 $contact->array_options[
'options_datapolicy_consentement'] = 1;
67 $contact->array_options[
'options_datapolicy_opposition_traitement'] = 0;
68 $contact->array_options[
'options_datapolicy_opposition_prospection'] = 0;
69 $contact->array_options[
'options_datapolicy_date'] =
dol_now();
72 } elseif ($action == 2) {
73 $contact->no_email = 1;
74 $contact->array_options[
'options_datapolicy_consentement'] = 0;
75 $contact->array_options[
'options_datapolicy_opposition_traitement'] = 1;
76 $contact->array_options[
'options_datapolicy_opposition_prospection'] = 1;
77 $contact->array_options[
'options_datapolicy_date'] =
dol_now();
81 $contact->update($idc);
82} elseif (!empty($ids)) {
84 $societe->fetch($ids);
85 $check =
dol_hash($societe->email,
'md5');
86 if ($check != $securitykey) {
87 $return = $langs->trans(
'Bad value for key.');
88 } elseif ($action == 1) {
89 $societe->array_options[
'options_datapolicy_consentement'] = 1;
90 $societe->array_options[
'options_datapolicy_opposition_traitement'] = 0;
91 $societe->array_options[
'options_datapolicy_opposition_prospection'] = 0;
92 $societe->array_options[
'options_datapolicy_date'] =
dol_now();
95 } elseif ($action == 2) {
96 $societe->array_options[
'options_datapolicy_consentement'] = 0;
97 $societe->array_options[
'options_datapolicy_opposition_traitement'] = 1;
98 $societe->array_options[
'options_datapolicy_opposition_prospection'] = 1;
99 $societe->array_options[
'options_datapolicy_date'] =
dol_now();
103 $societe->update($ids);
104} elseif (!empty($ida)) {
106 $adherent->fetch($ida);
107 $check =
dol_hash($adherent->email,
'md5');
108 if ($check != $securitykey) {
109 $return = $langs->trans(
'Bad value for key.');
110 } elseif ($action == 1) {
111 $adherent->array_options[
'options_datapolicy_consentement'] = 1;
112 $adherent->array_options[
'options_datapolicy_opposition_traitement'] = 0;
113 $adherent->array_options[
'options_datapolicy_opposition_prospection'] = 0;
117 } elseif ($action == 2) {
118 $adherent->array_options[
'options_datapolicy_consentement'] = 0;
119 $adherent->array_options[
'options_datapolicy_opposition_traitement'] = 1;
120 $adherent->array_options[
'options_datapolicy_opposition_prospection'] = 1;
125 $newuser =
new User($db);
126 $adherent->update($newuser);
136print
'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">';
140print
'<meta name="robots" content="noindex,nofollow">'.
"\n";
141print
'<meta name="keywords" content="dolibarr">'.
"\n";
142print
'<meta name="description" content="Dolibarr DATAPOLICIES">'.
"\n";
143print
"<title>".$langs->trans(
"DATAPOLICIESReturn").
"</title>\n";
144print
'<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.$conf->css.
'?lang='.$lang.
'">'.
"\n";
145print
'<style type="text/css">';
146print
'.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;}';
147print
'.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;}';
151print
'<body style="margin: 10% 40%">'.
"\n";
152print
'<table class="CTableRow1" ><tr><td style="text_align:center;">';
153print $return.
"<br>\n";
154print
'</td></tr></table>';
Class to manage members of a foundation.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage Dolibarr users.
dol_now($mode='auto')
Return date for now.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
if(!defined( 'NOREQUIREMENU')) if(!empty(GETPOST('seteventmessages', 'alpha'))) if(!function_exists("llxHeader")) top_httphead($contenttype='text/html', $forcenocache=0)
Show HTTP header.
dol_hash($chain, $type='0')
Returns a hash (non reversible encryption) of a string.