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

Don't throw PHP notice when rendering dedupefind template. #22709

Merged
merged 1 commit into from
Feb 5, 2022

Conversation

braders
Copy link
Contributor

@braders braders commented Feb 5, 2022

Overview

Don't throw PHP notice when rendering dedupefind template.

Before

A number of notices occured from the Smarty template when finding duplicate contacts:

Screenshot 2022-02-05 at 13 27 50

These only occur if no default dedupe limit dedupe_default_limit is set

After

The notices related to the limit field no longer occur. (Note there is still a Undefined index: gid, which appears to be coming from a slightly different template).

Technical Details

I was slightly confused by the logic around when the "No of contacts to find matches for" should be shown. It appears that it is only shown if a default limit is set, presumably in order to avoid showing unnecessary fields to administrators of smaller networks.

The visibility is now controlled by a new template variable limitShown, which uses the same logic as is currently in place. One benefit of this change is that it is now possible for site owners to ensure the limit field is shown or hidden regardless of the global setting, by setting the limitShown variable within hook_civicrm_buildForm.

@civibot
Copy link

civibot bot commented Feb 5, 2022

(Standard links)

@civibot civibot bot added the master label Feb 5, 2022
if (Civi::settings()->get('dedupe_default_limit')) {
$this->add('text', 'limit', ts('No of contacts to find matches for '));
}
$this->add('text', 'limit', ts('No of contacts to find matches for '));
Copy link
Member

Choose a reason for hiding this comment

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

It's a pre-existing condition, but this text makes no sense to me, and trailing spaces are not allowed within ts()

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@colemanw I do agree, but I'm struggling to think of a better string (other than writing "number" in full). Maybe a {help} popup is required to add some longer-form description?

@colemanw
Copy link
Member

colemanw commented Feb 5, 2022

I've stepped through the code and confirm this is the same before/after, just without the php notice.

@colemanw colemanw merged commit 7b0a937 into civicrm:master Feb 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants