diff --git a/modules/crm_core_user_sync/config/install/views.view.contact_to_user_management.yml b/modules/crm_core_user_sync/config/install/views.view.contact_to_user_management.yml new file mode 100644 index 0000000000000000000000000000000000000000..a25efe1da9d443286663ffecd394ff0ea793625a --- /dev/null +++ b/modules/crm_core_user_sync/config/install/views.view.contact_to_user_management.yml @@ -0,0 +1,702 @@ +langcode: en +status: true +dependencies: + module: + - crm_core_contact + - crm_core_user_sync + - name + - user +id: contact_to_user_management +label: 'Contact to User Management' +module: views +description: '' +tag: '' +base_table: crm_core_individual +base_field: individual_id +core: 8.x +display: + default: + display_plugin: default + id: default + display_title: Master + position: 0 + display_options: + access: + type: perm + options: + perm: 'administer crm-core-user-sync' + cache: + type: tag + options: { } + query: + type: views_query + options: + disable_sql_rewrite: false + distinct: false + replica: false + query_comment: '' + query_tags: { } + exposed_form: + type: basic + options: + submit_button: Apply + reset_button: true + reset_button_label: Reset + exposed_sorts_label: 'Sort by' + expose_sort_order: true + sort_asc_label: Asc + sort_desc_label: Desc + pager: + type: full + options: + items_per_page: 50 + offset: 0 + id: 0 + total_pages: null + tags: + previous: ‹‹ + next: ›› + first: '« First' + last: 'Last »' + expose: + items_per_page: false + items_per_page_label: 'Items per page' + items_per_page_options: '5, 10, 25, 50' + items_per_page_options_all: false + items_per_page_options_all_label: '- All -' + offset: false + offset_label: Offset + quantity: 9 + style: + type: table + row: + type: fields + fields: + individual_id: + id: individual_id + table: crm_core_individual + field: individual_id + relationship: none + group_type: group + admin_label: '' + label: 'Individual ID' + exclude: false + alter: + alter_text: false + text: '' + make_link: false + path: '' + absolute: false + external: false + replace_spaces: false + path_case: none + trim_whitespace: false + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: false + max_length: 0 + word_boundary: true + ellipsis: true + more_link: false + more_link_text: '' + more_link_path: '' + strip_tags: false + trim: false + preserve_tags: '' + html: false + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: true + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: true + click_sort_column: value + type: number_unformatted + settings: { } + group_column: value + group_columns: { } + group_rows: true + delta_limit: 0 + delta_offset: 0 + delta_reversed: false + delta_first_last: false + multi_type: separator + separator: ', ' + field_api_classes: false + entity_type: crm_core_individual + entity_field: individual_id + plugin_id: field + name__title: + id: name__title + table: crm_core_individual + field: name__title + relationship: none + group_type: group + admin_label: '' + label: 'Individual name' + exclude: false + alter: + alter_text: false + text: '' + make_link: false + path: '' + absolute: false + external: false + replace_spaces: false + path_case: none + trim_whitespace: false + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: false + max_length: 0 + word_boundary: true + ellipsis: true + more_link: false + more_link_text: '' + more_link_path: '' + strip_tags: false + trim: false + preserve_tags: '' + html: false + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: true + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: true + click_sort_column: family + type: name_default + settings: + format: default + markup: false + output: default + multiple: default + multiple_delimiter: ', ' + multiple_and: text + multiple_delimiter_precedes_last: never + multiple_el_al_min: '3' + multiple_el_al_first: '1' + group_column: '' + group_columns: { } + group_rows: true + delta_limit: 0 + delta_offset: 0 + delta_reversed: false + delta_first_last: false + multi_type: separator + separator: ', ' + field_api_classes: false + entity_type: crm_core_individual + entity_field: name + plugin_id: field + type: + id: type + table: crm_core_individual + field: type + relationship: none + group_type: group + admin_label: '' + label: 'Individual type' + exclude: false + alter: + alter_text: false + text: '' + make_link: false + path: '' + absolute: false + external: false + replace_spaces: false + path_case: none + trim_whitespace: false + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: false + max_length: 0 + word_boundary: true + ellipsis: true + more_link: false + more_link_text: '' + more_link_path: '' + strip_tags: false + trim: false + preserve_tags: '' + html: false + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: true + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: true + click_sort_column: target_id + type: entity_reference_label + settings: + link: false + group_column: target_id + group_columns: { } + group_rows: true + delta_limit: 0 + delta_offset: 0 + delta_reversed: false + delta_first_last: false + multi_type: separator + separator: ', ' + field_api_classes: false + entity_type: crm_core_individual + entity_field: type + plugin_id: field + id: + id: id + table: crm_core_user_sync_relation + field: id + relationship: crm_core_user_sync_relation + group_type: group + admin_label: '' + label: 'Relation ID' + exclude: false + alter: + alter_text: false + text: '' + make_link: true + path: '/admin/config/crm-core/user-sync/relation/{{id}}/edit?destination=/admin/config/crm-core/user-sync/contact' + absolute: false + external: false + replace_spaces: false + path_case: none + trim_whitespace: false + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: false + max_length: 0 + word_boundary: true + ellipsis: true + more_link: false + more_link_text: '' + more_link_path: '' + strip_tags: false + trim: false + preserve_tags: '' + html: false + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: true + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: 'No relation' + hide_empty: false + empty_zero: false + hide_alter_empty: true + click_sort_column: value + type: number_unformatted + settings: { } + group_column: value + group_columns: { } + group_rows: true + delta_limit: 0 + delta_offset: 0 + delta_reversed: false + delta_first_last: false + multi_type: separator + separator: ', ' + field_api_classes: false + entity_type: crm_core_user_sync_relation + entity_field: id + plugin_id: field + user_id: + id: user_id + table: crm_core_user_sync_relation + field: user_id + relationship: crm_core_user_sync_relation + group_type: group + admin_label: '' + label: User + exclude: false + alter: + alter_text: false + text: '' + make_link: false + path: '' + absolute: false + external: false + replace_spaces: false + path_case: none + trim_whitespace: false + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: false + max_length: 0 + word_boundary: true + ellipsis: true + more_link: false + more_link_text: '' + more_link_path: '' + strip_tags: false + trim: false + preserve_tags: '' + html: false + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: true + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: 'Add relation' + hide_empty: false + empty_zero: false + hide_alter_empty: true + click_sort_column: target_id + type: entity_reference_label + settings: + link: true + group_column: target_id + group_columns: { } + group_rows: true + delta_limit: 0 + delta_offset: 0 + delta_reversed: false + delta_first_last: false + multi_type: separator + separator: ', ' + field_api_classes: false + entity_type: crm_core_user_sync_relation + entity_field: user_id + plugin_id: field + filters: + id: + id: id + table: crm_core_user_sync_relation + field: id + relationship: crm_core_user_sync_relation + group_type: group + admin_label: 'Have related user' + operator: '=' + value: + min: '' + max: '' + value: '' + group: 1 + exposed: true + expose: + operator_id: id_op + label: ID + description: null + use_operator: false + operator: id_op + identifier: id + required: false + remember: false + multiple: false + remember_roles: + authenticated: authenticated + placeholder: null + min_placeholder: null + max_placeholder: null + is_grouped: true + group_info: + label: 'Have related user' + description: '' + identifier: id + optional: true + widget: select + multiple: false + remember: false + default_group: All + default_group_multiple: { } + group_items: + 1: + title: 'Yes' + operator: 'not empty' + value: + value: '' + min: '' + max: '' + 2: + title: 'No' + operator: empty + value: + value: '' + min: '' + max: '' + 3: + title: '' + operator: '=' + value: + value: '' + min: '' + max: '' + entity_type: crm_core_user_sync_relation + entity_field: id + plugin_id: numeric + name__given: + id: name__given + table: crm_core_individual + field: name__given + relationship: none + group_type: group + admin_label: '' + operator: contains + value: '' + group: 1 + exposed: true + expose: + operator_id: name__given_op + label: 'First name (given)' + description: '' + use_operator: false + operator: name__given_op + identifier: given + required: false + remember: false + multiple: false + remember_roles: + authenticated: authenticated + anonymous: '0' + administrator: '0' + placeholder: '' + is_grouped: false + group_info: + label: '' + description: '' + identifier: '' + optional: true + widget: select + multiple: false + remember: false + default_group: All + default_group_multiple: { } + group_items: { } + entity_type: crm_core_individual + entity_field: name + plugin_id: string + name__middle: + id: name__middle + table: crm_core_individual + field: name__middle + relationship: none + group_type: group + admin_label: '' + operator: contains + value: '' + group: 1 + exposed: true + expose: + operator_id: name__middle_op + label: 'Middle name (middle)' + description: '' + use_operator: false + operator: name__middle_op + identifier: middle + required: false + remember: false + multiple: false + remember_roles: + authenticated: authenticated + anonymous: '0' + administrator: '0' + placeholder: '' + is_grouped: false + group_info: + label: '' + description: '' + identifier: '' + optional: true + widget: select + multiple: false + remember: false + default_group: All + default_group_multiple: { } + group_items: { } + entity_type: crm_core_individual + entity_field: name + plugin_id: string + name__family: + id: name__family + table: crm_core_individual + field: name__family + relationship: none + group_type: group + admin_label: '' + operator: contains + value: '' + group: 1 + exposed: true + expose: + operator_id: name__family_op + label: 'Last name (family)' + description: '' + use_operator: false + operator: name__family_op + identifier: family + required: false + remember: false + multiple: false + remember_roles: + authenticated: authenticated + anonymous: '0' + administrator: '0' + placeholder: '' + is_grouped: false + group_info: + label: '' + description: '' + identifier: '' + optional: true + widget: select + multiple: false + remember: false + default_group: All + default_group_multiple: { } + group_items: { } + entity_type: crm_core_individual + entity_field: name + plugin_id: string + type: + id: type + table: crm_core_individual + field: type + relationship: none + group_type: group + admin_label: '' + operator: in + value: { } + group: 1 + exposed: true + expose: + operator_id: type_op + label: 'Individual type' + description: '' + use_operator: false + operator: type_op + identifier: type + required: false + remember: false + multiple: false + remember_roles: + authenticated: authenticated + anonymous: '0' + administrator: '0' + reduce: false + is_grouped: false + group_info: + label: '' + description: '' + identifier: '' + optional: true + widget: select + multiple: false + remember: false + default_group: All + default_group_multiple: { } + group_items: { } + entity_type: crm_core_individual + entity_field: type + plugin_id: bundle + sorts: { } + title: 'Contacts with related users' + header: + result: + id: result + table: views + field: result + relationship: none + group_type: group + admin_label: '' + empty: false + content: 'Displaying @start - @end of @total' + plugin_id: result + footer: { } + empty: { } + relationships: + crm_core_user_sync_relation: + id: crm_core_user_sync_relation + table: crm_core_individual + field: crm_core_user_sync_relation + relationship: none + group_type: group + admin_label: 'CRM Core User Sync relation' + required: false + entity_type: crm_core_individual + plugin_id: standard + arguments: { } + display_extenders: { } + filter_groups: + operator: AND + groups: + 1: AND + cache_metadata: + max-age: -1 + contexts: + - 'languages:language_content' + - 'languages:language_interface' + - url + - url.query_args + - user.permissions + tags: { } + page_1: + display_plugin: page + id: page_1 + display_title: Page + position: 1 + display_options: + display_extenders: { } + path: admin/config/crm-core/user-sync/contact + menu: + type: tab + title: 'Contacts with related users' + description: '' + expanded: false + parent: crm_core_user_sync.config + weight: 1 + context: '0' + menu_name: admin + cache_metadata: + max-age: -1 + contexts: + - 'languages:language_content' + - 'languages:language_interface' + - url + - url.query_args + - user.permissions + tags: { } diff --git a/modules/crm_core_user_sync/config/install/views.view.user_to_contact_management.yml b/modules/crm_core_user_sync/config/install/views.view.user_to_contact_management.yml new file mode 100644 index 0000000000000000000000000000000000000000..659da307e038ffae7038a61b777edc9e79716329 --- /dev/null +++ b/modules/crm_core_user_sync/config/install/views.view.user_to_contact_management.yml @@ -0,0 +1,744 @@ +langcode: en +status: true +dependencies: + module: + - crm_core_user_sync + - user +id: user_to_contact_management +label: 'User to contact management' +module: views +description: '' +tag: '' +base_table: users_field_data +base_field: uid +core: 8.x +display: + default: + display_plugin: default + id: default + display_title: Master + position: 0 + display_options: + access: + type: perm + options: + perm: 'administer crm-core-user-sync' + cache: + type: tag + options: { } + query: + type: views_query + options: + disable_sql_rewrite: false + distinct: false + replica: false + query_comment: '' + query_tags: { } + exposed_form: + type: basic + options: + submit_button: Apply + reset_button: true + reset_button_label: Reset + exposed_sorts_label: 'Sort by' + expose_sort_order: true + sort_asc_label: Asc + sort_desc_label: Desc + pager: + type: mini + options: + items_per_page: 50 + offset: 0 + id: 0 + total_pages: null + expose: + items_per_page: false + items_per_page_label: 'Items per page' + items_per_page_options: '5, 10, 25, 50' + items_per_page_options_all: false + items_per_page_options_all_label: '- All -' + offset: false + offset_label: Offset + tags: + previous: ‹‹ + next: ›› + style: + type: table + row: + type: fields + fields: + uid: + id: uid + table: users_field_data + field: uid + relationship: none + group_type: group + admin_label: '' + label: 'User ID' + exclude: false + alter: + alter_text: false + text: '' + make_link: false + path: '' + absolute: false + external: false + replace_spaces: false + path_case: none + trim_whitespace: false + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: false + max_length: 0 + word_boundary: true + ellipsis: true + more_link: false + more_link_text: '' + more_link_path: '' + strip_tags: false + trim: false + preserve_tags: '' + html: false + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: true + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: true + click_sort_column: value + type: number_unformatted + settings: { } + group_column: value + group_columns: { } + group_rows: true + delta_limit: 0 + delta_offset: 0 + delta_reversed: false + delta_first_last: false + multi_type: separator + separator: ', ' + field_api_classes: false + entity_type: user + entity_field: uid + plugin_id: field + name: + id: name + table: users_field_data + field: name + relationship: none + group_type: group + admin_label: '' + label: Name + exclude: false + alter: + alter_text: false + text: '' + make_link: false + path: '' + absolute: false + external: false + replace_spaces: false + path_case: none + trim_whitespace: false + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: false + max_length: 0 + word_boundary: false + ellipsis: false + more_link: false + more_link_text: '' + more_link_path: '' + strip_tags: false + trim: false + preserve_tags: '' + html: false + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: true + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: true + click_sort_column: value + type: string + settings: + link_to_entity: true + group_column: value + group_columns: { } + group_rows: true + delta_limit: 0 + delta_offset: 0 + delta_reversed: false + delta_first_last: false + multi_type: separator + separator: ', ' + field_api_classes: false + entity_type: user + entity_field: name + plugin_id: field + mail: + id: mail + table: users_field_data + field: mail + relationship: none + group_type: group + admin_label: '' + label: Email + exclude: false + alter: + alter_text: false + text: '' + make_link: false + path: '' + absolute: false + external: false + replace_spaces: false + path_case: none + trim_whitespace: false + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: false + max_length: 0 + word_boundary: true + ellipsis: true + more_link: false + more_link_text: '' + more_link_path: '' + strip_tags: false + trim: false + preserve_tags: '' + html: false + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: true + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: true + click_sort_column: value + type: basic_string + settings: { } + group_column: value + group_columns: { } + group_rows: true + delta_limit: 0 + delta_offset: 0 + delta_reversed: false + delta_first_last: false + multi_type: separator + separator: ', ' + field_api_classes: false + entity_type: user + entity_field: mail + plugin_id: field + roles_target_id: + id: roles_target_id + table: user__roles + field: roles_target_id + relationship: none + group_type: group + admin_label: '' + label: Roles + exclude: false + alter: + alter_text: false + text: '' + make_link: false + path: '' + absolute: false + external: false + replace_spaces: false + path_case: none + trim_whitespace: false + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: false + max_length: 0 + word_boundary: true + ellipsis: true + more_link: false + more_link_text: '' + more_link_path: '' + strip_tags: false + trim: false + preserve_tags: '' + html: false + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: true + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: true + type: separator + separator: ', ' + entity_type: user + entity_field: roles + plugin_id: user_roles + id: + id: id + table: crm_core_user_sync_relation + field: id + relationship: crm_core_user_sync_relation + group_type: group + admin_label: '' + label: 'Relation ID' + exclude: false + alter: + alter_text: false + text: '' + make_link: true + path: '/admin/config/crm-core/user-sync/relation/{{id}}/edit?destination=/admin/config/crm-core/user-sync/contact' + absolute: false + external: false + replace_spaces: false + path_case: none + trim_whitespace: false + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: false + max_length: 0 + word_boundary: true + ellipsis: true + more_link: false + more_link_text: '' + more_link_path: '' + strip_tags: false + trim: false + preserve_tags: '' + html: false + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: true + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: 'No relation' + hide_empty: false + empty_zero: false + hide_alter_empty: true + click_sort_column: value + type: number_unformatted + settings: { } + group_column: value + group_columns: { } + group_rows: true + delta_limit: 0 + delta_offset: 0 + delta_reversed: false + delta_first_last: false + multi_type: separator + separator: ', ' + field_api_classes: false + entity_type: crm_core_user_sync_relation + entity_field: id + plugin_id: field + individual_id: + id: individual_id + table: crm_core_user_sync_relation + field: individual_id + relationship: crm_core_user_sync_relation + group_type: group + admin_label: '' + label: 'Individual name' + exclude: false + alter: + alter_text: false + text: '' + make_link: false + path: '' + absolute: false + external: false + replace_spaces: false + path_case: none + trim_whitespace: false + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: false + max_length: 0 + word_boundary: true + ellipsis: true + more_link: false + more_link_text: '' + more_link_path: '' + strip_tags: false + trim: false + preserve_tags: '' + html: false + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: true + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: 'Add relation' + hide_empty: false + empty_zero: false + hide_alter_empty: true + click_sort_column: target_id + type: entity_reference_label + settings: + link: true + group_column: target_id + group_columns: { } + group_rows: true + delta_limit: 0 + delta_offset: 0 + delta_reversed: false + delta_first_last: false + multi_type: separator + separator: ', ' + field_api_classes: false + entity_type: crm_core_user_sync_relation + entity_field: individual_id + plugin_id: field + filters: + uid_raw: + id: uid_raw + table: users_field_data + field: uid_raw + relationship: none + group_type: group + admin_label: 'Not anonymous' + operator: '!=' + value: + min: '' + max: '' + value: '0' + group: 1 + exposed: false + expose: + operator_id: '' + label: '' + description: '' + use_operator: false + operator: '' + identifier: '' + required: false + remember: false + multiple: false + remember_roles: + authenticated: authenticated + placeholder: '' + min_placeholder: '' + max_placeholder: '' + is_grouped: false + group_info: + label: '' + description: '' + identifier: '' + optional: true + widget: select + multiple: false + remember: false + default_group: All + default_group_multiple: { } + group_items: { } + entity_type: user + plugin_id: numeric + id: + id: id + table: crm_core_user_sync_relation + field: id + relationship: crm_core_user_sync_relation + group_type: group + admin_label: '' + operator: '=' + value: + min: '' + max: '' + value: '' + group: 1 + exposed: true + expose: + operator_id: id_op + label: ID + description: null + use_operator: false + operator: id_op + identifier: id + required: false + remember: false + multiple: false + remember_roles: + authenticated: authenticated + placeholder: null + min_placeholder: null + max_placeholder: null + is_grouped: true + group_info: + label: 'Have related contact' + description: '' + identifier: id + optional: true + widget: select + multiple: false + remember: false + default_group: All + default_group_multiple: { } + group_items: + 1: + title: 'Yes' + operator: 'not empty' + value: + value: '' + min: '' + max: '' + 2: + title: 'No' + operator: empty + value: + value: '' + min: '' + max: '' + 3: + title: '' + operator: '=' + value: + value: '' + min: '' + max: '' + entity_type: crm_core_user_sync_relation + entity_field: id + plugin_id: numeric + uid: + id: uid + table: users_field_data + field: uid + relationship: none + group_type: group + admin_label: '' + operator: in + value: { } + group: 1 + exposed: true + expose: + operator_id: uid_op + label: 'Username (autocomplete)' + description: '' + use_operator: false + operator: uid_op + identifier: uid + required: false + remember: false + multiple: false + remember_roles: + authenticated: authenticated + anonymous: '0' + administrator: '0' + reduce: false + is_grouped: false + group_info: + label: '' + description: '' + identifier: '' + optional: true + widget: select + multiple: false + remember: false + default_group: All + default_group_multiple: { } + group_items: { } + entity_type: user + entity_field: uid + plugin_id: user_name + mail: + id: mail + table: users_field_data + field: mail + relationship: none + group_type: group + admin_label: '' + operator: contains + value: '' + group: 1 + exposed: true + expose: + operator_id: mail_op + label: Email + description: '' + use_operator: false + operator: mail_op + identifier: email + required: false + remember: false + multiple: false + remember_roles: + authenticated: authenticated + anonymous: '0' + administrator: '0' + placeholder: '' + is_grouped: false + group_info: + label: '' + description: '' + identifier: '' + optional: true + widget: select + multiple: false + remember: false + default_group: All + default_group_multiple: { } + group_items: { } + entity_type: user + entity_field: mail + plugin_id: string + roles_target_id: + id: roles_target_id + table: user__roles + field: roles_target_id + relationship: none + group_type: group + admin_label: '' + operator: or + value: { } + group: 1 + exposed: true + expose: + operator_id: roles_target_id_op + label: Roles + description: '' + use_operator: false + operator: roles_target_id_op + identifier: roles_target_id + required: false + remember: false + multiple: false + remember_roles: + authenticated: authenticated + anonymous: '0' + administrator: '0' + reduce: false + is_grouped: false + group_info: + label: '' + description: '' + identifier: '' + optional: true + widget: select + multiple: false + remember: false + default_group: All + default_group_multiple: { } + group_items: { } + reduce_duplicates: false + entity_type: user + entity_field: roles + plugin_id: user_roles + sorts: { } + title: 'Users with related contacts' + header: + result: + id: result + table: views + field: result + relationship: none + group_type: group + admin_label: '' + empty: false + content: 'Displaying @start - @end of @total' + plugin_id: result + footer: { } + empty: { } + relationships: + crm_core_user_sync_relation: + id: crm_core_user_sync_relation + table: users_field_data + field: crm_core_user_sync_relation + relationship: none + group_type: group + admin_label: 'CRM Core User Sync Relation' + required: false + entity_type: user + plugin_id: standard + arguments: { } + display_extenders: { } + filter_groups: + operator: AND + groups: + 1: AND + cache_metadata: + max-age: -1 + contexts: + - 'languages:language_content' + - 'languages:language_interface' + - url + - url.query_args + - user.permissions + tags: { } + page_1: + display_plugin: page + id: page_1 + display_title: Page + position: 1 + display_options: + display_extenders: { } + path: admin/config/crm-core/user-sync/user + menu: + type: tab + title: 'Users with related contacts' + description: '' + expanded: false + parent: crm_core_user_sync.config + weight: 2 + context: '0' + menu_name: admin + cache_metadata: + max-age: -1 + contexts: + - 'languages:language_content' + - 'languages:language_interface' + - url + - url.query_args + - user.permissions + tags: { } diff --git a/modules/crm_core_user_sync/crm_core_user_sync.admin.inc b/modules/crm_core_user_sync/crm_core_user_sync.admin.inc deleted file mode 100644 index 165ebad9b2c213c214533b23e0613073fa8f48c6..0000000000000000000000000000000000000000 --- a/modules/crm_core_user_sync/crm_core_user_sync.admin.inc +++ /dev/null @@ -1,232 +0,0 @@ -User relation edit form. - */ -function crm_core_user_sync_edit_relation_form($form, &$form_state, $relation) { - if (empty($relation)) { - drupal_set_title('Create a new relation'); - - if (!empty($_GET['uid'])) { - $user = user_load($_GET['uid']); - $disabled_user_field = !empty($user); - } - - if (!empty($_GET['contact_id'])) { - $contact = Contact::load($_GET['contact_id']); - $disabled_contact_field = !empty($contact); - } - } - else { - drupal_set_title('Edit relation'); - - if (!empty($relation->endpoints[LANGUAGE_NONE][0]['entity_id'])) { - $user = user_load($relation->endpoints[LANGUAGE_NONE][0]['entity_id']); - } - - if (!empty($relation->endpoints[LANGUAGE_NONE][1]['entity_id'])) { - $contact = Contact::load($relation->endpoints[LANGUAGE_NONE][1]['entity_id']); - } - } - - $form['relation'] = array( - '#type' => 'value', - '#value' => $relation, - ); - - $form['description'] = array( - '#type' => 'item', - '#markup' => t('You can edit the details of a contact record to user account relationship using the following form.'), - ); - - $form['contact'] = array( - '#title' => t('Contact record'), - '#type' => 'textfield', - '#default_value' => empty($contact) ? '' : $contact->label() . " [contact_id:{$contact->contact_id}]", - '#disabled' => empty($disabled_contact_field) ? FALSE : TRUE, - '#autocomplete_path' => 'admin/config/crm-core/user-sync/contact-to-user-management/contact-autocomplete', - ); - - $form['user'] = array( - '#title' => t('User record'), - '#type' => 'textfield', - '#default_value' => empty($user) ? '' : $user->name . " [uid:{$user->uid}]", - '#disabled' => empty($disabled_user_field) ? FALSE : TRUE, - '#autocomplete_path' => 'admin/config/crm-core/user-sync/contact-to-user-management/user-autocomplete', - ); - - $form['actions'] = array('#type' => 'actions'); - - $form['actions']['save'] = array( - '#type' => 'submit', - '#value' => t('Save'), - ); - - if (!empty($relation)) { - $form['actions']['delete'] = array( - '#type' => 'submit', - '#value' => t('Delete'), - ); - } - - $form['actions']['cancel'] = array( - '#markup' => l(t('Cancel'), 'admin/config/crm-core/user-sync/contact-to-user-management'), - ); - - return $form; -} - -/** - * Validate callback on edit form. - */ -function crm_core_user_sync_edit_relation_form_validate($form, &$form_state) { - if ($form_state['values']['op'] == $form['actions']['save']['#value']) { - $user = _crm_core_user_sync_get_entity_id_from_text($form_state['values']['user'], 'user'); - $contact = _crm_core_user_sync_get_entity_id_from_text($form_state['values']['contact'], 'crm_core_contact'); - - if (empty($user)) { - form_set_error('user', t('Could not load a user account.')); - } - - if (empty($contact)) { - form_set_error('contact', t('Could not load a contact.')); - } - - if (empty($user) || empty($contact)) { - return; - } - - // Check if the same user->contact relation exists when adding or editing relation. - if (crm_core_user_sync_get_contact_from_uid($user->uid) && (empty($form_state['values']['relation']) || - $form_state['values']['relation']->endpoints['und'][0]['entity_id'] != $user->uid) - ) { - form_set_error('user', t('The user account has been already synchronized.')); - } - - // Check if the same user->contact relation exists when adding or editing relation. - if (crm_core_user_sync_get_user_from_contact_id($contact->contact_id) && (empty($form_state['values']['relation']) || - $form_state['values']['relation']->endpoints['und'][1]['entity_id'] != $contact->contact_id) - ) { - form_set_error('contact', t('The contact record has been already synchronized.')); - } - } -} - -/** - * Submit callback on edit form. - */ -function crm_core_user_sync_edit_relation_form_submit($form, &$form_state) { - if ($form_state['values']['op'] == $form['actions']['save']['#value']) { - $user = _crm_core_user_sync_get_entity_id_from_text($form_state['values']['user'], 'user'); - $contact = _crm_core_user_sync_get_entity_id_from_text($form_state['values']['contact'], 'crm_core_contact'); - - if (!empty($form_state['values']['relation'])) { - $relation = $form_state['values']['relation']; - - $relation->endpoints[LANGUAGE_NONE][0]['entity_id'] = $user->uid; - $relation->endpoints[LANGUAGE_NONE][1]['entity_id'] = $contact->contact_id; - - $relation->save(); - } - else { - $relation = Relation::create(array( - 'relation_type' => 'crm_core_user_sync', - array( - array('entity_type' => 'user', 'entity_id' => $user->uid), - array( - 'entity_type' => 'crm_core_contact', - 'entity_id' => $contact->contact_id, - ), - ), - )); - $relation->save(); - } - - $form_state['redirect'] = 'admin/config/crm-core/user-sync/contact-to-user-management'; - drupal_set_message('Relation has been saved.'); - } - elseif ($form_state['values']['op'] == $form['actions']['delete']['#value']) { - $relation = $form_state['values']['relation']; - $form_state['redirect'] = 'admin/config/crm-core/user-sync/contact-to-user-management/' . $relation->id() . '/delete'; - } -} - -/** - * User autocomplete for user->contact relation form. - */ -function crm_core_user_sync_user_autocomplete($search_string) { - $matches = array(); - - $query = db_select('users', 'user'); - $on_cond = "endpoints.endpoints_entity_type = 'user' AND user.uid = endpoints.endpoints_entity_id"; - $query->leftJoin('field_data_endpoints', 'endpoints', $on_cond); - $query->addField('user', 'uid'); - $query->isNull('endpoints_entity_id'); - $query->condition('name', $search_string . '%', 'LIKE'); - watchdog('debug', $query->__toString()); - $uids = $query->range(0, 20)->execute()->fetchCol(); - - if (!empty($uids)) { - $users = entity_load('user', $uids); - foreach ($users as $user) { - $matches[$user->name . " [uid:$user->uid]"] = $user->name; - } - } - - drupal_json_output($matches); -} - -/** - * User autocomplete for user->contact relation form. - */ -function crm_core_user_sync_contact_autocomplete($search_string) { - $matches = array(); - - $query = new EntityFieldQuery; - $query->entityCondition('entity_type', 'crm_core_contact') - ->range(0, 20); - - $query->addMetaData('match', $search_string) - ->addTag(variable_get('crm_core_contact_search_query_tag', 'crm_core_contact_search')); - $query->addMetaData('user', FALSE); - - $result = $query->execute(); - if (!empty($result)) { - $contacts = entity_load('crm_core_contact', array_keys($result['crm_core_contact'])); - foreach ($contacts as $contact) { - $crm_core_contact_title = $contact->label(); - $matches[$crm_core_contact_title . " [contact_id:$contact->contact_id]"] = $crm_core_contact_title; - } - } - drupal_json_output($matches); -} - -/** - * Delete relation form. - */ -function crm_core_user_sync_delete_relation_form($form, &$form_state, $relation) { - $form['relation'] = array( - '#type' => 'value', - '#value' => $relation, - ); - - $question = t('Are you sure you want to delete the relation?'); - $path = 'admin/config/crm-core/user-sync/contact-to-user-management'; - - return confirm_form($form, $question, $path); -} - -/** - * Submission handler for delete relation form. - */ -function crm_core_user_sync_delete_relation_form_submit($form, &$form_state) { - $relation = $form_state['values']['relation']; - - Relation::load($relation->id())->delete(); - - $form_state['redirect'] = 'admin/config/crm-core/user-sync/contact-to-user-management'; - drupal_set_message(t('Relation has been deleted.')); -} diff --git a/modules/crm_core_user_sync/crm_core_user_sync.info.yml b/modules/crm_core_user_sync/crm_core_user_sync.info.yml index 000e2239178c8b96eee9ceb2dd4288ae63c5a4d7..f7bdf135825fdcabe9d4d1d6a6d535cb97e5b9a0 100644 --- a/modules/crm_core_user_sync/crm_core_user_sync.info.yml +++ b/modules/crm_core_user_sync/crm_core_user_sync.info.yml @@ -8,3 +8,4 @@ configure: crm_core_user_sync.sync dependencies: - crm_core:crm_core_contact + - drupal:views diff --git a/modules/crm_core_user_sync/crm_core_user_sync.links.menu.yml b/modules/crm_core_user_sync/crm_core_user_sync.links.menu.yml new file mode 100644 index 0000000000000000000000000000000000000000..efa1a0200f5d9c71fbf0dad89f74625296f8b9f4 --- /dev/null +++ b/modules/crm_core_user_sync/crm_core_user_sync.links.menu.yml @@ -0,0 +1,6 @@ +crm_core_user_sync.config: + title: 'User Synchronization' + description: 'Manage CRM Core user synchronization settings.' + route_name: crm_core_user_sync.config + parent: crm_core.config + weight: 0 diff --git a/modules/crm_core_user_sync/crm_core_user_sync.links.task.yml b/modules/crm_core_user_sync/crm_core_user_sync.links.task.yml new file mode 100644 index 0000000000000000000000000000000000000000..f3a38ffb265a414fcff3ada51eceeb15358d9f81 --- /dev/null +++ b/modules/crm_core_user_sync/crm_core_user_sync.links.task.yml @@ -0,0 +1,10 @@ +crm_core_user_sync.config: + title: Configuration + route_name: crm_core_user_sync.config + base_route: crm_core_user_sync.config + +crm_core_user_sync.relations: + title: Relations + route_name: entity.crm_core_user_sync_relation.collection + base_route: crm_core_user_sync.config + weight: 3 diff --git a/modules/crm_core_user_sync/src/Entity/Relation.php b/modules/crm_core_user_sync/src/Entity/Relation.php index 68c4559893d74a0686ca37cef2b4f4d4dda3495e..a14ef388ec9d21964a717a8ae641d8d9a2f3bbad 100644 --- a/modules/crm_core_user_sync/src/Entity/Relation.php +++ b/modules/crm_core_user_sync/src/Entity/Relation.php @@ -37,11 +37,11 @@ use Drupal\user\UserInterface; * "uuid" = "uuid" * }, * links = { - * "add-form" = "/admin/config/crm-core/user-sync/contact-to-user-management/add", - * "canonical" = "/admin/config/crm-core/user-sync/contact-to-user-management/{crm_core_user_sync_relation}", - * "edit-form" = "/admin/config/crm-core/user-sync/contact-to-user-management/{crm_core_user_sync_relation}/edit", - * "delete-form" = "/admin/config/crm-core/user-sync/contact-to-user-management/{crm_core_user_sync_relation}/delete", - * "collection" = "/admin/config/crm-core/user-sync/contact-to-user-management" + * "add-form" = "/admin/config/crm-core/user-sync/relation/add", + * "canonical" = "/admin/config/crm-core/user-sync/relation/{crm_core_user_sync_relation}", + * "edit-form" = "/admin/config/crm-core/user-sync/relation/{crm_core_user_sync_relation}/edit", + * "delete-form" = "/admin/config/crm-core/user-sync/relation/{crm_core_user_sync_relation}/delete", + * "collection" = "/admin/config/crm-core/user-sync/relation" * } * ) */ diff --git a/modules/crm_core_user_sync/src/RelationListBuilder.php b/modules/crm_core_user_sync/src/RelationListBuilder.php index 5591fe106b21ba77f99b8105ba6488a9e207a3a1..1d10a3df24fe32aceb8c9fafeedcc2a0fa3cfbed 100644 --- a/modules/crm_core_user_sync/src/RelationListBuilder.php +++ b/modules/crm_core_user_sync/src/RelationListBuilder.php @@ -63,13 +63,14 @@ class RelationListBuilder extends EntityListBuilder { * {@inheritdoc} */ public function render() { - $build['table'] = parent::render(); - $total = \Drupal::database() ->query('SELECT COUNT(*) FROM {crm_core_user_sync_relation}') ->fetchField(); $build['summary']['#markup'] = $this->t('Total relations: @total', ['@total' => $total]); + + $build['table'] = parent::render(); + return $build; }