From d1dde0fface7f43ad571edbf0010e7b2780f0544 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 6 Oct 2018 02:51:47 +0200 Subject: [PATCH] Include rgpd module with name DataPolicies --- htdocs/core/modules/modDataPolicies.class.php | 283 ++++++++++ htdocs/datapolicies/ChangeLog.md | 24 + htdocs/datapolicies/admin/setup.php | 217 ++++++++ htdocs/datapolicies/admin/setupmail.php | 203 ++++++++ .../class/actions_datapolicies.class.php | 450 ++++++++++++++++ .../datapolicies/class/datapolicies.class.php | 320 ++++++++++++ .../class/datapoliciescron.class.php | 487 ++++++++++++++++++ htdocs/datapolicies/css/datapolicies.css.php | 74 +++ htdocs/datapolicies/img/datapolicies.png | Bin 0 -> 683 bytes htdocs/datapolicies/img/gfdl.png | Bin 0 -> 4709 bytes htdocs/datapolicies/img/gplv3.png | Bin 0 -> 2666 bytes .../datapolicies/img/object_datapolicies.png | Bin 0 -> 2226 bytes .../datapolicies/img/object_inoveaconseil.png | Bin 0 -> 764 bytes htdocs/datapolicies/js/datapolicies.js.php | 59 +++ .../langs/en_US/datapolicies.lang | 92 ++++ .../langs/fr_FR/datapolicies.lang | 96 ++++ .../langs/it_IT/datapolicies.lang | 80 +++ htdocs/datapolicies/lib/datapolicies.lib.php | 59 +++ htdocs/datapolicies/mailing.php | 58 +++ htdocs/datapolicies/modulebuilder.txt | 3 + htdocs/datapolicies/public/index.php | 169 ++++++ 21 files changed, 2674 insertions(+) create mode 100644 htdocs/core/modules/modDataPolicies.class.php create mode 100644 htdocs/datapolicies/ChangeLog.md create mode 100644 htdocs/datapolicies/admin/setup.php create mode 100644 htdocs/datapolicies/admin/setupmail.php create mode 100644 htdocs/datapolicies/class/actions_datapolicies.class.php create mode 100644 htdocs/datapolicies/class/datapolicies.class.php create mode 100644 htdocs/datapolicies/class/datapoliciescron.class.php create mode 100644 htdocs/datapolicies/css/datapolicies.css.php create mode 100644 htdocs/datapolicies/img/datapolicies.png create mode 100644 htdocs/datapolicies/img/gfdl.png create mode 100644 htdocs/datapolicies/img/gplv3.png create mode 100644 htdocs/datapolicies/img/object_datapolicies.png create mode 100644 htdocs/datapolicies/img/object_inoveaconseil.png create mode 100644 htdocs/datapolicies/js/datapolicies.js.php create mode 100644 htdocs/datapolicies/langs/en_US/datapolicies.lang create mode 100644 htdocs/datapolicies/langs/fr_FR/datapolicies.lang create mode 100644 htdocs/datapolicies/langs/it_IT/datapolicies.lang create mode 100644 htdocs/datapolicies/lib/datapolicies.lib.php create mode 100644 htdocs/datapolicies/mailing.php create mode 100644 htdocs/datapolicies/modulebuilder.txt create mode 100644 htdocs/datapolicies/public/index.php diff --git a/htdocs/core/modules/modDataPolicies.class.php b/htdocs/core/modules/modDataPolicies.class.php new file mode 100644 index 00000000000..9322aae6dd0 --- /dev/null +++ b/htdocs/core/modules/modDataPolicies.class.php @@ -0,0 +1,283 @@ + + * Copyright (C) 2018 Nicolas ZABOURI + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \defgroup datapolicies Module datapolicies + * \brief datapolicies module descriptor. + * + * \file htdocs/datapolicies/core/modules/modGdpr.class.php + * \ingroup datapolicies + * \brief Description and activation file for module DATAPOLICIES + */ +include_once DOL_DOCUMENT_ROOT . '/core/modules/DolibarrModules.class.php'; + + + +// The class name should start with a lower case mod for Dolibarr to pick it up +// so we ignore the Squiz.Classes.ValidClassName.NotCamelCaps rule. +// @codingStandardsIgnoreStart +/** + * Description and activation class for module datapolicies + */ +class modDataPolicies extends DolibarrModules { + + // @codingStandardsIgnoreEnd + /** + * Constructor. Define names, constants, directories, boxes, permissions + * + * @param DoliDB $db Database handler + */ + public function __construct($db) { + global $langs, $conf; + + $this->db = $db; + + // Id for module (must be unique). + // Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id). + $this->numero = 4100; + // Key text used to identify module (for permissions, menus, etc...) + $this->rights_class = 'datapolicies'; + + // Family can be 'base' (core modules),'crm','financial','hr','projects','products','ecm','technic' (transverse modules),'interface' (link with external tools),'other','...' + // It is used to group modules by family in module setup page + $this->family = "hr"; + // Module position in the family on 2 digits ('01', '10', '20', ...) + $this->module_position = '90'; + // Gives the possibility to the module, to provide his own family info and position of this family (Overwrite $this->family and $this->module_position. Avoid this) + //$this->familyinfo = array('myownfamily' => array('position' => '01', 'label' => $langs->trans("MyOwnFamily"))); + // Module label (no space allowed), used if translation string 'ModuledatapoliciesName' not found (MyModue is name of module). + $this->name = preg_replace('/^mod/i', '', get_class($this)); + // Module description, used if translation string 'ModuledatapoliciesDesc' not found (MyModue is name of module). + $this->description = "Module to manage Data policies (for compliance with GDPR in Europe or other Data policies rules)"; + // Used only if file README.md and README-LL.md not found. + $this->descriptionlong = ""; + + $this->editor_name = 'Inovea Conseil'; + + // Possible values for version are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z' + $this->version = 'development'; + // Key used in llx_const table to save module status enabled/disabled (where datapolicies is value of property name of module in uppercase) + $this->const_name = 'MAIN_MODULE_' . strtoupper($this->name); + // Name of image file used for this module. + // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue' + // If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module' + $this->picto = 'generic'; + + // Defined all module parts (triggers, login, substitutions, menus, css, etc...) + // for default path (eg: /datapolicies/core/xxxxx) (0=disable, 1=enable) + // for specific path of parts (eg: /datapolicies/core/modules/barcode) + // for specific css file (eg: /datapolicies/css/datapolicies.css.php) + $this->module_parts = array( + 'triggers' => 0, // Set this to 1 if module has its own trigger directory (core/triggers) + 'login' => 0, // Set this to 1 if module has its own login method file (core/login) + 'substitutions' => 0, // Set this to 1 if module has its own substitution function file (core/substitutions) + 'menus' => 0, // Set this to 1 if module has its own menus handler directory (core/menus) + 'theme' => 0, // Set this to 1 if module has its own theme directory (theme) + 'tpl' => 0, // Set this to 1 if module overwrite template dir (core/tpl) + 'barcode' => 0, // Set this to 1 if module has its own barcode directory (core/modules/barcode) + 'models' => 0, // Set this to 1 if module has its own models directory (core/modules/xxx) + 'css' => array('/datapolicies/css/datapolicies.css.php'), // Set this to relative path of css file if module has its own css file + 'js' => array('/datapolicies/js/datapolicies.js.php'), // Set this to relative path of js file if module must load a js on all pages + 'hooks' => array('data' => array('membercard', 'contactcard', 'thirdpartycard'), 'entity' => $conf->entity) // Set here all hooks context managed by module. To find available hook context, make a "grep -r '>initHooks(' *" on source code. You can also set hook context 'all' + ); + + // Data directories to create when module is enabled. + // Example: this->dirs = array("/datapolicies/temp","/datapolicies/subdir"); + $this->dirs = array("/datapolicies/temp"); + + // Config pages. Put here list of php page, stored into datapolicies/admin directory, to use to setup module. + $this->config_page_url = array("setup.php@datapolicies"); + + // Dependencies + $this->hidden = false; // A condition to hide module + $this->depends = array(); // List of module class names as string that must be enabled if this module is enabled + $this->requiredby = array(); // List of module ids to disable if this one is disabled + $this->conflictwith = array(); // List of module class names as string this module is in conflict with + $this->langfiles = array("datapolicies@datapolicies"); + $this->phpmin = array(5, 3); // Minimum version of PHP required by module + $this->need_dolibarr_version = array(4, 0); // Minimum version of Dolibarr required by module + $this->warnings_activation = array(); // Warning to show when we activate module. array('always'='text') or array('FR'='textfr','ES'='textes'...) + $this->warnings_activation_ext = array(); // Warning to show when we activate an external module. array('always'='text') or array('FR'='textfr','ES'='textes'...) + //$this->automatic_activation = array('FR'=>'datapoliciesWasAutomaticallyActivatedBecauseOfYourCountryChoice'); + //$this->always_enabled = true; // If true, can't be disabled + // Constants + // List of particular constants to add when module is enabled (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive) + // Example: $this->const=array(0=>array('datapolicies_MYNEWCONST1','chaine','myvalue','This is a constant to add',1), + // 1=>array('datapolicies_MYNEWCONST2','chaine','myvalue','This is another constant to add',0, 'current', 1) + // ); + $this->const = array( + array('DATAPOLICIES_TIERS_CLIENT', 'chaine', '', 'Nombre de mois avant suppression des données', 0), + array('DATAPOLICIES_TIERS_PROSPECT', 'chaine', '', 'Nombre de mois avant suppression des données', 0), + array('DATAPOLICIES_TIERS_PROSPECT_CLIENT', 'chaine', '', 'Nombre de mois avant suppression des données', 0), + array('DATAPOLICIES_TIERS_NIPROSPECT_NICLIENT', 'chaine', '', 'Nombre de mois avant suppression des données', 0), + array('DATAPOLICIES_TIERS_FOURNISSEUR', 'chaine', '', 'Nombre de mois avant suppression des données', 0), + array('DATAPOLICIES_CONTACT_CLIENT', 'chaine', '', 'Nombre de mois avant suppression des données', 0), + array('DATAPOLICIES_CONTACT_PROSPECT', 'chaine', '', 'Nombre de mois avant suppression des données', 0), + array('DATAPOLICIES_CONTACT_PROSPECT_CLIENT', 'chaine', '', 'Nombre de mois avant suppression des données', 0), + array('DATAPOLICIES_CONTACT_NIPROSPECT_NICLIENT', 'chaine', '', 'Nombre de mois avant suppression des données', 0), + array('DATAPOLICIES_CONTACT_FOURNISSEUR', 'chaine', '', 'Nombre de mois avant suppression des données', 0), + array('DATAPOLICIES_ADHERENT', 'chaine', '', 'Nombre de mois avant suppression des données', 0), + ); + + $country = explode(":", $conf->global->MAIN_INFO_SOCIETE_COUNTRY); + if ($country[0] == $conf->entity && $country[2] == "France") + $this->editor_url = "https://www.inovea-conseil.com (Attestation NF525)"; + else + $this->editor_url = 'https://www.inovea-conseil.com'; + + // Some keys to add into the overwriting translation tables + /* $this->overwrite_translation = array( + 'en_US:ParentCompany'=>'Parent company or reseller', + 'fr_FR:ParentCompany'=>'Maison mère ou revendeur' + ) */ + + if (!isset($conf->datapolicies) || !isset($conf->datapolicies->enabled)) { + $conf->datapolicies = new stdClass(); + $conf->datapolicies->enabled = 0; + } + + + // Array to add new pages in new tabs + $this->tabs = array(); + // Example: + // $this->tabs[] = array('data'=>'objecttype:+tabname1:Title1:mylangfile@datapolicies:$user->rights->datapolicies->read:/datapolicies/mynewtab1.php?id=__ID__'); // To add a new tab identified by code tabname1 + // $this->tabs[] = array('data'=>'objecttype:+tabname2:SUBSTITUTION_Title2:mylangfile@datapolicies:$user->rights->othermodule->read:/datapolicies/mynewtab2.php?id=__ID__', // To add another new tab identified by code tabname2. Label will be result of calling all substitution functions on 'Title2' key. + // $this->tabs[] = array('data'=>'objecttype:-tabname:NU:conditiontoremove'); // To remove an existing tab identified by code tabname + // + // Where objecttype can be + // 'categories_x' to add a tab in category view (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member) + // 'contact' to add a tab in contact view + // 'contract' to add a tab in contract view + // 'group' to add a tab in group view + // 'intervention' to add a tab in intervention view + // 'invoice' to add a tab in customer invoice view + // 'invoice_supplier' to add a tab in supplier invoice view + // 'member' to add a tab in fundation member view + // 'opensurveypoll' to add a tab in opensurvey poll view + // 'order' to add a tab in customer order view + // 'order_supplier' to add a tab in supplier order view + // 'payment' to add a tab in payment view + // 'payment_supplier' to add a tab in supplier payment view + // 'product' to add a tab in product view + // 'propal' to add a tab in propal view + // 'project' to add a tab in project view + // 'stock' to add a tab in stock view + // 'thirdparty' to add a tab in third party view + // 'user' to add a tab in user view + // Dictionaries + $this->dictionaries = array(); + /* Example: + $this->dictionaries=array( + 'langs'=>'mylangfile@datapolicies', + 'tabname'=>array(MAIN_DB_PREFIX."table1",MAIN_DB_PREFIX."table2",MAIN_DB_PREFIX."table3"), // List of tables we want to see into dictonnary editor + 'tablib'=>array("Table1","Table2","Table3"), // Label of tables + 'tabsql'=>array('SELECT f.rowid as rowid, f.code, f.label, f.active FROM '.MAIN_DB_PREFIX.'table1 as f','SELECT f.rowid as rowid, f.code, f.label, f.active FROM '.MAIN_DB_PREFIX.'table2 as f','SELECT f.rowid as rowid, f.code, f.label, f.active FROM '.MAIN_DB_PREFIX.'table3 as f'), // Request to select fields + 'tabsqlsort'=>array("label ASC","label ASC","label ASC"), // Sort order + 'tabfield'=>array("code,label","code,label","code,label"), // List of fields (result of select to show dictionary) + 'tabfieldvalue'=>array("code,label","code,label","code,label"), // List of fields (list of fields to edit a record) + 'tabfieldinsert'=>array("code,label","code,label","code,label"), // List of fields (list of fields for insert) + 'tabrowid'=>array("rowid","rowid","rowid"), // Name of columns with primary key (try to always name it 'rowid') + 'tabcond'=>array($conf->datapolicies->enabled,$conf->datapolicies->enabled,$conf->datapolicies->enabled) // Condition to show each dictionary + ); + */ + + + // Boxes/Widgets + // Add here list of php file(s) stored in datapolicies/core/boxes that contains class to show a widget. + $this->boxes = array(); + + + // Cronjobs (List of cron jobs entries to add when module is enabled) + // unit_frequency must be 60 for minute, 3600 for hour, 86400 for day, 604800 for week + $this->cronjobs = array( + 0 => array('label' => 'DATAPOLICIES Cron', 'jobtype' => 'method', 'class' => '/datapolicies/class/datapoliciesCron.class.php', 'objectname' => 'RgpdCron', 'method' => 'exec', 'parameters' => '', 'comment' => 'Comment', 'frequency' => 1, 'unitfrequency' => 86400, 'status' => 1, 'test' => true), + 1 => array('label' => 'DATAPOLICIES Mailing', 'jobtype' => 'method', 'class' => '/datapolicies/class/datapoliciesCron.class.php', 'objectname' => 'RgpdCron', 'method' => 'sendMailing', 'parameters' => '', 'comment' => 'Comment', 'frequency' => 1, 'unitfrequency' => 86400, 'status' => 0, 'test' => true) + ); + // Example: $this->cronjobs=array(0=>array('label'=>'My label', 'jobtype'=>'method', 'class'=>'/dir/class/file.class.php', 'objectname'=>'MyClass', 'method'=>'myMethod', 'parameters'=>'param1, param2', 'comment'=>'Comment', 'frequency'=>2, 'unitfrequency'=>3600, 'status'=>0, 'test'=>true), + // 1=>array('label'=>'My label', 'jobtype'=>'command', 'command'=>'', 'parameters'=>'param1, param2', 'comment'=>'Comment', 'frequency'=>1, 'unitfrequency'=>3600*24, 'status'=>0, 'test'=>true) + // ); + // Permissions + $this->rights = array(); // Permission array used by this module + // Main menu entries + $this->menu = array(); // List of menus to add + $r = 0; + } + + /** + * Function called when module is enabled. + * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database. + * It also creates data directories + * + * @param string $options Options when enabling module ('', 'noboxes') + * @return int 1 if OK, 0 if KO + */ + public function init($options = '') { + global $langs; + + $this->_load_tables('/datapolicies/sql/'); + + // Create extrafields + include_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php'; + $extrafields = new ExtraFields($this->db); + + + // Extrafield contact + //$result1=$extrafields->addExtraField('datapolicies_separate', "DATAPOLICIES_BLOCKCHECKBOX", 'separate', 100, 1, 'thirdparty', 0, 0, '', '', 1, '', '1', 0, '', '', 'datapolicies@datapolicies', '$conf->datapolicies->enabled'); + $result1 = $extrafields->addExtraField('datapolicies_consentement', "DATAPOLICIES_consentement", 'boolean', 101, 3, 'thirdparty', 0, 0, '', '', 1, '', '3', 0, '', '', 'datapolicies@datapolicies', '$conf->datapolicies->enabled'); + $result1 = $extrafields->addExtraField('datapolicies_opposition_traitement', "DATAPOLICIES_opposition_traitement", 'boolean', 102, 3, 'thirdparty', 0, 0, '', '', 1, '', '3', 0, '', '', 'datapolicies@datapolicies', '$conf->datapolicies->enabled'); + $result1 = $extrafields->addExtraField('datapolicies_opposition_prospection', "DATAPOLICIES_opposition_prospection", 'boolean', 103, 3, 'thirdparty', 0, 0, '', '', 1, '', '3', 0, '', '', 'datapolicies@datapolicies', '$conf->datapolicies->enabled'); + $result1 = $extrafields->addExtraField('datapolicies_date', $langs->trans("DATAPOLICIES_date"), 'date', 104, 3, 'thirdparty', 0, 0, '', '', 1, '', '3', 0); + $result1 = $extrafields->addExtraField('datapolicies_send', $langs->trans("DATAPOLICIES_send"), 'date', 105, 3, 'thirdparty', 0, 0, '', '', 0, '', '0', 0); + + // Extrafield Tiers + //$result1=$extrafields->addExtraField('datapolicies_separate', "DATAPOLICIES_BLOCKCHECKBOX", 'separate', 100, 1, 'contact', 0, 0, '', '', 1, '', '1', 0, '', '', 'datapolicies@datapolicies', '$conf->datapolicies->enabled'); + $result1 = $extrafields->addExtraField('datapolicies_consentement', "DATAPOLICIES_consentement", 'boolean', 101, 3, 'contact', 0, 0, '', '', 1, '', '3', 0, '', '', 'datapolicies@datapolicies', '$conf->datapolicies->enabled'); + $result1 = $extrafields->addExtraField('datapolicies_opposition_traitement', "DATAPOLICIES_opposition_traitement", 'boolean', 102, 3, 'contact', 0, 0, '', '', 1, '', '3', 0, '', '', 'datapolicies@datapolicies', '$conf->datapolicies->enabled'); + $result1 = $extrafields->addExtraField('datapolicies_opposition_prospection', "DATAPOLICIES_opposition_prospection", 'boolean', 103, 3, 'contact', 0, 0, '', '', 1, '', '3', 0, '', '', 'datapolicies@datapolicies', '$conf->datapolicies->enabled'); + $result1 = $extrafields->addExtraField('datapolicies_date', $langs->trans("DATAPOLICIES_date"), 'date', 104, 3, 'contact', 0, 0, '', '', 1, '', '3', 0); + $result1 = $extrafields->addExtraField('datapolicies_send', $langs->trans("DATAPOLICIES_send"), 'date', 105, 3, 'contact', 0, 0, '', '', 0, '', '0', 0); + + // Extrafield Adherent + //$result1=$extrafields->addExtraField('datapolicies_separate', "DATAPOLICIES_BLOCKCHECKBOX", 'separate', 100, 1, 'adherent', 0, 0, '', '', 1, '', '1', 0, '', '', 'datapolicies@datapolicies', '$conf->datapolicies->enabled'); + $result1 = $extrafields->addExtraField('datapolicies_consentement', "DATAPOLICIES_consentement", 'boolean', 101, 3, 'adherent', 0, 0, '', '', 1, '', '3', 0, '', '', 'datapolicies@datapolicies', '$conf->datapolicies->enabled'); + $result1 = $extrafields->addExtraField('datapolicies_opposition_traitement', "DATAPOLICIES_opposition_traitement", 'boolean', 102, 3, 'adherent', 0, 0, '', '', 1, '', '3', 0, '', '', 'datapolicies@datapolicies', '$conf->datapolicies->enabled'); + $result1 = $extrafields->addExtraField('datapolicies_opposition_prospection', "DATAPOLICIES_opposition_prospection", 'boolean', 103, 3, 'adherent', 0, 0, '', '', 1, '', '3', 0, '', '', 'datapolicies@datapolicies', '$conf->datapolicies->enabled'); + $result1 = $extrafields->addExtraField('datapolicies_date', $langs->trans("DATAPOLICIES_date"), 'date', 104, 3, 'adherent', 0, 0, '', '', 1, '', '3', 0); + $result1 = $extrafields->addExtraField('datapolicies_send', $langs->trans("DATAPOLICIES_send"), 'date', 105, 3, 'adherent', 0, 0, '', '', 0, '', '0', 0); + + $sql = array(); + + return $this->_init($sql, $options); + } + + /** + * Function called when module is disabled. + * Remove from database constants, boxes and permissions from Dolibarr database. + * Data directories are not deleted + * + * @param string $options Options when enabling module ('', 'noboxes') + * @return int 1 if OK, 0 if KO + */ + public function remove($options = '') { + $sql = array(); + + return $this->_remove($sql, $options); + } + +} diff --git a/htdocs/datapolicies/ChangeLog.md b/htdocs/datapolicies/ChangeLog.md new file mode 100644 index 00000000000..1c149a77e39 --- /dev/null +++ b/htdocs/datapolicies/ChangeLog.md @@ -0,0 +1,24 @@ +**2.2** +* Fix link to accept or refuse + +**2.1** +* Change IT translations + +**2.0** +* Add date of agreement +* Add possibility to send e-mail +* Save the agreement by e-mail + +**1.2** +* Bug fixed + +**1.1** +* Add some translations +* Add some type of company +* Bug fixed + + +**1.0** +* The end of the beginning + + diff --git a/htdocs/datapolicies/admin/setup.php b/htdocs/datapolicies/admin/setup.php new file mode 100644 index 00000000000..bcb47489c31 --- /dev/null +++ b/htdocs/datapolicies/admin/setup.php @@ -0,0 +1,217 @@ + + * Copyright (C) 2018 Nicolas ZABOURI + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file datapolicies/admin/setup.php + * \ingroup datapolicies + * \brief datapolicies setup page. + */ + +// Load Dolibarr environment +$res=0; +// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) +if (! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res=@include($_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"); +// Try main.inc.php into web root detected using web root caluclated from SCRIPT_FILENAME +$tmp=empty($_SERVER['SCRIPT_FILENAME'])?'':$_SERVER['SCRIPT_FILENAME'];$tmp2=realpath(__FILE__); $i=strlen($tmp)-1; $j=strlen($tmp2)-1; +while($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i]==$tmp2[$j]) { $i--; $j--; } +if (! $res && $i > 0 && file_exists(substr($tmp, 0, ($i+1))."/main.inc.php")) $res=@include(substr($tmp, 0, ($i+1))."/main.inc.php"); +if (! $res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i+1)))."/main.inc.php")) $res=@include(dirname(substr($tmp, 0, ($i+1)))."/main.inc.php"); +// Try main.inc.php using relative path +if (! $res && file_exists("../../main.inc.php")) $res=@include("../../main.inc.php"); +if (! $res && file_exists("../../../main.inc.php")) $res=@include("../../../main.inc.php"); +if (! $res) die("Include of main fails"); + +global $langs, $user; + +// Libraries +require_once DOL_DOCUMENT_ROOT . "/core/lib/admin.lib.php"; +require_once '../lib/datapolicies.lib.php'; +//require_once "../class/myclass.class.php"; + +// Translations +$langs->load('admin'); +$langs->load('companies'); +$langs->load('members'); +$langs->load('datapolicies@datapolicies'); + +// Access control +if (! $user->admin) accessforbidden(); + +// Parameters +$action = GETPOST('action', 'alpha'); +$backtopage = GETPOST('backtopage', 'alpha'); + +$arrayofparameters=array( + 'DATAPOLICIES_TIERS_CLIENT'=>array('css'=>'minwidth200'), + 'DATAPOLICIES_TIERS_PROSPECT'=>array('css'=>'minwidth200'), + 'DATAPOLICIES_TIERS_PROSPECT_CLIENT'=>array('css'=>'minwidth200'), + 'DATAPOLICIES_TIERS_NIPROSPECT_NICLIENT'=>array('css'=>'minwidth200'), + 'DATAPOLICIES_TIERS_FOURNISSEUR'=>array('css'=>'minwidth200'), + 'DATAPOLICIES_CONTACT_CLIENT'=>array('css'=>'minwidth200'), + 'DATAPOLICIES_CONTACT_PROSPECT'=>array('css'=>'minwidth200'), + 'DATAPOLICIES_CONTACT_PROSPECT_CLIENT'=>array('css'=>'minwidth200'), + 'DATAPOLICIES_CONTACT_NIPROSPECT_NICLIENT'=>array('css'=>'minwidth200'), + 'DATAPOLICIES_CONTACT_FOURNISSEUR'=>array('css'=>'minwidth200'), + 'DATAPOLICIES_ADHERENT'=>array('css'=>'minwidth200'), +); + + +/* + * Actions + */ + +include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; + +if (DOL_VERSION < '7' && $action == 'update') { + foreach ($arrayofparameters as $k => $v) { + $res = dolibarr_set_const($db,$k,GETPOST($k),'chaine',0,'',$conf->entity); + if (! $res > 0) $error++; + } + if (! $error) + { + $db->commit(); + if (empty($nomessageinsetmoduleoptions)) setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } + else + { + $db->rollback(); + if (empty($nomessageinsetmoduleoptions)) setEventMessages($langs->trans("SetupNotSaved"), null, 'errors'); + } +} + + +$arrayofparameters=array( + 'ThirdParty' => array( + 'DATAPOLICIES_TIERS_CLIENT'=>array('css'=>'minwidth200'), + 'DATAPOLICIES_TIERS_PROSPECT'=>array('css'=>'minwidth200'), + 'DATAPOLICIES_TIERS_PROSPECT_CLIENT'=>array('css'=>'minwidth200'), + 'DATAPOLICIES_TIERS_NIPROSPECT_NICLIENT'=>array('css'=>'minwidth200'), + 'DATAPOLICIES_TIERS_FOURNISSEUR'=>array('css'=>'minwidth200'), + ), + 'Contact' => array( + 'DATAPOLICIES_CONTACT_CLIENT'=>array('css'=>'minwidth200'), + 'DATAPOLICIES_CONTACT_PROSPECT'=>array('css'=>'minwidth200'), + 'DATAPOLICIES_CONTACT_PROSPECT_CLIENT'=>array('css'=>'minwidth200'), + 'DATAPOLICIES_CONTACT_NIPROSPECT_NICLIENT'=>array('css'=>'minwidth200'), + 'DATAPOLICIES_CONTACT_FOURNISSEUR'=>array('css'=>'minwidth200'), + ), + 'Member' => array( + 'DATAPOLICIES_ADHERENT'=>array('css'=>'minwidth200'), + ) +); + +$valTab = array( + '' => $langs->trans('None'), + '6' => $langs->trans('NB_MONTHS', 6), + '12' => $langs->trans('ONE_YEAR'), + '24' => $langs->trans('NB_YEARS', 2), + '36' => $langs->trans('NB_YEARS', 3), + '48' => $langs->trans('NB_YEARS', 4), + '60' => $langs->trans('NB_YEARS', 5), + '120' => $langs->trans('NB_YEARS', 10), +); + + +/* + * View + */ + +$page_name = "datapoliciesSetup"; +llxHeader('', $langs->trans($page_name)); + +// Subheader +$linkback = ''.$langs->trans("BackToModuleList").''; + +print load_fiche_titre($langs->trans($page_name), $linkback, 'object_datapolicies@datapolicies'); + +// Configuration header +$head = datapoliciesAdminPrepareHead(); +dol_fiche_head($head, 'settings', '', -1, "datapolicies@datapolicies"); + +// Setup page goes here +echo $langs->trans("datapoliciesSetupPage"); + + +if ($action == 'edit') +{ + print '
'; + print ''; + print ''; + + print ''; + print ''; + + foreach($arrayofparameters as $title => $tab) + { + print ''; + foreach($tab as $key => $val) + { + print ''; + } + + } + + print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans($title).'
'; + print $form->textwithpicto($langs->trans($key),$langs->trans($key.'Tooltip')); + print ''; + print ''; + print '
'; + + print '
'; + print ''; + print '
'; + + print '
'; + print '
'; +} +else +{ + print ''; + print ''; + + foreach($arrayofparameters as $title => $tab) + { + print ''; + foreach($tab as $key => $val) + { + print ''; + } + + } + + print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans($title).'
'; + print $form->textwithpicto($langs->trans($key),$langs->trans('DATAPOLICIES_Tooltip_SETUP')); + print '' . ($conf->global->$key == '' ? $langs->trans('None') : $valTab[$conf->global->$key]) . '
'; + + print '
'; + print ''.$langs->trans("Modify").''; + print '
'; +} + + +// Page end +dol_fiche_end(); + +llxFooter(); +$db->close(); diff --git a/htdocs/datapolicies/admin/setupmail.php b/htdocs/datapolicies/admin/setupmail.php new file mode 100644 index 00000000000..4420e2203b3 --- /dev/null +++ b/htdocs/datapolicies/admin/setupmail.php @@ -0,0 +1,203 @@ + + * Copyright (C) 2018 Nicolas ZABOURI + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file datapolicies/admin/setupmail.php + * \ingroup datapolicies + * \brief datapolicies setup page. + */ +// Load Dolibarr environment +$res = 0; +// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) +if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) + $res = @include($_SERVER["CONTEXT_DOCUMENT_ROOT"] . "/main.inc.php"); +// Try main.inc.php into web root detected using web root caluclated from SCRIPT_FILENAME +$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; +$tmp2 = realpath(__FILE__); +$i = strlen($tmp) - 1; +$j = strlen($tmp2) - 1; +while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { + $i--; + $j--; +} +if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1)) . "/main.inc.php")) + $res = @include(substr($tmp, 0, ($i + 1)) . "/main.inc.php"); +if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1))) . "/main.inc.php")) + $res = @include(dirname(substr($tmp, 0, ($i + 1))) . "/main.inc.php"); +// Try main.inc.php using relative path +if (!$res && file_exists("../../main.inc.php")) + $res = @include("../../main.inc.php"); +if (!$res && file_exists("../../../main.inc.php")) + $res = @include("../../../main.inc.php"); +if (!$res) + die("Include of main fails"); + +global $langs, $user; + +// Libraries +require_once DOL_DOCUMENT_ROOT . "/core/lib/admin.lib.php"; +require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php'; +require_once DOL_DOCUMENT_ROOT . '/core/class/html.formadmin.class.php'; +require_once '../lib/datapolicies.lib.php'; + +//require_once "../class/myclass.class.php"; +// Translations +$langs->load('admin'); +$langs->load('companies'); +$langs->load('members'); +$langs->load('datapolicies@datapolicies'); + + +// Parameters +$action = GETPOST('action', 'alpha'); +$backtopage = GETPOST('backtopage', 'alpha'); +$formadmin = new FormAdmin($db); + +if (GETPOST('l')) { + $l = GETPOST('l'); +} else { + $l = $langs->defaultlang; +} +// Access control +if (!$user->admin) + accessforbidden(); + +/* + * Actions + */ + +include DOL_DOCUMENT_ROOT . '/core/actions_setmoduleoptions.inc.php'; + +if ($action == 'setvalue' && $user->admin) { + $db->begin(); + $sub = "DATAPOLICIESSUBJECT_" . $l; + $result = dolibarr_set_const($db, $sub, GETPOST($sub), 'chaine', 0, '', $conf->entity); + $cont = "DATAPOLICIESCONTENT_" . $l; + $result = dolibarr_set_const($db, $cont, GETPOST($cont), 'chaine', 0, '', $conf->entity); + $cont = "TXTLINKDATAPOLICIESACCEPT_" . $l; + $result = dolibarr_set_const($db, $cont, GETPOST($cont), 'chaine', 0, '', $conf->entity); + $cont = "TXTLINKDATAPOLICIESREFUSE_" . $l; + $result = dolibarr_set_const($db, $cont, GETPOST($cont), 'chaine', 0, '', $conf->entity); + $sub = "DATAPOLICIESACCEPT_" . $l; + $result = dolibarr_set_const($db, $sub, GETPOST($sub), 'chaine', 0, '', $conf->entity); + $sub = "DATAPOLICIESREFUSE_" . $l; + $result = dolibarr_set_const($db, $sub, GETPOST($sub), 'chaine', 0, '', $conf->entity); + if (!$result > 0) + $error++; + if (!$error) { + $db->commit(); + setEventMessage($langs->trans("SetupSaved")); + } else { + $db->rollback(); + dol_print_error($db); + } +} + + +/* + * View + */ + +$page_name = "datapoliciesSetup"; +llxHeader('', $langs->trans($page_name)); + +// Subheader +$linkback = '' . $langs->trans("BackToModuleList") . ''; + +print load_fiche_titre($langs->trans($page_name), $linkback, 'object_datapolicies@datapolicies'); + +// Configuration header +$head = datapoliciesAdminPrepareHead(); +dol_fiche_head($head, 'settings', '', -1, "datapolicies@datapolicies"); + + + + + +print ""; + +print '
'; +print ''; +print ''; +print ''; +if ($conf->global->MAIN_MULTILANGS) { + print ''; +} +$subject = 'DATAPOLICIESSUBJECT_' . $l; +$linka = 'TXTLINKDATAPOLICIESACCEPT_' . $l; +$linkr = 'TXTLINKDATAPOLICIESREFUSE_' . $l; +$content = 'DATAPOLICIESCONTENT_' . $l; +$acc = 'DATAPOLICIESACCEPT_' . $l; +$ref = 'DATAPOLICIESREFUSE_' . $l; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print '
' . fieldLabel('DefaultLang', 'default_lang') . '' . "\n"; + print $formadmin->select_language((GETPOST('l') ? GETPOST('l') : $langs->defaultlang), 'default_lang', 0, 0, 1, 0, 0, 'maxwidth200onsmartphone'); + print '
'; +print $langs->trans('DATAPOLICIESSUBJECTMAIL') . ''; +print ''; +print '
'; +print $langs->trans('DATAPOLICIESCONTENTMAIL').''; +print $langs->trans('DATAPOLICIESSUBSITUTION');echo'__LINKACCEPT__,__LINKREFUSED__,__FIRSTNAME__,__NAME__,__CIVILITY__'; +$doleditor = new DolEditor($content, $conf->global->$content, '', 250, 'Full', '', false, true, 1, 200, 70); +$doleditor->Create(); +print '
'; +print $langs->trans('TXTLINKDATAPOLICIESACCEPT') . ''; +print ''; +print '
'; +print $langs->trans('TXTLINKDATAPOLICIESREFUSE') . ''; +print ''; +print '
'; + +print $langs->trans('DATAPOLICIESACCEPT').''; + +$doleditor = new DolEditor($acc, $conf->global->$acc, '', 250, 'Full', '', false, true, 1, 200, 70); +$doleditor->Create(); +print '
'; +print $langs->trans('DATAPOLICIESREFUSE').''; + +print $langs->trans(''); +$doleditor = new DolEditor($ref, $conf->global->$ref, '', 250, 'Full', '', false, true, 1, 200, 70); +$doleditor->Create(); +print '
'; + +print '
'; + +print '
'; + +dol_fiche_end(); + +print '

