The customer form consent message is installed with the account creation text

Open
#259 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
48/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
php
Domain
backend

Research direction

Read the module’s install() method and compare the psgdpr_customer_form branch with psgdpr_creation_form; the issue identifies the preset message property and the 1.4.x and dev branches involved. Review the old customer message, including its placeholder and wording, before deciding what text should be restored. Done means new installs receive the intended customer form message on both branches.

Written by the indexing model from the issue text.

Description

Description

On install, psgdpr pre-fills two consent messages per language: PSGDPR_CREATION_FORM (account creation form) and PSGDPR_CUSTOMER_FORM (customer account form). Both receive the account creation text:

I agree to the terms and conditions and the privacy policy

The customer form had its own text, Psgdpr::$presetMessageAccountCustomer (added in ceda349, "Add translations for preset messages", translated in 15 languages):

By submitting this form, I accept that the data entered is used by xxxxx so they can (i) acknowledge your request, (ii) replay and, if necessary, (iii) manage the contractual relationship that may result.

It has not been read since 7ddc02c ("Some clean", 2018-12-11), which rewrote the psgdpr_customer_form branch of install() with $presetMessageAccountCreation instead of $presetMessageAccountCustomer:

             } elseif ($value === 'psgdpr_customer_form') {
                 foreach ($languages as $lang) {
-                    if (array_key_exists($lang['iso_code'], $this->presetMessageAccountCreation)) {
-                        $tmp[Tools::strtoupper($value)][$lang['id_lang']] = $this->presetMessageAccountCustomer[$lang['iso_code']];
-                    } else {
-                        $tmp[Tools::strtoupper($value)][$lang['id_lang']] = $this->presetMessageAccountCustomer['en'];
-                    }
+                    $tmp[Tools::strtoupper($value)][$lang['id_lang']] = isset($this->presetMessageAccountCreation[$lang['iso_code']]) ?
+                        $this->presetMessageAccountCreation[$lang['iso_code']] :
+                        $this->presetMessageAccountCreation['en'];

The commit looks like a refactoring, so the change of text is most likely unintended.

  • 1.4.x: the property is still there, unread. PHPStan on PrestaShop 9 reports it as never read; #257 keeps it and ignores that report, pointing here.
  • dev (2.x): the property has been removed and install() has the same code, so the customer text is gone there too.
Steps to reproduce
  1. Install psgdpr on a fresh shop.
  2. Back office > psgdpr > Consent: compare the "Customer account form" message with the "Account creation form" message.
Expected behavior

The customer account form is pre-filled with its own message, as before 7ddc02c.

Actual result

Both forms are pre-filled with the account creation message.

To decide before fixing
  • Restoring the 2018 text is a behaviour change for new installs only (existing shops keep their saved message, install() is the only writer).
  • The text needs a look before it comes back: it contains the xxxxx placeholder for the merchant's name and "replay" where "reply" is meant.
  • Which lines to fix: 1.4.x (restore the read), dev (restore the property and the read).
Dominant language
JavaScript
Stars
34
Forks
77
Avg merge
12h 50m
Merged PRs (30d)
2

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from PrestaShop/psgdpr

All issues in PrestaShop/psgdpr

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.