Skip to content

Commit

Permalink
Merge pull request #168 from PrestaShop/dev
Browse files Browse the repository at this point in the history
Release 1.4.1
  • Loading branch information
Progi1984 authored Apr 6, 2022
2 parents 27dbd1a + 606e6e7 commit 3266aee
Show file tree
Hide file tree
Showing 22 changed files with 191 additions and 402 deletions.
56 changes: 0 additions & 56 deletions classes/APIFAQClass.php

This file was deleted.

2 changes: 1 addition & 1 deletion config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<module>
<name>psgdpr</name>
<displayName><![CDATA[Official GDPR compliance]]></displayName>
<version><![CDATA[1.4.0]]></version>
<version><![CDATA[1.4.1]]></version>
<description><![CDATA[Make your store comply with the General Data Protection Regulation (GDPR).]]></description>
<author><![CDATA[PrestaShop]]></author>
<tab><![CDATA[front_office_features]]></tab>
Expand Down
100 changes: 63 additions & 37 deletions psgdpr.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public function __construct()
// Settings
$this->name = 'psgdpr';
$this->tab = 'administration';
$this->version = '1.4.0';
$this->version = '1.4.1';
$this->author = 'PrestaShop';
$this->need_instance = 0;

Expand Down Expand Up @@ -314,18 +314,51 @@ public function loadAsset()
}

/**
* FAQ API
*/

/**
* @return bool
* @return array
*/
public function loadFaq()
{
$api = new APIFAQ();
$faq = $api->getData($this->module_key, $this->version);

return $faq;
return [
[
'title' => $this->trans('Data accessibility'),
'blocks' => [
[
'question' => $this->trans('How can a customer retrieve all of his personal data?'),
'answer' => $this->trans('From his customer account, a new tab called My Personal Data is available and your customer can retrieve all of his personal data collected by your shop and installed modules, in PDF or CSV format.'),
],
],
],
[
'title' => $this->trans('Customer consent'),
'blocks' => [
[
'question' => $this->trans('There is no consent confirmation checkbox in the contact form. Isn\'t this a requirement?'),
'answer' => $this->trans('No, it is not a requirement as the customer gives consent by clicking on the Submit message button. Only a message is required to give your customers more information about the use of personal data on your website. We are currently working on a new version of the contact form, it will be available really soon for your online store.'),
],
],
],
[
'title' => $this->trans('Data erasure'),
'blocks' => [
[
'question' => $this->trans('How will a customer ask for all of his personal data to be deleted ?'),
'answer' => $this->trans('The customer will send a message from the contact form for any rectification and erasure requests, justifying his request.'),
],
[
'question' => $this->trans('There is no Remove Data button in the customer account. Isn\'t this a requirement?'),
'answer' => $this->trans("No, the Remove Data button in the customer account is not an obligation. For the data erasure requests, your customers can request data removal only under certain circumstances, that is the reason why we decided not to include an automatic Remove Data button in their customer account.\n\nThey can, however, contact you anytime via your contact form, in this case, you can review their request and once you accept it, you will be able to remove their personal data directly in the configuration page of our Official GDPR Compliance module."),
],
[
'question' => $this->trans('How to remove the personal data of a customer?'),
'answer' => $this->trans("If the request is valid, from the Personal Data Management tab of this module, any customer can be found by typing the first few letters of his name or email address in the search bar.\nBefore deleting any data, we recommend you to download all the invoices of the involved customer. After deleting the data with the “Remove data” button, the customer’s orders can’t be legally deleted, they just won’t be linked to any account. This allows you to keep precise statistics of your shop."),
],
[
'question' => $this->trans('After removing all personal data of a customer from my database, what will happen to his orders?'),
'answer' => $this->trans("Due to other legal obligations, his orders will still be stocked but they are no longer associated with the customer.\nOnly the name, shipping, and billing information must be kept in the order details page for legal reasons, invoicing, and accounting.\nAccording to the Rec.30;Art.7(1)(c)"),
],
],
],
];
}

