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

CRM-21391 Refactor form search to use a base class, resolve issues with action … #11240

Closed
wants to merge 7 commits into from

Conversation

mattwire
Copy link
Contributor

@mattwire mattwire commented Nov 3, 2017

…list when changing the entity filter

Overview

Refactor all the component tasks so they are extend a new base class CRM_Core_Task.

Before

There were a number of issues with the "Advanced Search" when switching between component types where the task list would be populated with the wrong list of tasks, but the keys would trigger an action on the selected component and an unexpected action may occur.
Also there seemed to be a bug with saving group_type where mailing_list was always being checked.

After

This cleans up the code and uses shared code where possible.

Technical Details

Introduces a new base class CRM_Core_Task.

Comments

Further refactoring would be possible, also some tasks actually work in all contexts (eg. create/update smart group) and we could extend the lists to share these elements too.

@colemanw
Copy link
Member

colemanw commented Nov 4, 2017

@mattwire this is a difficult one to review/test. Can you give some more background on why these changes are needed, how to reproduce at least one of the bugs this fixes, and some suggested workflows to test with this PR.

@mattwire mattwire force-pushed the CRM-21391_form_task_cleanup branch from edb5dcd to a4f50cc Compare November 7, 2017 15:48
@mattwire mattwire force-pushed the CRM-21391_form_task_cleanup branch 2 times, most recently from 10519dc to b773723 Compare November 17, 2017 15:06
@eileenmcnaughton
Copy link
Contributor

I think this is tricky to review because there are a lot of changes in it - on the other hand they seem to make sense. With things like this I normally split them up into a series of stand alone changes - e.g just fix up the constants, or do the minimum possible to institute the base class for the tasks in one PR & then next do the cleanup this facilitates

@colemanw
Copy link
Member

Doesn't even need to be different PRs. One PR with a series of commits would help to break things down.

@mattwire mattwire force-pushed the CRM-21391_form_task_cleanup branch from b773723 to 6726536 Compare November 22, 2017 18:32
@mattwire
Copy link
Contributor Author

@colemanw @eileenmcnaughton Been requested to squash commits down in the past but perhaps I went too far with this one. I'll break it down into a few commits and re-push.

@mattwire mattwire changed the title CRM-21391 Refactor form search to use a base class, resolve issues with action … WIP CRM-21391 Refactor form search to use a base class, resolve issues with action … Nov 22, 2017
@eileenmcnaughton
Copy link
Contributor

@mattwire so my rule with commits is that if a change is complete in itself it gets it's own commit - e.g a function extraction. Where I ask people to squash is when they make subsequent fixes to an earlier commit - so the earlier commit is not correct without the later one.

@colemanw colemanw added the needs-work-not-review-ready Submitter required to take action, will be closed after 1-2 weeks in this state label Dec 3, 2017
@mattwire
Copy link
Contributor Author

mattwire commented Dec 7, 2017

Note for myself: Does this fix "Send Email" action missing from "Find Contacts"/"Find Memberships"?

@mattwire mattwire force-pushed the CRM-21391_form_task_cleanup branch 2 times, most recently from 6f2ab7d to b8d20c9 Compare January 2, 2018 09:12
@mattwire
Copy link
Contributor Author

Jenkins test this please

@eileenmcnaughton
Copy link
Contributor

@mattwire this is a pretty big PR to review - if you pulled out the first 2 commits into a separate PR I could review that - which I think would reduce the code involved quite a bit

@mattwire
Copy link
Contributor Author

mattwire commented Jan 17, 2018

@eileenmcnaughton Ok breaking it down...
First PR: #11535 - just string changes for consistency.
Second PR: #11536 - add the new core tasks class.

@mattwire mattwire force-pushed the CRM-21391_form_task_cleanup branch from 424befc to f4fdff4 Compare January 17, 2018 13:01
@eileenmcnaughton
Copy link
Contributor

OK - I merged the original one - let's get this rebased & I'll see if we can get this merged. I have my head into the changes you are making now & agree it's an improvement

@eileenmcnaughton
Copy link
Contributor

Hmm - some of these changes will require more grepping than others - perhaps there is another easy PR to pull out to get a quick merge on & reduce bulk?

@mattwire mattwire force-pushed the CRM-21391_form_task_cleanup branch from f4fdff4 to 87a2bdf Compare January 28, 2018 15:29
@mattwire mattwire force-pushed the CRM-21391_form_task_cleanup branch from 87a2bdf to 002c046 Compare January 28, 2018 15:46
@mattwire mattwire changed the title WIP CRM-21391 Refactor form search to use a base class, resolve issues with action … CRM-21391 Refactor form search to use a base class, resolve issues with action … Jan 28, 2018
@mattwire
Copy link
Contributor Author

@eileenmcnaughton I've broken out the search class changes into another PR #11600. This PR now contains only changes to convert the remaining task classes to use CRM_Core_Task and changes in each class should be near identical.

@mattwire mattwire force-pushed the CRM-21391_form_task_cleanup branch 2 times, most recently from 634f8f0 to ca93a01 Compare February 19, 2018 14:39
@@ -143,8 +120,8 @@ public static function &permissionedTaskTitles($permission) {
public static function getTask($value) {
self::tasks();
if (!$value || !CRM_Utils_Array::value($value, self::$_tasks)) {
// make the interview task by default
$value = 1;
// make the print task by default
Copy link
Contributor

Choose a reason for hiding this comment

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

@mattwire this comment is incorrect - otherwise changes in this commit look good.

Note the comment wouldn't be needed if the function were called 'getDefaultTask

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well spotted :-) The default task stuff is all a bit wierd... but given the scale of the code changes I'm making here I didn't want to make any functional changes. There is a PR raised by @johanv (#11596) which is waiting for all this to be merged that touches on the default task

@mattwire mattwire force-pushed the CRM-21391_form_task_cleanup branch 2 times, most recently from 975e7e1 to baf339a Compare February 20, 2018 08:30
@mattwire
Copy link
Contributor Author

@eileenmcnaughton Thanks for going through all of this... Do you want me to cherry-pick each commit into it's own PR like you've done for contribute/activity?

@eileenmcnaughton
Copy link
Contributor

@mattwire I've picked off contribution & activity but yeah - I'm kinda picking them off to be more manageable since this is quite a big PR.

@mattwire
Copy link
Contributor Author

mattwire commented Mar 5, 2018

@eileenmcnaughton Just opened separate PRs for the remaining 7 task classes

@eileenmcnaughton
Copy link
Contributor

@mattwire these are almost all merged & I'm about to try mailing. I just spotted a regression caused by these - I have not logged an issue at this stage but am adding a screenshot to illustrate it. Note that the PR for this may need to be against the rc depending when it is raised vs the rc being cut

screenshot 2018-03-12 16 26 17

@mattwire
Copy link
Contributor Author

@eileenmcnaughton "Find Respondents To Reserve" is now fixed in #11808

@eileenmcnaughton
Copy link
Contributor

I'm going to close this master task now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
master needs-work-not-review-ready Submitter required to take action, will be closed after 1-2 weeks in this state
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants