Missing commerce license acl_id record when manually creating license

Created on 16 September 2022, over 2 years ago

Problem/Motivation

If you manually create an Access Control license for a user and activate it, the site will error out with.

Drupal\Core\Entity\EntityStorageException: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'acl_id' cannot be null: INSERT INTO "acl_user" ("acl_id", "uid") VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1); Array ( [:db_insert_placeholder_0] => [:db_insert_placeholder_1] => 28213 ) in Drupal\Core\Entity\Sql\SqlContentEntityStorage->save() (line 811 of core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).

Also, when viewing all licenses on the /admin/commerce/licenses page, the label for this new license incorrectly shows it as "Access Control License" instead of the actual name from the product variation label.

Steps to reproduce

  1. Create a new license on /admin/commerce/licenses/add
  2. Choose Access Control
  3. Fill in the Licensed Production Variation, Owner, Expiration, etc fields and Save
  4. Click on the Confirm Activation button

Proposed resolution

The problem is that the commerce_license__acl_id table is missing an entry for this license. In my tests, manually inserting a row with the relevant license data, then clearing the site cache, allows the admin to save and Confirm Activation without error. This also fixes the incorrect name shown on the admin license page.

Not sure what area code needs to be modified or if this is an issue with the parent Commerce License module.

Remaining tasks

πŸ› Bug report
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States retiredpro

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024