Skip to content

Comments

#2810 - Ability To Configure Which Fields To Search For Duplications On#2882

Open
kodinkat wants to merge 11 commits intoDiscipleTools:developfrom
kodinkat:2810-ability-to-configure-which-fields-to-search-for-duplications-on
Open

#2810 - Ability To Configure Which Fields To Search For Duplications On#2882
kodinkat wants to merge 11 commits intoDiscipleTools:developfrom
kodinkat:2810-ability-to-configure-which-fields-to-search-for-duplications-on

Conversation

@kodinkat
Copy link
Collaborator

@kodinkat kodinkat commented Feb 5, 2026

                - Added checks for the existence of Foundation components before initializing the Accordion and MediaQuery functions to prevent potential errors in environments where Foundation is not loaded.
                - Improved mobile filter collapse functionality by ensuring Foundation is available before executing related logic.
                - Added functionality to configure fields for duplicate detection in the general settings tab.
                - Introduced a new form for selecting fields to check for duplicates, ensuring the 'name' field is always included.
                - Enhanced JavaScript to manage field selection and submission, utilizing a multi-select component for better user experience.
                - Created helper functions to extract field values based on type for duplicate searches.
                - Updated site options to store duplicate field configurations, allowing for flexible management of duplicate detection across post types.
               - Enhanced the collapse_filters function in modular-list.js for better readability by formatting conditional checks.
               - Updated contacts.js to ensure the merge duplicate modal is properly initialized before opening, adding error handling for missing Foundation components and modal instances.
               - Enhanced the logic for processing duplicate fields configuration in the general settings tab, ensuring that user-defined settings are respected and defaults are applied when necessary.
               - Improved JavaScript to handle form submissions for duplicate fields, including validation and sanitization of input data.
               - Updated PHP to clear cache after saving settings, ensuring fresh data is read on subsequent requests.
               - Streamlined the extraction of field values for duplicate searches, improving code readability and maintainability.
               - Cleaned up whitespace and improved code readability in the duplicate fields configuration functions.
               - Enhanced the logic for processing duplicate fields in the admin settings, ensuring proper validation and sanitization of input data.
               - Streamlined the handling of default fields for duplicate detection across post types, maintaining user-defined settings while applying defaults where necessary.
               - Updated comments for clarity and maintainability throughout the affected files.
…r clarity

               - Removed redundant mention of the 'name' field in the instructions for configuring duplicate record checks, streamlining the user guidance.
@corsacca
Copy link
Member

@claude review?

@claude
Copy link

claude bot commented Feb 10, 2026

Claude Code is working…

I'll analyze this and get back to you.

View job run

@corsacca
Copy link
Member

Hey @kodinkat,

Could you look into (or clarify) these 2?

  1. ids_of_non_dismissed_duplicates signature change is a breaking
    change (High)

In duplicates-merging.php, the endpoint now calls
self::ids_of_non_dismissed_duplicates( $post_type, $post_id, false ) —
changing from true (exact match) to false (fuzzy match). This is a
behavior change that affects all duplicate detection, not just the
configurability feature. This seems unintentional and would make
duplicate detection less precise globally.

2 remove Foundation defensive checks in modular-list.js and
contacts.js

                              - Simplified conditional checks for Foundation MediaQuery in the collapse_filters function for better readability.
                              - Streamlined the initialization of the Foundation Accordion by removing redundant checks, ensuring it is always executed when filter_accordions are present.
                              - Enhanced the merge duplicate modal opening logic in contacts.js by directly calling the foundation method, improving code clarity and reducing error handling complexity.
…ools-theme into 2810-ability-to-configure-which-fields-to-search-for-duplications-on
               - Updated the  to remove an unnecessary parameter in the duplicate ID retrieval function for cleaner code.
               - Initialized  as an associative array in  to ensure a consistent structure.
               - Enhanced JavaScript in  to ensure  is always treated as an array, improving robustness and preventing potential errors.
@kodinkat
Copy link
Collaborator Author

Hey @kodinkat,

Could you look into (or clarify) these 2?

  1. ids_of_non_dismissed_duplicates signature change is a breaking
    change (High)

In duplicates-merging.php, the endpoint now calls self::ids_of_non_dismissed_duplicates( $post_type, $post_id, false ) — changing from true (exact match) to false (fuzzy match). This is a behavior change that affects all duplicate detection, not just the configurability feature. This seems unintentional and would make duplicate detection less precise globally.

2 remove Foundation defensive checks in modular-list.js and contacts.js

@corsacca good spot re point (1); as this was changed in error. Latest updates pushed and review ready.....

'available_languages' => dt_get_available_languages(),
'site_options' => dt_get_option( 'dt_site_options' ),
'contacts_field_settings' => DT_Posts::get_post_field_settings( 'contacts' ),
'duplicate_fields' => $duplicate_fields_data,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kodinkat the field_settings for all post types could be directly available under dtOptionAPI. Then it can be used by other settings

// Check if valid config exists for this post type
let selectedFields;
if (
duplicateFieldsConfig.hasOwnProperty(postType) &&
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

* @param string $post_type The post type to get defaults for
* @return array Array of field keys to check for duplicates
*/
if ( !function_exists( 'dt_get_duplicate_fields_defaults' ) ) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kodinkat why the function existis?

dt_theme_enqueue_script( 'web-components', 'dt-assets/build/components/index.js', array(), false );
dt_theme_enqueue_style( 'web-components-css', 'dt-assets/build/css/light.min.css', array() );

if ( isset( $_GET['tab'] ) && ( ( $_GET['tab'] === 'people-groups' ) || ( $_GET['tab'] === 'general' ) ) ) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this page need to work on /wp-admin/admin.php?page=dt_options as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ability to configure which fields to search for duplicates on.

2 participants