'; + +print $langs->trans('SendAgreementText'); +print ''.$langs->trans('SendAgreement').''; + +llxFooter(); +$db->close(); diff --git a/htdocs/datapolicies/class/actions_datapolicies.class.php b/htdocs/datapolicies/class/actions_datapolicies.class.php new file mode 100644 index 00000000000..05958e23ed8 --- /dev/null +++ b/htdocs/datapolicies/class/actions_datapolicies.class.php @@ -0,0 +1,450 @@ +. + */ + +/** + * \file datapolicies/class/actions_datapolicies.class.php + * \ingroup datapolicies + * \brief Example hook overload. + * + * Put detailed description here. + */ + +/** + * Class Actionsdatapolicies + */ +class Actionsdatapolicies { + + /** + * @var DoliDB Database handler. + */ + public $db; + + /** + * @var string Error + */ + public $error = ''; + + /** + * @var array Errors + */ + public $errors = array(); + + /** + * @var array Hook results. Propagated to $hookmanager->resArray for later reuse + */ + public $results = array(); + + /** + * @var string String displayed by executeHook() immediately after return + */ + public $resprints; + + /** + * Constructor + * + * @param DoliDB $db Database handler + */ + public function __construct($db) { + $this->db = $db; + } + + /** + * Execute action + * + * @param array $parameters Array of parameters + * @param CommonObject $object The object to process (an invoice if you are in invoice module, a propale in propale's module, etc...) + * @param string $action 'add', 'update', 'view' + * @return int <0 if KO, + * =0 if OK but we want to process standard actions too, + * >0 if OK and we want to replace standard actions. + */ + function getNomUrl($parameters, &$object, &$action) { + global $db, $langs, $conf, $user; + $this->resprints = ''; + return 0; + } + + /** + * Overloading the doActions function : replacing the parent's function with the one below + * + * @param array $parameters Hook metadatas (context, etc...) + * @param CommonObject $object The object to process (an invoice if you are in invoice module, a propale in propale's module, etc...) + * @param string $action Current action (if set). Generally create or edit or null + * @param HookManager $hookmanager Hook manager propagated to allow calling another hook + * @return int < 0 on error, 0 on success, 1 to replace standard code + */ + public function doActions($parameters, &$object, &$action, $hookmanager) { + global $conf, $user, $langs; + $langs->load('datapolicies@datapolicies'); + $error = 0; // Error counter + + if (GETPOST('socid') && $parameters['currentcontext'] == 'thirdpartycard') { + $object->fetch(GETPOST('socid')); + } + + if ($parameters['currentcontext'] == 'thirdpartycard' && $action == 'anonymiser' && ($object->forme_juridique_code == 11 || $object->forme_juridique_code == 12 || $object->forme_juridique_code == 13 || $object->forme_juridique_code == 15 || $object->forme_juridique_code == 17 || $object->forme_juridique_code == 18 || $object->forme_juridique_code == 19 || $object->forme_juridique_code == 35 || $object->forme_juridique_code == 60 || $object->forme_juridique_code == 200 || $object->forme_juridique_code == 311 || $object->forme_juridique_code == 312 || $object->forme_juridique_code == 316 || $object->forme_juridique_code == 401 || $object->forme_juridique_code == 600 || $object->forme_juridique_code == 700 || $object->forme_juridique_code == 1005 || $object->typent_id == 8)) { + // on verifie si l'objet est utilisé + if ($object->isObjectUsed(GETPOST('socid'))) { + $object->name = $langs->trans('ANONYME'); + $object->name_bis = ''; + $object->name_alias = ''; + $object->address = ''; + $object->town = ''; + $object->zip = ''; + $object->phone = ''; + $object->email = ''; + $object->url = ''; + $object->fax = ''; + $object->state = ''; + $object->country = ''; + $object->state_id = ''; + $object->skype = ''; + $object->country_id = ''; + $object->note_private = $object->note_private . '
' . $langs->trans('ANONYMISER_AT', dol_print_date(time())); + + if ($object->update($object->id, $user, 0)) { + + // On supprime les contacts associé + $sql = "DELETE FROM " . MAIN_DB_PREFIX . "socpeople WHERE fk_soc = " . $object->id; + $this->db->query($sql); + + setEventMessages($langs->trans('ANONYMISER_SUCCESS'), array()); + header('Location:' . $_SERVER["PHP_SELF"] . "?socid=" . $object->id); + } + } + } elseif ($parameters['currentcontext'] == 'thirdpartycard' && $action == 'datapolicies_portabilite') { + header('Content-Type: application/csv'); + header('Content-Disposition: attachment; filename=datapolicies_portabilite.csv'); + header('Pragma: no-cache'); + $object->fetch(GETPOST('socid')); + echo 'Nom;Prénom;Civilite;Tiers;Poste/Fonction;Adresse;CP;Ville;Département;Pays;Email;Tel Pro;Tel Perso;Tel Portable;Messagerie instantanée;Date de naissance;' . PHP_EOL; + echo $object->name . ';'; + echo ';'; + echo ';'; + echo ';'; + echo ';'; + echo $object->address . ';'; + echo $object->zip . ';'; + echo $object->town . ';'; + echo $object->state . ';'; + echo $object->country . ';'; + echo $object->email . ';'; + echo $object->phone . ';'; + echo ';'; + echo ';'; + echo $object->skype . ';'; + echo ';'; + exit; + } elseif ($parameters['currentcontext'] == 'membercard' && $action == 'datapolicies_portabilite') { + header('Content-Type: application/csv'); + header('Content-Disposition: attachment; filename=datapolicies_portabilite.csv'); + header('Pragma: no-cache'); + $soc = $object->fetch_thirdparty(); + + echo 'Nom;Prénom;Civilite;Tiers;Poste/Fonction;Adresse;CP;Ville;Département;Pays;Email;Tel Pro;Tel Perso;Tel Portable;Messagerie instantanée;Date de naissance;' . PHP_EOL; + echo $object->lastname . ';'; + echo $object->firstname . ';'; + echo $object->getCivilityLabel() . ';'; + echo ($soc != -1 ? $object->thirdparty->name : '') . ';'; + echo ';'; + echo $object->address . ';'; + echo $object->zip . ';'; + echo $object->town . ';'; + echo $object->state . ';'; + echo $object->country . ';'; + echo $object->email . ';'; + echo $object->phone . ';'; + echo $object->phone_perso . ';'; + echo $object->phone_mobile . ';'; + echo $object->skype . ';'; + echo dol_print_date($object->birth) . ';'; + exit; + } elseif ($parameters['currentcontext'] == 'contactcard' && $action == 'datapolicies_portabilite') { + $object->fetch(GETPOST('id')); + header('Content-Type: application/csv'); + header('Content-Disposition: attachment; filename=datapolicies_portabilite.csv'); + header('Pragma: no-cache'); + $soc = $object->fetch_thirdparty(); + echo 'Nom;Prénom;Civilite;Tiers;Poste/Fonction;Adresse;CP;Ville;Département;Pays;Email;Tel Pro;Tel Perso;Tel Portable;Messagerie instantanée;Date de naissance;' . PHP_EOL; + echo $object->lastname . ';'; + echo $object->firstname . ';'; + echo $object->getCivilityLabel() . ';'; + echo ($soc != -1 ? $object->thirdparty->name : '') . ';'; + echo $object->poste . ';'; + echo $object->address . ';'; + echo $object->zip . ';'; + echo $object->town . ';'; + echo $object->state . ';'; + echo $object->country . ';'; + echo $object->email . ';'; + echo $object->phone_pro . ';'; + echo $object->phone_perso . ';'; + echo $object->phone_mobile . ';'; + echo $object->jabberid . ';'; + echo dol_print_date($object->birth) . ';'; + exit; + } elseif ($parameters['currentcontext'] == 'contactcard' && $action == 'send_datapolicies') { + $object->fetch(GETPOST('id')); + + dol_include_once('/contact/class/contact.class.php'); + dol_include_once('/datapolicies/class/datapolicies.class.php'); + DataPolicies::sendMailDataPoliciesContact($object); + } + elseif ($parameters['currentcontext'] == 'membercard' && $action == 'send_datapolicies') { + $object->fetch(GETPOST('id')); + dol_include_once('/adherents/class/adherent.class.php'); + dol_include_once('/datapolicies/class/datapolicies.class.php'); + DataPolicies::sendMailDataPoliciesAdherent($object); + } elseif ($parameters['currentcontext'] == 'thirdpartycard' && $action == 'send_datapolicies') { + $object->fetch(GETPOST('socid')); + dol_include_once('/societe/class/societe.class.php'); + dol_include_once('/datapolicies/class/datapolicies.class.php'); + DataPolicies::sendMailDataPoliciesCompany($object); + } + + + if (!$error) { + $this->results = array('myreturn' => 999); + $this->resprints = 'A text to show'; + return 0; // or return 1 to replace standard code + } else { + $this->errors[] = 'Error message'; + return -1; + } + } + + /** + * Overloading the doActions function : replacing the parent's function with the one below + * + * @param array $parameters Hook metadatas (context, etc...) + * @param CommonObject $object The object to process (an invoice if you are in invoice module, a propale in propale's module, etc...) + * @param string $action Current action (if set). Generally create or edit or null + * @param HookManager $hookmanager Hook manager propagated to allow calling another hook + * @return int < 0 on error, 0 on success, 1 to replace standard code + */ + public function doMassActions($parameters, &$object, &$action, $hookmanager) { + global $conf, $user, $langs; + + $error = 0; // Error counter + + /* print_r($parameters); print_r($object); echo "action: " . $action; */ + if (in_array($parameters['currentcontext'], array('somecontext1', 'somecontext2'))) { // do something only for the context 'somecontext1' or 'somecontext2' + foreach ($parameters['toselect'] as $objectid) { + // Do action on each object id + } + } + + if (!$error) { + $this->results = array('myreturn' => 999); + $this->resprints = 'A text to show'; + return 0; // or return 1 to replace standard code + } else { + $this->errors[] = 'Error message'; + return -1; + } + } + + /** + * Overloading the addMoreMassActions function : replacing the parent's function with the one below + * + * @param array $parameter
s Hook metadatas (context, etc...) + * @param CommonObject $object The object to process (an invoice if you are in invoice module, a propale in propale's module, etc...) + * @param string $action Current action (if set). Generally create or edit or null + * @param HookManager $hookmanager Hook manager propagated to allow calling another hook + * @return int < 0 on error, 0 on success, 1 to replace standard code + */ + public function addMoreMassActions($parameters, &$object, &$action, $hookmanager) { + global $conf, $user, $langs; + + $error = 0; // Error counter + + /* print_r($parameters); print_r($object); echo "action: " . $action; */ + if (in_array($parameters['currentcontext'], array('somecontext1', 'somecontext2'))) { // do something only for the context 'somecontext1' or 'somecontext2' + $this->resprints = ''; + } + + if (!$error) { + return 0; // or return 1 to replace standard code + } else { + $this->errors[] = 'Error message'; + return -1; + } + } + + /** + * Execute action + * + * @param array $parameters Array of parameters + * @param Object $object Object output on PDF + * @param string $action 'add', 'update', 'view' + * @return int <0 if KO, + * =0 if OK but we want to process standard actions too, + * >0 if OK and we want to replace standard actions. + */ + function beforePDFCreation($parameters, &$object, &$action) { + global $conf, $user, $langs; + global $hookmanager; + + $outputlangs = $langs; + + $ret = 0; + $deltemp = array(); + dol_syslog(get_class($this) . '::executeHooks action=' . $action); + + /* print_r($parameters); print_r($object); echo "action: " . $action; */ + if (in_array($parameters['currentcontext'], array('somecontext1', 'somecontext2'))) { // do something only for the context 'somecontext1' or 'somecontext2' + + } + + return $ret; + } + + /** + * Execute action + * + * @param array $parameters Array of parameters + * @param Object $pdfhandler PDF builder handler + * @param string $action 'add', 'update', 'view' + * @return int <0 if KO, + * =0 if OK but we want to process standard actions too, + * >0 if OK and we want to replace standard actions. + */ + function afterPDFCreation($parameters, &$pdfhandler, &$action) { + global $conf, $user, $langs; + global $hookmanager; + + $outputlangs = $langs; + + $ret = 0; + $deltemp = array(); + dol_syslog(get_class($this) . '::executeHooks action=' . $action); + + /* print_r($parameters); print_r($object); echo "action: " . $action; */ + if (in_array($parameters['currentcontext'], array('somecontext1', 'somecontext2'))) { // do something only for the context 'somecontext1' or 'somecontext2' + + } + + return $ret; + } + + function addMoreActionsButtons($parameters, &$object, &$action, $hookmanager) { + global $conf, $user, $langs; + $langs->load('datapolicies@datapolicies'); + + $dialog = '"; + $dialog .= ''; + echo $dialog; + if ($parameters['currentcontext'] == 'thirdpartycard' && $object->forme_juridique_code == 11 || $object->forme_juridique_code == 12 || $object->forme_juridique_code == 13 || $object->forme_juridique_code == 15 || $object->forme_juridique_code == 17 || $object->forme_juridique_code == 18 || $object->forme_juridique_code == 19 || $object->forme_juridique_code == 35 || $object->forme_juridique_code == 60 || $object->forme_juridique_code == 200 || $object->forme_juridique_code == 311 || $object->forme_juridique_code == 312 || $object->forme_juridique_code == 316 || $object->forme_juridique_code == 401 || $object->forme_juridique_code == 600 || $object->forme_juridique_code == 700 || $object->forme_juridique_code == 1005 || $object->typent_id == 8) { + echo ''; + } elseif ($parameters['currentcontext'] == 'membercard') { + echo ''; + } elseif ($parameters['currentcontext'] == 'contactcard') { + echo ''; + } + if (!empty($object->mail) && empty($object->array_options['options_datapolicies_send']) && $parameters['currentcontext'] == 'thirdpartycard' && $object->forme_juridique_code == 11 || $object->forme_juridique_code == 12 || $object->forme_juridique_code == 13 || $object->forme_juridique_code == 15 || $object->forme_juridique_code == 17 || $object->forme_juridique_code == 18 || $object->forme_juridique_code == 19 || $object->forme_juridique_code == 35 || $object->forme_juridique_code == 60 || $object->forme_juridique_code == 200 || $object->forme_juridique_code == 311 || $object->forme_juridique_code == 312 || $object->forme_juridique_code == 316 || $object->forme_juridique_code == 401 || $object->forme_juridique_code == 600 || $object->forme_juridique_code == 700 || $object->forme_juridique_code == 1005 || $object->typent_id == 8) { + echo ''; + } elseif (!empty($object->mail) && empty($object->array_options['options_datapolicies_send']) && $parameters['currentcontext'] == 'membercard') { + echo ''; + } elseif (!empty($object->mail) && empty($object->array_options['options_datapolicies_send']) && $parameters['currentcontext'] == 'contactcard') { + echo ''; + } + } + + function printCommonFooter($parameters, &$object, &$action, $hookmanager) { + global $conf, $user, $langs; + + $jsscript = ''; + if ($parameters['currentcontext'] == 'thirdpartycard') { + if (GETPOST('action') == 'create' || GETPOST('action') == 'edit' || GETPOST('action') == '') { + $jsscript .= ''; + } elseif (GETPOST('action') == 'confirm_delete' && GETPOST('confirm') == 'yes' && GETPOST('socid') > 0) { + + // La suppression n'a pas été possible + require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; + $societe = new Societe($this->db); + $societe->fetch(GETPOST('socid')); + // On vérifie si il est utilisé + if (($societe->forme_juridique_code == 11 || $societe->forme_juridique_code == 12 || $societe->forme_juridique_code == 13 || $societe->forme_juridique_code == 15 || $societe->forme_juridique_code == 17 || $societe->forme_juridique_code == 18 || $societe->forme_juridique_code == 19 || $societe->forme_juridique_code == 35 || $societe->forme_juridique_code == 60 || $societe->forme_juridique_code == 200 || $societe->forme_juridique_code == 311 || $societe->forme_juridique_code == 312 || $societe->forme_juridique_code == 316 || $societe->forme_juridique_code == 401 || $societe->forme_juridique_code == 600 || $societe->forme_juridique_code == 700 || $societe->forme_juridique_code == 1005 || $societe->typent_id == 8) && $societe->isObjectUsed(GETPOST('socid'))) { + + require_once DOL_DOCUMENT_ROOT . '/core/class/html.form.class.php'; + $form = new Form($this->db); + echo $form->formconfirm($_SERVER["PHP_SELF"] . "?socid=" . GETPOST('socid'), substr($langs->trans("DATAPOLICIES_POPUP_ANONYME_TITLE"), 0, strlen($langs->trans("DATAPOLICIES_POPUP_ANONYME_TITLE")) - 2), $langs->trans("DATAPOLICIES_POPUP_ANONYME_TEXTE"), 'anonymiser', '', '', 1); + } + } + + if (GETPOST('socid')) { + require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; + $societe = new Societe($this->db); + $societe->fetch(GETPOST('socid')); + + if ($societe->forme_juridique_code != 11 && $societe->forme_juridique_code != 12 && $societe->forme_juridique_code != 13 && $societe->forme_juridique_code != 15 && $societe->forme_juridique_code != 17 && $societe->forme_juridique_code != 18 && $societe->forme_juridique_code != 19 && $societe->forme_juridique_code != 35 && $societe->forme_juridique_code != 60 && $societe->forme_juridique_code != 200 && $societe->forme_juridique_code != 311 && $societe->forme_juridique_code != 312 && $societe->forme_juridique_code != 316 && $societe->forme_juridique_code != 401 && $societe->forme_juridique_code != 600 && $societe->forme_juridique_code != 700 && $societe->forme_juridique_code != 1005 && $societe->typent_id != 8) { + + require_once DOL_DOCUMENT_ROOT . '/core/class/html.form.class.php'; + $jsscript .= ''; + } + } + } elseif ($parameters['currentcontext'] == 'contactcard') { + if (GETPOST('action') == 'create' || GETPOST('action') == 'edit') { + $jsscript .= ''; + } + } + + echo $jsscript; + } + +} diff --git a/htdocs/datapolicies/class/datapolicies.class.php b/htdocs/datapolicies/class/datapolicies.class.php new file mode 100644 index 00000000000..030d5ff475f --- /dev/null +++ b/htdocs/datapolicies/class/datapolicies.class.php @@ -0,0 +1,320 @@ +. + */ + +/** + * \file datapolicies/class/actions_datapolicies.class.php + * \ingroup datapolicies + * \brief Example hook overload. + * + * Put detailed description here. + */ +include_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php'; +include_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; +include_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php'; + +/** + * Class datapolicies + */ +Class DataPolicies extends Contact { + + function getAllContactNotInformed() { + + global $langs, $conf, $db, $user; + + $langs->load("companies"); + + $sql = "SELECT c.rowid"; + $sql .= " FROM " . MAIN_DB_PREFIX . "socpeople as c"; + $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe as s ON c.fk_soc = s.rowid"; + $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "socpeople_extrafields as spe ON spe.fk_object = c.rowid"; + $sql .= " WHERE (c.statut=1 AND c.no_email=0 AND (spe.datapolicies_consentement=0 OR spe.datapolicies_consentement IS NULL) AND (spe.datapolicies_opposition_traitement=0 OR spe.datapolicies_opposition_traitement IS NULL) AND (spe.datapolicies_opposition_prospection=0 OR spe.datapolicies_opposition_prospection IS NULL))"; + $sql .= " AND spe.datapolicies_send IS NULL"; + $sql .= " AND c.entity=" . $conf->entity; + $resql = $this->db->query($sql); + if ($resql) { + $num = $this->db->num_rows($resql); + $i = 0; + while ($i < $num) { + $obj = $this->db->fetch_object($resql); + //echo "
".print_r($obj,1)."
"; + $contact = new Contact($db); + $contact->fetch($obj->rowid); + + DataPolicies::sendMailDataPoliciesContact($contact); + $i++; + } + } else { + $this->error = $this->db->error(); + return -1; + } + } + + function getAllCompaniesNotInformed() { + + global $langs, $conf, $db, $user; + + $langs->load("companies"); + + $sql = "SELECT s.rowid"; + $sql .= " FROM " . MAIN_DB_PREFIX . "societe as s"; + $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_extrafields as se ON se.fk_object = s.rowid"; + $sql .= " WHERE s.statut=0 AND (se.datapolicies_consentement=0 OR se.datapolicies_consentement IS NULL) AND (se.datapolicies_opposition_traitement=0 OR se.datapolicies_opposition_traitement IS NULL) AND (se.datapolicies_opposition_prospection=0 OR se.datapolicies_opposition_prospection IS NULL)"; + $sql .= " AND se.datapolicies_send IS NULL"; + $sql .= " AND s.entity=" . $conf->entity; + $resql = $this->db->query($sql); + if ($resql) { + $num = $this->db->num_rows($resql); + $i = 0; + while ($i < $num) { + $obj = $this->db->fetch_object($resql); + //echo "
".print_r($obj,1)."
"; + $societe = new Societe($db); + $societe->fetch($obj->rowid); + + DataPolicies::sendMailDataPoliciesCompany($societe); + $i++; + } + } else { + $this->error = $this->db->error(); + return -1; + } + } + + function getAllAdherentsNotInformed() { + + global $langs, $conf, $db, $user; + + $langs->load("adherent"); + + $sql = "SELECT a.rowid"; + $sql .= " FROM " . MAIN_DB_PREFIX . "adherent as a"; + $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "adherent_extrafields as ae ON ae.fk_object = a.rowid"; + $sql .= " WHERE a.statut=0 AND (ae.datapolicies_consentement=0 OR ae.datapolicies_consentement IS NULL) AND (ae.datapolicies_opposition_traitement=0 OR ae.datapolicies_opposition_traitement IS NULL) AND (ae.datapolicies_opposition_prospection=0 OR ae.datapolicies_opposition_prospection IS NULL)"; + $sql .= " AND ae.datapolicies_send IS NULL"; + $sql .= " AND a.entity=" . $conf->entity; + $resql = $this->db->query($sql); + if ($resql) { + $num = $this->db->num_rows($resql); + $i = 0; + while ($i < $num) { + $obj = $this->db->fetch_object($resql); + //echo "
".print_r($obj,1)."
"; + $adherent = new Adherent($db); + $adherent->fetch($obj->rowid); + + DataPolicies::sendMailDataPoliciesAdherent($adherent); + $i++; + } + } else { + $this->error = $this->db->error(); + return -1; + } + } + + function sendMailDataPoliciesContact($contact) { + global $langs, $conf, $db, $user; + $from = $user->getFullName($langs) . ' <' . $user->email . '>'; + $replyto = $from; + $sendto = $contact->email; +//echo "
".print_r($contact,1)."
"; + $code= md5($contact->email); + if (!empty($contact->default_lang)) { + $l = $contact->default_lang; + } else { + $l = $langs->defaultlang; + } + $s = "DATAPOLICIESSUBJECT_" . $l; + $ma = "DATAPOLICIESCONTENT_" . $l; + $la = 'TXTLINKDATAPOLICIESACCEPT_' . $l; + $lr = 'TXTLINKDATAPOLICIESREFUSE_' . $l; + + $subject = $conf->global->$s; + $message = $conf->global->$ma; + $linka = $conf->global->$la; + $linkr = $conf->global->$lr; + + $substitutionarray = array( + '__LINKACCEPT__' => ''.$linka.'', + '__LINKREFUSED__' => ''.$linkr.'', + '__FIRSTNAME__' => $contact->firstname, + '__NAME__' => $contact->lastname, + '__CIVILITY__' => $contact->civility, + ); + $subject = make_substitutions($subject, $substitutionarray); + $message = make_substitutions($message, $substitutionarray); + + $actiontypecode = 'AC_EMAIL'; + $actionmsg = $langs->transnoentities('MailSentBy') . ' ' . $from . ' ' . $langs->transnoentities('To') . ' ' . $sendto; + if ($message) { + if ($sendtocc) + $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc') . ": " . $sendtocc); + $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic') . ": " . $subject); + $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":"); + $actionmsg = dol_concatdesc($actionmsg, $message); + } + + + + // Send mail + require_once(DOL_DOCUMENT_ROOT . '/core/class/CMailFile.class.php'); + $mailfile = new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, $sendtocc, $sendtobcc, $deliveryreceipt, -1); + + if ($mailfile->error) { + $resultmasssend .= '
' . $mailfile->error . '
'; + } else { + $result4 = $mailfile->sendfile(); + if (!$error) { + + $resultmasssend .= $langs->trans("MailSent") . ': ' . $sendto . "
"; + $contact->array_options['options_datapolicies_send'] = date('Y-m-d', time()); + $contact->update($contact->id); + + } else { + dol_print_error($db); + } + } + setEventMessage($resultmasssend); + } + + function sendMailDataPoliciesCompany($societe) { + global $langs, $conf, $db, $user; + $from = $user->getFullName($langs) . ' <' . $user->email . '>'; + $replyto = $from; + $sendto = $societe->email; + + $code= md5($societe->email); + if (!empty($societe->default_lang)) { + $l = $societe->default_lang; + } else { + $l = $langs->defaultlang; + } + $s = "DATAPOLICIESSUBJECT_" . $l; + $ma = "DATAPOLICIESCONTENT_" . $l; + $la = 'TXTLINKDATAPOLICIESACCEPT_' . $l; + $lr = 'TXTLINKDATAPOLICIESREFUSE_' . $l; + + $subject = $conf->global->$s; + $message = $conf->global->$ma; + $linka = $conf->global->$la; + $linkr = $conf->global->$lr; + + + $substitutionarray = array( + '__LINKACCEPT__' => ''.$linka.'', + '__LINKREFUSED__' => ''.$linkr.'', + ); + $subject = make_substitutions($subject, $substitutionarray); + $message = make_substitutions($message, $substitutionarray); + + $actiontypecode = 'AC_EMAIL'; + $actionmsg = $langs->transnoentities('MailSentBy') . ' ' . $from . ' ' . $langs->transnoentities('To') . ' ' . $sendto; + if ($message) { + if ($sendtocc) + $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc') . ": " . $sendtocc); + $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic') . ": " . $subject); + $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":"); + $actionmsg = dol_concatdesc($actionmsg, $message); + } + + + + // Send mail + require_once(DOL_DOCUMENT_ROOT . '/core/class/CMailFile.class.php'); + $mailfile = new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, $sendtocc, $sendtobcc, $deliveryreceipt, -1); + if ($mailfile->error) { + $resultmasssend .= '
' . $mailfile->error . '
'; + } else { + $result4 = $mailfile->sendfile(); + + if (!$error) { + $resultmasssend .= $langs->trans("MailSent") . ': ' . $sendto . "
"; + $societe->array_options['options_datapolicies_send'] = date('Y-m-d', time()); + $societe->update($societe->id); + + } else { + dol_print_error($db); + } + } + setEventMessage($resultmasssend); + + } + + function sendMailDataPoliciesAdherent($adherent) { + global $langs, $conf, $db, $user; + $from = $user->getFullName($langs) . ' <' . $user->email . '>'; + $replyto = $from; + $sendto = $adherent->email; + + $code= md5($adherent->email); + if (!empty($adherent->default_lang)) { + $l = $adherent->default_lang; + } else { + $l = $langs->defaultlang; + } + $la = 'TXTLINKDATAPOLICIESACCEPT_' . $l; + $lr = 'TXTLINKDATAPOLICIESREFUSE_' . $l; + + $subject = $conf->global->$s; + $message = $conf->global->$ma; + $linka = $conf->global->$la; + $linkr = $conf->global->$lr; + + + $substitutionarray = array( + '__LINKACCEPT__' => ''.$linka.'', + '__LINKREFUSED__' => ''.$linkr.'', + ); + $subject = make_substitutions($subject, $substitutionarray); + $message = make_substitutions($message, $substitutionarray); + + $actiontypecode = 'AC_EMAIL'; + $actionmsg = $langs->transnoentities('MailSentBy') . ' ' . $from . ' ' . $langs->transnoentities('To') . ' ' . $sendto; + if ($message) { + if ($sendtocc) + $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc') . ": " . $sendtocc); + $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic') . ": " . $subject); + $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":"); + $actionmsg = dol_concatdesc($actionmsg, $message); + } + + + + // Send mail + require_once(DOL_DOCUMENT_ROOT . '/core/class/CMailFile.class.php'); + $mailfile = new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, $sendtocc, $sendtobcc, $deliveryreceipt, -1); + if ($mailfile->error) { + $resultmasssend .= '
' . $mailfile->error . '
'; + } else { + $result4 = $mailfile->sendfile(); + + if (!$error) { + $resultmasssend .= $langs->trans("MailSent") . ': ' . $sendto . "
"; + $adherent->array_options['options_datapolicies_send'] = date('Y-m-d', time()); + $adherent->update($user); + + } else { + dol_print_error($db); + } + } + setEventMessage($resultmasssend); + + } + + + +} diff --git a/htdocs/datapolicies/class/datapoliciescron.class.php b/htdocs/datapolicies/class/datapoliciescron.class.php new file mode 100644 index 00000000000..18484d1619d --- /dev/null +++ b/htdocs/datapolicies/class/datapoliciescron.class.php @@ -0,0 +1,487 @@ +load('datapolicies@datapolicies'); + + $arrayofparameters=array( + 'DATAPOLICIES_TIERS_CLIENT' => array( + 'sql' => " + SELECT s.rowid FROM ".MAIN_DB_PREFIX."societe as s + WHERE (s.fk_forme_juridique = 19 OR s.fk_forme_juridique = 11 OR s.fk_forme_juridique = 12 OR s.fk_forme_juridique = 13 OR s.fk_forme_juridique = 15 OR s.fk_forme_juridique = 17 OR s.fk_forme_juridique = 18 OR s.fk_forme_juridique = 35 OR s.fk_forme_juridique = 60 OR s.fk_forme_juridique = 312 OR s.fk_forme_juridique = 316 OR s.fk_forme_juridique = 401 OR s.fk_forme_juridique = 600 OR s.fk_forme_juridique = 700 OR s.fk_forme_juridique = 1005 OR s.fk_typent = 8) + AND s.entity = %d + AND s.client = 1 + AND s.fournisseur = 0 + AND s.tms < DATE_SUB(NOW(), INTERVAL %d MONTH) + AND s.rowid NOT IN ( + SELECT DISTINCT a.fk_soc + FROM ".MAIN_DB_PREFIX."actioncomm as a + WHERE a.tms > DATE_SUB(NOW(), INTERVAL %d MONTH) + AND a.fk_soc IS NOT NULL + ) + ", + "class" => "Societe", + "file" => DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php', + 'fields_anonym' => array( + 'name' => $langs->trans('ANONYME'), + 'name_bis' => '', + 'name_alias' => '', + 'address' => '', + 'town' => '', + 'zip' => '', + 'phone' => '', + 'email' => '', + 'url' => '', + 'fax' => '', + 'state' => '', + 'country' => '', + 'state_id' => '', + 'skype' => '', + 'country_id' => '', + ) + ), + 'DATAPOLICIES_TIERS_PROSPECT' => array( + 'sql' => " + SELECT s.rowid FROM ".MAIN_DB_PREFIX."societe as s + WHERE (s.fk_forme_juridique = 19 OR s.fk_forme_juridique = 11 OR s.fk_forme_juridique = 12 OR s.fk_forme_juridique = 13 OR s.fk_forme_juridique = 15 OR s.fk_forme_juridique = 17 OR s.fk_forme_juridique = 18 OR s.fk_forme_juridique = 35 OR s.fk_forme_juridique = 60 OR s.fk_forme_juridique = 312 OR s.fk_forme_juridique = 316 OR s.fk_forme_juridique = 401 OR s.fk_forme_juridique = 600 OR s.fk_forme_juridique = 700 OR s.fk_forme_juridique = 1005 OR s.fk_typent = 8) + AND s.entity = %d + AND s.client = 2 + AND s.fournisseur = 0 + AND s.tms < DATE_SUB(NOW(), INTERVAL %d MONTH) + AND s.rowid NOT IN ( + SELECT DISTINCT a.fk_soc + FROM ".MAIN_DB_PREFIX."actioncomm as a + WHERE a.tms > DATE_SUB(NOW(), INTERVAL %d MONTH) + AND a.fk_soc IS NOT NULL + ) + ", + "class" => "Societe", + "file" => DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php', + 'fields_anonym' => array( + 'name' => $langs->trans('ANONYME'), + 'name_bis' => '', + 'name_alias' => '', + 'address' => '', + 'town' => '', + 'zip' => '', + 'phone' => '', + 'email' => '', + 'url' => '', + 'fax' => '', + 'state' => '', + 'country' => '', + 'state_id' => '', + 'skype' => '', + 'country_id' => '', + ) + ), + 'DATAPOLICIES_TIERS_PROSPECT_CLIENT' => array( + 'sql' => " + SELECT s.rowid FROM ".MAIN_DB_PREFIX."societe as s + WHERE (s.fk_forme_juridique = 19 OR s.fk_forme_juridique = 11 OR s.fk_forme_juridique = 12 OR s.fk_forme_juridique = 13 OR s.fk_forme_juridique = 15 OR s.fk_forme_juridique = 17 OR s.fk_forme_juridique = 18 OR s.fk_forme_juridique = 35 OR s.fk_forme_juridique = 60 OR s.fk_forme_juridique = 312 OR s.fk_forme_juridique = 316 OR s.fk_forme_juridique = 401 OR s.fk_forme_juridique = 600 OR s.fk_forme_juridique = 700 OR s.fk_forme_juridique = 1005 OR s.fk_typent = 8) + AND s.entity = %d + AND s.client = 3 + AND s.fournisseur = 0 + AND s.tms < DATE_SUB(NOW(), INTERVAL %d MONTH) + AND s.rowid NOT IN ( + SELECT DISTINCT a.fk_soc + FROM ".MAIN_DB_PREFIX."actioncomm as a + WHERE a.tms > DATE_SUB(NOW(), INTERVAL %d MONTH) + AND a.fk_soc IS NOT NULL + ) + ", + "class" => "Societe", + "file" => DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php', + 'fields_anonym' => array( + 'name' => $langs->trans('ANONYME'), + 'name_bis' => '', + 'name_alias' => '', + 'address' => '', + 'town' => '', + 'zip' => '', + 'phone' => '', + 'email' => '', + 'url' => '', + 'fax' => '', + 'state' => '', + 'country' => '', + 'state_id' => '', + 'skype' => '', + 'country_id' => '', + ) + ), + 'DATAPOLICIES_TIERS_NIPROSPECT_NICLIENT' => array( + 'sql' => " + SELECT s.rowid FROM ".MAIN_DB_PREFIX."societe as s + WHERE (s.fk_forme_juridique = 19 OR s.fk_forme_juridique = 11 OR s.fk_forme_juridique = 12 OR s.fk_forme_juridique = 13 OR s.fk_forme_juridique = 15 OR s.fk_forme_juridique = 17 OR s.fk_forme_juridique = 18 OR s.fk_forme_juridique = 35 OR s.fk_forme_juridique = 60 OR s.fk_forme_juridique = 312 OR s.fk_forme_juridique = 316 OR s.fk_forme_juridique = 401 OR s.fk_forme_juridique = 600 OR s.fk_forme_juridique = 700 OR s.fk_forme_juridique = 1005 OR s.fk_typent = 8) + AND s.entity = %d + AND s.client = 0 + AND s.fournisseur = 0 + AND s.tms < DATE_SUB(NOW(), INTERVAL %d MONTH) + AND s.rowid NOT IN ( + SELECT DISTINCT a.fk_soc + FROM ".MAIN_DB_PREFIX."actioncomm as a + WHERE a.tms > DATE_SUB(NOW(), INTERVAL %d MONTH) + AND a.fk_soc IS NOT NULL + ) + ", + "class" => "Societe", + "file" => DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php', + 'fields_anonym' => array( + 'name' => $langs->trans('ANONYME'), + 'name_bis' => '', + 'name_alias' => '', + 'address' => '', + 'town' => '', + 'zip' => '', + 'phone' => '', + 'email' => '', + 'url' => '', + 'fax' => '', + 'state' => '', + 'country' => '', + 'state_id' => '', + 'skype' => '', + 'country_id' => '', + ) + ), + 'DATAPOLICIES_TIERS_FOURNISSEUR' => array( + 'sql' => " + SELECT s.rowid FROM ".MAIN_DB_PREFIX."societe as s + WHERE (s.fk_forme_juridique = 19 OR s.fk_forme_juridique = 11 OR s.fk_forme_juridique = 12 OR s.fk_forme_juridique = 13 OR s.fk_forme_juridique = 15 OR s.fk_forme_juridique = 17 OR s.fk_forme_juridique = 18 OR s.fk_forme_juridique = 35 OR s.fk_forme_juridique = 60 OR s.fk_forme_juridique = 312 OR s.fk_forme_juridique = 316 OR s.fk_forme_juridique = 401 OR s.fk_forme_juridique = 600 OR s.fk_forme_juridique = 700 OR s.fk_forme_juridique = 1005 OR s.fk_typent = 8) + AND s.entity = %d + AND s.fournisseur = 1 + AND s.tms < DATE_SUB(NOW(), INTERVAL %d MONTH) + AND s.rowid NOT IN ( + SELECT DISTINCT a.fk_soc + FROM ".MAIN_DB_PREFIX."actioncomm as a + WHERE a.tms > DATE_SUB(NOW(), INTERVAL %d MONTH) + AND a.fk_contact IS NOT NULL + ) + ", + "class" => "Societe", + "file" => DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php', + 'fields_anonym' => array( + 'name' => $langs->trans('ANONYME'), + 'name_bis' => '', + 'name_alias' => '', + 'address' => '', + 'town' => '', + 'zip' => '', + 'phone' => '', + 'email' => '', + 'url' => '', + 'fax' => '', + 'state' => '', + 'country' => '', + 'state_id' => '', + 'skype' => '', + 'country_id' => '', + ) + ), + 'DATAPOLICIES_CONTACT_CLIENT' => array( + 'sql' => " + SELECT c.rowid FROM ".MAIN_DB_PREFIX."socpeople as c + INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = c.fk_soc + WHERE c.entity = %d + AND c.tms < DATE_SUB(NOW(), INTERVAL %d MONTH) + AND s.client = 1 + AND s.fournisseur = 0 + AND c.rowid NOT IN ( + SELECT DISTINCT a.fk_contact + FROM ".MAIN_DB_PREFIX."actioncomm as a + WHERE a.tms > DATE_SUB(NOW(), INTERVAL %d MONTH) + AND a.fk_contact IS NOT NULL + ) + ", + "class" => "Contact", + "file" => DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php', + 'fields_anonym' => array( + 'lastname' => $langs->trans('ANONYME'), + 'firstname' => '', + 'civility_id' => '', + 'poste' => '', + 'address' => '', + 'town' => '', + 'zip' => '', + 'phone_pro' => '', + 'phone_perso' => '', + 'phone_mobile' => '', + 'email' => '', + 'url' => '', + 'fax' => '', + 'state' => '', + 'country' => '', + 'state_id' => '', + 'skype' => '', + 'jabberid' => '', + 'country_id' => '', + ) + ), + 'DATAPOLICIES_CONTACT_PROSPECT' => array( + 'sql' => " + SELECT c.rowid FROM ".MAIN_DB_PREFIX."socpeople as c + INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = c.fk_soc + WHERE c.entity = %d + AND c.tms < DATE_SUB(NOW(), INTERVAL %d MONTH) + AND s.client = 2 + AND s.fournisseur = 0 + AND c.rowid NOT IN ( + SELECT DISTINCT a.fk_contact + FROM ".MAIN_DB_PREFIX."actioncomm as a + WHERE a.tms > DATE_SUB(NOW(), INTERVAL %d MONTH) + AND a.fk_contact IS NOT NULL + ) + ", + "class" => "Contact", + "file" => DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php', + 'fields_anonym' => array( + 'lastname' => $langs->trans('ANONYME'), + 'firstname' => '', + 'civility_id' => '', + 'poste' => '', + 'address' => '', + 'town' => '', + 'zip' => '', + 'phone_pro' => '', + 'phone_perso' => '', + 'phone_mobile' => '', + 'email' => '', + 'url' => '', + 'fax' => '', + 'state' => '', + 'country' => '', + 'state_id' => '', + 'skype' => '', + 'jabberid' => '', + 'country_id' => '', + ) + ), + 'DATAPOLICIES_CONTACT_PROSPECT_CLIENT' => array( + 'sql' => " + SELECT c.rowid FROM ".MAIN_DB_PREFIX."socpeople as c + INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = c.fk_soc + WHERE c.entity = %d + AND c.tms < DATE_SUB(NOW(), INTERVAL %d MONTH) + AND s.client = 3 + AND s.fournisseur = 0 + AND c.rowid NOT IN ( + SELECT DISTINCT a.fk_contact + FROM ".MAIN_DB_PREFIX."actioncomm as a + WHERE a.tms > DATE_SUB(NOW(), INTERVAL %d MONTH) + AND a.fk_contact IS NOT NULL + ) + ", + "class" => "Contact", + "file" => DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php', + 'fields_anonym' => array( + 'lastname' => $langs->trans('ANONYME'), + 'firstname' => '', + 'civility_id' => '', + 'poste' => '', + 'address' => '', + 'town' => '', + 'zip' => '', + 'phone_pro' => '', + 'phone_perso' => '', + 'phone_mobile' => '', + 'email' => '', + 'url' => '', + 'fax' => '', + 'state' => '', + 'country' => '', + 'state_id' => '', + 'skype' => '', + 'jabberid' => '', + 'country_id' => '', + ) + ), + 'DATAPOLICIES_CONTACT_NIPROSPECT_NICLIENT' => array( + 'sql' => " + SELECT c.rowid FROM ".MAIN_DB_PREFIX."socpeople as c + INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = c.fk_soc + WHERE c.entity = %d + AND c.tms < DATE_SUB(NOW(), INTERVAL %d MONTH) + AND s.client = 0 + AND s.fournisseur = 0 + AND c.rowid NOT IN ( + SELECT DISTINCT a.fk_contact + FROM ".MAIN_DB_PREFIX."actioncomm as a + WHERE a.tms > DATE_SUB(NOW(), INTERVAL %d MONTH) + AND a.fk_contact IS NOT NULL + ) + ", + "class" => "Contact", + "file" => DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php', + 'fields_anonym' => array( + 'lastname' => $langs->trans('ANONYME'), + 'firstname' => '', + 'civility_id' => '', + 'poste' => '', + 'address' => '', + 'town' => '', + 'zip' => '', + 'phone_pro' => '', + 'phone_perso' => '', + 'phone_mobile' => '', + 'email' => '', + 'url' => '', + 'fax' => '', + 'state' => '', + 'country' => '', + 'state_id' => '', + 'skype' => '', + 'jabberid' => '', + 'country_id' => '', + ) + ), + 'DATAPOLICIES_CONTACT_FOURNISSEUR' => array( + 'sql' => " + SELECT c.rowid FROM ".MAIN_DB_PREFIX."socpeople as c + INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = c.fk_soc + WHERE c.entity = %d + AND c.tms < DATE_SUB(NOW(), INTERVAL %d MONTH) + AND s.fournisseur = 1 + AND c.rowid NOT IN ( + SELECT DISTINCT a.fk_contact + FROM ".MAIN_DB_PREFIX."actioncomm as a + WHERE a.tms > DATE_SUB(NOW(), INTERVAL %d MONTH) + AND a.fk_contact IS NOT NULL + ) + ", + "class" => "Contact", + "file" => DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php', + 'fields_anonym' => array( + 'lastname' => $langs->trans('ANONYME'), + 'firstname' => '', + 'civility_id' => '', + 'poste' => '', + 'address' => '', + 'town' => '', + 'zip' => '', + 'phone_pro' => '', + 'phone_perso' => '', + 'phone_mobile' => '', + 'email' => '', + 'url' => '', + 'fax' => '', + 'state' => '', + 'country' => '', + 'state_id' => '', + 'skype' => '', + 'jabberid' => '', + 'country_id' => '', + ) + ), + 'DATAPOLICIES_ADHERENT' => array( + 'sql' => " + SELECT a.rowid FROM ".MAIN_DB_PREFIX."adherent as a + WHERE a.entity = %d + AND a.tms < DATE_SUB(NOW(), INTERVAL %d MONTH) + AND a.rowid NOT IN ( + SELECT DISTINCT a.fk_element + FROM ".MAIN_DB_PREFIX."actioncomm as a + WHERE a.tms > DATE_SUB(NOW(), INTERVAL %d MONTH) + AND a.elementtype LIKE 'member' + AND a.fk_element IS NOT NULL + ) + ", + "class" => "Adherent", + "file" => DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php', + 'fields_anonym' => array( + 'lastname' => $langs->trans('ANONYME'), + 'firstname' => $langs->trans('ANONYME'), + 'civility_id' => '', + 'societe' => '', + 'address' => '', + 'town' => '', + 'zip' => '', + 'phone' => '', + 'phone_perso' => '', + 'phone_mobile' => '', + 'email' => '', + 'url' => '', + 'fax' => '', + 'state' => '', + 'country' => '', + 'state_id' => '', + 'skype' => '', + 'country_id' => '', + ) + ), + ); + + foreach ($arrayofparameters as $key => $params) { + if ($conf->global->$key != '' && is_numeric($conf->global->$key) && (int)$conf->global->$key > 0) { + + $sql = sprintf($params['sql'], (int)$conf->entity, (int)$conf->global->$key, (int)$conf->global->$key); + + $resql = $db->query($sql); + + if ($resql && $db->num_rows($resql) > 0) { + + $num = $db->num_rows($resql); + $i = 0; + + require_once $params['file']; + $object = new $params['class']($db); + + while ($i < $num) + { + $obj = $db->fetch_object($resql); + + $object->fetch($obj->rowid); + $object->id = $obj->rowid; + + if ($object->isObjectUsed($obj->rowid) > 0) { + foreach ($params['fields_anonym'] as $fields => $val) { + $object->$fields = $val; + } + $object->update($obj->rowid, $user); + if ($params['class'] == 'Societe') { + // On supprime les contacts associé + $sql = "DELETE FROM ".MAIN_DB_PREFIX."socpeople WHERE fk_soc = " . $obj->rowid; + $db->query($sql); + } + } else { + if (DOL_VERSION < 8) { + $ret = $object->delete($obj->rowid, $user); + } else { + if ($object->element == 'adherent') { + $ret = $object->delete($obj->rowid); + } else { + $ret = $object->delete(); + } + } + + } + + $i++; + } + } + } + + } + return true; + + } + + + public function sendMailing() { + global $conf, $db, $langs, $user; + + $langs->load('datapolicies@datapolicies'); + + dol_include_once('/datapolicies/class/datapolicies.class.php'); + + $contacts = new DataPolicies($db); + $contacts->getAllContactNotInformed(); + $contacts->getAllCompaniesNotInformed(); + $contacts->getAllAdherentsNotInformed(); + return true; + + } +} \ No newline at end of file diff --git a/htdocs/datapolicies/css/datapolicies.css.php b/htdocs/datapolicies/css/datapolicies.css.php new file mode 100644 index 00000000000..72a3c09819e --- /dev/null +++ b/htdocs/datapolicies/css/datapolicies.css.php @@ -0,0 +1,74 @@ +. + */ + +/** + * \file rgpd/css/rgpd.css.php + * \ingroup rgpd + * \brief CSS file for module rgpd. + */ + +//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled because need to load personalized language +//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled. Language code is found on url. +if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); +//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Not disabled because need to do translations +if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK',1); +if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL',1); +if (! defined('NOLOGIN')) define('NOLOGIN',1); // File must be accessed by logon page so without login +//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU',1); // We need top menu content +if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML',1); +if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); + +// Load Dolibarr environment +$res=0; +// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) +if (! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res=@include($_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"); +// Try main.inc.php into web root detected using web root caluclated from SCRIPT_FILENAME +$tmp=empty($_SERVER['SCRIPT_FILENAME'])?'':$_SERVER['SCRIPT_FILENAME'];$tmp2=realpath(__FILE__); $i=strlen($tmp)-1; $j=strlen($tmp2)-1; +while($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i]==$tmp2[$j]) { $i--; $j--; } +if (! $res && $i > 0 && file_exists(substr($tmp, 0, ($i+1))."/main.inc.php")) $res=@include(substr($tmp, 0, ($i+1))."/main.inc.php"); +if (! $res && $i > 0 && file_exists(substr($tmp, 0, ($i+1))."/../main.inc.php")) $res=@include(substr($tmp, 0, ($i+1))."/../main.inc.php"); +// Try main.inc.php using relative path +if (! $res && file_exists("../../main.inc.php")) $res=@include("../../main.inc.php"); +if (! $res && file_exists("../../../main.inc.php")) $res=@include("../../../main.inc.php"); +if (! $res) die("Include of main fails"); + +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; + +session_cache_limiter(false); + +// Load user to have $user->conf loaded (not done by default here because of NOLOGIN constant defined) and load permission if we need to use them in CSS +/*if (empty($user->id) && ! empty($_SESSION['dol_login'])) +{ + $user->fetch('',$_SESSION['dol_login']); + $user->getrights(); +}*/ + + +// Define css type +header('Content-type: text/css'); +// Important: Following code is to cache this file to avoid page request by browser at each Dolibarr page access. +// You can use CTRL+F5 to refresh your browser cache. +if (empty($dolibarr_nocache)) header('Cache-Control: max-age=3600, public, must-revalidate'); +else header('Cache-Control: no-cache'); + +?> + +.myclasscss { + /* ... */ +} + + diff --git a/htdocs/datapolicies/img/datapolicies.png b/htdocs/datapolicies/img/datapolicies.png new file mode 100644 index 0000000000000000000000000000000000000000..2681ccc1d3a7d33593e8502daa447b8c816ddb08 GIT binary patch literal 683 zcmV;c0#yBpP)&bpol<(u!rW?;H+EQ%enXNbFO(BxM6em zT6?Xvzwg`ooU^Y){|U(ZFQBI!m!$&}L7j!5{;fYTRT7^Ei2`otSo}~$jn`>$_0GV8{|=a0ceV}S zT##S2)dC>kW)OEac4ad=0PF{D)D5n&1&hE|5*Fn>+!87O7%&6uq>(Lac(63vU3r8dAUkz5(vJ*$kYi!M+3>2Chh&smne_ z0k^l4oC%S=;mTvomp7S=zUfMq-Pa*-4U* z(fYvM9@LwZ^Z;0LC%nYcD^%FWV(tM!t@kx*iR5*SB+L^EYlZ(WSOrixfZrRuvN}?F RO?LnQ002ovPDHLkV1iP-B{u*7 literal 0 HcmV?d00001 diff --git a/htdocs/datapolicies/img/gfdl.png b/htdocs/datapolicies/img/gfdl.png new file mode 100644 index 0000000000000000000000000000000000000000..f2bacfd179a99f051654eaa6ba30089dd8691d7a GIT binary patch literal 4709 zcmV-r5}NIaP)00004b3#c}2nYxW zd%dU$Ce+szoV9OJ5UN#164pJ za0WO590CqYl2p=>Ff$P7r^@&6|A`4W3~T|`N|IF5`l0|F2QD6e^`*?6HSvE?zuzWy zyMy#Y+3fr|ot#{w$8|vvh>MLRF(HQFAT4@*Ao`#{g7ksTbDaj8&CYi}{6cX_1=ZDc z)YjEgS$PJ#-O--t24Fq#t|UnZ!Knn_0@G$(KZf-mukiof_TYiBsGJ!$KgNmd)2_I% zupp*S8%=UjB1uCNNE#A{R;xjhB#KKaFq<0@MLTx81H0YsJa;&-+Z{wk7>JLH0>Er; z;H!;4^RM+=*|RqjNs<^kIF5*jFm~)Z&{jb{0u~CuTR_UtA@QW`S$zQ?#cvabLt^BW z3&}d+RDe+<2eatz8QgTkIC63eIdnLOoLnP$`9;oSUJ;E=mUhe3^iorh^99<#UT*QJ z`!Y#+=ygtHpJvG5I6nBtpV+u*45;IFTL%GwW}e%XH%;1QP+nClxUFRvjyJoth{N~xTIhDEdo^gc(H37_?HGxG7Zy-4-fzq-nKHso|^h4QX9?2s+rw~!J zcdBeb5YXu~gaqpd3DFTB7sY_Y7_Ph`i7}&-*|a5<_dnRgp1m2Zv)Ke70H?<&tXcgy zbIzfKV6oW9$t~pA@sqCK>B2G$20f7xVMIiPGIVep)23dDPN(t6Z?13T+s&z{RLbU` z0<}tsAPCs)4n(^hi^WD$lNF1_iq$F-7#M&~r{R+1M4}?Y`1G?MQK^)u)k@SV6)Kei zheN_9ir8!-qG-ovvm=Tkf*{bpe*^;)`w|kO>(o8|`}6H6l?v2qB>`#`N~Hp;Rm5Vo zVzJl&xcSC$9hTEt31l(>hvTgIPfUm=IVq9kqy(pPI5eImB&kUdgd!lO zpo@NiBuT7UyO}4SSxsGCLx<_rY9*7e8O7Y$lel5}7*~8%RV|B_ywXwA#w#!Wc@Yn$ z%;w$)UUM^}oyA}XVqjtn6UJXg%92~WDk;D{_r2V1{S1bnPANfa4y3K&ll9y9=eqAH zGgXnBS43`J5nq12%aul})esV_MW@rC*9AI{dJS5w22r$ASJyyoU48Sh0drjgl~rf3 zTD?CDwOZ*?+7<*!k`M%87clnrTd!sHyN`D226FR?c;LamvOCpjT4XYTDc4@XsLKa) z`G`Tp#Pr5!G;u8JB%gn=qs0jUAV966vUH1Ec@BrfR~vt3@sd~Eyx{=@`Vt)#My~)h z0Rbv%>l&!2sNv|b0z}cy>USUI_FJz7V8_mbELi*!CR4R5|G2TknL7CjR4N5|c|~OB z6q21&NTIRJ?OzBG8mi}CYoBK9Rl_{)x4gWDox9Wd(-W&&d)CDEkKm=}?`8Dwk}w#8 zI(%-eEkR}J76Q~NY&Mbax2BQypJQZX=8<_M&+Q)06`4#RAwHVqqy)mkg86#m&y<;} z35gtyrM{Sk+5!NJqB(sYFt)QTgiV`Mx$Ev1T`xE)cD@7dov5olb*Jt05#r$Dl#63>h3pLwys^zOaV(KKKTQL&6Xfjh3^@Ipr=D5Ot{+!= z%@-W3bqj}tbWUDZ>C-!uYbJ(r&BT#i&fCyv;k)mD;cstz$`9Mpuv$gbns6c#XAu-W z8~{O(wImnZl%S-vk|v9l0JX}efECZJaWhqqKYB-p3eZAKbU1x_htR)YgwHg=!JTu| zf`YVYwHl8mZD=PQy%y%onn-lEn`k+A9HN8F%l~PG@Nd?9t6Go$nLZb}wX#c9TyW?0 zTsmxEm-2KsDwTo}xRPQy#j-^*S1yof>-L}cPj>|!Gh zu@Sr2(CXKSU2H^h*ifoNPzHpe3J66RU~nCk>JYaV>E3QbA**g@pL%^De7}acx=zk|a@RG?AF#KN;;Y`<4m3 zzh)Du`!Ycg2k}oBQo<{`P7La=DDs+zmMFP2DO>ke#&zo=V`u66EF@-980!xyyAb5%8Br+Y z9VhGpp`m&Y(|_{Rg;j!~L*iMqa0WI@4Q2V8x>=g1PXNtIknh71WVIUm28fI>`29tA zBe-?W zHT>h9KN1;XaJzQHjH?LL1az(D&4h;PJ<2;@T8|70g1{4x&G&2h=Yqiy#ERv2;jr5% z&i>S|WqT+A&Hey5&Au;|J$##6UwQhW?6y;td@zOd-0A~kKd*Arvqy%oib+TLB z%6B*TuVP-1EcHRj1 zumpW$dUx0Xv|{-JH#7e2mc6W6{k7jJ*LId{eVeeqS@+2gtbT8!E4=LCTm9A@ZZcJ4 zGFAJWvepr1a|1Weev*oc8X^;Cq7S>oFZBXI@Ekixfc8HHEkyJQ<>{yHa)l*HV%cLW z`OB;8{8G1?n!0ww9nsN3jTWk^YPoIx3Krl0sw>ZfDYHBD1)3T=S3W>SrgLysuj~3! zPlrQd{(=`co^_It$kBxNpWJb#F5oeWNV5{e`)D4v<$?QVk`N!w;`?8vvbl%xxfj=R zFg=^=rd+|evBQarjiji!oYZ}p?A@E$slk}66Q?j1xqHF;e?3lJT|=k;O<7r|+`>Qa zIYdaX4xL`Z$&)3V$Sx#1=QLSar>Jjm4$|oLfvi}*fW>#;&|&$Xt5tN( zkZx?Uay;uKM~)Vdo9A3(crKRU@u&XI58KiR3?4|##q+wHzazZOCvbKY_3wN?_0-8% zus`)Z7A}5?ox9Qj*!e*Gf&`KNb$wkYg&2TLD)+rtU_ar>|QxcyhJc?^aiX3reYW6S1s zxah{=ka&36Tds+FS%U9UF=MV?evpJNJL;9f{@(YSFn;VFU4ksqMH~sqdVanuDOuv4N*A5u9 zO39=NBb+O2RL)g4a=FYozh1N>+MILk<#OMXC9F0ZGMS7A?wg51DMzJLy2`NHM8xK` z2RfaG$jC4TCdM#s?C?$xg0;y1!~M6o)<*zXtu|NrR;%c$M}S&|IzUB$TIqFStuJ=& zO6Q?vZ=z84A~rb%xl-G4rgNaRB@lpNKsrF`&Q%P%WI(qF?ZJt+Dd#QZ=lSh4Zwkyu11U**Z!Xw&5P^)DBDsa~Oac(|+vsCW68*B``Pvg{tFKP3<8$Y*-phn5(leR~@6iCL6oxK6TBd1il82 zdhjp0RxO1>qlrNm$MXEMi{)qMWt4gglYy^Q(urnp_V+a2uPm&tcq(?~y*O-5#3mpjZ_ z2o2Q}+dqQX{*hchaxjx7T*jb_W3gIA=FWSDAGW0doD^_wdlqtDch(|WraUuzr+ zjV6vAFQB%r0ZWsWCX2OsnZ9$mev`$DDB6jN3~PSr&KKXdld7n=oDV)9GUg1KF z()HkpAP7p}W?%_0*2{I`Vk5cuqW%O2YtQaYpwpn!2cpyVLKN-P)-|~8QBYUcK$)qU zBS-UHUHWbC+`_I$3I6v8f-nTQ8@LikqLqd46YXzi*`oyiUkJ|Oy#Y9Ta);rZ1+H)Y n1+_VfIJdB^ZFB6>wzmHTwMhFML%JGy00000NkvXXu0mjfK;ap? literal 0 HcmV?d00001 diff --git a/htdocs/datapolicies/img/gplv3.png b/htdocs/datapolicies/img/gplv3.png new file mode 100644 index 0000000000000000000000000000000000000000..ba78d4c4941dabf2fcac5409a92ac4c57920c69f GIT binary patch literal 2666 zcmV-w3YGPVP)Px#32;bRa{vGVivR!tivi)#(!2lw00(qQO+^RT0uvMpF24YJ`L;(K) z{{a7>y{D4^014_zL_t(&-tC%skW|$b#(x5`77PlZ01Xf|tXfvU1+9P)Nl;9MMIeIW zf~A;|yxWx-F&@d<9Z!mSGK`{-NXD*+V< z1U?qnFHjo71r>243NtglEQV7Q5|M$wwPW#3mU1Xa75(4)}+D^1dj!r-wg;N!7wPTlz6cv~* zaG8PJ%ocdxi%_r(8VF2J2gJd((|x~-stE3f0*?zktgtfz_z{7D0<}|XS^^CmbayaJ zV6ea`S+E+%|4L05^x|!{8+(dT?jEM~Js`$27+y6h2%>GgYF0wJYE0l-O z)7o925Tv&W;2eAZgu;B5;j^dJ8-bz3oKpjkZt1g)zX^66mI| z)j_Xp5wNzxdh2k6HU6=}>lr5fjzC|47oe%aZiQ_MKeNs1Wz;5au`^ddqYxT8_`O0| z2+eKGVG3K)+k_Uu1%|7S@cDv!RA5U0Jp{%pe3tfppM%?rytQ5}8P;njwoMwi^#raG z_|!q~0P19O58V`YC~Ow^rGefh%fweYXuAOFEA&%1pirdH-T=NSi#0u9by^9`QxJv5 zHjl?NEpVEPINjb~s%aLOrIZQ$Er2cpYhwES(!o;>ZWd4fj>h!yt-vP^&Rzf~rSJ-% zg@aKFTLZW-2{m&$=#dIvD=Zf1XvcR*1&`sq0ThV$zmI09^NGMv1M6&ojS7EJsBiOF z8n;M=9{?nvrNFcK_*#Yg1^TDhK}Ke?#C57YX(PO#~hmZ&YIfXpm0?Of77b zcz4lUy){(?;9j;d=Zg=NarIQ8n^{2*frBCRE`gImI7i`?I3Q90+X5fTF_*Oh*9+WO z1x|lZpeTTXIJ}Zj$9dYg#Asf_jNm>ECo6nxzAm326$kDY0%zN14N};eq2A;GS}N34 z_?^POB%Ep+b3>f}wIrZv1mNKjYL#A=I=IZiomF5OUkN;%%t28n`n7hnwKmOUxi!^C z?!7sJ)RYjqCgH3A+6T}!^hf+gd!G=mbKa5;2^2Z#5Q*l| zfdhdl0@EDyF+dtC++#s#w6j4H&?112wh__NE(zy`FhF3r<@t|C0A7{B|L)KTzz$ld zr)$xAGn~&v$ExqQqQD+9qd48hXc$805H1yOr8Q%W^E8V!qcoEr7HA|sO)M9(j7va) zLPO)u<>K8*eH(mXo|E4b6{n4!WlMoas%ZhvALqY1(?UYejX$qum2H*6CFz(2o?R^x zDEv(hmVvj&jg=p^uDHvkZKlwQXnG#Q_KXL#Ubbsr9Nn7x7-IFOx}g0W@Fj z20>x8!ootY1Jtn~{dF~g`?~m)`Q!|iyHa6%kmfQnQM3*U9~p3ePDSc@Q2%*2Wf?S% zmJ%okp_W5IHRG)GOwilcdW(Gu*4g{T~>dyLTd*<7nqH5>P4bO#m15lF^bQk0@fXG4I;>Zi8G4~)h=aS0UnUjaR`^J~?z=+$ zHTWKdViR&!n`TiY-;I@$Nas4sHq*3$R%RqSBP!U};>Y>BK#9N@@vNzKHf)UY&9JQQ zCMxp?bTg|ev(NnmCWO%6!B~MAp&w|lz>EMc4xx`RjCHn%FPzVQekwkb8YeK{!Gi*~ zsNb|P0)6c!`IJklP`iK9vb6vc-7RoHJ0Nq5dRwk5m+UDA)gAo?O?LN0*eFN#QW*D#LIwjzkygL(4{)S zRcNGevoWb@0%ujrt~sxh79Qi@G*o92@TaP*zZ6=F7pc}Mlq8{3Nv<1-3c80vD-#)#iR!fAg3`3i=|n0Ep+VCB*yVN$x?2_YiZ5k$@3&Tcz#W!=Gm9%=?NxpL Y19h*OP%`Tk_W%F@07*qoM6N<$g8#_jNdN!< literal 0 HcmV?d00001 diff --git a/htdocs/datapolicies/img/object_datapolicies.png b/htdocs/datapolicies/img/object_datapolicies.png new file mode 100644 index 0000000000000000000000000000000000000000..5d65c309ccaef535bcf8619b40a45b6b4489206b GIT binary patch literal 2226 zcmV;j2u=5iP)FGsdji+S+^W zb8#@fESWDHOB)8bln7|<4NuMb!uAOXWHK4}d_JVp>85l#{k9MSE|&{bQ9ua+r4*D9 zNCH3tnM~%BnKNg8bFzaR?Y}8UO#=naVc0hMk|}s47P9dZbzO(o>qU5A;8-|3u*|Kw zOACq$6=rVu+1dsqY=Mc9&wr#^SO<0x%Zrk`*ON-}T1p4yqswE{1nSqG zQZGp`@cHMMK4XTrt*vcnbad41_xn*^UIv#-17i%7(mS*lLV$A)&NXMD_};2V82}9Q_hUwFEkdDC&(P4276=52;gzKgxNVPx+mS*_ za3L_7A4Mb*-7p^T@{s=hST5J#Vf5oAGirA>E}XaNySx4pl7;kB(w33GZ~XC_0L&8W zP$=})<;#~}4h8}UR#d>}^TFfsILSBe^ngSvm4>eCgW+)a`G$suLjW)|nn!h+2j`;k zKgDy|2E*ns1;^<1zIi`d`K?P6MTVXXokTbip3&Re`?8`ap!8Ozqo}2L&tqj{*|$cOJVt$P80HDLq*AQp|T;X=SN&63uHkWwT7MzVnp->7+DGIUSBkwmhtO1}CN+HK?&OHXzb$uFfJRgE{$6Sh1NFi|X z!o`F2_4N}j-rI5Q>Lq;y3L#*shVbc*H{Ne-cou*TLhcI=0JLBj0h@DJmJJ~#2yw{B zqU|PA$?X39`zKud`|m7G4xH{>kckfMKJuI96|HalVlx1HFdhe_ykl-#Tie7En1-Qn z&OxaS+p-|I02hwKS*D3#FgRxglxo|R9!f8IJ)BRLdRZVMcX}KX4#SH*QjvN613=a+0Z4pu;9zL)-aSjl6Hu<-xPji@-u|gmr#@9vQ&YNf zibA2PE@+wtg)u0Uf)E0Q(o!o%6$*th+$z!lCB%sY;M5aJ5Rb>v+}ymh?%}$0BAK|8 z002Dt$Rjv@;>4c1y1Gq1pU>qGaP%K*Kv8N&DVVB&G1d7FfE4FYLZL7Ps;a`Js!$jM zq{Q1hcQ(div7_U`OV#k|wQKldT^;}9d+*JPM5Chsq+y!K=5om8axhI3w0L?Dz_M&u zmQ{342UvA!C@U|6*Xu=jSsBX8%g4Z9J9qBfyZ5@j%GgUHk-+TPvkM0f9Qd8r>;2)B z>gpi3IjEw5F$O}2)0j%>6duR3A*C!viiCr|F0%s-UzE&0@` zQ;oA{&u&kpQfeUJU*`AwA*Fz#Fla6pR8<9I%mHN#OktpufDj5#nFk{y34HLuUk`2G zym?+Y9PYZGdn)5UWV2ZSKr9wJ+|kjooiU|6lgTcrs;n$UK?>p28Yzop7&<#U(AL)W zkH&S4FSNI}Z=F4Rwx#R(fA-(7qM`zcM56d!`SnGM7A&u>u3lXAP<5?a(^Ss+NFtd$ zf8qT3!=0U-9|JH~*4N{o_o$x#wGphW#Q*L1H|^kOr1ghIrT_o{07*qoM6N<$f-8_9 An*aa+ literal 0 HcmV?d00001 diff --git a/htdocs/datapolicies/img/object_inoveaconseil.png b/htdocs/datapolicies/img/object_inoveaconseil.png new file mode 100644 index 0000000000000000000000000000000000000000..292a9c75ef2efec13eda20eee1c7c2666785ab2a GIT binary patch literal 764 zcmV-^~1-S!dmL4a99(KL`@K1-6%nR8lYIp_6s!poi!K2`q?C9r{2I zb`m;v2!x1mgAP$rx=7_zj^ygDn;*-ryXv^>XFK!X|BUVj_{aswhfRg~tQN7%a<5Q%a}v#>P-{d)tqX$z=ar zE`K+jU1`1F*>Ms8NGuks5P)k{RaMyE--lrs(<_%@vZ&RiEw;Ayu6ujUr1-3 zrgVMkpc=7lyNX&?{SmJhj^kib)9&5w>x%=xlkv#lwq>VY}+S?k$Z&H5t!4~*G!XKyja^v1@<2mnZ-P{_qO@0Dd4ZnqnLzrPR; zhu;Cf&kyg-iQ(shJ{NmwQF?=O-YozxbY0I8$8iivlClNU3>1q+1OkEH(b3VgzuN!S zqSmp*a`KL8nys934nUA3DF`4g)z{TIvMiSqLRwT+g~#KO2qEWf+wLrtN>`|5ouZV2 z*|xB>w6xSeFwh5pOEb|Zmt}dz=k=YIh?CtLE%tWIt znx^FdKmveNDn%!?$>Exs+8VdpT`SA7SVo8-2!bPs;$A+N`!pVjbPNp*E&TJVp-`xy ut*xyo7!3LqMgFzCxcv3u<3|&RbH4!rJ4K(QHqWR40000. + * + * Library javascript to enable Browser notifications + */ + +if (!defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1'); +if (!defined('NOREQUIREDB')) define('NOREQUIREDB','1'); +if (!defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); +if (!defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); +if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', 1); +if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', 1); +if (!defined('NOLOGIN')) define('NOLOGIN', 1); +if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', 1); +if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', 1); +if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); + + +/** + * \file datapolicies/js/datapolicies.js.php + * \ingroup datapolicies + * \brief JavaScript file for module datapolicies. + */ + +// Load Dolibarr environment +$res=0; +// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) +if (! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res=@include($_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"); +// Try main.inc.php into web root detected using web root caluclated from SCRIPT_FILENAME +$tmp=empty($_SERVER['SCRIPT_FILENAME'])?'':$_SERVER['SCRIPT_FILENAME'];$tmp2=realpath(__FILE__); $i=strlen($tmp)-1; $j=strlen($tmp2)-1; +while($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i]==$tmp2[$j]) { $i--; $j--; } +if (! $res && $i > 0 && file_exists(substr($tmp, 0, ($i+1))."/main.inc.php")) $res=@include(substr($tmp, 0, ($i+1))."/main.inc.php"); +if (! $res && $i > 0 && file_exists(substr($tmp, 0, ($i+1))."/../main.inc.php")) $res=@include(substr($tmp, 0, ($i+1))."/../main.inc.php"); +// Try main.inc.php using relative path +if (! $res && file_exists("../../main.inc.php")) $res=@include("../../main.inc.php"); +if (! $res && file_exists("../../../main.inc.php")) $res=@include("../../../main.inc.php"); +if (! $res) die("Include of main fails"); + +// Define js type +header('Content-Type: application/javascript'); +// Important: Following code is to cache this file to avoid page request by browser at each Dolibarr page access. +// You can use CTRL+F5 to refresh your browser cache. +if (empty($dolibarr_nocache)) header('Cache-Control: max-age=3600, public, must-revalidate'); +else header('Cache-Control: no-cache'); +?> + diff --git a/htdocs/datapolicies/langs/en_US/datapolicies.lang b/htdocs/datapolicies/langs/en_US/datapolicies.lang new file mode 100644 index 00000000000..0afff450b38 --- /dev/null +++ b/htdocs/datapolicies/langs/en_US/datapolicies.lang @@ -0,0 +1,92 @@ +# Copyright (C) 2018 SuperAdmin +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# Module label 'ModulergpdName' +ModulergpdName = GDPR +# Module description 'ModulergpdDesc' +ModulergpdDesc = Conformity with the GDPR + +# +# Page d'administration +# +rgpdSetup = Module Setup +Settings_DATAPOLICIES = Settings of DATAPOLICIES module +rgpdSetupPage = According to Article 5 of the GDPR, personal data must be kept for a period not exceeding that necessary for the purposes for which they were processed, except for archival purposes. +The deletion will be done automatically after a certain duration without event (the duration which you will have indicated below). +NB_MONTHS = %s months +ONE_YEAR = 1 year +NB_YEARS = %s years +DATAPOLICIES_TIERS_CLIENT = Customer +DATAPOLICIES_TIERS_PROSPECT = Prospect +DATAPOLICIES_TIERS_PROSPECT_CLIENT = Prospect/Customer +DATAPOLICIES_TIERS_NIPROSPECT_NICLIENT = Nor prospect/Nor customer +DATAPOLICIES_TIERS_FOURNISSEUR = Supplier +DATAPOLICIES_CONTACT_CLIENT = Customer +DATAPOLICIES_CONTACT_PROSPECT = Prospect +DATAPOLICIES_CONTACT_PROSPECT_CLIENT = Prospect/Customer +DATAPOLICIES_CONTACT_NIPROSPECT_NICLIENT = Nor prospect/Nor customer +DATAPOLICIES_CONTACT_FOURNISSEUR = Supplier +DATAPOLICIES_ADHERENT = Member +DATAPOLICIES_Tooltip_SETUP = Type of contact - Indicate your choices for each type. +DATAPOLICIESMail=Emails Setup +DATAPOLICIESSUBJECTMAIL=Subject of email +DATAPOLICIESCONTENTMAIL=Content of the email +DATAPOLICIESSUBSITUTION=You can use the following variables in your email (LINKACCEPT allows to create a link recording the agreement of the person, LINKREFUSED makes it possible to record the refusal of the person): +DATAPOLICIESACCEPT=Message after agreement +DATAPOLICIESREFUSE=Message after desagreement +SendAgreementText=You can send a GDPR email to all your relevant contacts (who have not yet received an email and for which you have not registered anything about their GDPR agreement). To do this, use the following button. +SendAgreement=Send emails +AllAgreementSend = All emails have been sent +TXTLINKDATAPOLICIESACCEPT= Text for the link "agreement" +TXTLINKDATAPOLICIESREFUSE= Text for the link "desagreement" + + +# +# Extrafield +# +DATAPOLICIES_BLOCKCHECKBOX = GDPR : Processing of personal data +DATAPOLICIES_consentement = Consent obtained for the processing of personal data +DATAPOLICIES_opposition_traitement = Opposes the processing of his personal data +DATAPOLICIES_opposition_prospection = Opposes the processing of his personal data for the purposes of prospecting + +# +# Popup +# +DATAPOLICIES_POPUP_ANONYME_TITLE = Anonymize a thirdparty +DATAPOLICIES_POPUP_ANONYME_TEXTE = You can not delete this contact from Dolibarr because there are related items. In accordance with the GDPR, you will make all this data anonymous to respect your obligations. Would you like to continue ? + +# +# Bouton portabilité +# +DATAPOLICIES_PORTABILITE = Portability GDPR +DATAPOLICIES_PORTABILITE_TITLE = Export of personal data +DATAPOLICIES_PORTABILITE_CONFIRMATION = You want to export the personal data of this contact. Are you sure ? + +# +# Note ajoutés lors d'une anonymisation +# +ANONYMISER_AT = Anonymised the %s + +#V2 +DATAPOLICIESReturn=GDPR Validation +DATAPOLICIES_date = Date of agreement/desagreement GDPR +DATAPOLICIES_send = Date sending agreement email +DATAPOLICIESReturn = GDPR Return +DATAPOLICIES_SEND = Send GDPR email +MailSent = Email has been sent + +#ERROR +ErrorSubjectIsRequired= Error : The subject of email is required. Indicate it in the module setup +=Due to a technical problem, we were unable to register your choice. We apologize for that. Contact us to send us your choice. diff --git a/htdocs/datapolicies/langs/fr_FR/datapolicies.lang b/htdocs/datapolicies/langs/fr_FR/datapolicies.lang new file mode 100644 index 00000000000..ba024fbb2fb --- /dev/null +++ b/htdocs/datapolicies/langs/fr_FR/datapolicies.lang @@ -0,0 +1,96 @@ +# Copyright (C) 2018 INOVEA CONSEIl info@inovea-conseil.com +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# +# Générique +# + +# Module label 'ModulergpdName' +ModulergpdName = DATAPOLICIES +# Module description 'ModulergpdDesc' +Module432452Desc = Module de mise en conformité avec le DATAPOLICIES + +# +# Page d'administration +# +rgpdSetup = Configuration du module DATAPOLICIES +Settings_DATAPOLICIES = Paramétrage du module DATAPOLICIES +rgpdSetupPage = Selon l’article 5 du DATAPOLICIES, les données à caractère personnel doivent être conservées pendant une durée n’excédant pas celle nécessaire au regard des finalités pour lesquelles elles ont été traitées, à l’exception de fins archivistiques. La suppression se fera automatiquement après une certaine durée sans évènement (la durée que vous aurez indiquée ci-dessous). +NB_MONTHS = %s mois +ONE_YEAR = 1 an +NB_YEARS = %s ans +DATAPOLICIES_TIERS_CLIENT = Client +DATAPOLICIES_TIERS_PROSPECT = Prospect +DATAPOLICIES_TIERS_PROSPECT_CLIENT = Prospect/Client +DATAPOLICIES_TIERS_NIPROSPECT_NICLIENT = Ni prospect / Ni client +DATAPOLICIES_TIERS_FOURNISSEUR = Fournisseur +DATAPOLICIES_CONTACT_CLIENT = Client +DATAPOLICIES_CONTACT_PROSPECT = Prospect +DATAPOLICIES_CONTACT_PROSPECT_CLIENT = Prospect/Client +DATAPOLICIES_CONTACT_NIPROSPECT_NICLIENT = Ni prospect / Ni client +DATAPOLICIES_CONTACT_FOURNISSEUR = Fournisseur +DATAPOLICIES_ADHERENT = Adhérent +DATAPOLICIES_Tooltip_SETUP = Type du contact - Indiquez vos choix pour chaque type. +DATAPOLICIESMail=Paramétrage des emails +DATAPOLICIESSUBJECTMAIL=Objet du mail +DATAPOLICIESCONTENTMAIL=Contenu du mail +DATAPOLICIESSUBSITUTION=Vous pouvez utiliser les variables suivantes dans votre email (LINKACCEPT permet de créer un lien enregistrant l'acceptation de la personne, LINKREFUSED permet d'enregistrer le refus de la personne) : +DATAPOLICIESACCEPT=Message suite acceptation +DATAPOLICIESREFUSE=Message suite opposition +SendAgreementText=Vous pouvez envoyer un email DATAPOLICIES à tous vos contacts concernés (qui n'ont pas encore reçus de mail et pour lesquels vous n'avez rien enregistré concernant leur accord/désaccord DATAPOLICIES). Pour cela, utilisez le bouton suivant. +SendAgreement=Envoyer les emails +AllAgreementSend = Tous les e-mails de consentement ont été envoyés +TXTLINKDATAPOLICIESACCEPT= Texte du lien d'acceptation +TXTLINKDATAPOLICIESREFUSE= Texte du lien d'opposition + + + +# +# Extrafield +# +DATAPOLICIES_BLOCKCHECKBOX = DATAPOLICIES : Traitement des données à caractère personnel +DATAPOLICIES_consentement = Consentement recueilli pour le traitement des données à caractère personnel le concernant +DATAPOLICIES_opposition_traitement = S’oppose au traitement de ses données à caractère personnel +DATAPOLICIES_opposition_prospection = S’oppose au traitement de ses données à caractère personnel à des fins de prospection + +# +# Popup +# +DATAPOLICIES_POPUP_ANONYME_TITLE = Anonymiser un tiers +DATAPOLICIES_POPUP_ANONYME_TEXTE = Vous ne pouvez pas supprimer ce contact de Dolibarr car des éléments y sont liés. Conformément au DATAPOLICIES, vous allez rendre toutes ces données anonymes afin de respecter vos obligations. Souhaitez-vous continuer ? + +# +# Bouton portabilité +# +DATAPOLICIES_PORTABILITE = Portabilité DATAPOLICIES +DATAPOLICIES_PORTABILITE_TITLE = Export des données à caractère personnel +DATAPOLICIES_PORTABILITE_CONFIRMATION = Vous souhaitez exporter les données à caractère personnel de ce contact. Etes-vous sûr ? + +# +# Note ajoutés lors d'une anonymisation +# +ANONYMISER_AT = Anonymisé le %s + +#V2 +DATAPOLICIESReturn=Validation DATAPOLICIES +DATAPOLICIES_date=Date d'accord/opposition au traitement +DATAPOLICIES_send=Date envoi consentement +DATAPOLICIESReturn=Retour DATAPOLICIES +DATAPOLICIES_SEND=Envoyer l'email de consentement +MailSent=L'email a bien été envoyé + +#ERROR +ErrorSubjectIsRequired=Erreur : vous n'avez pas indiqué l'objet de l'email dans la configuration +=Suite à un problème technique, nous n'avons pas pu enregistrer votre choix. Nous nous en excusons. Contactez-nous pour nous transmettre votre choix. diff --git a/htdocs/datapolicies/langs/it_IT/datapolicies.lang b/htdocs/datapolicies/langs/it_IT/datapolicies.lang new file mode 100644 index 00000000000..a979c931c41 --- /dev/null +++ b/htdocs/datapolicies/langs/it_IT/datapolicies.lang @@ -0,0 +1,80 @@ +# Copyright (C) 2018 INOVEA CONSEIl info@inovea-conseil.com - Thanks to Claudio Aschieri +# +# # Module label 'ModulergpdName' +ModulergpdName = GDPR +# Module description 'ModulergpdDesc' +ModulergpdDesc = Conformità con GDPR +Module432452Name=GDPR +Module432452Desc=Conformità con GDPR (Regolamento Generale sulla protezione di dati) + +# +# Page d'administration +# +rgpdSetup = Module Setup +Settings_DATAPOLICIES = Configurazione modulo GDPR +rgpdSetupPage = In accordo con l'art 5 del GDPR i dati personali devono essere conservati per un periodo di tempo che .... ed eliminati se non sono più utili agli scopi per cui sono stati processati. +NB_MONTHS = %s mesi +ONE_YEAR = 1 anno +NB_YEARS = %s anni +DATAPOLICIES_TIERS_CLIENT = Cliente +DATAPOLICIES_TIERS_PROSPECT = Fornitore +DATAPOLICIES_TIERS_PROSPECT_CLIENT = Potenziale Cliente / Cliente +DATAPOLICIES_TIERS_NIPROSPECT_NICLIENT = Nè potenziale cliente / Nè cliente +DATAPOLICIES_TIERS_FOURNISSEUR = Fornitore +DATAPOLICIES_CONTACT_CLIENT = Cliente +DATAPOLICIES_CONTACT_PROSPECT = Potenziale cliente +DATAPOLICIES_CONTACT_PROSPECT_CLIENT = Potenziale Cliente / Cliente +DATAPOLICIES_CONTACT_NIPROSPECT_NICLIENT = Nè potenziale cliente / Nè cliente +DATAPOLICIES_CONTACT_FOURNISSEUR = Fornitore +DATAPOLICIES_ADHERENT = Membri +DATAPOLICIES_Tooltip_SETUP = Tipo di contatto - Indica la scelta per ogni tipologia +DATAPOLICIESMail=Configurazione Email +DATAPOLICIESSUBJECTMAIL=Subject dell'e-mail +DATAPOLICIESCONTENTMAIL=Contenuto dell'e-mail +DATAPOLICIESSUBSITUTION=Puoi utilizzare le seguenti variabili nella tua email (LINKACCEPT consente di creare un link per registrare l'accettazione della persona, LINKREFUSED consente di registrare il rifiuto della persona): +DATAPOLICIESACCEPT= Messaggio dopo il consenso +DATAPOLICIESREFUSE=Messaggio dopo il rifiuto +SendAgreementText=Puoi inviare un'email GDPR a tutti i tuoi contatti rilevanti (che non hanno ancora ricevuto un'e-mail e per i quali non hai registrato nulla sul loro accordo GDPR). Per fare ciò, utilizzare il seguente pulsante. +SendAgreement=Invia emails +AllAgreementSend = Tutte le email sono state inviate +TXTLINKDATAPOLICIESACCEPT= Testo per il link "Consenso" +TXTLINKDATAPOLICIESREFUSE= Testo per il link "Consenso negato" + +# +# Extrafield +# +DATAPOLICIES_BLOCKCHECKBOX = GDPR : Trattamento dei dati personali +DATAPOLICIES_consentement = Consenso ottenuto al Trattamento dei dati personali +DATAPOLICIES_opposition_traitement = Consenso negato al trattamento dei dati personali +DATAPOLICIES_opposition_prospection = Consenso negato al trattamento dei dati personali a fini commerciali + +# +# Popup +# +DATAPOLICIES_POPUP_ANONYME_TITLE = Anonimizza un soggetto terzo +DATAPOLICIES_POPUP_ANONYME_TEXTE = Impossibile eliminare questo contatto da Dolibarr perchè vi sono elementi collegati. In conformità con il GDPR, renderai tutti questi dati anonimi per rispettare i tuoi obblighi. Vuoi continuare? + + +# +# Bouton portabilité +# +DATAPOLICIES_PORTABILITE = Portabilità GDPR +DATAPOLICIES_PORTABILITE_TITLE = Esporta i dati personali +DATAPOLICIES_PORTABILITE_CONFIRMATION = Vuoi davvero esportare i dati personali di questo contatto? + +# +# Note ajoutée lors d'une anonymisation +# +ANONYMISER_AT = Anonimizzato il %s + +#V2 +DATAPOLICIESReturn=GDPR Validazione +DATAPOLICIES_date = Data di accordo / disaccordo GDPR +DATAPOLICIES_send = Data di invio del consenso (e-mail) +DATAPOLICIESReturn = GDPR ritorno +DATAPOLICIES_SEND = Inviare GDPR e-mail +MailSent=L'email è stata inviata + +#ERROR +ErrorSubjectIsRequired= Errore: L'oggetto della mail è obbligatorio. Inserisci l'oggetto nella configurazione del modulo. +=A causa di un problema tecnico, non siamo stati in grado di registrare la tua scelta. Ci scusiamo per questo. Contattaci per inviarci la tua scelta. diff --git a/htdocs/datapolicies/lib/datapolicies.lib.php b/htdocs/datapolicies/lib/datapolicies.lib.php new file mode 100644 index 00000000000..d02668d40fc --- /dev/null +++ b/htdocs/datapolicies/lib/datapolicies.lib.php @@ -0,0 +1,59 @@ +. + */ + +/** + * \file datapolicies/lib/datapolicies.lib.php + * \ingroup datapolicies + * \brief Library files with common functions for datapolicies + */ + +/** + * Prepare admin pages header + * + * @return array + */ +function datapoliciesAdminPrepareHead() +{ + global $langs, $conf; + + $langs->load("datapolicies@datapolicies"); + + $h = 0; + $head = array(); + + $head[$h][0] = dol_buildpath("/datapolicies/admin/setup.php", 1); + $head[$h][1] = $langs->trans("Settings_DATAPOLICIES"); + $head[$h][2] = 'settings'; + $h++; + + $head[$h][0] = dol_buildpath("/datapolicies/admin/setupmail.php", 1); + $head[$h][1] = $langs->trans("DATAPOLICIESMail"); + $head[$h][2] = 'settings'; + $h++; + + // Show more tabs from modules + // Entries must be declared in modules descriptor with line + //$this->tabs = array( + // 'entity:+tabname:Title:@datapolicies:/datapolicies/mypage.php?id=__ID__' + //); // to add new tab + //$this->tabs = array( + // 'entity:-tabname:Title:@datapolicies:/datapolicies/mypage.php?id=__ID__' + //); // to remove a tab + complete_head_from_modules($conf, $langs, $object, $head, $h, 'datapolicies'); + + return $head; +} diff --git a/htdocs/datapolicies/mailing.php b/htdocs/datapolicies/mailing.php new file mode 100644 index 00000000000..4621a270e76 --- /dev/null +++ b/htdocs/datapolicies/mailing.php @@ -0,0 +1,58 @@ + + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file datapolicies/mailing.php + * \ingroup datapolicies + * \brief datapolicies mailing page. + */ + +// Load Dolibarr environment +$res=0; +// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) +if (! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res=@include($_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"); +// Try main.inc.php into web root detected using web root caluclated from SCRIPT_FILENAME +$tmp=empty($_SERVER['SCRIPT_FILENAME'])?'':$_SERVER['SCRIPT_FILENAME'];$tmp2=realpath(__FILE__); $i=strlen($tmp)-1; $j=strlen($tmp2)-1; +while($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i]==$tmp2[$j]) { $i--; $j--; } +if (! $res && $i > 0 && file_exists(substr($tmp, 0, ($i+1))."/main.inc.php")) $res=@include(substr($tmp, 0, ($i+1))."/main.inc.php"); +if (! $res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i+1)))."/main.inc.php")) $res=@include(dirname(substr($tmp, 0, ($i+1)))."/main.inc.php"); +// Try main.inc.php using relative path +if (! $res && file_exists("../../main.inc.php")) $res=@include("../../main.inc.php"); +if (! $res && file_exists("../../../main.inc.php")) $res=@include("../../../main.inc.php"); +if (! $res) die("Include of main fails"); + +global $langs, $user, $db, $conf; + +dol_include_once('/contact/class/contact.class.php'); +dol_include_once('/datapolicies/class/datapolicies.class.php'); + +$idcontact = GETPOST('idc'); + +if(!empty($idcontact)){ + $contact = new Contact($db); + $contact->fetch($idcontact); + DataPolicies::sendMailDataPoliciesContact($contact); + + +}else{ + + $contacts = new DataPolicies($db); + $contacts->getAllContactNotInformed(); + $contacts->getAllCompaniesNotInformed(); + $contacts->getAllAdherentsNotInformed(); + echo $langs->trans('AllAgreementSend'); +} diff --git a/htdocs/datapolicies/modulebuilder.txt b/htdocs/datapolicies/modulebuilder.txt new file mode 100644 index 00000000000..24ea0d6eac5 --- /dev/null +++ b/htdocs/datapolicies/modulebuilder.txt @@ -0,0 +1,3 @@ +# DO NOT DELETE THIS FILE MANUALLY +# File to flag module built using official module template. +# When this file is present into a module directory, you can edit it with the module builder tool. Use ModuleBuilder if you want to delete module. \ No newline at end of file diff --git a/htdocs/datapolicies/public/index.php b/htdocs/datapolicies/public/index.php new file mode 100644 index 00000000000..8fb2ef09290 --- /dev/null +++ b/htdocs/datapolicies/public/index.php @@ -0,0 +1,169 @@ + + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file datapolicies/admin/setup.php + * \ingroup datapolicies + * \brief datapolicies setup page. + */ +if (!defined('NOLOGIN')) + define("NOLOGIN", 1); // This means this output page does not require to be logged. +if (!defined('NOCSRFCHECK')) + define('NOCSRFCHECK', '1'); // Do not check anti CSRF attack test +if (!defined('NOREQUIREMENU')) + define('NOREQUIREMENU', '1'); +// Load Dolibarr environment +$res = 0; +// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) +if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) + $res = @include($_SERVER["CONTEXT_DOCUMENT_ROOT"] . "/main.inc.php"); +// Try main.inc.php into web root detected using web root caluclated from SCRIPT_FILENAME +$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; +$tmp2 = realpath(__FILE__); +$i = strlen($tmp) - 1; +$j = strlen($tmp2) - 1; +while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { + $i--; + $j--; +} +if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1)) . "/main.inc.php")) + $res = @include(substr($tmp, 0, ($i + 1)) . "/main.inc.php"); +if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1))) . "/main.inc.php")) + $res = @include(dirname(substr($tmp, 0, ($i + 1))) . "/main.inc.php"); +// Try main.inc.php using relative path +if (!$res && file_exists("../../main.inc.php")) + $res = @include("../../main.inc.php"); +if (!$res && file_exists("../../../main.inc.php")) + $res = @include("../../../main.inc.php"); +if (!$res) + die("Include of main fails"); + +global $langs, $user, $db, $conf; + +dol_include_once('/contact/class/contact.class.php'); +dol_include_once('/societe/class/societe.class.php'); +dol_include_once('/adherents/class/adherent.class.php'); +dol_include_once('/user/class/user.class.php'); + +dol_include_once('/datapolicies/class/datapolicies.class.php'); + +$idc = GETPOST('c'); +$ids = GETPOST('s'); +$ida = GETPOST('a'); +$action = GETPOST('action'); +$lang = GETPOST('l'); +$code = GETPOST('key'); +$acc = "DATAPOLICIESACCEPT_" . $lang; +$ref = "DATAPOLICIESREFUSE_" . $lang; +$langs->load('datapolicies@datapolicies',0,0,$lang); + +if (empty($action) || (empty($idc) && empty($ids) && empty($ida))) { + return 0; +} elseif (!empty($idc)) { + $contact = new Contact($db); + $contact->fetch($idc); + $check = md5($contact->email); + if ($check != $code) { + $return = $langs->trans('ErrorEmailDATAPOLICIES'); + } elseif ($action == 1) { + $contact->array_options['options_datapolicies_consentement'] = 1; + $contact->array_options['options_datapolicies_opposition_traitement'] = 0; + $contact->array_options['options_datapolicies_opposition_prospection'] = 0; + $contact->array_options['options_datapolicies_date'] = date('Y-m-d', time()); + + $return = $conf->global->$acc; + } elseif ($action == 2) { + $contact->no_email = 1; + $contact->array_options['options_datapolicies_consentement'] = 0; + $contact->array_options['options_datapolicies_opposition_traitement'] = 1; + $contact->array_options['options_datapolicies_opposition_prospection'] = 1; + $contact->array_options['options_datapolicies_date'] = date('Y-m-d', time()); + + $return = $conf->global->$ref; + } + $contact->update($idc); +} elseif (!empty($ids)) { + $societe = new Societe($db); + $societe->fetch($ids); + $check = md5($societe->email); + if ($check != $code) { + $return = $langs->trans('ErrorEmailDATAPOLICIES'); + } elseif ($action == 1) { + $societe->array_options['options_datapolicies_consentement'] = 1; + $societe->array_options['options_datapolicies_opposition_traitement'] = 0; + $societe->array_options['options_datapolicies_opposition_prospection'] = 0; + $societe->array_options['options_datapolicies_date'] = date('Y-m-d', time()); + $return = $conf->global->$acc; + } elseif ($action == 2) { + $societe->array_options['options_datapolicies_consentement'] = 0; + $societe->array_options['options_datapolicies_opposition_traitement'] = 1; + $societe->array_options['options_datapolicies_opposition_prospection'] = 1; + $societe->array_options['options_datapolicies_date'] = date('Y-m-d', time()); + + $return = $conf->global->$ref; + } + $societe->update($ids); +} elseif (!empty($ida)) { + $adherent = new Adherent($db); + $adherent->fetch($ida); + $check = md5($adherent->email); + if ($check != $code) { + $return = $langs->trans('ErrorEmailDATAPOLICIES'); + } elseif ($action == 1) { + $adherent->array_options['options_datapolicies_consentement'] = 1; + $adherent->array_options['options_datapolicies_opposition_traitement'] = 0; + $adherent->array_options['options_datapolicies_opposition_prospection'] = 0; + //$adherent->array_options['options_datapolicies_date'] = date('Y-m-d', time()); + $return = $conf->global->$acc; + } elseif ($action == 2) { + $adherent->array_options['options_datapolicies_consentement'] = 0; + $adherent->array_options['options_datapolicies_opposition_traitement'] = 1; + $adherent->array_options['options_datapolicies_opposition_prospection'] = 1; + //$adherent->array_options['options_datapolicies_date'] = date('Y-m-d', time()); + + $return = $conf->global->$ref; + } + $newuser = new User($db); + $adherent->update($newuser); +} + +header("Content-type: text/html; charset=" . $conf->file->character_set_client); + +print ''; +print "\n"; +print "\n"; +print "\n"; +print '' . "\n"; +print '' . "\n"; +print '' . "\n"; +print "" . $langs->trans("DATAPOLICIESReturn") . "\n"; +print '' . "\n"; +print ''; + +print "\n"; +print '' . "\n"; +print '
'; +print $return . "
\n"; +print '
'; +print "\n"; +print "\n"; +$db->close(); +?> \ No newline at end of file