Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dev/core#4530 - Change email fields to text in search mode #27130

Merged
merged 2 commits into from
Aug 25, 2023

Conversation

colemanw
Copy link
Member

Overview

Fixes dev/core#4530

Before

Email validation kicks in when it shouldn't.

After

Only validates when it should.

@civibot
Copy link

civibot bot commented Aug 23, 2023

Thank you for contributing to CiviCRM! ❤️ We will need to test and review the PR. 👷

Introduction for new contributors
  • If this is your first PR, an admin will greenlight automated testing with the command ok to test or add to whitelist.
  • A series of tests will automatically run. You can see the results at the bottom of this page (if there are any problems, it will include a link to see what went wrong).
  • A demo site will be built where anyone can try out a version of CiviCRM that includes your changes.
  • If this process needs to be repeated, an admin will issue the command test this please to rerun tests and build a new demo site.
  • Before this PR can be merged, it needs to be reviewed. Please keep in mind that reviewers are volunteers, and their response time can vary from a few hours to a few weeks depending on their availability and their knowledge of this particular part of CiviCRM.
  • A great way to speed up this process is to "trade reviews" with someone - find an open PR that you feel able to review, and leave a comment like "I'm reviewing this now, could you please review mine?" (include a link to yours). You don't have to wait for a response to get started (and you don't have to stop at one!) the more you review, the faster this process goes for everyone 😄
  • To ensure that you are credited properly in the final release notes, please add yourself to contributor-key.yml
  • For more information about contributing, see CONTRIBUTING.md.
Quick links for reviewers

@civibot civibot bot added the master label Aug 23, 2023
@civibot
Copy link

civibot bot commented Aug 23, 2023

The issue associated with the Pull Request can be viewed at https://lab.civicrm.org/dev/core/-/issues/4530

@eileenmcnaughton
Copy link
Contributor

Hmm something is wonky here - I was gonna set up on the demo site but it is not built so test this please

@eileenmcnaughton
Copy link
Contributor

Note this should be against the rc....

@eileenmcnaughton
Copy link
Contributor

Here is what I want to import onto the demo site


[
  [
    "SavedSearch",
    "save",
    {
      "records": [
        {
          "name": "snooze",
          "label": "snooze",
          "form_values": null,
          "mapping_id": null,
          "search_custom_id": null,
          "api_entity": "Email",
          "api_params": {
            "version": 4,
            "select": [
              "contact_id",
              "contact_id.display_name",
              "email",
              "on_hold:label",
              "hold_date",
              "Email_Contact_contact_id_01.display_name",
              "is_primary"
            ],
            "orderBy": [],
            "where": [
              [
                "Email_Contact_contact_id_01.is_deleted",
                "=",
                false
              ]
            ],
            "groupBy": [],
            "join": [
              [
                "Contact AS Email_Contact_contact_id_01",
                "INNER",
                [
                  "contact_id",
                  "=",
                  "Email_Contact_contact_id_01.id"
                ]
              ]
            ],
            "having": []
          },
          "expires_date": null,
          "description": "Emails"
        }
      ],
      "match": [
        "name"
      ]
    }
  ],
  [
    "SearchDisplay",
    "save",
    {
      "records": [
        {
          "name": "snooze_table",
          "label": "Emails with snooze data",
          "saved_search_id.name": "snooze",
          "type": "table",
          "settings": {
            "description": "Emails with editable on hold",
            "sort": [],
            "limit": 10,
            "pager": [],
            "placeholder": 5,
            "columns": [
              {
                "type": "field",
                "key": "email",
                "dataType": "String",
                "label": "Email",
                "sortable": true
              },
              {
                "type": "field",
                "key": "contact_id.display_name",
                "dataType": "String",
                "label": "Contact Display Name",
                "sortable": true,
                "link": {
                  "path": "",
                  "entity": "Contact",
                  "action": "view",
                  "join": "contact_id",
                  "target": "_blank"
                },
                "title": "View Contact"
              },
              {
                "type": "field",
                "key": "on_hold:label",
                "dataType": "Integer",
                "label": "On Hold",
                "sortable": true,
                "editable": true
              },
              {
                "type": "field",
                "key": "contact_id",
                "dataType": "Integer",
                "label": "Contact ID",
                "sortable": true
              },
              {
                "type": "field",
                "key": "hold_date",
                "dataType": "Timestamp",
                "label": "Hold Date",
                "sortable": true
              },
              {
                "type": "field",
                "key": "Email_Contact_contact_id_01.display_name",
                "dataType": "String",
                "label": "Email Contact: Display Name",
                "sortable": true
              },
              {
                "type": "field",
                "key": "is_primary",
                "dataType": "Boolean",
                "label": "Is Primary",
                "sortable": true
              }
            ],
            "actions": true,
            "classes": [
              "table",
              "table-striped"
            ],
            "button": "Search"
          },
          "acl_bypass": false
        }
      ],
      "match": [
        "name",
        "saved_search_id"
      ]
    }
  ],
  [
    "Afform",
    "save",
    {
      "records": [
        {
          "name": "afsearchEmailSnooze",
          "requires": [],
          "title": "Email hold",
          "description": "",
          "is_dashlet": true,
          "is_public": false,
          "is_token": false,
          "permission": "access CiviCRM",
          "type": "search",
          "entity_type": null,
          "join_entity": null,
          "contact_summary": null,
          "summary_contact_type": null,
          "icon": "fa-bed",
          "server_route": "civicrm/email-hold",
          "redirect": null,
          "create_submission": false,
          "navigation": {
            "parent": "Contacts",
            "label": "Email Snooze",
            "weight": 20
          },
          "layout": "<div af-fieldset=\"\">\n  <div class=\"af-container af-layout-cols\">\n    <af-field name=\"email\" />\n    <af-field name=\"Email_Contact_contact_id_01.id\" defn=\"{required: false, input_attrs: {}}\" />\n    <af-field name=\"on_hold\" defn=\"{input_attrs: {multiple: true}, required: false}\" />\n  </div>\n  <crm-search-display-table search-name=\"snooze\" display-name=\"snooze_table\"></crm-search-display-table>\n</div>\n"
        }
      ]
    }
  ]
]

What I'm seeing is that searching by exact email works

image

But searching by anything else is like searching by *

image

@colemanw colemanw changed the base branch from master to 5.65 August 25, 2023 00:05
@civibot civibot bot added the 5.65 label Aug 25, 2023
@civibot civibot bot removed the master label Aug 25, 2023
@colemanw
Copy link
Member Author

Retest this please

@eileenmcnaughton
Copy link
Contributor

Hmm - I tried importing my search on demo but can't see it -

http://core-27130-7xcgb.test-1.civicrm.org:8001/civicrm/admin/search#/list?tab=custom

does the demo user have insufficient permission?

@eileenmcnaughton
Copy link
Contributor

Hmm @colemanw the searching isn't right - check http://core-27130-7xcgb.test-1.civicrm.org:8001/civicrm/email-hold

& try searching for

mller.valene@testmail.net

& then just 'miler'

@eileenmcnaughton
Copy link
Contributor

oh weird - it's different now

@eileenmcnaughton
Copy link
Contributor

Well that's weird - it's working now. My brain hurts

@eileenmcnaughton eileenmcnaughton merged commit 017a465 into civicrm:5.65 Aug 25, 2023
@eileenmcnaughton eileenmcnaughton deleted the emailType branch August 25, 2023 03:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants