Avoid duplicate entry for mass adding terms

Created on 19 November 2018, over 6 years ago
Updated 23 September 2024, 11 months ago

Dear please add feature to avoid duplicate entry for mass adding terms.

Feature request
Status

Needs review

Version

2.0

Component

Code

Created by

🇮🇩Indonesia drupalnesia

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

Merge Requests

Comments & Activities

Not all content is available!

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

  • codebymikey changed the visibility of the branch 3014694-avoid-duplicate-entry to hidden.

  • Pipeline finished with Failed
    11 months ago
    Total: 658s
    #290425
  • Pipeline finished with Failed
    11 months ago
    Total: 311s
    #290449
  • Status changed to RTBC 3 months ago
  • 🇺🇦Ukraine dburiak

    The MR!52 is tested on Drupal 10.4.7.

    The bunch of taxonomy terms is imported successfully without duplicates.
    Works properly.

    Moving the ticket to RTBC.

  • 🇨🇦Canada danrod Ottawa

    It was about time.

  • 🇦🇺Australia jannakha Brisbane!

    can you please fix JSLint, PHPCS errors?

  • First commit to issue fork.
  • 🇦🇺Australia jannakha Brisbane!

    all green! thanks!

  • 🇦🇺Australia jannakha Brisbane!

    I have tested the patch and found an interesting issue, if vocabulary was setup with langcode (but module is not enabled - data and structure has been migrated from D8->D9->D10 and some stage language module might have been enabled) it will not match duplicates.

    Maybe add additional langcode check:

          // Check if site is multilingual.
          if ($this->moduleHandler->moduleExists('language')) {
            ...
          }
          else {
            $vocabulary = \Drupal::entityTypeManager()->getStorage('taxonomy_vocabulary')->load($vid);
            $langcode = $vocabulary->get('langcode');
          }
    
  • 🇦🇺Australia jannakha Brisbane!

    added langcode check for non-multilingual sites

  • Pipeline finished with Failed
    about 2 months ago
    Total: 341s
    #533151
  • Pipeline finished with Failed
    about 2 months ago
    Total: 155s
    #533168
  • Pipeline finished with Success
    about 2 months ago
    #533171
  • 🇦🇺Australia jannakha Brisbane!

    so, I installed a brand new Drupal 11 site, created a couple of vocabs and taxonomy terms,
    then installed taxonomy manager with patch (before langcode fix).

    Because by default (even without multi-lingual support) langcode is set to 'en' but taxonomy manager is searching for 'und'
    so duplicates are added anyway:

    After langcode set to 'en' - duplicates are not created (matched to langcode 'en').

    There'll be an issue with all terms which were created with taxonomy_manager before this fix (as they are created with langcode 'und')

Production build 0.71.5 2024