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

Export fix #17644

Merged
Merged

Conversation

eileenmcnaughton
Copy link
Contributor

@eileenmcnaughton eileenmcnaughton commented Jun 17, 2020

Overview

Alternative to https://github.com/civicrm/civicrm-core/pull/17590/files

@colemanw the code that was hurting you actually only existed to support this class - so I ripped it out & It seems to work...

Before

After

Technical Details

Comments

@civibot
Copy link

civibot bot commented Jun 17, 2020

(Standard links)

@civibot civibot bot added the master label Jun 17, 2020
@eileenmcnaughton eileenmcnaughton changed the title [WIP] Export fix Export fix Jun 17, 2020
@eileenmcnaughton eileenmcnaughton force-pushed the export_fix_standalonne branch from 76d66f2 to 239d4cf Compare June 17, 2020 09:14
// Contact
$entityShortname = $componentName[1];
$entityDAOName = $entityShortname;
$entityShortname = $entityDAOName = $this->getComponentName();
Copy link
Member

Choose a reason for hiding this comment

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

This is incorrect; those two variables are not always the same, see for example CRM_Export_Controller_Standalone::$components['Membership'] == 'Member'

Granted the names of these variables is confusing. By "short name" they actually mean "component name"

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 can you push up a fix to address that? same pattern I think (FWIW I think the whole switch could be in those functions....

Copy link
Member

Choose a reason for hiding this comment

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

@eileenmcnaughton stepping through this code, every condition in this switch statement appears to be unreachable except for the default. I put a breakpoint in each of the switch conditions and couldn't trigger any of them, using standalone export or the various component search screens.

Are you seeing the same thing? Can we just remove the whole switch() and always use the default condition?

@colemanw
Copy link
Member

@eileenmcnaughton I just pushed up a commit removing the switch entirely, as it appears to be unreachable.

@colemanw colemanw force-pushed the export_fix_standalonne branch 3 times, most recently from 108fcff to 5d8332b Compare June 18, 2020 22:12
$entityShortname = 'Case';
$entityDAOName = $entityShortname;
break;
$components = CRM_Export_Controller_Standalone::$components;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think you need to move this static to this form of 'somewhere' central if using from this form

Copy link
Member

Choose a reason for hiding this comment

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

@eileenmcnaughton
Copy link
Contributor Author

@colemanw that cleanup all looks good - but I'm not sure if @mattwire is leveraging the old logic (specifically mode_Query) from an extension. I know that was his motive in the first round of cleanup he did on this

@mattwire
Copy link
Contributor

This needs careful review and testing. I'm not specifically using this code but was responsible for a lot of the earlier cleanup around this (starting with #11536). That switch statement is reachable from core (or at least was until very recently). - I'm sorry but I don't remember how... but likely through a combination of search tasks and entities.

I am very much in favour of trying to clean it up and/or remove it but we do need to steop carefully.

@mattwire
Copy link
Contributor

Actually it's easy to reach - just use advanced search and select "display results as"->"contributions (or any other choice of entity) - that will set queryMode and take you to a specific case in that switch.

@mattwire mattwire added the needs-work-not-review-ready Submitter required to take action, will be closed after 1-2 weeks in this state label Jun 20, 2020
@colemanw colemanw force-pushed the export_fix_standalonne branch from e011de2 to d532b68 Compare June 20, 2020 16:53
@colemanw
Copy link
Member

Thanks @mattwire I've restored the switch so my changes are now fairly minimal.

@eileenmcnaughton
Copy link
Contributor Author

Lets merge this then - I do think the switch could be improved but actually queryMode is more reliable than formName when I think about it. Anyway that has now been punted

@eileenmcnaughton eileenmcnaughton merged commit 2613b08 into civicrm:master Jun 20, 2020
@eileenmcnaughton eileenmcnaughton deleted the export_fix_standalonne branch June 20, 2020 22:03
@mattwire
Copy link
Contributor

@eileenmcnaughton Agree I'd be happy to see this cleaned up further, but I remember it being somewhat non-trivial to debug!

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