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

[REF] Remove apparent copy & paste code. #16308

Merged
merged 1 commit into from
Jan 17, 2020

Conversation

eileenmcnaughton
Copy link
Contributor

@eileenmcnaughton eileenmcnaughton commented Jan 17, 2020

Overview

Removes a property that is set much more often than it is used

Before

All search forms have apparent copy & paste to set $this->_searchButtonName

After

Property removed, the one place it is used just calls getButtonName

Technical Details

In code familiarisation to tackle dev#core/1217 I looked at this var & concluded that the var is set in 9 places but in 8 of those it is never used. In the last place (CRM_Contact_Form_Search) it is used to determine whether to build the pre-next cache/ whether this is an 'original search'. I swapped it over to just doing a getButton without any
change - I stepped through in advanced search, search builder, custom search, basic search it still enters the cache lines of code. In Contribution, event search it doesn't (before & after).

Part of just making code semi-readable

Comments

In code familiarisation to tackle dev#core/1217 I looked at this var & concluded that the var is set in 9
places but in 8 of those it is never used. In the last place (CRM_Contact_Form_Search) it is used to
determine whether to build the pre-next cache. I swapped it over to just doing a getButton without any
change - I stepped through in advanced search, search builder, custom search, basic search it still enters the cache lines of code. In Contribution, event search it doesn't (before & after).

Part of just makingg code semi-readable
@civibot
Copy link

civibot bot commented Jan 17, 2020

(Standard links)

@civibot civibot bot added the master label Jan 17, 2020
@colemanw
Copy link
Member

Gotta love copy-paste.

@eileenmcnaughton eileenmcnaughton merged commit 4f29e2d into civicrm:master Jan 17, 2020
@eileenmcnaughton eileenmcnaughton deleted the search_ref branch January 17, 2020 02:18
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