49 global $conf, $langs, $user;
51 $langs->load(
'datapolicy@datapolicy');
55 $nbupdated = $nbdeleted = 0;
58 $arrayofparameters = array(
59 'DATAPOLICY_TIERS_CLIENT' => array(
61 SELECT s.rowid FROM ".MAIN_DB_PREFIX.
"societe as s
65 AND s.tms < DATE_SUB(NOW(), INTERVAL %d MONTH)
67 SELECT id FROM ".MAIN_DB_PREFIX.
"actioncomm as a WHERE a.fk_soc = s.rowid AND a.tms > DATE_SUB(NOW(), INTERVAL %d MONTH)
70 SELECT rowid FROM ".MAIN_DB_PREFIX.
"facture as f WHERE f.fk_soc = s.rowid
74 "file" => DOL_DOCUMENT_ROOT.
'/societe/class/societe.class.php',
75 'fields_anonym' => array(
76 'name' =>
'MAKEANONYMOUS',
89 'socialnetworks' =>
'',
93 'DATAPOLICY_TIERS_PROSPECT' => array(
95 SELECT s.rowid FROM ".MAIN_DB_PREFIX.
"societe as s
99 AND s.tms < DATE_SUB(NOW(), INTERVAL %d MONTH)
101 SELECT id FROM ".MAIN_DB_PREFIX.
"actioncomm as a WHERE a.fk_soc = s.rowid AND a.tms > DATE_SUB(NOW(), INTERVAL %d MONTH)
104 SELECT rowid FROM ".MAIN_DB_PREFIX.
"facture as f WHERE f.fk_soc = s.rowid
107 "class" =>
"Societe",
108 "file" => DOL_DOCUMENT_ROOT.
'/societe/class/societe.class.php',
109 'fields_anonym' => array(
110 'name' =>
'MAKEANONYMOUS',
123 'socialnetworks' =>
'',
127 'DATAPOLICY_TIERS_PROSPECT_CLIENT' => array(
129 SELECT s.rowid FROM ".MAIN_DB_PREFIX.
"societe as s
132 AND s.fournisseur = 0
133 AND s.tms < DATE_SUB(NOW(), INTERVAL %d MONTH)
135 SELECT id FROM ".MAIN_DB_PREFIX.
"actioncomm as a WHERE a.fk_soc = s.rowid AND a.tms > DATE_SUB(NOW(), INTERVAL %d MONTH)
138 SELECT rowid FROM ".MAIN_DB_PREFIX.
"facture as f WHERE f.fk_soc = s.rowid
141 "class" =>
"Societe",
142 "file" => DOL_DOCUMENT_ROOT.
'/societe/class/societe.class.php',
143 'fields_anonym' => array(
144 'name' =>
'MAKEANONYMOUS',
157 'socialnetworks' =>
'',
161 'DATAPOLICY_TIERS_NIPROSPECT_NICLIENT' => array(
163 SELECT s.rowid FROM ".MAIN_DB_PREFIX.
"societe as s
166 AND s.fournisseur = 0
167 AND s.tms < DATE_SUB(NOW(), INTERVAL %d MONTH)
169 SELECT id FROM ".MAIN_DB_PREFIX.
"actioncomm as a WHERE a.fk_soc = s.rowid AND a.tms > DATE_SUB(NOW(), INTERVAL %d MONTH)
172 SELECT rowid FROM ".MAIN_DB_PREFIX.
"facture as f WHERE f.fk_soc = s.rowid
175 "class" =>
"Societe",
176 "file" => DOL_DOCUMENT_ROOT.
'/societe/class/societe.class.php',
177 'fields_anonym' => array(
178 'name' =>
'MAKEANONYMOUS',
191 'socialnetworks' =>
'',
195 'DATAPOLICY_TIERS_FOURNISSEUR' => array(
197 SELECT s.rowid FROM ".MAIN_DB_PREFIX.
"societe as s
199 AND s.fournisseur = 1
200 AND s.tms < DATE_SUB(NOW(), INTERVAL %d MONTH)
202 SELECT id FROM ".MAIN_DB_PREFIX.
"actioncomm as a WHERE a.fk_soc = s.rowid AND a.tms > DATE_SUB(NOW(), INTERVAL %d MONTH)
205 SELECT rowid FROM ".MAIN_DB_PREFIX.
"facture as f WHERE f.fk_soc = s.rowid
208 "class" =>
"Societe",
209 "file" => DOL_DOCUMENT_ROOT.
'/societe/class/societe.class.php',
210 'fields_anonym' => array(
211 'name' =>
'MAKEANONYMOUS',
224 'socialnetworks' =>
'',
228 'DATAPOLICY_CONTACT_CLIENT' => array(
230 SELECT c.rowid FROM ".MAIN_DB_PREFIX.
"socpeople as c
231 INNER JOIN ".MAIN_DB_PREFIX.
"societe as s ON s.rowid = c.fk_soc
233 AND c.tms < DATE_SUB(NOW(), INTERVAL %d MONTH)
235 AND s.fournisseur = 0
237 SELECT id FROM ".MAIN_DB_PREFIX.
"actioncomm as a WHERE a.fk_contact = c.rowid AND a.tms > DATE_SUB(NOW(), INTERVAL %d MONTH)
240 SELECT rowid FROM ".MAIN_DB_PREFIX.
"facture as f WHERE f.fk_soc = s.rowid
243 "class" =>
"Contact",
244 "file" => DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php',
245 'fields_anonym' => array(
246 'lastname' =>
'MAKEANONYMOUS',
255 'phone_mobile' =>
'',
262 'socialnetworks' =>
'',
266 'DATAPOLICY_CONTACT_PROSPECT' => array(
268 SELECT c.rowid FROM ".MAIN_DB_PREFIX.
"socpeople as c
269 INNER JOIN ".MAIN_DB_PREFIX.
"societe as s ON s.rowid = c.fk_soc
271 AND c.tms < DATE_SUB(NOW(), INTERVAL %d MONTH)
273 AND s.fournisseur = 0
275 SELECT id FROM ".MAIN_DB_PREFIX.
"actioncomm as a WHERE a.fk_contact = c.rowid AND a.tms > DATE_SUB(NOW(), INTERVAL %d MONTH)
278 SELECT rowid FROM ".MAIN_DB_PREFIX.
"facture as f WHERE f.fk_soc = s.rowid
281 "class" =>
"Contact",
282 "file" => DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php',
283 'fields_anonym' => array(
284 'lastname' =>
'MAKEANONYMOUS',
293 'phone_mobile' =>
'',
300 'socialnetworks' =>
'',
304 'DATAPOLICY_CONTACT_PROSPECT_CLIENT' => array(
306 SELECT c.rowid FROM ".MAIN_DB_PREFIX.
"socpeople as c
307 INNER JOIN ".MAIN_DB_PREFIX.
"societe as s ON s.rowid = c.fk_soc
309 AND c.tms < DATE_SUB(NOW(), INTERVAL %d MONTH)
311 AND s.fournisseur = 0
313 SELECT id FROM ".MAIN_DB_PREFIX.
"actioncomm as a WHERE a.fk_contact = c.rowid AND a.tms > DATE_SUB(NOW(), INTERVAL %d MONTH)
316 SELECT rowid FROM ".MAIN_DB_PREFIX.
"facture as f WHERE f.fk_soc = s.rowid
319 "class" =>
"Contact",
320 "file" => DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php',
321 'fields_anonym' => array(
322 'lastname' =>
'MAKEANONYMOUS',
331 'phone_mobile' =>
'',
338 'socialnetworks' =>
'',
342 'DATAPOLICY_CONTACT_NIPROSPECT_NICLIENT' => array(
344 SELECT c.rowid FROM ".MAIN_DB_PREFIX.
"socpeople as c
345 INNER JOIN ".MAIN_DB_PREFIX.
"societe as s ON s.rowid = c.fk_soc
347 AND c.tms < DATE_SUB(NOW(), INTERVAL %d MONTH)
349 AND s.fournisseur = 0
351 SELECT id FROM ".MAIN_DB_PREFIX.
"actioncomm as a WHERE a.fk_contact = c.rowid AND a.tms > DATE_SUB(NOW(), INTERVAL %d MONTH)
354 SELECT rowid FROM ".MAIN_DB_PREFIX.
"facture as f WHERE f.fk_soc = s.rowid
357 "class" =>
"Contact",
358 "file" => DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php',
359 'fields_anonym' => array(
360 'lastname' =>
'MAKEANONYMOUS',
369 'phone_mobile' =>
'',
376 'socialnetworks' =>
'',
380 'DATAPOLICY_CONTACT_FOURNISSEUR' => array(
382 SELECT c.rowid FROM ".MAIN_DB_PREFIX.
"socpeople as c
383 INNER JOIN ".MAIN_DB_PREFIX.
"societe as s ON s.rowid = c.fk_soc
385 AND c.tms < DATE_SUB(NOW(), INTERVAL %d MONTH)
386 AND s.fournisseur = 1
388 SELECT id FROM ".MAIN_DB_PREFIX.
"actioncomm as a WHERE a.fk_contact = c.rowid AND a.tms > DATE_SUB(NOW(), INTERVAL %d MONTH)
391 SELECT rowid FROM ".MAIN_DB_PREFIX.
"facture as f WHERE f.fk_soc = s.rowid
394 "class" =>
"Contact",
395 "file" => DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php',
396 'fields_anonym' => array(
397 'lastname' =>
'MAKEANONYMOUS',
406 'phone_mobile' =>
'',
413 'socialnetworks' =>
'',
417 'DATAPOLICY_ADHERENT' => array(
419 SELECT a.rowid FROM ".MAIN_DB_PREFIX.
"adherent as a
421 AND a.tms < DATE_SUB(NOW(), INTERVAL %d MONTH)
423 SELECT id FROM ".MAIN_DB_PREFIX.
"actioncomm as a WHERE a.fk_element = a.rowid AND a.tms > DATE_SUB(NOW(), INTERVAL %d MONTH) AND a.elementtype LIKE 'member'
426 "class" =>
"Adherent",
427 "file" => DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php',
428 'fields_anonym' => array(
429 'lastname' =>
'MAKEANONYMOUS',
430 'firstname' =>
'MAKEANONYMOUS',
438 'phone_mobile' =>
'',
445 'socialnetworks' =>
'',
453 foreach ($arrayofparameters as $key => $params) {
463 require_once $params[
'file'];
464 $object =
new $params[
'class']($this->db);
466 while ($i < $num && !$error) {
467 $obj = $this->
db->fetch_object(
$resql);
469 $object->fetch($obj->rowid);
470 $object->id = $obj->rowid;
472 $action =
'anonymize';
474 if ($action ==
'anonymize') {
475 if ($object->isObjectUsed($obj->rowid) == 0) {
476 foreach ($params[
'fields_anonym'] as $fields => $val) {
477 if ($val ==
'MAKEANONYMOUS') {
478 $object->$fields = $fields.
'-anonymous-'.$obj->rowid;
480 $object->$fields = $val;
483 $result = $object->update($obj->rowid, $user);
485 $errormsg = $object->error;
492 if ($action ==
'delete') {
493 if ($object->element ==
'adherent') {
494 $result = $object->delete($obj->rowid, $user);
496 $result = $object->delete($user);
499 $errormsg = $object->error;
515 $this->output = $nbupdated.
' record updated, '.$nbdeleted.
' record deleted';
517 $this->error = $errormsg;
cleanDataForDataPolicy()
Function exec CAN BE A CRON TASK.
__construct($db)
Constructor.
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.
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
$conf db
API class for accounts.