New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add export feature + update translations + fix translation issue with csv and more #10

Merged
merged 20 commits into from Dec 14, 2018

Conversation

Projects
None yet
6 participants
@Joukz
Copy link
Contributor

Joukz commented Jun 13, 2018

No description provided.

Show resolved Hide resolved views/templates/admin/tabs/dataConfig.tpl Outdated
Show resolved Hide resolved controllers/front/ExportDataToCsv.php
Show resolved Hide resolved controllers/front/gdpr.php
Show resolved Hide resolved psgdpr.php
Show resolved Hide resolved views/js/back.js Outdated
// create an anonymous customer
$customer = new Customer();
$customer->id_gender = 1;
$customer->lastname = 'Anonymous';
$customer->firstname = 'Anonymous';
$customer->email = 'anonymous@anonymous.com';
$customer->email = 'anonymous@psgdpr.com';

This comment was marked as resolved.

@PierreRambaud

PierreRambaud Sep 4, 2018

What happened for other account already migrated to this one? Should you add a new check to find if there is already an anonymous@anonymous.com and change his email?

This comment has been minimized.

@Joukz

Joukz Dec 11, 2018

Contributor

Indeed! Solved by adding an upgrading file. Thanks.

psgdpr.php Outdated
@@ -95,12 +130,20 @@ public function install()
foreach ($this->settings_data_consent as $value) {
if ($value === 'psgdpr_creation_form') {
foreach ($languages as $lang) {
$tmp[Tools::strtoupper($value)][$lang['id_lang']] = 'I agree to the terms and conditions and the privacy policy <a href="#" style="color:#3ED2F0 !important;text-decoration: underline">Read the terms and conditions of use</a>.';
if (array_key_exists($lang['iso_code'], $this->presetMessageAccountCreation)) {

This comment has been minimized.

@PierreRambaud

PierreRambaud Sep 4, 2018

Can be done in one line

$tmp[Tools::strtoupper($value)][$lang['id_lang']] = isset($this->presetMessageAccountCreation[$lang['iso_code']]) ?
  $this->presetMessageAccountCreation[$lang['iso_code']] :
  $this->presetMessageAccountCreation['en'];

Same below

This comment has been minimized.

@Joukz

Joukz Dec 11, 2018

Contributor

Changed :)

@@ -87,5 +87,6 @@
var messageDeleteCancelText = "{/literal}{l s='Cancel action' mod='psgdpr'}{literal}";
var messageDeleteConfirmText = "{/literal}{l s='Confirm Erasure' mod='psgdpr'}{literal}";
var messageDeleteSuccess = "{/literal}{l s='The customer\'s data has been successfully deleted!' mod='psgdpr'}{literal}";
var datatableExport = "{/literal}{l s='Export' mod='psgdpr'}{literal}";

This comment has been minimized.

@Quetzacoalt91

Quetzacoalt91 Sep 4, 2018

Member

Did you know that you could avoid all the {litteral} if you use the js=1 attribute in your {l [...] js=1} calls?

This comment has been minimized.

@Joukz

Joukz Dec 11, 2018

Contributor

Good to know! I removed lireral tag.

Show resolved Hide resolved psgdpr.php Outdated
Show resolved Hide resolved psgdpr.php Outdated
{
$gdprCustomer = Congiguration::get('PSGDPR_ANONYMOUS_CUSTOMER');
$query = 'SELECT email FROM `'._DB_PREFIX_.'customer` c WHERE id_customer = '.$gdprCustomer;

This comment has been minimized.

@MrBaiame

MrBaiame Dec 11, 2018

cast is missing !

This comment has been minimized.

@Joukz

Joukz Dec 12, 2018

Contributor

Cast added too.

if (!empty($emailGdprCustomer) && $emailGdprCustomer === 'anonymous@anonymous.com') {
$query = 'UPDATE `'._DB_PREFIX_.'customer`
SET email = "anonymous@psgdpr.com"
WHERE id_customer ='.$gdprCustomer;

This comment has been minimized.

@MrBaiame

MrBaiame Dec 11, 2018

cast missing as well

This comment has been minimized.

@Joukz

Joukz Dec 12, 2018

Contributor

Cast added :)

$(document).on('submit', parentForm, function(event) {
$.ajax({
data: 'POST',
//dataType: 'JSON',

This comment has been minimized.

@MrBaiame

MrBaiame Dec 11, 2018

you might want to remove the comment if not needed anymore

This comment has been minimized.

@Joukz

Joukz Dec 12, 2018

Contributor

Removed.

$query = 'SELECT email FROM `'._DB_PREFIX_.'customer` c WHERE id_customer = '.$gdprCustomer;
$emailGdprCustomer = Db::getInstance()->getValue($query);
if (!empty($emailGdprCustomer) && $emailGdprCustomer === 'anonymous@anonymous.com') {

This comment has been minimized.

@PierreRambaud

PierreRambaud Dec 11, 2018

if (empty($emailGdprCustomer) || $emailGdprCustomer !== 'anonymous@anonymous.com') {
  return false;
}

Return faster, prevent big indentation.

This comment has been minimized.

@jolelievre

jolelievre Dec 11, 2018

return true or the upgrade will fail

This comment has been minimized.

@Joukz

Joukz Dec 12, 2018

Contributor

Done, thanks for your feedback :)

@Joukz Joukz merged commit 25f7a7f into PrestaShop:dev Dec 14, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment