So apologies for rolling everything into one patch. I've worked a lot on the module and can't submit one by one anymore.

Problem/Motivation

Order association should be configurable as site admins may or may not want come of the functionality.
The module should be compatible with Drupal 8 and 9
Some of the patches in the issue queue won't apply to the dev version

Proposed resolution

Add config form

Remaining tasks

Test and approve patch, following feedback and fixes

User interface changes

New config form

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

Dubs created an issue. See original summary.

dubs’s picture

Status: Active » Needs review
StatusFileSize
new16.69 KB

Patch :-)

vood002’s picture

Thanks for this. Working great for me.

skyredwang’s picture

Status: Needs review » Reviewed & tested by the community

It also works for me on D9.

skyredwang’s picture

StatusFileSize
new8.52 KB

Just a small improvement. I updated the helper text to this one below, to make sure people understand the complication.

This could potentially lead to GDPR / PII data problems. e.g. An anonymous user placed an order but made a typo in the email address, this order could be assigned to another user by mistake. Then, the second user could see the personal information of the first user.

skyredwang’s picture

StatusFileSize
new14.94 KB

Forgot to add new files in the previous patch file

lexsoft’s picture

The #2 patch works for me. I can't upgrade to Drupal 9 from Drupal 8 without removing the module from composer and re-adding it after.

Plus 1 to get this committed!

lexsoft’s picture

StatusFileSize
new18.65 KB

There is a bug on the config form:

$form['assign_to_existing'] = [
  '#type' => 'checkbox',
  '#title' => $this->t('Assign orders to existing accounts'),
  '#default_value' => $config->get('create_new'),
  '#description' => $this->t('This could potentially lead to GDPR / PII data problems. e.g. An anonymous user placed an order but made a typo in the email address, this order could be assigned to another user by mistake. Then, the second user could see the personal information of the first user.'),
  '#weight' => '0',
];

Where it should be:

$form['assign_to_existing'] = [
  '#type' => 'checkbox',
  '#title' => $this->t('Assign orders to existing accounts'),
  '#default_value' => $config->get('assign_to_existing'),
  '#description' => $this->t('This could potentially lead to GDPR / PII data problems. e.g. An anonymous user placed an order but made a typo in the email address, this order could be assigned to another user by mistake. Then, the second user could see the personal information of the first user.'),
  '#weight' => '0',
];

Re-roll of patch #6 with the fix above and applied coding standards and best practices.

./vendor/bin/drupal-check web/modules/custom/commerce_guest_registration/
<be>
 4/4 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%


 [OK] No errors

 /vendor/bin/phpcs -p --standard="DrupalPractice" --ignore=*/vendor/*,*/bootstrap/*,*/tests/*,*/.gitlab-ci/*,Readme.md,style.css,print.css,*Test.php,RoboFile.php "web/modules/custom/commerce_guest_registration/" --extensions=php,inc,module,install,test,profile,them
... 3 / 3 (100%)


Time: 83ms; Memory: 4MB

./vendor/bin/phpcs -p --standard="Drupal" --ignore=*/vendor/*,*/bootstrap/*,*/tests/*,*/.gitlab-ci/*,Readme.md,style.css,print.css,*Test.php,RoboFile.php "web/modules/custom/commerce_guest_registration/" --extensions=php,inc,module,install,test,profile,them
... 3 / 3 (100%)


Time: 143ms; Memory: 6MB

I believe we can commit this and release a 2.0.0 version of the module for Drupal 9.

socialnicheguru’s picture

I am trying to pull your MR version via composer.json to do a test but I keep getting an error:

composer 2.25

Problem 1
- Root composer.json requires drupal/commerce_guest_registration dev-custom#b4481e7a207cee63b0da9b33105891907f19db6f, it is satisfiable by drupal/commerce_guest_registration[dev-custom] from package repo (defining 1 package) but drupal/commerce_guest_registration[dev-1.x, 1.0.0, 1.x-dev (alias of dev-1.x)] from composer repo (https://packages.drupal.org/8) has higher repository priority. The packages from the higher priority repository do not match your constraint and are therefore not installable. That repository is canonical so the lower priority repo's packages are not installable. See https://getcomposer.org/repoprio for details and assistance.

I added "canonical": false, as shown below.

 under require  "drupal/commerce_guest_registration":"dev-custom#b4481e7a207cee63b0da9b331\
05891907f19db6f",
	"repositories": [
        {
            "type": "composer",
	    "url": "https://packages.drupal.org/8",
	    "canonical": false,
            "exclude": [
                "drupal/commerce_guest_regsitration",
                "drupal/group_webform",
                "drupal/webform_dropzonejs"
	    ]

and the repositories:

	{
            "type": "package",
            "package": {
                "name": "drupal/commerce_guest_registration",
                "type": "drupal-module",
		"version": "dev-custom",
                "source": {
                    "type": "git",
                    "url": "git@git.drupal.org:issue/commerce_guest_registration-3\
224303.git",
	            "reference": "3224303-new-features-and"
                }
	    }
        },
arunkumark’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.