Make the field value unique

Created on 27 June 2024, 5 months ago

Problem/Motivation

Currently, the Brazilian IDs module allows adding CPF, CNPJ, and RG fields, but there is no validation to ensure these fields are unique in the system. This can lead to data duplication and inconsistencies, especially in systems that require the uniqueness of these identifiers for compliance and data integrity purposes.

Steps to reproduce

  1. Create a new content or user with a CPF, CNPJ, or RG field.
  2. Fill in the field with a valid value.
  3. Save the content or user.
  4. Create a new content or user and fill in the same field with the same value used previously.
  5. Save the content or user again.

Proposed resolution

Add uniqueness validation for the CPF, CNPJ, and RG fields in the Brazilian IDs module. This can be done using the Drupal validation API to ensure that the values entered in these fields are unique in the database.

Remaining tasks

  • Add the uniqueness validation logic to the CPF, CNPJ, and RG fields.
  • Update existing tests to cover the new validation use cases.
  • Test the functionality in different scenarios to ensure the uniqueness validation works correctly.

User interface changes

No significant changes to the user interface, except for the possible display of error messages when attempting to save a field with a duplicate value.

API changes

No changes to the existing API. The uniqueness validation will be implemented using Drupal's standard hooks and methods.

Data model changes

Possibly the addition of unique indexes for the CPF, CNPJ, and RG fields in the relevant database tables.

Feature request
Status

Active

Version

1.0

Component

Code

Created by

🇧🇷Brazil tiagohfweb Patos de Minas - MG

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

Comments & Activities

Production build 0.71.5 2024