/**
Expand All @@ -344,7 +377,6 @@ public function getContent()
$id_lang = $this->context->language->id;
$id_shop = $this->context->shop->id;

$faq = $this->loadFaq(); // load faq from addons api
$this->loadAsset(); // load js and css
$this->postProcess(); // execute submit form

Expand Down Expand Up @@ -417,7 +449,7 @@ public function getContent()
'id_lang' => $id_lang,
'psgdpr_adminController' => $adminController,
'adminControllerInvoices' => $adminControllerInvoices,
'apifaq' => $faq,
'faq' => $this->loadFaq(),
'doc' => $doc,
'youtubeLink' => $youtubeLink,
'cmspage' => $CMS,
Expand Down Expand Up @@ -766,7 +798,7 @@ public function getCustomerDataFromPrestashop(Customer $customer)
$genderName = $gender->name;
unset($gender);

$customerInfo = [
$data['customerInfo'] = [
'id_customer' => $customer->id,
'gender' => $genderName,
'firstname' => $customer->firstname,
Expand All @@ -784,7 +816,7 @@ public function getCustomerDataFromPrestashop(Customer $customer)
];

// get orders
$orders = [];
$data['orders'] = [];
$orderList = Order::getCustomerOrders($customer->id);

if (count($orderList) >= 1) {
Expand All @@ -793,7 +825,7 @@ public function getCustomerDataFromPrestashop(Customer $customer)
$productsOrder = $orderObject->getProducts();
$currency = Currency::getCurrency($order['id_currency']);

array_push($orders, [
$data['orders'][] = [
'id_order' => $order['id_order'],
'reference' => $order['reference'],
'payment' => $order['payment'],
Expand All @@ -803,80 +835,74 @@ public function getCustomerDataFromPrestashop(Customer $customer)
'total_paid_tax_incl' => number_format($order['total_paid_tax_incl'], 2) . ' ' . $currency['iso_code'],
'nb_products' => $order['nb_products'],
'products' => [],
]);
];
foreach ($productsOrder as $product) {
array_push($orders[$index]['products'], [
$data['orders'][$index]['products'][] = [
'id_product' => $product['product_id'],
'id_product_attribute' => $product['product_attribute_id'],
'product_reference' => $product['product_reference'],
'product_name' => $product['product_name'],
'product_quantity' => $product['product_quantity'],
]);
];
}
unset($orderObject);
}
}

// get carts
$carts = [];
$data['carts'] = [];
$cartList = Cart::getCustomerCarts($customer->id, false);

if (count($cartList) >= 1) {
foreach ($cartList as $index => $cart) {
$cartObject = new Cart($cart['id_cart']);
$productsCart = $cartObject->getProducts();

array_push($carts, [
$data['carts'][] = [
'id_cart' => $cart['id_cart'],
'nb_products' => count($productsCart),
'products' => [],
'date_add' => $cart['date_add'],
]);
];
foreach ($productsCart as $product) {
array_push($carts[$index]['products'], [
$data['carts'][$index]['products'][] = [
'id_product' => $product['id_product'],
'id_product_attribute' => $product['id_product_attribute'],
'product_reference' => $product['reference'],
'product_name' => $product['name'],
'product_quantity' => $product['cart_quantity'],
'total_wt' => $product['total_wt'],
]);
];
}
unset($cartObject);
}
}

// get addresses
$addresses = $customer->getAddresses($id_lang);
$data['addresses'] = $customer->getAddresses($id_lang);

// get messages
$messages = [];
$data['messages'] = [];
$messageList = CustomerThread::getCustomerMessages($customer->id);

if (count($messageList) >= 1) {
foreach ($messageList as $index => $message) {
array_push($messages, [
$data['messages'][] = [
'id_customer_thread' => $message['id_customer_thread'],
'message' => $message['message'],
'ip' => (int) $message['ip_address'] == $message['ip_address'] ? long2ip((int) $message['ip_address']) : $message['ip_address'],
'date_add' => $message['date_add'],
]);
];
}
}

// get connections
$connections = $customer->getLastConnections();
$data['connections'] = $customer->getLastConnections();

// get referrers
$referrer = Referrer::getReferrers($customer->id);

$data['customerInfo'] = $customerInfo;
$data['orders'] = $orders;
$data['carts'] = $carts;
$data['addresses'] = $addresses;
$data['messages'] = $messages;
$data['connections'] = $connections;
$data['referrer'] = $referrer;
if (version_compare(_PS_VERSION_, '8.0.0', '<')) {
$data['referrer'] = Referrer::getReferrers($customer->id);
}

return $data;
}
Expand Down
6 changes: 2 additions & 4 deletions sql/install.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,10 @@
`date_add` datetime NOT NULL,
`date_upd` datetime NOT NULL,
PRIMARY KEY (`id_gdpr_log`),
INDEX (`id_customer`)
INDEX (`id_customer`),
INDEX `idx_id_customer` ( `id_customer`, `id_guest`, `client_name`, `id_module`, `date_add`, `date_upd`)
) ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=UTF8;';

$sql[] = ' ALTER TABLE `' . _DB_PREFIX_ . 'psgdpr_log`
ADD INDEX `idx_id_customer` ( `id_customer`, `id_guest`, `client_name`, `id_module`, `date_add`, `date_upd`); ';

foreach ($sql as $query) {
if (Db::getInstance()->execute($query) == false) {
return false;
Expand Down
31 changes: 9 additions & 22 deletions translations/ag.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,29 +28,16 @@
$_MODULE['<{psgdpr}prestashop>psgdpr_a59aa7fb037f2498e36a6d687869e83e'] = 'Datos del cliente borrados por el módulo oficial RGPD.';
$_MODULE['<{psgdpr}prestashop>psgdpr_cb84a315de222f4aa4ab6d6d5219314e'] = 'Cumplimenta todos los campos necesarios.';
$_MODULE['<{psgdpr}prestashop>htmltemplatepsgdprmodule_9ad5a301cfed1c7f825506bf57205ab6'] = 'DATOS PERSONALES';
$_MODULE['<{psgdpr}prestashop>customerpersonaldata17_c654dacdea4ad6f75ad36553a8a947cd'] = 'Mis datos personales';
$_MODULE['<{psgdpr}prestashop>customerpersonaldata17_a8308387f3ffc2d045d2b6125e74317d'] = 'Acceder a mis datos';
$_MODULE['<{psgdpr}prestashop>customerpersonaldata17_915f4446a47b51378e37374cfbb72d7f'] = 'Tienes derecho a recuperar los datos que has facilitado al sitio en cualquier momento. Haz clic en "Obtener mis datos" para descargar automáticamente una copia de tus datos personales en un archivo PDF o CSV.';
$_MODULE['<{psgdpr}prestashop>customerpersonaldata17_49b5d04f5f20820830f080d4674c8669'] = 'OBTENER MIS DATOS CSV';
$_MODULE['<{psgdpr}prestashop>customerpersonaldata17_7b0b06bfe69473081553bcccb12ca068'] = 'OBTENER MIS DATOS PDF';
$_MODULE['<{psgdpr}prestashop>customerpersonaldata17_91a49c1d45a5d37e85658d01b6f37423'] = 'Solicitudes de rectificación y supresión';
$_MODULE['<{psgdpr}prestashop>customerpersonaldata17_01cb324ae91e9bd16213cc2945334249'] = 'Tienes derecho a modificar todos los datos personales que aparecen en la página "Mi cuenta". Para cualquier otra solicitud que puedas tener respecto a la rectificación o supresión de tus datos personales, ponte en contacto con nosotros a través de nuestra';
$_MODULE['<{psgdpr}prestashop>customerpersonaldata17_af5efea250326c1c34d69aa9364b482c'] = 'página de contacto.';
$_MODULE['<{psgdpr}prestashop>customerpersonaldata17_332087a4991d8bc866abd3fd78a2e514'] = 'Estudiaremos tu solicitud y te responderemos lo antes posible.';
$_MODULE['<{psgdpr}prestashop>customerpersonaldata_c654dacdea4ad6f75ad36553a8a947cd'] = 'Mis datos personales';
$_MODULE['<{psgdpr}prestashop>customerpersonaldata_a8308387f3ffc2d045d2b6125e74317d'] = 'Acceder a mis datos';
$_MODULE['<{psgdpr}prestashop>customerpersonaldata_915f4446a47b51378e37374cfbb72d7f'] = 'Tienes derecho a recuperar los datos que has facilitado al sitio en cualquier momento. Haz clic en "Obtener mis datos" para descargar automáticamente una copia de tus datos personales en un archivo PDF o CSV.';
$_MODULE['<{psgdpr}prestashop>customerpersonaldata_49b5d04f5f20820830f080d4674c8669'] = 'OBTENER MIS DATOS CSV';
$_MODULE['<{psgdpr}prestashop>customerpersonaldata_7b0b06bfe69473081553bcccb12ca068'] = 'OBTENER MIS DATOS PDF';
$_MODULE['<{psgdpr}prestashop>customerpersonaldata_91a49c1d45a5d37e85658d01b6f37423'] = 'Solicitudes de rectificación y supresión';
$_MODULE['<{psgdpr}prestashop>customerpersonaldata_01cb324ae91e9bd16213cc2945334249'] = 'Tienes derecho a modificar todos los datos personales que aparecen en la página "Mi cuenta". Para cualquier otra solicitud que puedas tener respecto a la rectificación o supresión de tus datos personales, ponte en contacto con nosotros a través de nuestra';
$_MODULE['<{psgdpr}prestashop>customerpersonaldata_af5efea250326c1c34d69aa9364b482c'] = 'página de contacto.';
$_MODULE['<{psgdpr}prestashop>customerpersonaldata_332087a4991d8bc866abd3fd78a2e514'] = 'Estudiaremos tu solicitud y te responderemos lo antes posible.';
$_MODULE['<{psgdpr}prestashop>customeraccount_5868129c4526891dddb05b8e59c33572'] = 'Mis datos personales';
$_MODULE['<{psgdpr}prestashop>customerpersonaldata16_d95cf4ab2cbf1dfb63f066b50558b07d'] = 'Mi cuenta';
$_MODULE['<{psgdpr}prestashop>customerpersonaldata16_c654dacdea4ad6f75ad36553a8a947cd'] = 'Mis datos personales';
$_MODULE['<{psgdpr}prestashop>customerpersonaldata16_c654dacdea4ad6f75ad36553a8a947cd'] = 'Mis datos personales';
$_MODULE['<{psgdpr}prestashop>customerpersonaldata16_a8308387f3ffc2d045d2b6125e74317d'] = 'Acceder a mis datos';
$_MODULE['<{psgdpr}prestashop>customerpersonaldata16_915f4446a47b51378e37374cfbb72d7f'] = 'Tienes derecho a recuperar los datos que has facilitado al sitio en cualquier momento. Haz clic en "Obtener mis datos" para descargar automáticamente una copia de tus datos personales en un archivo PDF o CSV.';
$_MODULE['<{psgdpr}prestashop>customerpersonaldata16_49b5d04f5f20820830f080d4674c8669'] = 'OBTENER MIS DATOS CSV';
$_MODULE['<{psgdpr}prestashop>customerpersonaldata16_7b0b06bfe69473081553bcccb12ca068'] = 'OBTENER MIS DATOS PDF';
$_MODULE['<{psgdpr}prestashop>customerpersonaldata16_91a49c1d45a5d37e85658d01b6f37423'] = 'Solicitudes de rectificación y supresión';
$_MODULE['<{psgdpr}prestashop>customerpersonaldata16_01cb324ae91e9bd16213cc2945334249'] = 'Tienes derecho a modificar todos los datos personales que aparecen en la página "Mi cuenta". Para cualquier otra solicitud que puedas tener respecto a la rectificación o supresión de tus datos personales, ponte en contacto con nosotros a través de nuestra';
$_MODULE['<{psgdpr}prestashop>customerpersonaldata16_af5efea250326c1c34d69aa9364b482c'] = 'página de contacto.';
$_MODULE['<{psgdpr}prestashop>customerpersonaldata16_332087a4991d8bc866abd3fd78a2e514'] = 'Estudiaremos tu solicitud y te responderemos lo antes posible.';
$_MODULE['<{psgdpr}prestashop>customerpersonaldata16_0b3db27bc15f682e92ff250ebb167d4b'] = 'Volver a tu cuenta';
$_MODULE['<{psgdpr}prestashop>customerpersonaldata16_8cf04a9734132302f96da8e113e80ce5'] = 'Pagina de inicio';
$_MODULE['<{psgdpr}prestashop>personaldata.connections-tab_93bd48ecb9c4d5c4eec7fefffbb2070f'] = 'Últimas conexiones';
$_MODULE['<{psgdpr}prestashop>personaldata.connections-tab_33e29c1d042c0923008f78b46af94984'] = 'Solicitud de origen';
$_MODULE['<{psgdpr}prestashop>personaldata.connections-tab_57f32d7d0e6672cc2b60bc7a49f91453'] = 'Página vista';
Expand Down
Loading

0 comments on commit 3266aee

Please sign in to comment.